summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/.cvsignore5
-rw-r--r--Source/CMakeInstallDestinations.cmake5
-rw-r--r--Source/CMakeLists.txt42
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CMakeVersionCompute.cmake17
-rw-r--r--Source/CMakeVersionSource.cmake9
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx42
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h29
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx7
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx25
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx41
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx32
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx12
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx16
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx2
-rw-r--r--Source/CPack/cmCPack7zGenerator.h4
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx20
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h10
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx8
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h8
-rw-r--r--Source/CPack/cmCPackComponentGroup.h4
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx66
-rw-r--r--Source/CPack/cmCPackDebGenerator.h14
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h10
-rw-r--r--Source/CPack/cmCPackGenerator.cxx38
-rw-r--r--Source/CPack/cmCPackGenerator.h4
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx9
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h2
-rw-r--r--Source/CPack/cmCPackLog.cxx8
-rw-r--r--Source/CPack/cmCPackLog.h2
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx22
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h23
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx22
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h8
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx367
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h96
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx380
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h74
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx231
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.h58
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx23
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h14
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h10
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h4
-rw-r--r--Source/CPack/cmCPackTXZGenerator.h4
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h4
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h4
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h4
-rw-r--r--Source/CPack/cpack.cxx22
-rw-r--r--Source/CTest/cmCTestBZR.cxx59
-rw-r--r--Source/CTest/cmCTestBZR.h26
-rw-r--r--Source/CTest/cmCTestBatchTestHandler.cxx12
-rw-r--r--Source/CTest/cmCTestBatchTestHandler.h13
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx27
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h19
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx23
-rw-r--r--Source/CTest/cmCTestBuildCommand.h23
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx43
-rw-r--r--Source/CTest/cmCTestBuildHandler.h17
-rw-r--r--Source/CTest/cmCTestCVS.cxx16
-rw-r--r--Source/CTest/cmCTestCVS.h21
-rw-r--r--Source/CTest/cmCTestCommand.h4
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx24
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h14
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx6
-rw-r--r--Source/CTest/cmCTestConfigureHandler.h9
-rw-r--r--Source/CTest/cmCTestCoverageCommand.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx64
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h18
-rw-r--r--Source/CTest/cmCTestCurl.cxx51
-rw-r--r--Source/CTest/cmCTestCurl.h6
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx6
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h17
-rw-r--r--Source/CTest/cmCTestGIT.cxx53
-rw-r--r--Source/CTest/cmCTestGIT.h28
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx8
-rw-r--r--Source/CTest/cmCTestGenericHandler.h14
-rw-r--r--Source/CTest/cmCTestGlobalVC.cxx3
-rw-r--r--Source/CTest/cmCTestGlobalVC.h13
-rw-r--r--Source/CTest/cmCTestHG.cxx34
-rw-r--r--Source/CTest/cmCTestHG.h24
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx14
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h12
-rw-r--r--Source/CTest/cmCTestLaunch.cxx42
-rw-r--r--Source/CTest/cmCTestLaunch.h5
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h12
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx107
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h17
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx42
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h12
-rw-r--r--Source/CTest/cmCTestP4.cxx39
-rw-r--r--Source/CTest/cmCTestP4.h25
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.cxx6
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h17
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx9
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h17
-rw-r--r--Source/CTest/cmCTestRunTest.cxx29
-rw-r--r--Source/CTest/cmCTestRunTest.h8
-rw-r--r--Source/CTest/cmCTestSVN.cxx40
-rw-r--r--Source/CTest/cmCTestSVN.h28
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx82
-rw-r--r--Source/CTest/cmCTestScriptHandler.h17
-rw-r--r--Source/CTest/cmCTestSleepCommand.cxx9
-rw-r--r--Source/CTest/cmCTestSleepCommand.h17
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx18
-rw-r--r--Source/CTest/cmCTestStartCommand.h18
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx11
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h26
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx82
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h16
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx8
-rw-r--r--Source/CTest/cmCTestTestCommand.h14
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx112
-rw-r--r--Source/CTest/cmCTestTestHandler.h19
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx8
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h14
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx31
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h11
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx20
-rw-r--r--Source/CTest/cmCTestUploadCommand.h19
-rw-r--r--Source/CTest/cmCTestUploadHandler.cxx4
-rw-r--r--Source/CTest/cmCTestUploadHandler.h10
-rw-r--r--Source/CTest/cmCTestVC.cxx8
-rw-r--r--Source/CTest/cmCTestVC.h14
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx8
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.h9
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx6
-rw-r--r--Source/CTest/cmParseCacheCoverage.h10
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.cxx15
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.h9
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx5
-rw-r--r--Source/CTest/cmParseDelphiCoverage.h9
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx6
-rw-r--r--Source/CTest/cmParseGTMCoverage.h9
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx15
-rw-r--r--Source/CTest/cmParseJacocoCoverage.h10
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx32
-rw-r--r--Source/CTest/cmParseMumpsCoverage.h8
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx10
-rw-r--r--Source/CTest/cmParsePHPCoverage.h8
-rw-r--r--Source/CTest/cmProcess.cxx15
-rw-r--r--Source/CTest/cmProcess.h4
-rw-r--r--Source/Checks/cm_cxx11_unordered_map.cmake25
-rw-r--r--Source/Checks/cm_cxx_features.cmake39
-rw-r--r--Source/Checks/cm_cxx_nullptr.cxx14
-rw-r--r--Source/Checks/cm_cxx_override.cxx24
-rw-r--r--Source/Checks/cm_cxx_unordered_map.cxx (renamed from Source/Checks/cm_cxx11_unordered_map.cpp)0
-rw-r--r--Source/Checks/cm_cxx_unordered_set.cxx7
-rw-r--r--Source/CursesDialog/CMakeLists.txt2
-rw-r--r--Source/CursesDialog/ccmake.cxx33
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.cxx15
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx7
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h2
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.cxx3
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx4
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.cxx3
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h4
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx15
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h8
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx62
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h10
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx48
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx32
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx2
-rw-r--r--Source/Modules/FindLibUV.cmake131
-rw-r--r--Source/QtDialog/CMakeLists.txt12
-rw-r--r--Source/QtDialog/CMakeSetup.cxx39
-rw-r--r--Source/QtDialog/CMakeSetup64.pngbin0 -> 7213 bytes
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx9
-rw-r--r--Source/QtIFW/CMake.DeveloperReference.HTML.qs.in21
-rw-r--r--Source/QtIFW/installscript.qs.in3
-rw-r--r--Source/bindexplib.cxx4
-rw-r--r--Source/cmAddCompileOptionsCommand.h8
-rw-r--r--Source/cmAddCustomCommandCommand.cxx21
-rw-r--r--Source/cmAddCustomCommandCommand.h8
-rw-r--r--Source/cmAddCustomTargetCommand.cxx2
-rw-r--r--Source/cmAddCustomTargetCommand.h8
-rw-r--r--Source/cmAddDefinitionsCommand.h8
-rw-r--r--Source/cmAddDependenciesCommand.h8
-rw-r--r--Source/cmAddExecutableCommand.h8
-rw-r--r--Source/cmAddLibraryCommand.h8
-rw-r--r--Source/cmAddSubDirectoryCommand.h8
-rw-r--r--Source/cmAddTestCommand.h8
-rw-r--r--Source/cmArchiveWrite.cxx21
-rw-r--r--Source/cmArchiveWrite.h18
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h8
-rw-r--r--Source/cmBreakCommand.cxx2
-rw-r--r--Source/cmBreakCommand.h10
-rw-r--r--Source/cmBuildCommand.cxx27
-rw-r--r--Source/cmBuildCommand.h8
-rw-r--r--Source/cmBuildNameCommand.h10
-rw-r--r--Source/cmCLocaleEnvironmentScope.cxx10
-rw-r--r--Source/cmCLocaleEnvironmentScope.h5
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h10
-rw-r--r--Source/cmCMakeMinimumRequired.h10
-rw-r--r--Source/cmCMakePolicyCommand.h10
-rw-r--r--Source/cmCPackPropertiesGenerator.cxx7
-rw-r--r--Source/cmCPackPropertiesGenerator.h13
-rw-r--r--Source/cmCPluginAPI.cxx22
-rw-r--r--Source/cmCTest.cxx333
-rw-r--r--Source/cmCTest.h181
-rw-r--r--Source/cmCacheManager.cxx32
-rw-r--r--Source/cmCacheManager.h20
-rw-r--r--Source/cmCallVisualStudioMacro.cxx4
-rw-r--r--Source/cmCommand.h4
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx30
-rw-r--r--Source/cmCommandArgumentsHelper.cxx28
-rw-r--r--Source/cmCommandArgumentsHelper.h26
-rw-r--r--Source/cmCommands.h2
-rw-r--r--Source/cmCommonTargetGenerator.cxx203
-rw-r--r--Source/cmCommonTargetGenerator.h30
-rw-r--r--Source/cmComputeComponentGraph.h3
-rw-r--r--Source/cmComputeLinkDepends.cxx15
-rw-r--r--Source/cmComputeLinkDepends.h11
-rw-r--r--Source/cmComputeLinkInformation.cxx33
-rw-r--r--Source/cmComputeLinkInformation.h15
-rw-r--r--Source/cmComputeTargetDepends.cxx15
-rw-r--r--Source/cmComputeTargetDepends.h9
-rw-r--r--Source/cmConditionEvaluator.cxx36
-rw-r--r--Source/cmConfigure.cmake.h.in36
-rw-r--r--Source/cmConfigureFileCommand.h10
-rw-r--r--Source/cmContinueCommand.h10
-rw-r--r--Source/cmCoreTryCompile.cxx47
-rw-r--r--Source/cmCreateTestSourceList.h8
-rw-r--r--Source/cmCryptoHash.cxx145
-rw-r--r--Source/cmCryptoHash.h52
-rw-r--r--Source/cmCurl.h2
-rw-r--r--Source/cmCustomCommand.cxx16
-rw-r--r--Source/cmCustomCommand.h5
-rw-r--r--Source/cmCustomCommandGenerator.cxx6
-rw-r--r--Source/cmCustomCommandLines.h38
-rw-r--r--Source/cmDefinePropertyCommand.h8
-rw-r--r--Source/cmDefinitions.cxx2
-rw-r--r--Source/cmDefinitions.h4
-rw-r--r--Source/cmDepends.cxx21
-rw-r--r--Source/cmDepends.h2
-rw-r--r--Source/cmDependsC.cxx29
-rw-r--r--Source/cmDependsC.h9
-rw-r--r--Source/cmDependsFortran.cxx35
-rw-r--r--Source/cmDependsFortran.h13
-rw-r--r--Source/cmDependsJava.cxx10
-rw-r--r--Source/cmDependsJava.h13
-rw-r--r--Source/cmDependsJavaParserHelper.cxx49
-rw-r--r--Source/cmDependsJavaParserHelper.h17
-rw-r--r--Source/cmDocumentation.cxx21
-rw-r--r--Source/cmDocumentation.h2
-rw-r--r--Source/cmDocumentationEntry.h45
-rw-r--r--Source/cmDynamicLoader.cxx10
-rw-r--r--Source/cmELF.cxx91
-rw-r--r--Source/cmElseCommand.h10
-rw-r--r--Source/cmElseIfCommand.h10
-rw-r--r--Source/cmEnableLanguageCommand.h8
-rw-r--r--Source/cmEnableTestingCommand.h8
-rw-r--r--Source/cmEndForEachCommand.h13
-rw-r--r--Source/cmEndFunctionCommand.h13
-rw-r--r--Source/cmEndIfCommand.h10
-rw-r--r--Source/cmEndMacroCommand.h13
-rw-r--r--Source/cmEndWhileCommand.h13
-rw-r--r--Source/cmExecProgramCommand.cxx8
-rw-r--r--Source/cmExecProgramCommand.h13
-rw-r--r--Source/cmExecuteProcessCommand.cxx6
-rw-r--r--Source/cmExecuteProcessCommand.h10
-rw-r--r--Source/cmExecutionStatus.h4
-rw-r--r--Source/cmExportBuildFileGenerator.cxx11
-rw-r--r--Source/cmExportBuildFileGenerator.h16
-rw-r--r--Source/cmExportCommand.cxx11
-rw-r--r--Source/cmExportCommand.h8
-rw-r--r--Source/cmExportFileGenerator.cxx14
-rw-r--r--Source/cmExportInstallFileGenerator.cxx2
-rw-r--r--Source/cmExportInstallFileGenerator.h18
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx10
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h18
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx5
-rw-r--r--Source/cmExportTryCompileFileGenerator.h14
-rw-r--r--Source/cmExprParserHelper.cxx7
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx52
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h55
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx129
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h15
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx30
-rw-r--r--Source/cmExtraCodeLiteGenerator.h17
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx59
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h22
-rw-r--r--Source/cmExtraKateGenerator.cxx30
-rw-r--r--Source/cmExtraKateGenerator.h17
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx75
-rw-r--r--Source/cmExtraSublimeTextGenerator.h16
-rw-r--r--Source/cmFLTKWrapUICommand.cxx4
-rw-r--r--Source/cmFLTKWrapUICommand.h12
-rw-r--r--Source/cmFileCommand.cxx79
-rw-r--r--Source/cmFileCommand.h10
-rw-r--r--Source/cmFileLockPool.cxx5
-rw-r--r--Source/cmFilePathUuid.cxx132
-rw-r--r--Source/cmFilePathUuid.h77
-rw-r--r--Source/cmFileTimeComparison.cxx33
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindCommon.cxx4
-rw-r--r--Source/cmFindCommon.h2
-rw-r--r--Source/cmFindFileCommand.h4
-rw-r--r--Source/cmFindLibraryCommand.cxx9
-rw-r--r--Source/cmFindLibraryCommand.h10
-rw-r--r--Source/cmFindPackageCommand.cxx123
-rw-r--r--Source/cmFindPackageCommand.h26
-rw-r--r--Source/cmFindPathCommand.cxx2
-rw-r--r--Source/cmFindPathCommand.h10
-rw-r--r--Source/cmFindProgramCommand.h10
-rw-r--r--Source/cmForEachCommand.cxx7
-rw-r--r--Source/cmForEachCommand.h18
-rw-r--r--Source/cmFortranParserImpl.cxx57
-rw-r--r--Source/cmFunctionCommand.cxx23
-rw-r--r--Source/cmFunctionCommand.h18
-rw-r--r--Source/cmGeneratedFileStream.cxx6
-rw-r--r--Source/cmGeneratedFileStream.h2
-rw-r--r--Source/cmGeneratorExpression.cxx9
-rw-r--r--Source/cmGeneratorExpression.h19
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx2
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx23
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h11
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx23
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h16
-rw-r--r--Source/cmGeneratorExpressionNode.cxx298
-rw-r--r--Source/cmGeneratorTarget.cxx360
-rw-r--r--Source/cmGeneratorTarget.h12
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx2
-rw-r--r--Source/cmGetCMakePropertyCommand.h10
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h10
-rw-r--r--Source/cmGetFilenameComponentCommand.h10
-rw-r--r--Source/cmGetPropertyCommand.cxx15
-rw-r--r--Source/cmGetPropertyCommand.h10
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h11
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx24
-rw-r--r--Source/cmGetTargetPropertyCommand.h8
-rw-r--r--Source/cmGetTestPropertyCommand.cxx2
-rw-r--r--Source/cmGetTestPropertyCommand.h8
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGhsMultiTargetGenerator.h4
-rw-r--r--Source/cmGlobalCommonGenerator.h2
-rw-r--r--Source/cmGlobalGenerator.cxx91
-rw-r--r--Source/cmGlobalGenerator.h22
-rw-r--r--Source/cmGlobalGeneratorFactory.h21
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h6
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx46
-rw-r--r--Source/cmGlobalKdevelopGenerator.h15
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx150
-rw-r--r--Source/cmGlobalNinjaGenerator.h79
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx39
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h84
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h6
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx7
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h2
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h10
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx130
-rw-r--r--Source/cmGlobalXCodeGenerator.h5
-rw-r--r--Source/cmGraphVizWriter.cxx37
-rw-r--r--Source/cmHexFileConverter.cxx12
-rw-r--r--Source/cmIfCommand.cxx9
-rw-r--r--Source/cmIfCommand.h21
-rw-r--r--Source/cmIncludeCommand.cxx2
-rw-r--r--Source/cmIncludeCommand.h10
-rw-r--r--Source/cmIncludeDirectoryCommand.h8
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h14
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h14
-rw-r--r--Source/cmInstallCommand.cxx53
-rw-r--r--Source/cmInstallCommand.h8
-rw-r--r--Source/cmInstallCommandArguments.cxx22
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx17
-rw-r--r--Source/cmInstallDirectoryGenerator.h12
-rw-r--r--Source/cmInstallExportGenerator.cxx39
-rw-r--r--Source/cmInstallExportGenerator.h13
-rw-r--r--Source/cmInstallFilesCommand.h12
-rw-r--r--Source/cmInstallFilesGenerator.cxx8
-rw-r--r--Source/cmInstallFilesGenerator.h12
-rw-r--r--Source/cmInstallGenerator.h17
-rw-r--r--Source/cmInstallProgramsCommand.h12
-rw-r--r--Source/cmInstallScriptGenerator.cxx2
-rw-r--r--Source/cmInstallScriptGenerator.h4
-rw-r--r--Source/cmInstallTargetGenerator.cxx21
-rw-r--r--Source/cmInstallTargetGenerator.h11
-rw-r--r--Source/cmInstallTargetsCommand.h8
-rw-r--r--Source/cmInstalledFile.cxx2
-rw-r--r--Source/cmInstalledFile.h2
-rw-r--r--Source/cmLinkDirectoriesCommand.h8
-rw-r--r--Source/cmLinkItem.h4
-rw-r--r--Source/cmLinkLibrariesCommand.h8
-rw-r--r--Source/cmLinkedTree.h2
-rw-r--r--Source/cmListCommand.h10
-rw-r--r--Source/cmListFileCache.cxx203
-rw-r--r--Source/cmListFileCache.h5
-rw-r--r--Source/cmLoadCacheCommand.h8
-rw-r--r--Source/cmLoadCommandCommand.cxx24
-rw-r--r--Source/cmLoadCommandCommand.h8
-rw-r--r--Source/cmLocalCommonGenerator.cxx51
-rw-r--r--Source/cmLocalCommonGenerator.h15
-rw-r--r--Source/cmLocalGenerator.cxx233
-rw-r--r--Source/cmLocalGenerator.h39
-rw-r--r--Source/cmLocalNinjaGenerator.cxx54
-rw-r--r--Source/cmLocalNinjaGenerator.h22
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx216
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h61
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx48
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx14
-rw-r--r--Source/cmLocalVisualStudioGenerator.h7
-rw-r--r--Source/cmLocale.h2
-rw-r--r--Source/cmMacroCommand.cxx21
-rw-r--r--Source/cmMacroCommand.h18
-rw-r--r--Source/cmMakeDirectoryCommand.h10
-rw-r--r--Source/cmMakefile.cxx505
-rw-r--r--Source/cmMakefile.h118
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx106
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.h8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx168
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h10
-rw-r--r--Source/cmMakefileTargetGenerator.cxx310
-rw-r--r--Source/cmMakefileTargetGenerator.h29
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.h8
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx2
-rw-r--r--Source/cmMarkAsAdvancedCommand.h10
-rw-r--r--Source/cmMathCommand.h10
-rw-r--r--Source/cmMessageCommand.cxx18
-rw-r--r--Source/cmMessageCommand.h10
-rw-r--r--Source/cmMessenger.cxx209
-rw-r--r--Source/cmMessenger.h44
-rw-r--r--Source/cmNewLineStyle.cxx17
-rw-r--r--Source/cmNewLineStyle.h5
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx88
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h13
-rw-r--r--Source/cmNinjaTargetGenerator.cxx75
-rw-r--r--Source/cmNinjaTargetGenerator.h21
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx42
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.h10
-rw-r--r--Source/cmOSXBundleGenerator.cxx20
-rw-r--r--Source/cmOptionCommand.h10
-rw-r--r--Source/cmOrderDirectories.cxx8
-rw-r--r--Source/cmOrderDirectories.h3
-rw-r--r--Source/cmOutputConverter.cxx316
-rw-r--r--Source/cmOutputConverter.h43
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx8
-rw-r--r--Source/cmOutputRequiredFilesCommand.h8
-rw-r--r--Source/cmParseArgumentsCommand.h10
-rw-r--r--Source/cmPolicies.cxx27
-rw-r--r--Source/cmPolicies.h9
-rw-r--r--Source/cmProcessTools.cxx15
-rw-r--r--Source/cmProcessTools.h14
-rw-r--r--Source/cmProjectCommand.h8
-rw-r--r--Source/cmProperty.cxx4
-rw-r--r--Source/cmProperty.h4
-rw-r--r--Source/cmPropertyDefinition.cxx2
-rw-r--r--Source/cmPropertyDefinition.h4
-rw-r--r--Source/cmPropertyDefinitionMap.cxx10
-rw-r--r--Source/cmPropertyDefinitionMap.h6
-rw-r--r--Source/cmPropertyMap.cxx20
-rw-r--r--Source/cmPropertyMap.h8
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapCPPCommand.h8
-rw-r--r--Source/cmQTWrapUICommand.cxx4
-rw-r--r--Source/cmQTWrapUICommand.h8
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx97
-rw-r--r--Source/cmQtAutoGenerators.cxx208
-rw-r--r--Source/cmQtAutoGenerators.h5
-rw-r--r--Source/cmRemoveCommand.h10
-rw-r--r--Source/cmRemoveDefinitionsCommand.h8
-rw-r--r--Source/cmReturnCommand.h10
-rw-r--r--Source/cmScriptGenerator.cxx10
-rw-r--r--Source/cmSearchPath.cxx10
-rw-r--r--Source/cmSearchPath.h6
-rw-r--r--Source/cmSeparateArgumentsCommand.h10
-rw-r--r--Source/cmSetCommand.cxx11
-rw-r--r--Source/cmSetCommand.h10
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h16
-rw-r--r--Source/cmSetPropertyCommand.cxx10
-rw-r--r--Source/cmSetPropertyCommand.h10
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h14
-rw-r--r--Source/cmSetTargetPropertiesCommand.h8
-rw-r--r--Source/cmSetTestsPropertiesCommand.h8
-rw-r--r--Source/cmSiteNameCommand.cxx3
-rw-r--r--Source/cmSiteNameCommand.h10
-rw-r--r--Source/cmSourceFile.cxx11
-rw-r--r--Source/cmSourceFile.h2
-rw-r--r--Source/cmSourceFileLocation.cxx7
-rw-r--r--Source/cmSourceGroup.cxx12
-rw-r--r--Source/cmSourceGroup.h2
-rw-r--r--Source/cmSourceGroupCommand.cxx2
-rw-r--r--Source/cmSourceGroupCommand.h8
-rw-r--r--Source/cmStandardIncludes.h84
-rw-r--r--Source/cmState.cxx56
-rw-r--r--Source/cmState.h17
-rw-r--r--Source/cmStringCommand.cxx9
-rw-r--r--Source/cmStringCommand.h10
-rw-r--r--Source/cmSubdirCommand.h8
-rw-r--r--Source/cmSubdirDependsCommand.h8
-rw-r--r--Source/cmSystemTools.cxx115
-rw-r--r--Source/cmSystemTools.h55
-rw-r--r--Source/cmTarget.cxx250
-rw-r--r--Source/cmTarget.h29
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h26
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h20
-rw-r--r--Source/cmTargetCompileOptionsCommand.h20
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h32
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx4
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h8
-rw-r--r--Source/cmTargetLinkLibraryType.h22
-rw-r--r--Source/cmTargetSourcesCommand.h20
-rw-r--r--Source/cmTest.cxx6
-rw-r--r--Source/cmTest.h7
-rw-r--r--Source/cmTestGenerator.cxx12
-rw-r--r--Source/cmTestGenerator.h26
-rw-r--r--Source/cmTimestamp.cxx15
-rw-r--r--Source/cmTryCompileCommand.h8
-rw-r--r--Source/cmTryRunCommand.cxx25
-rw-r--r--Source/cmTryRunCommand.h8
-rw-r--r--Source/cmTypeMacro.h40
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmUnsetCommand.h10
-rw-r--r--Source/cmUseMangledMesaCommand.h10
-rw-r--r--Source/cmUtilitySourceCommand.cxx4
-rw-r--r--Source/cmUtilitySourceCommand.h8
-rw-r--r--Source/cmUtils.hxx26
-rw-r--r--Source/cmUuid.cxx13
-rw-r--r--Source/cmUuid.h5
-rw-r--r--Source/cmVS14CLFlagTable.h1
-rw-r--r--Source/cmVariableRequiresCommand.h8
-rw-r--r--Source/cmVariableWatch.cxx6
-rw-r--r--Source/cmVariableWatch.h17
-rw-r--r--Source/cmVariableWatchCommand.h14
-rw-r--r--Source/cmVersion.cxx2
-rw-r--r--Source/cmVersion.h2
-rw-r--r--Source/cmVersionConfig.h.in2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx78
-rw-r--r--Source/cmWhileCommand.cxx3
-rw-r--r--Source/cmWhileCommand.h21
-rw-r--r--Source/cmWriteFileCommand.h10
-rw-r--r--Source/cmXCodeObject.cxx16
-rw-r--r--Source/cmXCodeObject.h46
-rw-r--r--Source/cmXMLParser.cxx8
-rw-r--r--Source/cmXMLParser.h4
-rw-r--r--Source/cmXMLSafe.cxx2
-rw-r--r--Source/cmXMLSafe.h2
-rw-r--r--Source/cmXMLWriter.cxx6
-rw-r--r--Source/cmXMLWriter.h2
-rw-r--r--Source/cm_auto_ptr.hxx (renamed from Source/kwsys/auto_ptr.hxx.in)168
-rw-r--r--Source/cmake.cxx538
-rw-r--r--Source/cmake.h59
-rw-r--r--Source/cmakemain.cxx47
-rw-r--r--Source/cmcldeps.cxx3
-rw-r--r--Source/cmcmd.cxx150
-rw-r--r--Source/ctest.cxx11
-rw-r--r--Source/dir.dox7
-rw-r--r--Source/dir.dox.in7
-rw-r--r--Source/kwsys/CMakeLists.txt7
-rw-r--r--Source/kwsys/Configure.hxx.in7
-rw-r--r--Source/kwsys/Directory.cxx31
-rw-r--r--Source/kwsys/FStream.hxx.in234
-rw-r--r--Source/kwsys/SystemInformation.cxx15
-rw-r--r--Source/kwsys/SystemTools.cxx316
-rw-r--r--Source/kwsys/SystemTools.hxx.in10
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx5
-rw-r--r--Source/kwsys/testAutoPtr.cxx166
-rw-r--r--Source/kwsys/testSystemTools.cxx51
581 files changed, 10081 insertions, 7148 deletions
diff --git a/Source/.cvsignore b/Source/.cvsignore
deleted file mode 100644
index 31e286c..0000000
--- a/Source/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-ccommand___Win32_Debug
-Debug
-cmake___Win32_Debug
-ctest___Win32_Debug
-CMakeSetup.map
diff --git a/Source/CMakeInstallDestinations.cmake b/Source/CMakeInstallDestinations.cmake
index 2f9d95a..023f6c0 100644
--- a/Source/CMakeInstallDestinations.cmake
+++ b/Source/CMakeInstallDestinations.cmake
@@ -1,27 +1,32 @@
# Keep formatting here consistent with bootstrap script expectations.
if(BEOS)
+ set(CMAKE_BIN_DIR_DEFAULT "bin") # HAIKU
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU
set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # HAIKU
elseif(CYGWIN)
+ set(CMAKE_BIN_DIR_DEFAULT "bin") # CYGWIN
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # CYGWIN
else()
+ set(CMAKE_BIN_DIR_DEFAULT "bin") # OTHER
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # OTHER
endif()
+set(CMAKE_BIN_DIR_DESC "bin")
set(CMAKE_DATA_DIR_DESC "data")
set(CMAKE_DOC_DIR_DESC "docs")
set(CMAKE_MAN_DIR_DESC "man pages")
set(CMAKE_XDGDATA_DIR_DESC "XDG specific files")
foreach(v
+ CMAKE_BIN_DIR
CMAKE_DATA_DIR
CMAKE_DOC_DIR
CMAKE_MAN_DIR
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 3223831..8c74f60 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -45,9 +45,21 @@ endif()
set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
-# ensure Unicode friendly APIs are used on Windows
if(WIN32)
+ # ensure Unicode friendly APIs are used on Windows
add_definitions(-DUNICODE -D_UNICODE)
+
+ # minimize windows.h content
+ add_definitions(-DWIN32_LEAN_AND_MEAN)
+endif()
+
+# configure the .dox.in file
+if(CMake_BUILD_DEVELOPER_REFERENCE)
+ configure_file(
+ "${CMake_SOURCE_DIR}/Source/dir.dox.in"
+ "${CMake_BINARY_DIR}/Source/dir.dox"
+ @ONLY
+ )
endif()
# configure the .h file
@@ -238,6 +250,8 @@ set(SRCS
cmFileLockPool.h
cmFileLockResult.cxx
cmFileLockResult.h
+ cmFilePathUuid.cxx
+ cmFilePathUuid.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
cmFortranLexer.cxx
@@ -305,6 +319,8 @@ set(SRCS
cmMakefileExecutableTargetGenerator.cxx
cmMakefileLibraryTargetGenerator.cxx
cmMakefileUtilityTargetGenerator.cxx
+ cmMessenger.cxx
+ cmMessenger.h
cmOSXBundleGenerator.cxx
cmOSXBundleGenerator.h
cmOutputConverter.cxx
@@ -364,6 +380,7 @@ set(SRCS
cmake.cxx
cmake.h
+ cm_auto_ptr.hxx
cm_get_date.h
cm_get_date.c
cm_sha2.h
@@ -529,11 +546,14 @@ set(SRCS ${SRCS}
cmNinjaUtilityTargetGenerator.h
)
+# Temporary variable for tools targets
+set(_tools)
+
if(WIN32 AND NOT CYGWIN)
set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE})
+ list(APPEND _tools cmcldeps)
target_link_libraries(cmcldeps CMakeLib)
- install(TARGETS cmcldeps DESTINATION bin)
endif()
foreach(v CURL_CA_BUNDLE CURL_CA_PATH)
@@ -562,6 +582,7 @@ target_link_libraries(CMakeLib cmsys
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
${CMAKE_CURL_LIBRARIES}
${CMAKE_JSONCPP_LIBRARIES}
+ ${CMAKE_LIBUV_LIBRARIES}
${CMake_KWIML_LIBRARIES}
)
@@ -717,7 +738,9 @@ if(APPLE)
CPack/cmCPackBundleGenerator.cxx
CPack/cmCPackDragNDropGenerator.cxx
CPack/cmCPackOSXX11Generator.cxx
+ CPack/cmCPackPKGGenerator.cxx
CPack/cmCPackPackageMakerGenerator.cxx
+ CPack/cmCPackProductBuildGenerator.cxx
)
endif()
@@ -743,6 +766,7 @@ endif()
if(APPLE)
add_executable(cmakexbuild cmakexbuild.cxx)
+ list(APPEND _tools cmakexbuild)
target_link_libraries(cmakexbuild CMakeLib)
add_executable(OSXScriptLauncher
CPack/OSXScriptLauncher.cxx)
@@ -752,14 +776,17 @@ endif()
# Build CMake executable
add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
+list(APPEND _tools cmake)
target_link_libraries(cmake CMakeLib)
# Build CTest executable
add_executable(ctest ctest.cxx ${MANIFEST_FILE})
+list(APPEND _tools ctest)
target_link_libraries(ctest CTestLib)
# Build CPack executable
add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE})
+list(APPEND _tools cpack)
target_link_libraries(cpack CPackLib)
# Curses GUI
@@ -778,15 +805,12 @@ include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
# Install tools
-set(_tools cmake ctest cpack)
-
-if(APPLE)
- list(APPEND _tools cmakexbuild)
-endif()
-
foreach(_tool ${_tools})
CMake_OPTIONAL_COMPONENT(${_tool})
- install(TARGETS ${_tool} DESTINATION bin ${COMPONENT})
+ install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT})
endforeach()
install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
+
+# Unset temporary variables
+unset(_tools)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 6c81449..b8c7439 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 5)
-set(CMake_VERSION_PATCH 20160601)
+set(CMake_VERSION_MINOR 6)
+set(CMake_VERSION_PATCH 20160902)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CMakeVersionCompute.cmake b/Source/CMakeVersionCompute.cmake
index 496d6cf..d9218d7 100644
--- a/Source/CMakeVersionCompute.cmake
+++ b/Source/CMakeVersionCompute.cmake
@@ -3,18 +3,27 @@ include(${CMake_SOURCE_DIR}/Source/CMakeVersion.cmake)
# Releases define a small patch level.
if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
+ set(CMake_VERSION_IS_DIRTY 0)
set(CMake_VERSION_IS_RELEASE 1)
set(CMake_VERSION_SOURCE "")
else()
+ set(CMake_VERSION_IS_DIRTY 0) # may be set to 1 by CMakeVersionSource
set(CMake_VERSION_IS_RELEASE 0)
include(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
endif()
# Compute the full version string.
set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
-if(CMake_VERSION_RC)
- set(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC})
-endif()
if(CMake_VERSION_SOURCE)
- set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE})
+ set(CMake_VERSION_SUFFIX "${CMake_VERSION_SOURCE}")
+elseif(CMake_VERSION_RC)
+ set(CMake_VERSION_SUFFIX "rc${CMake_VERSION_RC}")
+else()
+ set(CMake_VERSION_SUFFIX "")
+endif()
+if(CMake_VERSION_SUFFIX)
+ set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SUFFIX})
+endif()
+if(CMake_VERSION_IS_DIRTY)
+ set(CMake_VERSION ${CMake_VERSION}-dirty)
endif()
diff --git a/Source/CMakeVersionSource.cmake b/Source/CMakeVersionSource.cmake
index 888f557..5ea1de3 100644
--- a/Source/CMakeVersionSource.cmake
+++ b/Source/CMakeVersionSource.cmake
@@ -23,15 +23,8 @@ if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
)
if(dirty)
- set(CMake_VERSION_SOURCE "${CMake_VERSION_SOURCE}-dirty")
+ set(CMake_VERSION_IS_DIRTY 1)
endif()
endif()
endif()
-elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository)
- file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo)
- set(branch "")
- if("${repo}" MATCHES "\\.git/([^\r\n]*)")
- set(branch "${CMAKE_MATCH_1}")
- endif()
- set(CMake_VERSION_SOURCE "cvs${branch}")
endif()
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index c1ff526..4a5eb90 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -101,8 +101,9 @@ int cmCPackIFWGenerator::PackageFiles()
int retVal = 1;
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository"
<< std::endl);
- bool res = cmSystemTools::RunSingleCommand(
- ifwCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
+ &output, &retVal, CM_NULLPTR,
+ this->GeneratorVerbose, 0);
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
ofs << "# Run command: " << ifwCmd << std::endl
@@ -178,8 +179,9 @@ int cmCPackIFWGenerator::PackageFiles()
std::string output;
int retVal = 1;
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
- bool res = cmSystemTools::RunSingleCommand(
- ifwCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
+ &output, &retVal, CM_NULLPTR,
+ this->GeneratorVerbose, 0);
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
ofs << "# Run command: " << ifwCmd << std::endl
@@ -345,18 +347,21 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end())
+ if (cit != Components.end()) {
return &(cit->second);
+ }
cmCPackComponent* component =
cmCPackGenerator::GetComponent(projectName, componentName);
- if (!component)
+ if (!component) {
return component;
+ }
std::string name = GetComponentPackageName(component);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return component;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -387,13 +392,15 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
{
cmCPackComponentGroup* group =
cmCPackGenerator::GetComponentGroup(projectName, groupName);
- if (!group)
+ if (!group) {
return group;
+ }
std::string name = GetGroupPackageName(group);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return group;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -462,8 +469,9 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
cmCPackComponentGroup* group) const
{
std::string name;
- if (!group)
+ if (!group) {
return name;
+ }
if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
return package->Name;
}
@@ -488,8 +496,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
cmCPackComponent* component) const
{
std::string name;
- if (!component)
+ if (!component) {
return name;
+ }
if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
return package->Name;
}
@@ -519,7 +528,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
{
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
GroupPackages.find(group);
- return pit != GroupPackages.end() ? pit->second : 0;
+ return pit != GroupPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
@@ -527,15 +536,16 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
{
std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
ComponentPackages.find(component);
- return pit != ComponentPackages.end() ? pit->second : 0;
+ return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end())
+ if (rit != Repositories.end()) {
return &(rit->second);
+ }
cmCPackIFWRepository* repository = &Repositories[repositoryName];
repository->Name = repositoryName;
@@ -548,7 +558,7 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
}
} else {
Repositories.erase(repositoryName);
- repository = 0;
+ repository = CM_NULLPTR;
cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
<< repositoryName << "\""
<< " configuration. Repository will be skipped."
@@ -559,7 +569,7 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- std::stringstream comment;
+ std::ostringstream comment;
comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
<< "for QtIFW ";
if (IsVersionLess("2.0")) {
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 2b35749..12f2ca6 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -46,7 +46,7 @@ public:
/**
* Destruct IFW generator
*/
- virtual ~cmCPackIFWGenerator();
+ ~cmCPackIFWGenerator() CM_OVERRIDE;
/**
* Compare \a version with QtIFW framework version
@@ -70,18 +70,18 @@ protected:
* @brief Initialize generator
* @return 0 on failure
*/
- virtual int InitializeInternal();
- virtual int PackageFiles();
- virtual const char* GetPackagingInstallPrefix();
+ int InitializeInternal() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetPackagingInstallPrefix() CM_OVERRIDE;
/**
* @brief Extension of binary installer
* @return Executable suffix or value from default implementation
*/
- virtual const char* GetOutputExtension();
+ const char* GetOutputExtension() CM_OVERRIDE;
- virtual std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ std::string GetComponentInstallDirNameSuffix(
+ const std::string& componentName) CM_OVERRIDE;
/**
* @brief Get Component
@@ -92,8 +92,8 @@ protected:
*
* @return Pointer to component
*/
- virtual cmCPackComponent* GetComponent(const std::string& projectName,
- const std::string& componentName);
+ cmCPackComponent* GetComponent(const std::string& projectName,
+ const std::string& componentName) CM_OVERRIDE;
/**
* @brief Get group of component
@@ -104,12 +104,13 @@ protected:
*
* @return Pointer to component group
*/
- virtual cmCPackComponentGroup* GetComponentGroup(
- const std::string& projectName, const std::string& groupName);
+ cmCPackComponentGroup* GetComponentGroup(
+ const std::string& projectName, const std::string& groupName) CM_OVERRIDE;
- enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
- virtual bool SupportsAbsoluteDestination() const;
- virtual bool SupportsComponentInstallation() const;
+ enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const
+ CM_OVERRIDE;
+ bool SupportsAbsoluteDestination() const CM_OVERRIDE;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
protected:
// Methods
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index dfc509b..13a3613 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -33,13 +33,13 @@
} while (0)
cmCPackIFWInstaller::cmCPackIFWInstaller()
- : Generator(0)
+ : Generator(CM_NULLPTR)
{
}
const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
{
- return Generator ? Generator->GetOption(op) : 0;
+ return Generator ? Generator->GetOption(op) : CM_NULLPTR;
}
bool cmCPackIFWInstaller::IsOn(const std::string& op) const
@@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index ad153d1..5db06e6 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -71,8 +71,9 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
{
- if (Compare.Type == CompareNone)
+ if (Compare.Type == CompareNone) {
return Name;
+ }
std::string result = Name;
@@ -95,15 +96,15 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
//------------------------------------------------------ cmCPackIFWPackage ---
cmCPackIFWPackage::cmCPackIFWPackage()
- : Generator(0)
- , Installer(0)
+ : Generator(CM_NULLPTR)
+ , Installer(CM_NULLPTR)
{
}
const char* cmCPackIFWPackage::GetOption(const std::string& op) const
{
- const char* option = Generator ? Generator->GetOption(op) : 0;
- return option && *option ? option : 0;
+ const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR;
+ return option && *option ? option : CM_NULLPTR;
}
bool cmCPackIFWPackage::IsOn(const std::string& op) const
@@ -128,8 +129,9 @@ bool cmCPackIFWPackage::IsVersionEqual(const char* version)
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return "";
+ }
const char* option =
GetOption("CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
@@ -189,8 +191,9 @@ int cmCPackIFWPackage::ConfigureFromOptions()
int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -284,8 +287,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
{
- if (!group)
+ if (!group) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -418,7 +422,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Write dependencies
if (!compDepSet.empty()) {
- std::stringstream dependencies;
+ std::ostringstream dependencies;
std::set<DependenceStruct>::iterator it = compDepSet.begin();
dependencies << it->NameWithCompare();
++it;
@@ -474,6 +478,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index b149f81..fcb1c77 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -35,7 +35,7 @@
cmCPackIFWRepository::cmCPackIFWRepository()
: Update(None)
- , Generator(0)
+ , Generator(CM_NULLPTR)
{
}
@@ -45,16 +45,16 @@ bool cmCPackIFWRepository::IsValid() const
switch (Update) {
case None:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Add:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Remove:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Replace:
- valid = (OldUrl.empty() || NewUrl.empty()) ? false : true;
+ valid = !OldUrl.empty() && !NewUrl.empty();
break;
}
@@ -63,7 +63,7 @@ bool cmCPackIFWRepository::IsValid() const
const char* cmCPackIFWRepository::GetOption(const std::string& op) const
{
- return Generator ? Generator->GetOption(op) : 0;
+ return Generator ? Generator->GetOption(op) : CM_NULLPTR;
}
bool cmCPackIFWRepository::IsOn(const std::string& op) const
@@ -89,8 +89,9 @@ bool cmCPackIFWRepository::IsVersionEqual(const char* version)
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
- if (Name.empty())
+ if (Name.empty()) {
return false;
+ }
std::string prefix =
"CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
@@ -176,7 +177,7 @@ public:
bool patched;
protected:
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
xout.StartElement(name);
StartFragment(atts);
@@ -191,26 +192,29 @@ protected:
}
}
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "Updates" && !patched) {
repository->WriteRepositoryUpdates(xout);
patched = true;
}
xout.EndElement();
- if (patched)
+ if (patched) {
return;
+ }
if (name == "Checksum") {
repository->WriteRepositoryUpdates(xout);
patched = true;
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
std::string content(data, data + length);
- if (content == "" || content == " " || content == " " || content == "\n")
+ if (content == "" || content == " " || content == " " ||
+ content == "\n") {
return;
+ }
xout.Content(content);
}
};
@@ -244,11 +248,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
fout.Close();
- if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) {
- return false;
- }
-
- return true;
+ return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data());
}
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
@@ -299,8 +299,8 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
if (Update == Add || Update == Remove) {
xout.Attribute("url", Url);
} else if (Update == Replace) {
- xout.Attribute("oldurl", OldUrl);
- xout.Attribute("newurl", NewUrl);
+ xout.Attribute("oldUrl", OldUrl);
+ xout.Attribute("newUrl", NewUrl);
}
// Enabled
if (!Enabled.empty()) {
@@ -336,6 +336,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index 19204a2..a233e76 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -72,7 +72,7 @@ int main(int argc, char* argv[])
std::string scriptDirectory =
cmsys::SystemTools::GetFilenamePath(fullScriptPath);
- ofs << fullScriptPath.c_str() << std::endl;
+ ofs << fullScriptPath << std::endl;
std::vector<const char*> args;
args.push_back(fullScriptPath.c_str());
int cc;
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 8777296..d7f69a1 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -18,6 +18,7 @@
#include <cmGeneratedFileStream.h>
#include <cmInstalledFile.h>
#include <cmSystemTools.h>
+#include <cmUuid.h>
#include "cmWIXDirectoriesSourceWriter.h"
#include "cmWIXFeaturesSourceWriter.h"
@@ -90,7 +91,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile,
return false;
}
- std::stringstream command;
+ std::ostringstream command;
command << QuotePath(executable);
command << " -nologo";
command << " -arch " << GetArchitecture();
@@ -115,7 +116,7 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
return false;
}
- std::stringstream command;
+ std::ostringstream command;
command << QuotePath(executable);
command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0));
@@ -254,7 +255,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
std::set<std::string> usedBaseNames;
- std::stringstream objectFiles;
+ std::ostringstream objectFiles;
for (size_t i = 0; i < this->WixSources.size(); ++i) {
std::string const& sourceFilename = this->WixSources[i];
@@ -265,7 +266,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
std::string uniqueBaseName = baseName;
while (usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) {
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << baseName << ++counter;
uniqueBaseName = tmp.str();
}
@@ -403,7 +404,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
std::string const& name,
std::string const& value)
{
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << name << "=\"" << value << '"';
source.AddProcessingInstruction(
@@ -441,6 +442,11 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
cmWIXFilesSourceWriter fileDefinitions(this->Logger,
fileDefinitionsFilename);
+ // if install folder is supposed to be set absolutely, the default
+ // component guid "*" cannot be used
+ fileDefinitions.GenerateComponentGuids =
+ cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"));
+
fileDefinitions.BeginElement("Fragment");
std::string featureDefinitionsFilename =
@@ -464,7 +470,14 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return false;
}
- featureDefinitions.AddAttribute("Title", cpackPackageName);
+ std::string featureTitle = cpackPackageName;
+ if (const char* title = GetOption("CPACK_WIX_ROOT_FEATURE_TITLE")) {
+ featureTitle = title;
+ }
+ featureDefinitions.AddAttribute("Title", featureTitle);
+ if (const char* desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) {
+ featureDefinitions.AddAttribute("Description", desc);
+ }
featureDefinitions.AddAttribute("Level", "1");
this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions);
@@ -559,6 +572,9 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const
{
+ if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
+ return "";
+ }
if (GetArchitecture() == "x86") {
return "ProgramFilesFolder";
} else {
@@ -1019,7 +1035,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
idPrefix = "H";
}
- std::stringstream result;
+ std::ostringstream result;
result << idPrefix << "_" << identifier;
size_t ambiguityCount = ++IdAmbiguityCounter[identifier];
@@ -1044,7 +1060,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
std::string cmCPackWIXGenerator::CreateHashedId(
std::string const& path, std::string const& normalizedFilename)
{
- cmsys::auto_ptr<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1");
+ CM_AUTO_PTR<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1");
std::string hash = sha1->HashString(path.c_str());
std::string identifier;
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index 043cdff..bbbd92d 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -127,7 +127,7 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry,
std::string const& name)
{
if (!this->IsBooleanAttribute(name)) {
- std::stringstream message;
+ std::ostringstream message;
message << "Unknown boolean attribute '" << name << "'";
this->ReportError(entry, message.str());
}
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
index 60ecae6..97e3a51 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
@@ -52,8 +52,12 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString)
{
- BeginElement("Directory");
- AddAttribute("Id", programFilesFolderId);
+ size_t offset = 1;
+ if (!programFilesFolderId.empty()) {
+ BeginElement("Directory");
+ AddAttribute("Id", programFilesFolderId);
+ offset = 0;
+ }
std::vector<std::string> installRoot;
@@ -69,7 +73,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
if (i == installRoot.size() - 1) {
AddAttribute("Id", "INSTALL_ROOT");
} else {
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << "INSTALL_PREFIX_" << i;
AddAttribute("Id", tmp.str());
}
@@ -77,7 +81,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
AddAttribute("Name", installRoot[i]);
}
- return installRoot.size();
+ return installRoot.size() - offset;
}
void cmWIXDirectoriesSourceWriter::EndInstallationPrefixDirectory(size_t size)
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 16dd0ab..1747b62 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -86,6 +86,10 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent(
AddAttribute("Display", "hidden");
}
+ if (component.IsDisabledByDefault) {
+ AddAttribute("Level", "2");
+ }
+
EndElement("Feature");
}
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 1341fa5..dde9635 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -16,6 +16,9 @@
#include <cmInstalledFile.h>
+#include <cmSystemTools.h>
+#include <cmUuid.h>
+
#include <sys/types.h>
// include sys/stat.h after sys/types.h
#include <sys/stat.h>
@@ -23,6 +26,7 @@
cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
std::string const& filename)
: cmWIXSourceWriter(logger, filename)
+ , GenerateComponentGuids(false)
{
}
@@ -31,7 +35,7 @@ void cmWIXFilesSourceWriter::EmitShortcut(std::string const& id,
std::string const& shortcutPrefix,
size_t shortcutIndex)
{
- std::stringstream shortcutId;
+ std::ostringstream shortcutId;
shortcutId << shortcutPrefix << id;
if (shortcutIndex > 0) {
@@ -126,12 +130,20 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
std::string componentId = std::string("CM_C") + id;
std::string fileId = std::string("CM_F") + id;
+ std::string guid = "*";
+ if (this->GenerateComponentGuids) {
+ std::string md5 = cmSystemTools::ComputeStringMD5(componentId);
+ cmUuid uuid;
+ std::vector<unsigned char> ns;
+ guid = uuid.FromMd5(ns, md5);
+ }
+
BeginElement("DirectoryRef");
AddAttribute("Id", directoryId);
BeginElement("Component");
AddAttribute("Id", componentId);
- AddAttribute("Guid", "*");
+ AddAttribute("Guid", guid);
if (installedFile) {
if (installedFile->GetPropertyAsBool("CPACK_NEVER_OVERWRITE")) {
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index c577e5b..eeb84cb 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -47,6 +47,8 @@ public:
std::string const& id,
std::string const& filePath, cmWIXPatch& patch,
cmInstalledFile const* installedFile);
+
+ bool GenerateComponentGuids;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index b750dcf..449a70b 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -88,7 +88,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) {
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value;
ReportValidationError(tmp.str());
}
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
index f5a323f..ddbcc34 100644
--- a/Source/CPack/cmCPack7zGenerator.h
+++ b/Source/CPack/cmCPack7zGenerator.h
@@ -27,10 +27,10 @@ public:
* Construct generator
*/
cmCPack7zGenerator();
- virtual ~cmCPack7zGenerator();
+ ~cmCPack7zGenerator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".7z"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".7z"; }
};
#endif
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 7db20a4..0d3725d 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -68,7 +68,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
++fileIt) {
std::string rp = filePrefix + *fileIt;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl);
- archive.Add(rp, 0, 0, false);
+ archive.Add(rp, 0, CM_NULLPTR, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
<< archive.GetError() << std::endl);
@@ -139,7 +139,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
// Does the component belong to a group?
- if (compIt->second.Group == NULL) {
+ if (compIt->second.Group == CM_NULLPTR) {
cmCPackLogger(
cmCPackLog::LOG_VERBOSE, "Component <"
<< compIt->second.Name
@@ -231,10 +231,8 @@ int cmCPackArchiveGenerator::PackageFiles()
// There will be 1 package for each component group
// however one may require to ignore component group and
// in this case you'll get 1 package for each component.
- else {
- return PackageComponents(componentPackageMethod ==
- ONE_PACKAGE_PER_COMPONENT);
- }
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
// CASE 3 : NON COMPONENT package.
@@ -246,7 +244,7 @@ int cmCPackArchiveGenerator::PackageFiles()
// Get the relative path to the file
std::string rp =
cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str());
- archive.Add(rp, 0, 0, false);
+ archive.Add(rp, 0, CM_NULLPTR, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
<< *fileIt << "> to archive <" << packageFileNames[0]
@@ -259,7 +257,7 @@ int cmCPackArchiveGenerator::PackageFiles()
return 1;
}
-int cmCPackArchiveGenerator::GenerateHeader(std::ostream*)
+int cmCPackArchiveGenerator::GenerateHeader(std::ostream* /*unused*/)
{
return 1;
}
@@ -269,9 +267,5 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const
// The Component installation support should only
// be activated if explicitly requested by the user
// (for backward compatibility reason)
- if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL");
}
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 9eb38b1..a018ebd 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -32,14 +32,14 @@ public:
* Construct generator
*/
cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format);
- virtual ~cmCPackArchiveGenerator();
+ ~cmCPackArchiveGenerator() CM_OVERRIDE;
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
// component support
- virtual bool SupportsComponentInstallation() const;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
protected:
- virtual int InitializeInternal();
+ int InitializeInternal() CM_OVERRIDE;
/**
* Add the files belonging to the specified component
* to the provided (already opened) archive.
@@ -55,7 +55,7 @@ protected:
* method will call either PackageComponents or
* PackageComponentsAllInOne.
*/
- int PackageFiles();
+ int PackageFiles() CM_OVERRIDE;
/**
* The method used to package files when component
* install is used. This will create one
@@ -67,7 +67,7 @@ protected:
* components will be put in a single installer.
*/
int PackageComponentsAllInOne();
- virtual const char* GetOutputExtension() = 0;
+ const char* GetOutputExtension() CM_OVERRIDE = 0;
cmArchiveWrite::Compress Compress;
std::string ArchiveFormat;
};
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index 1164021..9276e3a 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -232,12 +232,12 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID");
temp_sign_file_cmd << " \"";
temp_sign_file_cmd << bundle_path;
- temp_sign_file_cmd << it->c_str() << "\"";
+ temp_sign_file_cmd << *it << "\"";
if (!this->RunCommand(temp_sign_file_cmd, &output)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing file:"
- << bundle_path << it->c_str() << std::endl
- << output << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error signing file:" << bundle_path << *it << std::endl
+ << output << std::endl);
return 0;
}
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index 9cb2f0a..c6fa408 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -29,12 +29,12 @@ public:
virtual ~cmCPackBundleGenerator();
protected:
- virtual int InitializeInternal();
- virtual const char* GetPackagingInstallPrefix();
+ int InitializeInternal() CM_OVERRIDE;
+ const char* GetPackagingInstallPrefix() CM_OVERRIDE;
int ConstructBundle();
int SignBundle(const std::string& src_dir);
- int PackageFiles();
- bool SupportsComponentInstallation() const;
+ int PackageFiles() CM_OVERRIDE;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
std::string InstallPrefix;
};
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 5361d95..01a9e76 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -43,7 +43,7 @@ class cmCPackComponent
{
public:
cmCPackComponent()
- : Group(0)
+ : Group(CM_NULLPTR)
, IsRequired(true)
, IsHidden(false)
, IsDisabledByDefault(false)
@@ -117,7 +117,7 @@ class cmCPackComponentGroup
{
public:
cmCPackComponentGroup()
- : ParentGroup(0)
+ : ParentGroup(CM_NULLPTR)
{
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 1ad4152..1f3ac51 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -57,9 +57,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
// Begin the archive for this pack
std::string localToplevel(initialTopLevel);
std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel));
- std::string outputFileName(std::string(
- this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
- "-" + packageName + this->GetOutputExtension());
+ std::string outputFileName(
+ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + "-" +
+ packageName + this->GetOutputExtension());
localToplevel += "/" + packageName;
/* replace the TEMP DIRECTORY with the component one */
@@ -133,7 +133,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
// Does the component belong to a group?
- if (compIt->second.Group == NULL) {
+ if (compIt->second.Group == CM_NULLPTR) {
cmCPackLogger(
cmCPackLog::LOG_VERBOSE, "Component <"
<< compIt->second.Name
@@ -174,9 +174,9 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
// The ALL GROUPS in ONE package case
std::string localToplevel(initialTopLevel);
std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel));
- std::string outputFileName(std::string(
- this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
- this->GetOutputExtension());
+ std::string outputFileName(
+ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
+ this->GetOutputExtension());
// all GROUP in one vs all COMPONENT in one
localToplevel += "/" + compInstDirName;
@@ -242,15 +242,11 @@ int cmCPackDebGenerator::PackageFiles()
// There will be 1 package for each component group
// however one may require to ignore component group and
// in this case you'll get 1 package for each component.
- else {
- return PackageComponents(componentPackageMethod ==
- ONE_PACKAGE_PER_COMPONENT);
- }
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
// CASE 3 : NON COMPONENT package.
- else {
- return PackageComponentsAllInOne("");
- }
+ return PackageComponentsAllInOne("");
}
int cmCPackDebGenerator::createDeb()
@@ -675,11 +671,7 @@ int cmCPackDebGenerator::createDeb()
bool cmCPackDebGenerator::SupportsComponentInstallation() const
{
- if (IsOn("CPACK_DEB_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_DEB_COMPONENT_INSTALL");
}
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
@@ -696,11 +688,10 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
// the current COMPONENT belongs to.
std::string groupVar =
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
- if (NULL != GetOption(groupVar)) {
+ if (CM_NULLPTR != GetOption(groupVar)) {
return std::string(GetOption(groupVar));
- } else {
- return componentName;
}
+ return componentName;
}
// The following code is taken from OpenBSD ar:
@@ -830,8 +821,9 @@ static int copy_ar(CF* cfp, off_t size)
size_t nr, nw;
char buf[8 * 1024];
- if (sz == 0)
+ if (sz == 0) {
return 0;
+ }
FILE* from = cfp->rFile;
FILE* to = cfp->wFile;
@@ -841,16 +833,20 @@ static int copy_ar(CF* cfp, off_t size)
: sizeof(buf),
from)) > 0) {
sz -= nr;
- for (size_t off = 0; off < nr; nr -= off, off += nw)
- if ((nw = fwrite(buf + off, 1, nr, to)) < nr)
+ for (size_t off = 0; off < nr; nr -= off, off += nw) {
+ if ((nw = fwrite(buf + off, 1, nr, to)) < nr) {
return -1;
+ }
+ }
}
- if (sz)
+ if (sz) {
return -2;
+ }
if (cfp->flags & WPAD && (size + ar_already_written) & 1 &&
- fwrite(&pad, 1, 1, to) != 1)
+ fwrite(&pad, 1, 1, to) != 1) {
return -4;
+ }
return 0;
}
@@ -878,11 +874,11 @@ static int put_arobj(CF* cfp, struct stat* sb)
if (gid > USHRT_MAX) {
gid = USHRT_MAX;
}
- if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
+ if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) {
(void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime,
(unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode,
(long long)sb->st_size + lname, ARFMAG);
- else {
+ } else {
lname = 0;
(void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid,
(unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size,
@@ -890,12 +886,14 @@ static int put_arobj(CF* cfp, struct stat* sb)
}
off_t size = sb->st_size;
- if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR))
+ if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) {
return -1;
+ }
if (lname) {
- if (fwrite(name, 1, lname, cfp->wFile) != lname)
+ if (fwrite(name, 1, lname, cfp->wFile) != lname) {
return -2;
+ }
ar_already_written = lname;
}
result = copy_ar(cfp, size);
@@ -914,18 +912,18 @@ static int ar_append(const char* archive,
{
int eval = 0;
FILE* aFile = cmSystemTools::Fopen(archive, "wb+");
- if (aFile != NULL) {
+ if (aFile != CM_NULLPTR) {
fwrite(ARMAG, SARMAG, 1, aFile);
if (fseek(aFile, 0, SEEK_END) != -1) {
CF cf;
struct stat sb;
/* Read from disk, write to an archive; pad on write. */
- SETCF(NULL, 0, aFile, archive, WPAD);
+ SETCF(CM_NULLPTR, CM_NULLPTR, aFile, archive, WPAD);
for (std::vector<std::string>::const_iterator fileIt = files.begin();
fileIt != files.end(); ++fileIt) {
const char* filename = fileIt->c_str();
FILE* file = cmSystemTools::Fopen(filename, "rb");
- if (file == NULL) {
+ if (file == CM_NULLPTR) {
eval = -1;
continue;
}
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index ff34ca5..bcdc509 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -28,7 +28,7 @@ public:
* Construct generator
*/
cmCPackDebGenerator();
- virtual ~cmCPackDebGenerator();
+ ~cmCPackDebGenerator() CM_OVERRIDE;
static bool CanGenerate()
{
@@ -45,7 +45,7 @@ public:
}
protected:
- virtual int InitializeInternal();
+ int InitializeInternal() CM_OVERRIDE;
/**
* This method factors out the work done in component packaging case.
*/
@@ -62,11 +62,11 @@ protected:
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(const std::string& compInstDirName);
- virtual int PackageFiles();
- virtual const char* GetOutputExtension() { return ".deb"; }
- virtual bool SupportsComponentInstallation() const;
- virtual std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".deb"; }
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
+ std::string GetComponentInstallDirNameSuffix(
+ const std::string& componentName) CM_OVERRIDE;
private:
int createDeb();
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index f4379c1..640e437 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -235,7 +235,7 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target,
return false;
} else {
// Seek to desired size - 1 byte
- fout.seekp(size - 1, std::ios_base::beg);
+ fout.seekp(size - 1, std::ios::beg);
char byte = 0;
// Write one byte to ensure file grows
fout.write(&byte, 1);
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 1392b21..a5f89f6 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -29,17 +29,17 @@ public:
virtual ~cmCPackDragNDropGenerator();
protected:
- virtual int InitializeInternal();
- virtual const char* GetOutputExtension();
- int PackageFiles();
- bool SupportsComponentInstallation() const;
+ int InitializeInternal() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
bool CopyFile(std::ostringstream& source, std::ostringstream& target);
bool CreateEmptyFile(std::ostringstream& target, size_t size);
bool RunCommand(std::ostringstream& command, std::string* output = 0);
std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ const std::string& componentName) CM_OVERRIDE;
int CreateDMG(const std::string& src_dir, const std::string& output_file);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c8b075d..96c218c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -34,14 +34,14 @@
cmCPackGenerator::cmCPackGenerator()
{
this->GeneratorVerbose = cmSystemTools::OUTPUT_NONE;
- this->MakefileMap = 0;
- this->Logger = 0;
+ this->MakefileMap = CM_NULLPTR;
+ this->Logger = CM_NULLPTR;
this->componentPackageMethod = ONE_PACKAGE_PER_GROUP;
}
cmCPackGenerator::~cmCPackGenerator()
{
- this->MakefileMap = 0;
+ this->MakefileMap = CM_NULLPTR;
}
void cmCPackGeneratorProgress(const char* msg, float prog, void* ptr)
@@ -67,7 +67,8 @@ int cmCPackGenerator::PrepareNames()
cmCPackLog::LOG_ERROR, "CPACK_SET_DESTDIR is set to ON but the '"
<< Name << "' generator does NOT support it." << std::endl);
return 0;
- } else if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) {
+ }
+ if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) {
cmCPackLogger(cmCPackLog::LOG_WARNING,
"CPACK_SET_DESTDIR is set to ON but it is "
<< "usually a bad idea to do that with '" << Name
@@ -251,8 +252,9 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << *it << std::endl);
std::string output;
int retVal = 1;
- bool resB = cmSystemTools::RunSingleCommand(
- it->c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+ bool resB =
+ cmSystemTools::RunSingleCommand(it->c_str(), &output, &output, &retVal,
+ CM_NULLPTR, this->GeneratorVerbose, 0);
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/InstallOutput.log";
@@ -623,9 +625,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(
+ CM_AUTO_PTR<cmMakefile> mf(
new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- if (!installSubDirectory.empty() && installSubDirectory != "/") {
+ if (!installSubDirectory.empty() && installSubDirectory != "/" &&
+ installSubDirectory != ".") {
tempInstallDirectory += installSubDirectory;
}
if (componentInstall) {
@@ -814,7 +817,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
}
- if (NULL != mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (CM_NULLPTR !=
+ mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (!absoluteDestFiles.empty()) {
absoluteDestFiles += ";";
}
@@ -828,7 +832,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::string absoluteDestFileComponent =
std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
GetComponentInstallDirNameSuffix(installComponent);
- if (NULL != this->GetOption(absoluteDestFileComponent)) {
+ if (CM_NULLPTR != this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent =
this->GetOption(absoluteDestFileComponent);
absoluteDestFilesListComponent += ";";
@@ -1072,11 +1076,11 @@ const char* cmCPackGenerator::GetInstallPath()
return this->InstallPath.c_str();
}
#if defined(_WIN32) && !defined(__CYGWIN__)
- const char* prgfiles = cmsys::SystemTools::GetEnv("ProgramFiles");
- const char* sysDrive = cmsys::SystemTools::GetEnv("SystemDrive");
- if (prgfiles) {
+ std::string prgfiles;
+ std::string sysDrive;
+ if (cmsys::SystemTools::GetEnv("ProgramFiles", prgfiles)) {
this->InstallPath = prgfiles;
- } else if (sysDrive) {
+ } else if (cmsys::SystemTools::GetEnv("SystemDrive", sysDrive)) {
this->InstallPath = sysDrive;
this->InstallPath += "/Program Files";
} else {
@@ -1178,7 +1182,7 @@ int cmCPackGenerator::PrepareGroupingKind()
std::string groupingType;
// Second way to specify grouping
- if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
+ if (CM_NULLPTR != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
}
@@ -1355,7 +1359,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
component->Group = GetComponentGroup(projectName, groupName);
component->Group->Components.push_back(component);
} else {
- component->Group = 0;
+ component->Group = CM_NULLPTR;
}
const char* description = this->GetOption(macroPrefix + "_DESCRIPTION");
@@ -1423,7 +1427,7 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(
group->ParentGroup = GetComponentGroup(projectName, parentGroupName);
group->ParentGroup->Subgroups.push_back(group);
} else {
- group->ParentGroup = 0;
+ group->ParentGroup = CM_NULLPTR;
}
}
return group;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index ce93715..23e4bb7 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -101,7 +101,7 @@ public:
* Construct generator
*/
cmCPackGenerator();
- virtual ~cmCPackGenerator();
+ ~cmCPackGenerator() CM_OVERRIDE;
//! Set and get the options
void SetOption(const std::string& op, const char* value);
@@ -136,7 +136,7 @@ protected:
cmInstalledFile const* GetInstalledFile(std::string const& name) const;
virtual const char* GetOutputExtension() { return ".cpack"; }
- virtual const char* GetOutputPostfix() { return 0; }
+ virtual const char* GetOutputPostfix() { return CM_NULLPTR; }
/**
* Prepare requested grouping kind from CPACK_xxx vars
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index b17f52e..0f0268f 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -28,6 +28,7 @@
#include "cmCPackDragNDropGenerator.h"
#include "cmCPackOSXX11Generator.h"
#include "cmCPackPackageMakerGenerator.h"
+#include "cmCPackProductBuildGenerator.h"
#endif
#ifdef __CYGWIN__
@@ -122,6 +123,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
cmCPackOSXX11Generator::CreateGenerator);
}
+ if (cmCPackProductBuildGenerator::CanGenerate()) {
+ this->RegisterGenerator("productbuild", "Mac OSX pkg",
+ cmCPackProductBuildGenerator::CreateGenerator);
+ }
#endif
#if !defined(_WIN32) && !defined(__QNXNTO__) && !defined(__BEOS__) && \
!defined(__HAIKU__)
@@ -146,7 +151,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
{
cmCPackGenerator* gen = this->NewGeneratorInternal(name);
if (!gen) {
- return 0;
+ return CM_NULLPTR;
}
this->Generators.push_back(gen);
gen->SetLogger(this->Logger);
@@ -159,7 +164,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it =
this->GeneratorCreators.find(name);
if (it == this->GeneratorCreators.end()) {
- return 0;
+ return CM_NULLPTR;
}
return (it->second)();
}
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index a55ec6e..f0ed57a 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -28,7 +28,7 @@ public:
cmTypeMacro(cmCPackGeneratorFactory, cmObject);
cmCPackGeneratorFactory();
- ~cmCPackGeneratorFactory();
+ ~cmCPackGeneratorFactory() CM_OVERRIDE;
//! Get the generator
cmCPackGenerator* NewGenerator(const std::string& name);
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index ff06eb8..339323e 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -28,13 +28,13 @@ cmCPackLog::cmCPackLog()
this->DefaultOutput = &std::cout;
this->DefaultError = &std::cerr;
- this->LogOutput = 0;
+ this->LogOutput = CM_NULLPTR;
this->LogOutputCleanup = false;
}
cmCPackLog::~cmCPackLog()
{
- this->SetLogOutputStream(0);
+ this->SetLogOutputStream(CM_NULLPTR);
}
void cmCPackLog::SetLogOutputStream(std::ostream* os)
@@ -48,13 +48,13 @@ void cmCPackLog::SetLogOutputStream(std::ostream* os)
bool cmCPackLog::SetLogOutputFile(const char* fname)
{
- cmGeneratedFileStream* cg = 0;
+ cmGeneratedFileStream* cg = CM_NULLPTR;
if (fname) {
cg = new cmGeneratedFileStream(fname);
}
if (cg && !*cg) {
delete cg;
- cg = 0;
+ cg = CM_NULLPTR;
}
this->SetLogOutputStream(cg);
if (!cg) {
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 41871cc..77f0f0b 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -42,7 +42,7 @@ public:
cmTypeMacro(cmCPackLog, cmObject);
cmCPackLog();
- ~cmCPackLog();
+ ~cmCPackLog() CM_OVERRIDE;
enum __log_tags
{
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 9fa588d..d8ff907 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -212,7 +212,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::map<std::string, cmCPackComponentGroup>::iterator groupIt;
for (groupIt = this->ComponentGroups.begin();
groupIt != this->ComponentGroups.end(); ++groupIt) {
- if (groupIt->second.ParentGroup == 0) {
+ if (groupIt->second.ParentGroup == CM_NULLPTR) {
componentCode +=
this->CreateComponentGroupDescription(&groupIt->second, macrosOut);
}
@@ -301,8 +301,9 @@ int cmCPackNSISGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
std::string output;
int retVal = 1;
- bool res = cmSystemTools::RunSingleCommand(
- nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+ bool res =
+ cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
+ CM_NULLPTR, this->GeneratorVerbose, 0);
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << nsisCmd << std::endl
@@ -326,7 +327,7 @@ int cmCPackNSISGenerator::InitializeInternal()
"NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
"This option will be reset to 0 (for this generator only)."
<< std::endl);
- this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
+ this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", CM_NULLPTR);
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackNSISGenerator::Initialize()"
@@ -399,8 +400,9 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl);
std::string output;
int retVal = 1;
- bool resS = cmSystemTools::RunSingleCommand(
- nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+ bool resS =
+ cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
+ CM_NULLPTR, this->GeneratorVerbose, 0);
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
if (!resS || retVal ||
@@ -516,8 +518,8 @@ int cmCPackNSISGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str,
- std::ostringstream& deleteStr)
+void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
+ std::ostream& deleteStr)
{
const char* cpackMenuLinks = this->GetOption("CPACK_NSIS_MENU_LINKS");
if (!cpackMenuLinks) {
@@ -621,7 +623,7 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const
}
std::string cmCPackNSISGenerator::CreateComponentDescription(
- cmCPackComponent* component, std::ostringstream& macrosOut)
+ cmCPackComponent* component, std::ostream& macrosOut)
{
// Basic description of the component
std::string componentCode = "Section ";
@@ -873,7 +875,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription(
}
std::string cmCPackNSISGenerator::CreateComponentGroupDescription(
- cmCPackComponentGroup* group, std::ostringstream& macrosOut)
+ cmCPackComponentGroup* group, std::ostream& macrosOut)
{
if (group->Components.empty() && group->Subgroups.empty()) {
// Silently skip empty groups. NSIS doesn't support them.
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index fa52902..4923cf0 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -36,27 +36,28 @@ public:
* Construct generator
*/
cmCPackNSISGenerator(bool nsis64 = false);
- virtual ~cmCPackNSISGenerator();
+ ~cmCPackNSISGenerator() CM_OVERRIDE;
protected:
- virtual int InitializeInternal();
- void CreateMenuLinks(std::ostringstream& str, std::ostringstream& deleteStr);
- int PackageFiles();
- virtual const char* GetOutputExtension() { return ".exe"; }
- virtual const char* GetOutputPostfix() { return "win32"; }
+ int InitializeInternal() CM_OVERRIDE;
+ void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".exe"; }
+ const char* GetOutputPostfix() CM_OVERRIDE { return "win32"; }
bool GetListOfSubdirectories(const char* dir,
std::vector<std::string>& dirs);
- enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
- virtual bool SupportsAbsoluteDestination() const;
- virtual bool SupportsComponentInstallation() const;
+ enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const
+ CM_OVERRIDE;
+ bool SupportsAbsoluteDestination() const CM_OVERRIDE;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
/// Produce a string that contains the NSIS code to describe a
/// particular component. Any added macros will be emitted via
/// macrosOut.
std::string CreateComponentDescription(cmCPackComponent* component,
- std::ostringstream& macrosOut);
+ std::ostream& macrosOut);
/// Produce NSIS code that selects all of the components that this component
/// depends on, recursively.
@@ -72,7 +73,7 @@ protected:
/// particular component group, including its components. Any
/// added macros will be emitted via macrosOut.
std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
- std::ostringstream& macrosOut);
+ std::ostream& macrosOut);
/// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS.
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index d5691be..c0d2553 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -158,11 +158,10 @@ int cmCPackOSXX11Generator::PackageFiles()
tmpFile += "/hdiutilOutput.log";
std::ostringstream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
- << "\" create -ov -format UDZO -srcfolder \""
- << diskImageDirectory.c_str() << "\" \"" << packageFileNames[0]
- << "\"";
+ << "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory
+ << "\" \"" << packageFileNames[0] << "\"";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: "
- << dmgCmd.str().c_str() << std::endl);
+ << dmgCmd.str() << std::endl);
// since we get random dashboard failures with this one
// try running it more than once
int retVal = 1;
@@ -181,12 +180,12 @@ int cmCPackOSXX11Generator::PackageFiles()
}
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl
+ ofs << "# Run command: " << dmgCmd.str() << std::endl
<< "# Output:" << std::endl
- << output.c_str() << std::endl;
+ << output << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: "
- << dmgCmd.str().c_str() << std::endl
- << "Please check " << tmpFile.c_str() << " for errors"
+ << dmgCmd.str() << std::endl
+ << "Please check " << tmpFile << " for errors"
<< std::endl);
return 0;
}
@@ -249,7 +248,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< (inFileName ? inFileName : "(NULL)")
- << " to " << destFileName.c_str() << std::endl);
+ << " to " << destFileName << std::endl);
this->ConfigureFile(inFileName, destFileName.c_str());
return true;
}
@@ -277,9 +276,8 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
destFileName += "/";
destFileName += outputFileName;
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Configure file: " << inFileName.c_str() << " to "
- << destFileName.c_str() << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
+ << inFileName << " to " << destFileName << std::endl);
this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly);
return true;
}
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index adc05d2..d1d6789 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -32,10 +32,10 @@ public:
virtual ~cmCPackOSXX11Generator();
protected:
- virtual int InitializeInternal();
- int PackageFiles();
- virtual const char* GetPackagingInstallPrefix();
- virtual const char* GetOutputExtension() { return ".dmg"; }
+ virtual int InitializeInternal() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetPackagingInstallPrefix() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".dmg"; }
// bool CopyCreateResourceFile(const std::string& name,
// const std::string& dir);
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
new file mode 100644
index 0000000..19b587a
--- /dev/null
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -0,0 +1,367 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCPackPKGGenerator.h"
+
+#include "cmCPackComponentGroup.h"
+#include "cmCPackLog.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmXMLWriter.h"
+#include "cmake.h"
+
+#include <cmsys/Glob.hxx>
+#include <cmsys/SystemTools.hxx>
+
+cmCPackPKGGenerator::cmCPackPKGGenerator()
+{
+ this->componentPackageMethod = ONE_PACKAGE;
+}
+
+cmCPackPKGGenerator::~cmCPackPKGGenerator()
+{
+}
+
+bool cmCPackPKGGenerator::SupportsComponentInstallation() const
+{
+ return true;
+}
+
+int cmCPackPKGGenerator::InitializeInternal()
+{
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackPKGGenerator::Initialize()"
+ << std::endl);
+
+ return this->Superclass::InitializeInternal();
+}
+
+std::string cmCPackPKGGenerator::GetPackageName(
+ const cmCPackComponent& component)
+{
+ if (component.ArchiveFile.empty()) {
+ std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ packagesDir += ".dummy";
+ std::ostringstream out;
+ out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-"
+ << component.Name << ".pkg";
+ return out.str();
+ } else {
+ return component.ArchiveFile + ".pkg";
+ }
+}
+
+void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
+{
+ std::string distributionTemplate =
+ this->FindTemplate("CPack.distribution.dist.in");
+ if (distributionTemplate.empty()) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find input file: "
+ << distributionTemplate << std::endl);
+ return;
+ }
+
+ std::string distributionFile = metapackageFile;
+ distributionFile += "/Contents/distribution.dist";
+
+ // Create the choice outline, which provides a tree-based view of
+ // the components in their groups.
+ std::ostringstream choiceOut;
+ cmXMLWriter xout(choiceOut, 1);
+ xout.StartElement("choices-outline");
+
+ // Emit the outline for the groups
+ std::map<std::string, cmCPackComponentGroup>::iterator groupIt;
+ for (groupIt = this->ComponentGroups.begin();
+ groupIt != this->ComponentGroups.end(); ++groupIt) {
+ if (groupIt->second.ParentGroup == 0) {
+ CreateChoiceOutline(groupIt->second, xout);
+ }
+ }
+
+ // Emit the outline for the non-grouped components
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ if (!compIt->second.Group) {
+ xout.StartElement("line");
+ xout.Attribute("choice", compIt->first + "Choice");
+ xout.Content(""); // Avoid self-closing tag.
+ xout.EndElement();
+ }
+ }
+ if (!this->PostFlightComponent.Name.empty()) {
+ xout.StartElement("line");
+ xout.Attribute("choice", PostFlightComponent.Name + "Choice");
+ xout.Content(""); // Avoid self-closing tag.
+ xout.EndElement();
+ }
+ xout.EndElement(); // choices-outline>
+
+ // Create the actual choices
+ for (groupIt = this->ComponentGroups.begin();
+ groupIt != this->ComponentGroups.end(); ++groupIt) {
+ CreateChoice(groupIt->second, xout);
+ }
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ CreateChoice(compIt->second, xout);
+ }
+
+ if (!this->PostFlightComponent.Name.empty()) {
+ CreateChoice(PostFlightComponent, xout);
+ }
+
+ this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str());
+
+ // Create the distribution.dist file in the metapackage to turn it
+ // into a distribution package.
+ this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str());
+}
+
+void cmCPackPKGGenerator::CreateChoiceOutline(
+ const cmCPackComponentGroup& group, cmXMLWriter& xout)
+{
+ xout.StartElement("line");
+ xout.Attribute("choice", group.Name + "Choice");
+ std::vector<cmCPackComponentGroup*>::const_iterator groupIt;
+ for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end();
+ ++groupIt) {
+ CreateChoiceOutline(**groupIt, xout);
+ }
+
+ std::vector<cmCPackComponent*>::const_iterator compIt;
+ for (compIt = group.Components.begin(); compIt != group.Components.end();
+ ++compIt) {
+ xout.StartElement("line");
+ xout.Attribute("choice", (*compIt)->Name + "Choice");
+ xout.Content(""); // Avoid self-closing tag.
+ xout.EndElement();
+ }
+ xout.EndElement();
+}
+
+void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
+ cmXMLWriter& xout)
+{
+ xout.StartElement("choice");
+ xout.Attribute("id", group.Name + "Choice");
+ xout.Attribute("title", group.DisplayName);
+ xout.Attribute("start_selected", "true");
+ xout.Attribute("start_enabled", "true");
+ xout.Attribute("start_visible", "true");
+ if (!group.Description.empty()) {
+ xout.Attribute("description", group.Description);
+ }
+ xout.EndElement();
+}
+
+void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
+ cmXMLWriter& xout)
+{
+ std::string packageId = "com.";
+ packageId += this->GetOption("CPACK_PACKAGE_VENDOR");
+ packageId += '.';
+ packageId += this->GetOption("CPACK_PACKAGE_NAME");
+ packageId += '.';
+ packageId += component.Name;
+
+ xout.StartElement("choice");
+ xout.Attribute("id", component.Name + "Choice");
+ xout.Attribute("title", component.DisplayName);
+ xout.Attribute(
+ "start_selected",
+ component.IsDisabledByDefault && !component.IsRequired ? "false" : "true");
+ xout.Attribute("start_enabled", component.IsRequired ? "false" : "true");
+ xout.Attribute("start_visible", component.IsHidden ? "false" : "true");
+ if (!component.Description.empty()) {
+ xout.Attribute("description", component.Description);
+ }
+ if (!component.Dependencies.empty() ||
+ !component.ReverseDependencies.empty()) {
+ // The "selected" expression is evaluated each time any choice is
+ // selected, for all choices *except* the one that the user
+ // selected. A component is marked selected if it has been
+ // selected (my.choice.selected in Javascript) and all of the
+ // components it depends on have been selected (transitively) or
+ // if any of the components that depend on it have been selected
+ // (transitively). Assume that we have components A, B, C, D, and
+ // E, where each component depends on the previous component (B
+ // depends on A, C depends on B, D depends on C, and E depends on
+ // D). The expression we build for the component C will be
+ // my.choice.selected && B && A || D || E
+ // This way, selecting C will automatically select everything it depends
+ // on (B and A), while selecting something that depends on C--either D
+ // or E--will automatically cause C to get selected.
+ std::ostringstream selected("my.choice.selected");
+ std::set<const cmCPackComponent*> visited;
+ AddDependencyAttributes(component, visited, selected);
+ visited.clear();
+ AddReverseDependencyAttributes(component, visited, selected);
+ xout.Attribute("selected", selected.str());
+ }
+ xout.StartElement("pkg-ref");
+ xout.Attribute("id", packageId);
+ xout.EndElement(); // pkg-ref
+ xout.EndElement(); // choice
+
+ // Create a description of the package associated with this
+ // component.
+ std::string relativePackageLocation = "Contents/Packages/";
+ relativePackageLocation += this->GetPackageName(component);
+
+ // Determine the installed size of the package.
+ std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ dirName += '/';
+ dirName += component.Name;
+ dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
+ unsigned long installedSize =
+ component.GetInstalledSizeInKbytes(dirName.c_str());
+
+ xout.StartElement("pkg-ref");
+ xout.Attribute("id", packageId);
+ xout.Attribute("version", this->GetOption("CPACK_PACKAGE_VERSION"));
+ xout.Attribute("installKBytes", installedSize);
+ xout.Attribute("auth", "Admin");
+ xout.Attribute("onConclusion", "None");
+ if (component.IsDownloaded) {
+ xout.Content(this->GetOption("CPACK_DOWNLOAD_SITE"));
+ xout.Content(this->GetPackageName(component));
+ } else {
+ xout.Content("file:./");
+ xout.Content(relativePackageLocation);
+ }
+ xout.EndElement(); // pkg-ref
+}
+
+void cmCPackPKGGenerator::AddDependencyAttributes(
+ const cmCPackComponent& component,
+ std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
+{
+ if (visited.find(&component) != visited.end()) {
+ return;
+ }
+ visited.insert(&component);
+
+ std::vector<cmCPackComponent*>::const_iterator dependIt;
+ for (dependIt = component.Dependencies.begin();
+ dependIt != component.Dependencies.end(); ++dependIt) {
+ out << " && choices['" << (*dependIt)->Name << "Choice'].selected";
+ AddDependencyAttributes(**dependIt, visited, out);
+ }
+}
+
+void cmCPackPKGGenerator::AddReverseDependencyAttributes(
+ const cmCPackComponent& component,
+ std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
+{
+ if (visited.find(&component) != visited.end()) {
+ return;
+ }
+ visited.insert(&component);
+
+ std::vector<cmCPackComponent*>::const_iterator dependIt;
+ for (dependIt = component.ReverseDependencies.begin();
+ dependIt != component.ReverseDependencies.end(); ++dependIt) {
+ out << " || choices['" << (*dependIt)->Name << "Choice'].selected";
+ AddReverseDependencyAttributes(**dependIt, visited, out);
+ }
+}
+
+bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
+ const std::string& dirName)
+{
+ std::string uname = cmSystemTools::UpperCase(name);
+ std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
+ const char* inFileName = this->GetOption(cpackVar.c_str());
+ if (!inFileName) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: "
+ << cpackVar.c_str()
+ << " not specified. It should point to "
+ << (!name.empty() ? name : "<empty>") << ".rtf, " << name
+ << ".html, or " << name << ".txt file" << std::endl);
+ return false;
+ }
+ if (!cmSystemTools::FileExists(inFileName)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find "
+ << (!name.empty() ? name : "<empty>")
+ << " resource file: " << inFileName << std::endl);
+ return false;
+ }
+ std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName);
+ if (ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt") {
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR, "Bad file extension specified: "
+ << ext
+ << ". Currently only .rtfd, .rtf, .html, and .txt files allowed."
+ << std::endl);
+ return false;
+ }
+
+ std::string destFileName = dirName;
+ destFileName += '/';
+ destFileName += name + ext;
+
+ // Set this so that distribution.dist gets the right name (without
+ // the path).
+ this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(),
+ (name + ext).c_str());
+
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Configure file: " << (inFileName ? inFileName : "(NULL)")
+ << " to " << destFileName << std::endl);
+ this->ConfigureFile(inFileName, destFileName.c_str());
+ return true;
+}
+
+bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
+ const char* outName)
+{
+ if (!outName) {
+ outName = name.c_str();
+ }
+
+ std::string inFName = "CPack.";
+ inFName += name;
+ inFName += ".in";
+ std::string inFileName = this->FindTemplate(inFName.c_str());
+ if (inFileName.empty()) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot find input file: " << inFName << std::endl);
+ return false;
+ }
+
+ std::string destFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+ destFileName += "/";
+ destFileName += outName;
+
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
+ << inFileName << " to " << destFileName << std::endl);
+ this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
+ return true;
+}
+
+int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir,
+ const std::string& script,
+ const std::string& name)
+{
+ std::string dst = resdir;
+ dst += "/";
+ dst += name;
+ cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str());
+ cmSystemTools::SetPermissions(dst.c_str(), 0777);
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "copy script : " << script << "\ninto " << dst << std::endl);
+
+ return 1;
+}
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
new file mode 100644
index 0000000..d2135cc
--- /dev/null
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -0,0 +1,96 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackPKGGenerator_h
+#define cmCPackPKGGenerator_h
+
+#include "cmCPackGenerator.h"
+
+class cmCPackComponent;
+class cmXMLWriter;
+
+/** \class cmCPackPKGGenerator
+ * \brief A generator for pkg files
+ *
+ */
+class cmCPackPKGGenerator : public cmCPackGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackPKGGenerator();
+ virtual ~cmCPackPKGGenerator();
+
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
+
+protected:
+ int InitializeInternal() CM_OVERRIDE;
+ const char* GetOutputPostfix() CM_OVERRIDE { return "darwin"; }
+
+ // Copies or creates the resource file with the given name to the
+ // package or package staging directory dirName. The variable
+ // 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 std::string& name,
+ const std::string& dirName);
+ bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
+
+ int CopyInstallScript(const std::string& resdir, const std::string& script,
+ const std::string& name);
+
+ // Retrieve the name of package file that will be generated for this
+ // component. The name is just the file name with extension, and
+ // does not include the subdirectory.
+ std::string GetPackageName(const cmCPackComponent& component);
+
+ // Writes a distribution.dist file, which turns a metapackage into a
+ // full-fledged distribution. This file is used to describe
+ // inter-component dependencies. metapackageFile is the name of the
+ // metapackage for the distribution. Only valid for a
+ // component-based install.
+ void WriteDistributionFile(const char* metapackageFile);
+
+ // Subroutine of WriteDistributionFile that writes out the
+ // dependency attributes for inter-component dependencies.
+ void AddDependencyAttributes(const cmCPackComponent& component,
+ std::set<const cmCPackComponent*>& visited,
+ std::ostringstream& out);
+
+ // Subroutine of WriteDistributionFile that writes out the
+ // reverse dependency attributes for inter-component dependencies.
+ void AddReverseDependencyAttributes(
+ const cmCPackComponent& component,
+ std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
+
+ // Generates XML that encodes the hierarchy of component groups and
+ // their components in a form that can be used by distribution
+ // metapackages.
+ void CreateChoiceOutline(const cmCPackComponentGroup& group,
+ cmXMLWriter& xout);
+
+ /// Create the "choice" XML element to describe a component group
+ /// for the installer GUI.
+ void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
+
+ /// Create the "choice" XML element to describe a component for the
+ /// installer GUI.
+ void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
+
+ // The PostFlight component when creating a metapackage
+ cmCPackComponent PostFlightComponent;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 5ca3ff7..ce329ca 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -17,6 +17,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include "cmXMLWriter.h"
#include "cmake.h"
#include <cmsys/FStream.hxx>
@@ -46,21 +47,6 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const
return this->PackageCompatibilityVersion >= getVersion(10, 4);
}
-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.c_str(), dst.c_str());
- cmSystemTools::SetPermissions(dst.c_str(), 0777);
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : "
- << script << "\ninto " << dst.c_str() << std::endl);
-
- return 1;
-}
-
int cmCPackPackageMakerGenerator::PackageFiles()
{
// TODO: Use toplevel
@@ -116,7 +102,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: "
- << preflightDirName.c_str() << std::endl);
+ << preflightDirName << std::endl);
return 0;
}
}
@@ -124,7 +110,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: "
- << postflightDirName.c_str() << std::endl);
+ << postflightDirName << std::endl);
return 0;
}
}
@@ -152,7 +138,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating component packages directory: "
- << packageDir.c_str() << std::endl);
+ << packageDir << std::endl);
return 0;
}
@@ -162,7 +148,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
cmCPackLogger(
cmCPackLog::LOG_ERROR,
"Problem creating component PostFlight Packages directory: "
- << packageFileDir.c_str() << std::endl);
+ << packageFileDir << std::endl);
return 0;
}
std::string packageFile =
@@ -184,7 +170,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating component packages directory: "
- << basePackageDir.c_str() << std::endl);
+ << basePackageDir << std::endl);
return 0;
}
@@ -329,12 +315,12 @@ int cmCPackPackageMakerGenerator::PackageFiles()
}
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl
+ ofs << "# Run command: " << dmgCmd.str() << std::endl
<< "# Output:" << std::endl
- << output.c_str() << std::endl;
+ << output << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: "
- << dmgCmd.str().c_str() << std::endl
- << "Please check " << tmpFile.c_str() << " for errors"
+ << dmgCmd.str() << std::endl
+ << "Please check " << tmpFile << " for errors"
<< std::endl);
return 0;
}
@@ -344,8 +330,6 @@ int cmCPackPackageMakerGenerator::PackageFiles()
int cmCPackPackageMakerGenerator::InitializeInternal()
{
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "cmCPackPackageMakerGenerator::Initialize()" << std::endl);
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
// Starting with Xcode 4.3, PackageMaker is a separate app, and you
@@ -399,7 +383,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
if (!cmSystemTools::FileExists(versionFile.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find PackageMaker compiler version file: "
- << versionFile.c_str() << std::endl);
+ << versionFile << std::endl);
return 0;
}
@@ -433,7 +417,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
if (!cmSystemTools::GetLineFromStream(ifs, line) || !rexVersion.find(line)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem reading the PackageMaker compiler version file: "
- << versionFile.c_str() << std::endl);
+ << versionFile << std::endl);
return 0;
}
this->PackageMakerVersion = atof(rexVersion.match(1).c_str());
@@ -481,80 +465,6 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(
- const std::string& name, const std::string& dirName)
-{
- std::string uname = cmSystemTools::UpperCase(name);
- std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
- const char* inFileName = this->GetOption(cpackVar.c_str());
- if (!inFileName) {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: "
- << cpackVar.c_str()
- << " not specified. It should point to "
- << (!name.empty() ? name : "<empty>") << ".rtf, " << name
- << ".html, or " << name << ".txt file" << std::endl);
- return false;
- }
- if (!cmSystemTools::FileExists(inFileName)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find "
- << (!name.empty() ? name : "<empty>")
- << " resource file: " << inFileName << std::endl);
- return false;
- }
- std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName);
- if (ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt") {
- cmCPackLogger(
- cmCPackLog::LOG_ERROR, "Bad file extension specified: "
- << ext
- << ". Currently only .rtfd, .rtf, .html, and .txt files allowed."
- << std::endl);
- return false;
- }
-
- std::string destFileName = dirName;
- destFileName += '/';
- destFileName += name + ext;
-
- // Set this so that distribution.dist gets the right name (without
- // the path).
- this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(),
- (name + ext).c_str());
-
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
- << (inFileName ? inFileName : "(NULL)") << " to "
- << destFileName.c_str() << std::endl);
- this->ConfigureFile(inFileName, destFileName.c_str());
- return true;
-}
-
-bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(
- const std::string& name, const char* outName)
-{
- if (!outName) {
- outName = name.c_str();
- }
-
- std::string inFName = "CPack.";
- inFName += name;
- inFName += ".in";
- std::string inFileName = this->FindTemplate(inFName.c_str());
- if (inFileName.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find input file: " << inFName << std::endl);
- return false;
- }
-
- std::string destFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- destFileName += "/";
- destFileName += outName;
-
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Configure file: " << inFileName.c_str() << " to "
- << destFileName.c_str() << std::endl);
- this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
- return true;
-}
-
bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
const char* packageFile)
{
@@ -572,11 +482,11 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << command << std::endl
<< "# Output:" << std::endl
- << output.c_str() << std::endl;
+ << output << std::endl;
cmCPackLogger(
cmCPackLog::LOG_ERROR, "Problem running PackageMaker command: "
<< command << std::endl
- << "Please check " << tmpFile.c_str() << " for errors" << std::endl);
+ << "Please check " << tmpFile << " for errors" << std::endl);
return false;
}
// sometimes the command finishes but the directory is not yet
@@ -597,21 +507,6 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
return true;
}
-std::string cmCPackPackageMakerGenerator::GetPackageName(
- const cmCPackComponent& component)
-{
- if (component.ArchiveFile.empty()) {
- std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
- packagesDir += ".dummy";
- std::ostringstream out;
- out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-"
- << component.Name << ".pkg";
- return out.str();
- } else {
- return component.ArchiveFile + ".pkg";
- }
-}
-
bool cmCPackPackageMakerGenerator::GenerateComponentPackage(
const char* packageFile, const char* packageDir,
const cmCPackComponent& component)
@@ -629,21 +524,22 @@ bool cmCPackPackageMakerGenerator::GenerateComponentPackage(
std::string descriptionFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
descriptionFile += '/' + component.Name + "-Description.plist";
cmsys::ofstream out(descriptionFile.c_str());
- out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
- << "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
- << "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" << std::endl
- << "<plist version=\"1.4\">" << std::endl
- << "<dict>" << std::endl
- << " <key>IFPkgDescriptionTitle</key>" << std::endl
- << " <string>" << component.DisplayName << "</string>" << std::endl
- << " <key>IFPkgDescriptionVersion</key>" << std::endl
- << " <string>" << this->GetOption("CPACK_PACKAGE_VERSION")
- << "</string>" << std::endl
- << " <key>IFPkgDescriptionDescription</key>" << std::endl
- << " <string>" + this->EscapeForXML(component.Description)
- << "</string>" << std::endl
- << "</dict>" << std::endl
- << "</plist>" << std::endl;
+ cmXMLWriter xout(out);
+ xout.StartDocument();
+ xout.Doctype("plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
+ "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"");
+ xout.StartElement("plist");
+ xout.Attribute("version", "1.4");
+ xout.StartElement("dict");
+ xout.Element("key", "IFPkgDescriptionTitle");
+ xout.Element("string", component.DisplayName);
+ xout.Element("key", "IFPkgDescriptionVersion");
+ xout.Element("string", this->GetOption("CPACK_PACKAGE_VERSION"));
+ xout.Element("key", "IFPkgDescriptionDescription");
+ xout.Element("string", component.Description);
+ xout.EndElement(); // dict
+ xout.EndElement(); // plist
+ xout.EndDocument();
out.close();
// Create the Info.plist file for this component
@@ -686,219 +582,3 @@ bool cmCPackPackageMakerGenerator::GenerateComponentPackage(
// Run PackageMaker
return RunPackageMaker(pkgCmd.str().c_str(), packageFile);
}
-
-void cmCPackPackageMakerGenerator::WriteDistributionFile(
- const char* metapackageFile)
-{
- std::string distributionTemplate =
- this->FindTemplate("CPack.distribution.dist.in");
- if (distributionTemplate.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find input file: "
- << distributionTemplate << std::endl);
- return;
- }
-
- std::string distributionFile = metapackageFile;
- distributionFile += "/Contents/distribution.dist";
-
- // Create the choice outline, which provides a tree-based view of
- // the components in their groups.
- std::ostringstream choiceOut;
- choiceOut << "<choices-outline>" << std::endl;
-
- // Emit the outline for the groups
- std::map<std::string, cmCPackComponentGroup>::iterator groupIt;
- for (groupIt = this->ComponentGroups.begin();
- groupIt != this->ComponentGroups.end(); ++groupIt) {
- if (groupIt->second.ParentGroup == 0) {
- CreateChoiceOutline(groupIt->second, choiceOut);
- }
- }
-
- // Emit the outline for the non-grouped components
- std::map<std::string, cmCPackComponent>::iterator compIt;
- for (compIt = this->Components.begin(); compIt != this->Components.end();
- ++compIt) {
- if (!compIt->second.Group) {
- choiceOut << "<line choice=\"" << compIt->first << "Choice\"></line>"
- << std::endl;
- }
- }
- if (!this->PostFlightComponent.Name.empty()) {
- choiceOut << "<line choice=\"" << PostFlightComponent.Name
- << "Choice\"></line>" << std::endl;
- }
- choiceOut << "</choices-outline>" << std::endl;
-
- // Create the actual choices
- for (groupIt = this->ComponentGroups.begin();
- groupIt != this->ComponentGroups.end(); ++groupIt) {
- CreateChoice(groupIt->second, choiceOut);
- }
- for (compIt = this->Components.begin(); compIt != this->Components.end();
- ++compIt) {
- CreateChoice(compIt->second, choiceOut);
- }
-
- if (!this->PostFlightComponent.Name.empty()) {
- CreateChoice(PostFlightComponent, choiceOut);
- }
-
- this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str());
-
- // Create the distribution.dist file in the metapackage to turn it
- // into a distribution package.
- this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str());
-}
-
-void cmCPackPackageMakerGenerator::CreateChoiceOutline(
- const cmCPackComponentGroup& group, std::ostringstream& out)
-{
- out << "<line choice=\"" << group.Name << "Choice\">" << std::endl;
- std::vector<cmCPackComponentGroup*>::const_iterator groupIt;
- for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end();
- ++groupIt) {
- CreateChoiceOutline(**groupIt, out);
- }
-
- std::vector<cmCPackComponent*>::const_iterator compIt;
- for (compIt = group.Components.begin(); compIt != group.Components.end();
- ++compIt) {
- out << " <line choice=\"" << (*compIt)->Name << "Choice\"></line>"
- << std::endl;
- }
- out << "</line>" << std::endl;
-}
-
-void cmCPackPackageMakerGenerator::CreateChoice(
- const cmCPackComponentGroup& group, std::ostringstream& out)
-{
- out << "<choice id=\"" << group.Name << "Choice\" "
- << "title=\"" << group.DisplayName << "\" "
- << "start_selected=\"true\" "
- << "start_enabled=\"true\" "
- << "start_visible=\"true\" ";
- if (!group.Description.empty()) {
- out << "description=\"" << EscapeForXML(group.Description) << "\"";
- }
- out << "></choice>" << std::endl;
-}
-
-void cmCPackPackageMakerGenerator::CreateChoice(
- const cmCPackComponent& component, std::ostringstream& out)
-{
- std::string packageId = "com.";
- packageId += this->GetOption("CPACK_PACKAGE_VENDOR");
- packageId += '.';
- packageId += this->GetOption("CPACK_PACKAGE_NAME");
- packageId += '.';
- packageId += component.Name;
-
- out << "<choice id=\"" << component.Name << "Choice\" "
- << "title=\"" << component.DisplayName << "\" "
- << "start_selected=\""
- << (component.IsDisabledByDefault && !component.IsRequired ? "false"
- : "true")
- << "\" "
- << "start_enabled=\"" << (component.IsRequired ? "false" : "true")
- << "\" "
- << "start_visible=\"" << (component.IsHidden ? "false" : "true")
- << "\" ";
- if (!component.Description.empty()) {
- out << "description=\"" << EscapeForXML(component.Description) << "\" ";
- }
- if (!component.Dependencies.empty() ||
- !component.ReverseDependencies.empty()) {
- // The "selected" expression is evaluated each time any choice is
- // selected, for all choices *except* the one that the user
- // selected. A component is marked selected if it has been
- // selected (my.choice.selected in Javascript) and all of the
- // components it depends on have been selected (transitively) or
- // if any of the components that depend on it have been selected
- // (transitively). Assume that we have components A, B, C, D, and
- // E, where each component depends on the previous component (B
- // depends on A, C depends on B, D depends on C, and E depends on
- // D). The expression we build for the component C will be
- // my.choice.selected && B && A || D || E
- // This way, selecting C will automatically select everything it depends
- // on (B and A), while selecting something that depends on C--either D
- // or E--will automatically cause C to get selected.
- out << "selected=\"my.choice.selected";
- std::set<const cmCPackComponent*> visited;
- AddDependencyAttributes(component, visited, out);
- visited.clear();
- AddReverseDependencyAttributes(component, visited, out);
- out << "\"";
- }
- out << ">" << std::endl;
- out << " <pkg-ref id=\"" << packageId << "\"></pkg-ref>" << std::endl;
- out << "</choice>" << std::endl;
-
- // Create a description of the package associated with this
- // component.
- std::string relativePackageLocation = "Contents/Packages/";
- relativePackageLocation += this->GetPackageName(component);
-
- // Determine the installed size of the package.
- std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
- dirName += '/';
- dirName += component.Name;
- dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
- unsigned long installedSize =
- component.GetInstalledSizeInKbytes(dirName.c_str());
-
- out << "<pkg-ref id=\"" << packageId << "\" "
- << "version=\"" << this->GetOption("CPACK_PACKAGE_VERSION") << "\" "
- << "installKBytes=\"" << installedSize << "\" "
- << "auth=\"Admin\" onConclusion=\"None\">";
- if (component.IsDownloaded) {
- out << this->GetOption("CPACK_DOWNLOAD_SITE")
- << this->GetPackageName(component);
- } else {
- out << "file:./" << relativePackageLocation;
- }
- out << "</pkg-ref>" << std::endl;
-}
-
-void cmCPackPackageMakerGenerator::AddDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
-{
- if (visited.find(&component) != visited.end()) {
- return;
- }
- visited.insert(&component);
-
- std::vector<cmCPackComponent*>::const_iterator dependIt;
- for (dependIt = component.Dependencies.begin();
- dependIt != component.Dependencies.end(); ++dependIt) {
- out << " &amp;&amp; choices['" << (*dependIt)->Name << "Choice'].selected";
- AddDependencyAttributes(**dependIt, visited, out);
- }
-}
-
-void cmCPackPackageMakerGenerator::AddReverseDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
-{
- if (visited.find(&component) != visited.end()) {
- return;
- }
- visited.insert(&component);
-
- std::vector<cmCPackComponent*>::const_iterator dependIt;
- for (dependIt = component.ReverseDependencies.begin();
- dependIt != component.ReverseDependencies.end(); ++dependIt) {
- out << " || choices['" << (*dependIt)->Name << "Choice'].selected";
- AddReverseDependencyAttributes(**dependIt, visited, out);
- }
-}
-
-std::string cmCPackPackageMakerGenerator::EscapeForXML(std::string str)
-{
- cmSystemTools::ReplaceString(str, "&", "&amp;");
- cmSystemTools::ReplaceString(str, "<", "&lt;");
- cmSystemTools::ReplaceString(str, ">", "&gt;");
- cmSystemTools::ReplaceString(str, "\"", "&quot;");
- return str;
-}
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index 2b8d253..d1314a4 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -13,7 +13,7 @@
#ifndef cmCPackPackageMakerGenerator_h
#define cmCPackPackageMakerGenerator_h
-#include "cmCPackGenerator.h"
+#include "cmCPackPKGGenerator.h"
class cmCPackComponent;
@@ -23,46 +23,28 @@ class cmCPackComponent;
* http://developer.apple.com/documentation/Darwin
* /Reference/ManPages/man1/packagemaker.1.html
*/
-class cmCPackPackageMakerGenerator : public cmCPackGenerator
+class cmCPackPackageMakerGenerator : public cmCPackPKGGenerator
{
public:
- cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator);
+ cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackPKGGenerator);
/**
* Construct generator
*/
cmCPackPackageMakerGenerator();
virtual ~cmCPackPackageMakerGenerator();
-
- virtual bool SupportsComponentInstallation() const;
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
protected:
- 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"; }
- virtual const char* GetOutputPostfix() { return "darwin"; }
-
- // Copies or creates the resource file with the given name to the
- // package or package staging directory dirName. The variable
- // 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 std::string& name,
- const std::string& dirName);
- bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
+ int InitializeInternal() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".dmg"; }
// Run PackageMaker with the given command line, which will (if
// successful) produce the given package file. Returns true if
// PackageMaker succeeds, false otherwise.
bool RunPackageMaker(const char* command, const char* packageFile);
- // Retrieve the name of package file that will be generated for this
- // component. The name is just the file name with extension, and
- // does not include the subdirectory.
- std::string GetPackageName(const cmCPackComponent& component);
-
// Generate a package in the file packageFile for the given
// component. All of the files within this component are stored in
// the directory packageDir. Returns true if successful, false
@@ -71,48 +53,6 @@ protected:
const char* packageDir,
const cmCPackComponent& component);
- // Writes a distribution.dist file, which turns a metapackage into a
- // full-fledged distribution. This file is used to describe
- // inter-component dependencies. metapackageFile is the name of the
- // metapackage for the distribution. Only valid for a
- // component-based install.
- void WriteDistributionFile(const char* metapackageFile);
-
- // Subroutine of WriteDistributionFile that writes out the
- // dependency attributes for inter-component dependencies.
- void AddDependencyAttributes(const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited,
- std::ostringstream& out);
-
- // Subroutine of WriteDistributionFile that writes out the
- // reverse dependency attributes for inter-component dependencies.
- void AddReverseDependencyAttributes(
- const cmCPackComponent& component,
- std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
-
- // Generates XML that encodes the hierarchy of component groups and
- // their components in a form that can be used by distribution
- // metapackages.
- void CreateChoiceOutline(const cmCPackComponentGroup& group,
- std::ostringstream& out);
-
- /// Create the "choice" XML element to describe a component group
- /// for the installer GUI.
- void CreateChoice(const cmCPackComponentGroup& group,
- std::ostringstream& out);
-
- /// Create the "choice" XML element to describe a component for the
- /// installer GUI.
- void CreateChoice(const cmCPackComponent& component,
- std::ostringstream& out);
-
- // Escape the given string to make it usable as an XML attribute
- // value.
- std::string EscapeForXML(std::string str);
-
- // The PostFlight component when creating a metapackage
- cmCPackComponent PostFlightComponent;
-
double PackageMakerVersion;
unsigned int PackageCompatibilityVersion;
};
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
new file mode 100644
index 0000000..c2a13d0
--- /dev/null
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -0,0 +1,231 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCPackProductBuildGenerator.h"
+
+#include "cmCPackComponentGroup.h"
+#include "cmCPackLog.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <cmsys/Glob.hxx>
+#include <cmsys/SystemTools.hxx>
+
+cmCPackProductBuildGenerator::cmCPackProductBuildGenerator()
+{
+ this->componentPackageMethod = ONE_PACKAGE;
+}
+
+cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator()
+{
+}
+
+int cmCPackProductBuildGenerator::PackageFiles()
+{
+ // TODO: Use toplevel
+ // It is used! Is this an obsolete comment?
+
+ std::string packageDirFileName =
+ this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+
+ // Create the directory where component packages will be built.
+ std::string basePackageDir = packageDirFileName;
+ basePackageDir += "/Contents/Packages";
+ if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating component packages directory: "
+ << basePackageDir << std::endl);
+ return 0;
+ }
+
+ if (!this->Components.empty()) {
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ std::string packageDir = toplevel;
+ packageDir += '/';
+ packageDir += compIt->first;
+ if (!this->GenerateComponentPackage(basePackageDir,
+ GetPackageName(compIt->second),
+ packageDir, &compIt->second)) {
+ return 0;
+ }
+ }
+ } else {
+ if (!this->GenerateComponentPackage(basePackageDir,
+ this->GetOption("CPACK_PACKAGE_NAME"),
+ toplevel, NULL)) {
+ return 0;
+ }
+ }
+
+ // Copy or create all of the resource files we need.
+ std::string resDir = packageDirFileName + "/Contents";
+ if (!this->CopyCreateResourceFile("License", resDir.c_str()) ||
+ !this->CopyCreateResourceFile("ReadMe", resDir.c_str()) ||
+ !this->CopyCreateResourceFile("Welcome", resDir.c_str())) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
+ << std::endl);
+ return 0;
+ }
+
+ // combine package(s) into a distribution
+ WriteDistributionFile(packageDirFileName.c_str());
+ std::ostringstream pkgCmd;
+
+ std::string version = this->GetOption("CPACK_PACKAGE_VERSION");
+ std::string productbuild = this->GetOption("CPACK_COMMAND_PRODUCTBUILD");
+
+ pkgCmd << productbuild << " --distribution \"" << packageDirFileName
+ << "/Contents/distribution.dist\""
+ << " --package-path \"" << packageDirFileName << "/Contents/Packages"
+ << "\""
+ << " --resources \"" << resDir << "\""
+ << " --version \"" << version << "\""
+ << " \"" << packageFileNames[0] << "\"";
+
+ // Run ProductBuild
+ return RunProductBuild(pkgCmd.str());
+}
+
+int cmCPackProductBuildGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/Applications");
+
+ std::vector<std::string> no_paths;
+ std::string program =
+ cmSystemTools::FindProgram("pkgbuild", no_paths, false);
+ if (program.empty()) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find pkgbuild executable"
+ << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_COMMAND_PKGBUILD", program.c_str());
+
+ program = cmSystemTools::FindProgram("productbuild", no_paths, false);
+ if (program.empty()) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find productbuild executable"
+ << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_COMMAND_PRODUCTBUILD", program.c_str());
+
+ return this->Superclass::InitializeInternal();
+}
+
+bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
+{
+ std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+ tmpFile += "/ProductBuildOutput.log";
+
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl);
+ std::string output, error_output;
+ int retVal = 1;
+ bool res =
+ cmSystemTools::RunSingleCommand(command.c_str(), &output, &error_output,
+ &retVal, 0, this->GeneratorVerbose, 0);
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
+ if (!res || retVal) {
+ cmGeneratedFileStream ofs(tmpFile.c_str());
+ ofs << "# Run command: " << command << std::endl
+ << "# Output:" << std::endl
+ << output << std::endl;
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem running command: " << command << std::endl
+ << "Please check " << tmpFile
+ << " for errors" << std::endl);
+ return false;
+ }
+ return true;
+}
+
+bool cmCPackProductBuildGenerator::GenerateComponentPackage(
+ const std::string& packageFileDir, const std::string& packageFileName,
+ const std::string& packageDir, const cmCPackComponent* component)
+{
+ std::string packageFile = packageFileDir;
+ packageFile += '/';
+ packageFile += packageFileName;
+
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Building component package: "
+ << packageFile << std::endl);
+
+ const char* comp_name = component ? component->Name.c_str() : NULL;
+
+ const char* preflight = this->GetComponentScript("PREFLIGHT", comp_name);
+ const char* postflight = this->GetComponentScript("POSTFLIGHT", comp_name);
+
+ std::string resDir = packageFileDir;
+ if (component) {
+ resDir += "/";
+ resDir += component->Name;
+ }
+ std::string scriptDir = resDir + "/scripts";
+
+ if (!cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating installer directory: " << scriptDir
+ << std::endl);
+ return 0;
+ }
+
+ // if preflight, postflight, or postupgrade are set
+ // then copy them into the script directory and make
+ // them executable
+ if (preflight) {
+ this->CopyInstallScript(scriptDir.c_str(), preflight, "preinstall");
+ }
+ if (postflight) {
+ this->CopyInstallScript(scriptDir.c_str(), postflight, "postinstall");
+ }
+
+ // The command that will be used to run ProductBuild
+ std::ostringstream pkgCmd;
+
+ std::string pkgId = "com.";
+ pkgId += this->GetOption("CPACK_PACKAGE_VENDOR");
+ pkgId += '.';
+ pkgId += this->GetOption("CPACK_PACKAGE_NAME");
+ if (component) {
+ pkgId += '.';
+ pkgId += component->Name;
+ }
+
+ std::string version = this->GetOption("CPACK_PACKAGE_VERSION");
+ std::string pkgbuild = this->GetOption("CPACK_COMMAND_PKGBUILD");
+
+ pkgCmd << pkgbuild << " --root \"" << packageDir << "\""
+ << " --identifier \"" << pkgId << "\""
+ << " --scripts \"" << scriptDir << "\""
+ << " --version \"" << version << "\""
+ << " --install-location \"/\""
+ << " \"" << packageFile << "\"";
+
+ // Run ProductBuild
+ return RunProductBuild(pkgCmd.str());
+}
+
+const char* cmCPackProductBuildGenerator::GetComponentScript(
+ const char* script, const char* component_name)
+{
+ std::string scriptname = std::string("CPACK_") + script + "_";
+ if (component_name) {
+ scriptname += cmSystemTools::UpperCase(component_name);
+ scriptname += "_";
+ }
+ scriptname += "SCRIPT";
+
+ return this->GetOption(scriptname);
+}
diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h
new file mode 100644
index 0000000..fd2c090
--- /dev/null
+++ b/Source/CPack/cmCPackProductBuildGenerator.h
@@ -0,0 +1,58 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackProductBuildGenerator_h
+#define cmCPackProductBuildGenerator_h
+
+#include "cmCPackPKGGenerator.h"
+
+class cmCPackComponent;
+
+/** \class cmCPackProductBuildGenerator
+ * \brief A generator for ProductBuild files
+ *
+ */
+class cmCPackProductBuildGenerator : public cmCPackPKGGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPackProductBuildGenerator, cmCPackPKGGenerator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackProductBuildGenerator();
+ virtual ~cmCPackProductBuildGenerator();
+
+protected:
+ int InitializeInternal() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".pkg"; }
+
+ // Run ProductBuild with the given command line, which will (if
+ // successful) produce the given package file. Returns true if
+ // ProductBuild succeeds, false otherwise.
+ bool RunProductBuild(const std::string& command);
+
+ // Generate a package in the file packageFile for the given
+ // component. All of the files within this component are stored in
+ // the directory packageDir. Returns true if successful, false
+ // otherwise.
+ bool GenerateComponentPackage(const std::string& packageFileDir,
+ const std::string& packageFileName,
+ const std::string& packageDir,
+ const cmCPackComponent* component);
+
+ const char* GetComponentScript(const char* script,
+ const char* script_component);
+};
+
+#endif
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 9827b70..5d81a49 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -121,7 +121,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
// Does the component belong to a group?
- if (compIt->second.Group == NULL) {
+ if (compIt->second.Group == CM_NULLPTR) {
cmCPackLogger(
cmCPackLog::LOG_VERBOSE, "Component <"
<< compIt->second.Name
@@ -215,24 +215,16 @@ int cmCPackRPMGenerator::PackageFiles()
// There will be 1 package for each component group
// however one may require to ignore component group and
// in this case you'll get 1 package for each component.
- else {
- return PackageComponents(componentPackageMethod ==
- ONE_PACKAGE_PER_COMPONENT);
- }
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
// CASE 3 : NON COMPONENT package.
- else {
- return PackageComponentsAllInOne("");
- }
+ return PackageComponentsAllInOne("");
}
bool cmCPackRPMGenerator::SupportsComponentInstallation() const
{
- if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_RPM_COMPONENT_INSTALL");
}
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
@@ -249,9 +241,8 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
// the current COMPONENT belongs to.
std::string groupVar =
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
- if (NULL != GetOption(groupVar)) {
+ if (CM_NULLPTR != GetOption(groupVar)) {
return std::string(GetOption(groupVar));
- } else {
- return componentName;
}
+ return componentName;
}
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index b39f2c2..4baef08 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -32,7 +32,7 @@ public:
* Construct generator
*/
cmCPackRPMGenerator();
- virtual ~cmCPackRPMGenerator();
+ ~cmCPackRPMGenerator() CM_OVERRIDE;
static bool CanGenerate()
{
@@ -49,8 +49,8 @@ public:
}
protected:
- virtual int InitializeInternal();
- virtual int PackageFiles();
+ int InitializeInternal() CM_OVERRIDE;
+ int PackageFiles() CM_OVERRIDE;
/**
* This method factors out the work done in component packaging case.
*/
@@ -67,10 +67,10 @@ protected:
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(const std::string& compInstDirName);
- virtual const char* GetOutputExtension() { return ".rpm"; }
- virtual bool SupportsComponentInstallation() const;
- virtual std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ const char* GetOutputExtension() CM_OVERRIDE { return ".rpm"; }
+ bool SupportsComponentInstallation() const CM_OVERRIDE;
+ std::string GetComponentInstallDirNameSuffix(
+ const std::string& componentName) CM_OVERRIDE;
void AddGeneratedPackageNames();
};
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 08152b5..94cc8aa 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -28,13 +28,13 @@ public:
* Construct generator
*/
cmCPackSTGZGenerator();
- virtual ~cmCPackSTGZGenerator();
+ ~cmCPackSTGZGenerator() CM_OVERRIDE;
protected:
- int PackageFiles();
- virtual int InitializeInternal();
- int GenerateHeader(std::ostream* os);
- virtual const char* GetOutputExtension() { return ".sh"; }
+ int PackageFiles() CM_OVERRIDE;
+ int InitializeInternal() CM_OVERRIDE;
+ int GenerateHeader(std::ostream* os) CM_OVERRIDE;
+ const char* GetOutputExtension() CM_OVERRIDE { return ".sh"; }
};
#endif
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
index 408422b..cb7620c 100644
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ b/Source/CPack/cmCPackTGZGenerator.h
@@ -27,10 +27,10 @@ public:
* Construct generator
*/
cmCPackTGZGenerator();
- virtual ~cmCPackTGZGenerator();
+ ~cmCPackTGZGenerator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".tar.gz"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".tar.gz"; }
};
#endif
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
index 05052a1..87c92ef 100644
--- a/Source/CPack/cmCPackTXZGenerator.h
+++ b/Source/CPack/cmCPackTXZGenerator.h
@@ -27,10 +27,10 @@ public:
* Construct generator
*/
cmCPackTXZGenerator();
- virtual ~cmCPackTXZGenerator();
+ ~cmCPackTXZGenerator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".tar.xz"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".tar.xz"; }
};
#endif
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
index 4033197..6fec882 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ b/Source/CPack/cmCPackTarBZip2Generator.h
@@ -26,10 +26,10 @@ public:
* Construct generator
*/
cmCPackTarBZip2Generator();
- virtual ~cmCPackTarBZip2Generator();
+ ~cmCPackTarBZip2Generator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".tar.bz2"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".tar.bz2"; }
};
#endif
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index 7ff9a0a..02926a2 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -26,10 +26,10 @@ public:
* Construct generator
*/
cmCPackTarCompressGenerator();
- virtual ~cmCPackTarCompressGenerator();
+ ~cmCPackTarCompressGenerator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".tar.Z"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".tar.Z"; }
};
#endif
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
index 70e1a5f..1130826 100644
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ b/Source/CPack/cmCPackZIPGenerator.h
@@ -27,10 +27,10 @@ public:
* Construct generator
*/
cmCPackZIPGenerator();
- virtual ~cmCPackZIPGenerator();
+ ~cmCPackZIPGenerator() CM_OVERRIDE;
protected:
- virtual const char* GetOutputExtension() { return ".zip"; }
+ const char* GetOutputExtension() CM_OVERRIDE { return ".zip"; }
};
#endif
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 94e1615..de572c0 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -27,13 +27,13 @@
#include <cmsys/SystemTools.hxx>
static const char* cmDocumentationName[][2] = {
- { 0, " cpack - Packaging driver provided by CMake." },
- { 0, 0 }
+ { CM_NULLPTR, " cpack - Packaging driver provided by CMake." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationUsage[][2] = {
- { 0, " cpack -G <generator> [options]" },
- { 0, 0 }
+ { CM_NULLPTR, " cpack -G <generator> [options]" },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationOptions[][2] = {
@@ -47,10 +47,10 @@ static const char* cmDocumentationOptions[][2] = {
{ "-R <package version>", "override/define CPACK_PACKAGE_VERSION" },
{ "-B <package directory>", "override/define CPACK_PACKAGE_DIRECTORY" },
{ "--vendor <vendor name>", "override/define CPACK_PACKAGE_VENDOR" },
- { 0, 0 }
+ { CM_NULLPTR, CM_NULLPTR }
};
-int cpackUnknownArgument(const char*, void*)
+int cpackUnknownArgument(const char* /*unused*/, void* /*unused*/)
{
return 1;
}
@@ -185,7 +185,7 @@ int main(int argc, char const* const* argv)
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
- cmsys::auto_ptr<cmMakefile> globalMF(
+ CM_AUTO_PTR<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
@@ -200,7 +200,7 @@ int main(int argc, char const* const* argv)
cmCPackGeneratorFactory generators;
generators.SetLogger(&log);
- cmCPackGenerator* cpackGenerator = 0;
+ cmCPackGenerator* cpackGenerator = CM_NULLPTR;
cmDocumentation doc;
doc.addCPackStandardDocSections();
@@ -209,11 +209,7 @@ int main(int argc, char const* const* argv)
* should launch cpack using "cpackConfigFile" if it exists
* in the current directory.
*/
- if ((doc.CheckOptions(argc, argv, "-G")) && !(argc == 1)) {
- help = true;
- } else {
- help = false;
- }
+ help = doc.CheckOptions(argc, argv, "-G") && argc != 1;
// This part is used for cpack documentation lookup as well.
cminst.AddCMakePaths();
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index dd53be8..413cada 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -12,14 +12,20 @@
#include "cmCTestBZR.h"
#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
-#include <cmsys/RegularExpression.hxx>
-
#include <cm_expat.h>
+#include <cmsys/RegularExpression.hxx>
+#include <list>
+#include <map>
+#include <ostream>
+#include <stdlib.h>
+#include <vector>
-extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*,
+extern "C" int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
const XML_Char* name,
XML_Encoding* info)
{
@@ -61,8 +67,9 @@ extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*,
// workaround for these unknown encodings.
if (name == std::string("ascii") || name == std::string("cp1252") ||
name == std::string("ANSI_X3.4-1968")) {
- for (unsigned int i = 0; i < 256; ++i)
+ for (unsigned int i = 0; i < 256; ++i) {
info->map[i] = latin1[i];
+ }
return 1;
}
@@ -100,7 +107,7 @@ private:
bool CheckOutFound;
cmsys::RegularExpression RegexCheckOut;
cmsys::RegularExpression RegexParent;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexCheckOut.find(this->Line)) {
this->BZR->URL = this->RegexCheckOut.match(1);
@@ -125,7 +132,7 @@ public:
private:
std::string& Rev;
cmsys::RegularExpression RegexRevno;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexRevno.find(this->Line)) {
this->Rev = this->RegexRevno.match(1);
@@ -138,13 +145,13 @@ std::string cmCTestBZR::LoadInfo()
{
// Run "bzr info" to get the repository info from the work tree.
const char* bzr = this->CommandLineTool.c_str();
- const char* bzr_info[] = { bzr, "info", 0 };
+ const char* bzr_info[] = { bzr, "info", CM_NULLPTR };
InfoParser iout(this, "info-out> ");
OutputLogger ierr(this->Log, "info-err> ");
this->RunChild(bzr_info, &iout, &ierr);
// Run "bzr revno" to get the repository revision number from the work tree.
- const char* bzr_revno[] = { bzr, "revno", 0 };
+ const char* bzr_revno[] = { bzr, "revno", CM_NULLPTR };
std::string rev;
RevnoParser rout(this, "revno-out> ", rev);
OutputLogger rerr(this->Log, "revno-err> ");
@@ -182,14 +189,15 @@ public:
{
this->InitializeParser();
}
- ~LogParser() { this->CleanupParser(); }
+ ~LogParser() CM_OVERRIDE { this->CleanupParser(); }
- virtual int InitializeParser()
+ int InitializeParser() CM_OVERRIDE
{
int res = cmXMLParser::InitializeParser();
if (res) {
XML_SetUnknownEncodingHandler(static_cast<XML_Parser>(this->Parser),
- cmBZRXMLParserUnknownEncodingHandler, 0);
+ cmBZRXMLParserUnknownEncodingHandler,
+ CM_NULLPTR);
}
return res;
}
@@ -206,14 +214,14 @@ private:
cmsys::RegularExpression EmailRegex;
- virtual bool ProcessChunk(const char* data, int length)
+ bool ProcessChunk(const char* data, int length) CM_OVERRIDE
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- virtual void StartElement(const std::string& name, const char**)
+ void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
{
this->CData.clear();
if (name == "log") {
@@ -238,12 +246,12 @@ private:
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
this->CData.insert(this->CData.end(), data, data + length);
}
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "log") {
this->BZR->DoRevision(this->Rev, this->Changes);
@@ -273,7 +281,7 @@ private:
this->CData.clear();
}
- virtual void ReportError(int, int, const char* msg)
+ void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE
{
this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n";
}
@@ -293,7 +301,7 @@ private:
cmCTestBZR* BZR;
cmsys::RegularExpression RegexUpdate;
- virtual bool ProcessChunk(const char* first, int length)
+ bool ProcessChunk(const char* first, int length) CM_OVERRIDE
{
bool last_is_new_line = (*first == '\r' || *first == '\n');
@@ -324,7 +332,7 @@ private:
return true;
}
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexUpdate.find(this->Line)) {
this->DoPath(this->RegexUpdate.match(1)[0],
@@ -336,8 +344,9 @@ private:
void DoPath(char c0, char c1, char c2, std::string path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
cmSystemTools::ConvertToUnixSlashes(path);
const std::string dir = cmSystemTools::GetFilenamePath(path);
@@ -378,7 +387,7 @@ bool cmCTestBZR::UpdateImpl()
bzr_update.push_back(this->URL.c_str());
- bzr_update.push_back(0);
+ bzr_update.push_back(CM_NULLPTR);
// For some reason bzr uses stderr to display the update status.
OutputLogger out(this->Log, "pull-out> ");
@@ -406,7 +415,8 @@ void cmCTestBZR::LoadRevisions()
// Run "bzr log" to get all global revisions of interest.
const char* bzr = this->CommandLineTool.c_str();
const char* bzr_log[] = {
- bzr, "log", "-v", "-r", revs.c_str(), "--xml", this->URL.c_str(), 0
+ bzr, "log", "-v", "-r", revs.c_str(), "--xml", this->URL.c_str(),
+ CM_NULLPTR
};
{
LogParser out(this, "log-out> ");
@@ -429,7 +439,7 @@ public:
private:
cmCTestBZR* BZR;
cmsys::RegularExpression RegexStatus;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexStatus.find(this->Line)) {
this->DoPath(this->RegexStatus.match(1)[0],
@@ -441,8 +451,9 @@ private:
void DoPath(char c0, char c1, char c2, std::string path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
cmSystemTools::ConvertToUnixSlashes(path);
if (c0 == 'C') {
@@ -462,7 +473,7 @@ void cmCTestBZR::LoadModifications()
{
// Run "bzr status" which reports local modifications.
const char* bzr = this->CommandLineTool.c_str();
- const char* bzr_status[] = { bzr, "status", "-SV", 0 };
+ const char* bzr_status[] = { bzr, "status", "-SV", CM_NULLPTR };
StatusParser out(this, "status-out> ");
OutputLogger err(this->Log, "status-err> ");
this->RunChild(bzr_status, &out, &err);
diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h
index 4f44136..e2ee8b7 100644
--- a/Source/CTest/cmCTestBZR.h
+++ b/Source/CTest/cmCTestBZR.h
@@ -12,8 +12,15 @@
#ifndef cmCTestBZR_h
#define cmCTestBZR_h
+#include <cmConfigure.h>
+
#include "cmCTestGlobalVC.h"
+#include <iosfwd>
+#include <string>
+
+class cmCTest;
+
/** \class cmCTestBZR
* \brief Interaction with bzr command-line tool
*
@@ -24,30 +31,31 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestBZR(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestBZR();
+ ~cmCTestBZR() CM_OVERRIDE;
private:
// Implement cmCTestVC internal API.
- virtual void NoteOldRevision();
- virtual void NoteNewRevision();
- virtual bool UpdateImpl();
+ void NoteOldRevision() CM_OVERRIDE;
+ void NoteNewRevision() CM_OVERRIDE;
+ bool UpdateImpl() CM_OVERRIDE;
// URL of repository directory checked out in the working tree.
std::string URL;
std::string LoadInfo();
- void LoadModifications();
- void LoadRevisions();
+ void LoadModifications() CM_OVERRIDE;
+ void LoadRevisions() CM_OVERRIDE;
// Parsing helper classes.
class InfoParser;
- class RevnoParser;
class LogParser;
- class UpdateParser;
+ class RevnoParser;
class StatusParser;
+ class UpdateParser;
+
friend class InfoParser;
- friend class RevnoParser;
friend class LogParser;
+ friend class RevnoParser;
friend class UpdateParser;
friend class StatusParser;
};
diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx
index 386c8d5..bf4ead4 100644
--- a/Source/CTest/cmCTestBatchTestHandler.cxx
+++ b/Source/CTest/cmCTestBatchTestHandler.cxx
@@ -13,10 +13,14 @@
#include "cmCTestBatchTestHandler.h"
#include "cmCTest.h"
+#include "cmCTestMultiProcessHandler.h"
+#include "cmCTestTestHandler.h"
#include "cmProcess.h"
-#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
-#include <stdlib.h>
+
+#include <map>
+#include <utility>
+#include <vector>
cmCTestBatchTestHandler::~cmCTestBatchTestHandler()
{
@@ -45,7 +49,7 @@ void cmCTestBatchTestHandler::WriteBatchScript()
fout.close();
}
-void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
+void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::ostream& fout)
{
cmCTestTestHandler::cmCTestTestProperties* properties =
this->Properties[test];
@@ -73,7 +77,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
}
}
-void cmCTestBatchTestHandler::WriteTestCommand(int test, cmsys::ofstream& fout)
+void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout)
{
std::vector<std::string> args = this->Properties[test]->Args;
std::vector<std::string> processArgs;
diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h
index 7a2a4a2..da10824 100644
--- a/Source/CTest/cmCTestBatchTestHandler.h
+++ b/Source/CTest/cmCTestBatchTestHandler.h
@@ -13,12 +13,11 @@
#ifndef cmCTestBatchTestHandler_h
#define cmCTestBatchTestHandler_h
-#include <cmStandardIncludes.h>
+#include <cmConfigure.h>
#include <cmCTestMultiProcessHandler.h>
-#include <cmCTestRunTest.h>
-#include <cmCTestTestHandler.h>
#include <cmsys/FStream.hxx>
+#include <string>
/** \class cmCTestBatchTestHandler
* \brief run parallel ctest
@@ -28,13 +27,13 @@
class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler
{
public:
- ~cmCTestBatchTestHandler();
- virtual void RunTests();
+ ~cmCTestBatchTestHandler() CM_OVERRIDE;
+ void RunTests() CM_OVERRIDE;
protected:
void WriteBatchScript();
- void WriteSrunArgs(int test, cmsys::ofstream& fout);
- void WriteTestCommand(int test, cmsys::ofstream& fout);
+ void WriteSrunArgs(int test, std::ostream& fout);
+ void WriteTestCommand(int test, std::ostream& fout);
void SubmitBatchScript();
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 0cba8b2..9da2848 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -17,7 +17,9 @@
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmake.h"
+
#include <cmsys/Process.h>
+#include <stdlib.h>
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
{
@@ -72,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
args.push_back(toolset);
}
- const char* config = 0;
+ const char* config = CM_NULLPTR;
if (!this->CTest->GetConfigType().empty()) {
config = this->CTest->GetConfigType().c_str();
}
@@ -123,14 +125,15 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
return 0;
}
-void CMakeMessageCallback(const char* m, const char*, bool&, void* s)
+void CMakeMessageCallback(const char* m, const char* /*unused*/,
+ bool& /*unused*/, void* s)
{
std::string* out = (std::string*)s;
*out += m;
*out += "\n";
}
-void CMakeProgressCallback(const char* msg, float, void* s)
+void CMakeProgressCallback(const char* msg, float /*unused*/, void* s)
{
std::string* out = (std::string*)s;
*out += msg;
@@ -158,10 +161,10 @@ public:
}
~cmCTestBuildAndTestCaptureRAII()
{
- this->CM.SetProgressCallback(0, 0);
- cmSystemTools::SetStderrCallback(0, 0);
- cmSystemTools::SetStdoutCallback(0, 0);
- cmSystemTools::SetMessageCallback(0, 0);
+ this->CM.SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
+ cmSystemTools::SetStderrCallback(CM_NULLPTR, CM_NULLPTR);
+ cmSystemTools::SetStdoutCallback(CM_NULLPTR, CM_NULLPTR);
+ cmSystemTools::SetMessageCallback(CM_NULLPTR, CM_NULLPTR);
}
};
@@ -247,7 +250,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
}
std::string output;
- const char* config = 0;
+ const char* config = CM_NULLPTR;
if (!this->CTest->GetConfigType().empty()) {
config = this->CTest->GetConfigType().c_str();
}
@@ -302,7 +305,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "Could not find path to executable, perhaps it was not built: "
<< this->TestCommand << "\n";
out << "tried to find it in these places:\n";
- out << fullPath.c_str() << "\n";
+ out << fullPath << "\n";
for (unsigned int i = 0; i < failed.size(); ++i) {
out << failed[i] << "\n";
}
@@ -321,7 +324,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
for (size_t k = 0; k < this->TestCommandArgs.size(); ++k) {
testCommand.push_back(this->TestCommandArgs[k].c_str());
}
- testCommand.push_back(0);
+ testCommand.push_back(CM_NULLPTR);
std::string outs;
int retval = 0;
// run the test from the this->BuildRunDir if set
@@ -347,8 +350,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
}
- int runTestRes =
- this->CTest->RunTest(testCommand, &outs, &retval, 0, remainingTime, 0);
+ int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval,
+ CM_NULLPTR, remainingTime, CM_NULLPTR);
if (runTestRes != cmsysProcess_State_Exited || retval != 0) {
out << "Test command failed: " << testCommand[0] << "\n";
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index d0443ae..f917fb0 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -13,8 +13,15 @@
#ifndef cmCTestBuildAndTestHandler_h
#define cmCTestBuildAndTestHandler_h
+#include <cmConfigure.h>
+
#include "cmCTestGenericHandler.h"
-#include "cmListFileCache.h"
+#include "cmTypeMacro.h"
+
+#include <sstream>
+#include <stddef.h>
+#include <string>
+#include <vector>
class cmake;
@@ -30,12 +37,12 @@ public:
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
//! Set all the build and test arguments
- virtual int ProcessCommandLineArguments(
- const std::string& currentArg, size_t& idx,
- const std::vector<std::string>& allArgs);
+ int ProcessCommandLineArguments(const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs)
+ CM_OVERRIDE;
/*
* Get the output variable
@@ -44,7 +51,7 @@ public:
cmCTestBuildAndTestHandler();
- virtual void Initialize();
+ void Initialize() CM_OVERRIDE;
protected:
///! Run CMake and build a test and then run it as a single test.
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 05cccbf..91603d7 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -15,18 +15,25 @@
#include "cmCTestBuildHandler.h"
#include "cmCTestGenericHandler.h"
#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
#include "cmake.h"
+#include <sstream>
+#include <string.h>
+
+class cmExecutionStatus;
+
cmCTestBuildCommand::cmCTestBuildCommand()
{
- this->GlobalGenerator = 0;
+ this->GlobalGenerator = CM_NULLPTR;
this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS";
this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS";
this->Arguments[ctb_TARGET] = "TARGET";
this->Arguments[ctb_CONFIGURATION] = "CONFIGURATION";
this->Arguments[ctb_FLAGS] = "FLAGS";
this->Arguments[ctb_PROJECT_NAME] = "PROJECT_NAME";
- this->Arguments[ctb_LAST] = 0;
+ this->Arguments[ctb_LAST] = CM_NULLPTR;
this->Last = ctb_LAST;
}
@@ -34,7 +41,7 @@ cmCTestBuildCommand::~cmCTestBuildCommand()
{
if (this->GlobalGenerator) {
delete this->GlobalGenerator;
- this->GlobalGenerator = 0;
+ this->GlobalGenerator = CM_NULLPTR;
}
}
@@ -43,7 +50,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("build");
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate build handler");
- return 0;
+ return CM_NULLPTR;
}
this->Handler = (cmCTestBuildHandler*)handler;
@@ -91,7 +98,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
if (this->GlobalGenerator) {
if (this->GlobalGenerator->GetName() != cmakeGeneratorName) {
delete this->GlobalGenerator;
- this->GlobalGenerator = 0;
+ this->GlobalGenerator = CM_NULLPTR;
}
}
if (!this->GlobalGenerator) {
@@ -104,11 +111,11 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
e += "\"";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccured();
- return 0;
+ return CM_NULLPTR;
}
}
if (strlen(cmakeBuildConfiguration) == 0) {
- const char* config = 0;
+ const char* config = CM_NULLPTR;
#ifdef CMAKE_INTDIR
config = CMAKE_INTDIR;
#endif
@@ -145,7 +152,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
"with a custom command line.";
/* clang-format on */
this->SetError(ostr.str());
- return 0;
+ return CM_NULLPTR;
}
}
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index f420c2f..393c66e 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -12,10 +12,19 @@
#ifndef cmCTestBuildCommand_h
#define cmCTestBuildCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+#include <vector>
-class cmGlobalGenerator;
class cmCTestBuildHandler;
+class cmCTestGenericHandler;
+class cmCommand;
+class cmExecutionStatus;
+class cmGlobalGenerator;
/** \class cmCTestBuild
* \brief Run a ctest script
@@ -26,12 +35,12 @@ class cmCTestBuildCommand : public cmCTestHandlerCommand
{
public:
cmCTestBuildCommand();
- ~cmCTestBuildCommand();
+ ~cmCTestBuildCommand() CM_OVERRIDE;
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestBuildCommand* ni = new cmCTestBuildCommand;
ni->CTest = this->CTest;
@@ -42,10 +51,10 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_build"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_build"; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
cmTypeMacro(cmCTestBuildCommand, cmCTestHandlerCommand);
@@ -65,7 +74,7 @@ protected:
ctb_LAST
};
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
};
#endif
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 7141daf..cdf292c 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -16,25 +16,16 @@
#include "cmCTest.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include "cmake.h"
-//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
-
-// used for sleep
-#ifdef _WIN32
-#include "windows.h"
-#endif
-
-#include <float.h>
-#include <math.h>
+#include <set>
#include <stdlib.h>
-#include <time.h>
+#include <string.h>
static const char* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror",
@@ -92,7 +83,7 @@ static const char* cmCTestErrorMatches[] = {
"^The project cannot be built\\.",
"^\\[ERROR\\]",
"^Command .* failed with exit code",
- 0
+ CM_NULLPTR
};
static const char* cmCTestErrorExceptions[] = {
@@ -107,7 +98,7 @@ static const char* cmCTestErrorExceptions[] = {
":[ \\t]+Where:",
"([^ :]+):([0-9]+): Warning",
"------ Build started: .* ------",
- 0
+ CM_NULLPTR
};
static const char* cmCTestWarningMatches[] = {
@@ -132,7 +123,7 @@ static const char* cmCTestWarningMatches[] = {
"cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*",
"^CMake Warning.*:",
"^\\[WARNING\\]",
- 0
+ CM_NULLPTR
};
static const char* cmCTestWarningExceptions[] = {
@@ -152,7 +143,7 @@ static const char* cmCTestWarningExceptions[] = {
"ld32: WARNING 85: definition of dataKey in",
"cc: warning 422: Unknown option \"\\+b",
"_with_warning_C",
- 0
+ CM_NULLPTR
};
struct cmCTestBuildCompileErrorWarningRex
@@ -170,7 +161,7 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = {
{ "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 },
{ "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 },
{ "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 },
- { 0, 0, 0 }
+ { CM_NULLPTR, 0, 0 }
};
cmCTestBuildHandler::cmCTestBuildHandler()
@@ -521,7 +512,7 @@ public:
{
}
FragmentCompare()
- : FTC(0)
+ : FTC(CM_NULLPTR)
{
}
bool operator()(std::string const& l, std::string const& r)
@@ -532,9 +523,8 @@ public:
if (this->FTC->FileTimeCompare(l.c_str(), r.c_str(), &result) &&
result != 0) {
return result < 0;
- } else {
- return l < r;
}
+ return l < r;
}
private:
@@ -790,7 +780,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
// First generate the command and arguments
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
- if (args.size() < 1) {
+ if (args.empty()) {
return false;
}
@@ -799,7 +789,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
a != args.end(); ++a) {
argv.push_back(a->c_str());
}
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:",
this->Quiet);
@@ -851,7 +841,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
// For every chunk of data
int res;
- while ((res = cmsysProcess_WaitForData(cp, &data, &length, 0))) {
+ while ((res = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR))) {
// Replace '\0' with '\n', since '\0' does not really make sense. This is
// for Visual Studio output
for (int cc = 0; cc < length; ++cc) {
@@ -870,8 +860,9 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
}
}
- this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue);
- this->ProcessBuffer(0, 0, tick, tick_len, ofs,
+ this->ProcessBuffer(CM_NULLPTR, 0, tick, tick_len, ofs,
+ &this->BuildProcessingQueue);
+ this->ProcessBuffer(CM_NULLPTR, 0, tick, tick_len, ofs,
&this->BuildProcessingErrorQueue);
cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size of output: "
<< ((this->BuildOutputLogSize + 512) / 1024) << "K"
@@ -879,7 +870,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
this->Quiet);
// Properly handle output of the build command
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
int result = cmsysProcess_GetState(cp);
if (result == cmsysProcess_State_Exited) {
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 48a37b7..764dfed 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -13,13 +13,17 @@
#ifndef cmCTestBuildHandler_h
#define cmCTestBuildHandler_h
-#include "cmCTestGenericHandler.h"
+#include <cmConfigure.h>
-#include "cmListFileCache.h"
+#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
-
#include <deque>
+#include <iosfwd>
+#include <stddef.h>
+#include <string>
+#include <vector>
class cmMakefile;
class cmXMLWriter;
@@ -36,16 +40,16 @@ public:
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
cmCTestBuildHandler();
- void PopulateCustomVectors(cmMakefile* mf);
+ void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
/**
* Initialize handler
*/
- virtual void Initialize();
+ void Initialize() CM_OVERRIDE;
int GetTotalErrors() { return this->TotalErrors; }
int GetTotalWarnings() { return this->TotalWarnings; }
@@ -148,6 +152,7 @@ private:
bool UseCTestLaunch;
std::string CTestLaunchDir;
class LaunchHelper;
+
friend class LaunchHelper;
class FragmentCompare;
};
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 5ddafbb..64054d3 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -12,11 +12,13 @@
#include "cmCTestCVS.h"
#include "cmCTest.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <utility>
cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log)
: cmCTestVC(ct, log)
@@ -53,7 +55,7 @@ private:
cmsys::RegularExpression RegexFileRemoved1;
cmsys::RegularExpression RegexFileRemoved2;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexFileUpdated.find(this->Line)) {
this->DoFile(PathUpdated, this->RegexFileUpdated.match(2));
@@ -103,7 +105,7 @@ bool cmCTestCVS::UpdateImpl()
ai != args.end(); ++ai) {
cvs_update.push_back(ai->c_str());
}
- cvs_update.push_back(0);
+ cvs_update.push_back(CM_NULLPTR);
UpdateParser out(this, "up-out> ");
UpdateParser err(this, "up-err> ");
@@ -140,7 +142,7 @@ private:
SectionType Section;
Revision Rev;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->Line == ("======================================="
"======================================")) {
@@ -216,10 +218,9 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir)
std::string flag = "-r";
flag += tagLine.substr(1);
return flag;
- } else {
- // Use the default branch.
- return "-b";
}
+ // Use the default branch.
+ return "-b";
}
void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
@@ -229,7 +230,8 @@ void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
// Run "cvs log" to get revisions of this file on this branch.
const char* cvs = this->CommandLineTool.c_str();
- const char* cvs_log[] = { cvs, "log", "-N", branchFlag, file.c_str(), 0 };
+ const char* cvs_log[] = { cvs, "log", "-N",
+ branchFlag, file.c_str(), CM_NULLPTR };
LogParser out(this, "log-out> ", revisions);
OutputLogger err(this->Log, "log-err> ");
diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h
index 62fe01b..c1450b1 100644
--- a/Source/CTest/cmCTestCVS.h
+++ b/Source/CTest/cmCTestCVS.h
@@ -12,8 +12,18 @@
#ifndef cmCTestCVS_h
#define cmCTestCVS_h
+#include <cmConfigure.h>
+
#include "cmCTestVC.h"
+#include <iosfwd>
+#include <map>
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmXMLWriter;
+
/** \class cmCTestCVS
* \brief Interaction with cvs command-line tool
*
@@ -24,12 +34,12 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestCVS(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestCVS();
+ ~cmCTestCVS() CM_OVERRIDE;
private:
// Implement cmCTestVC internal API.
- virtual bool UpdateImpl();
- virtual bool WriteXMLUpdates(cmXMLWriter& xml);
+ bool UpdateImpl() CM_OVERRIDE;
+ bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE;
// Update status for files in each directory.
class Directory : public std::map<std::string, PathStatus>
@@ -44,10 +54,11 @@ private:
Directory const& dir);
// Parsing helper classes.
- class UpdateParser;
class LogParser;
- friend class UpdateParser;
+ class UpdateParser;
+
friend class LogParser;
+ friend class UpdateParser;
};
#endif
diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h
index 22a2c8e..b0c9206 100644
--- a/Source/CTest/cmCTestCommand.h
+++ b/Source/CTest/cmCTestCommand.h
@@ -29,8 +29,8 @@ class cmCTestCommand : public cmCommand
public:
cmCTestCommand()
{
- this->CTest = 0;
- this->CTestScriptHandler = 0;
+ this->CTest = CM_NULLPTR;
+ this->CTestScriptHandler = CM_NULLPTR;
}
cmCTest* CTest;
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index a90f27a..98e38d3 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -14,11 +14,18 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <sstream>
+#include <string.h>
+#include <vector>
cmCTestConfigureCommand::cmCTestConfigureCommand()
{
this->Arguments[ctc_OPTIONS] = "OPTIONS";
- this->Arguments[ctc_LAST] = 0;
+ this->Arguments[ctc_LAST] = CM_NULLPTR;
this->Last = ctc_LAST;
}
@@ -35,7 +42,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
"Build directory not specified. Either use BUILD "
"argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
"variable");
- return 0;
+ return CM_NULLPTR;
}
const char* ctestConfigureCommand =
@@ -55,7 +62,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
"Source directory not specified. Either use SOURCE "
"argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY "
"variable");
- return 0;
+ return CM_NULLPTR;
}
const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
@@ -63,7 +70,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
std::ostringstream e;
e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]";
this->SetError(e.str());
- return 0;
+ return CM_NULLPTR;
}
bool multiConfig = false;
@@ -90,8 +97,9 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
cmakeConfigureCommand += option;
cmakeConfigureCommand += "\"";
- if ((0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
- (0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) {
+ if ((CM_NULLPTR != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
+ (CM_NULLPTR !=
+ strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) {
cmakeBuildTypeInOptions = true;
}
}
@@ -134,7 +142,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
"Configure command is not specified. If this is a "
"\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, "
"set CTEST_CONFIGURE_COMMAND.");
- return 0;
+ return CM_NULLPTR;
}
}
@@ -143,7 +151,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
if (!handler) {
this->SetError(
"internal CTest error. Cannot instantiate configure handler");
- return 0;
+ return CM_NULLPTR;
}
handler->SetQuiet(this->Quiet);
return handler;
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index 9ff3d4a..9027b6b 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -12,7 +12,15 @@
#ifndef cmCTestConfigureCommand_h
#define cmCTestConfigureCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+
+class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestConfigure
* \brief Run a ctest script
@@ -27,7 +35,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestConfigureCommand* ni = new cmCTestConfigureCommand;
ni->CTest = this->CTest;
@@ -38,12 +46,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_configure"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_configure"; }
cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand);
protected:
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
enum
{
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index b99455f..78fa910 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -14,9 +14,11 @@
#include "cmCTest.h"
#include "cmGeneratedFileStream.h"
+#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include "cmake.h"
-#include <cmsys/Process.h>
+
+#include <ostream>
+#include <string>
cmCTestConfigureHandler::cmCTestConfigureHandler()
{
diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h
index 4c1a96b..a7d2167 100644
--- a/Source/CTest/cmCTestConfigureHandler.h
+++ b/Source/CTest/cmCTestConfigureHandler.h
@@ -13,9 +13,10 @@
#ifndef cmCTestConfigureHandler_h
#define cmCTestConfigureHandler_h
-#include "cmCTestGenericHandler.h"
+#include <cmConfigure.h>
-#include "cmListFileCache.h"
+#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
/** \class cmCTestConfigureHandler
* \brief A class that handles ctest -S invocations
@@ -29,11 +30,11 @@ public:
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
cmCTestConfigureHandler();
- void Initialize();
+ void Initialize() CM_OVERRIDE;
};
#endif
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index 223d010..7a4271e 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -14,6 +14,8 @@
#include "cmCTest.h"
#include "cmCTestCoverageHandler.h"
+class cmCTestGenericHandler;
+
cmCTestCoverageCommand::cmCTestCoverageCommand()
{
this->LabelsMentioned = false;
@@ -30,7 +32,7 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
this->CTest->GetInitializedHandler("coverage"));
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate test handler");
- return 0;
+ return CM_NULLPTR;
}
// If a LABELS option was given, select only files with the labels.
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index f60ffd5..b9ef53d 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -12,7 +12,16 @@
#ifndef cmCTestCoverageCommand_h
#define cmCTestCoverageCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <set>
+#include <string>
+
+class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestCoverage
* \brief Run a ctest script
@@ -27,7 +36,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestCoverageCommand* ni = new cmCTestCoverageCommand;
ni->CTest = this->CTest;
@@ -38,15 +47,15 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_coverage"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_coverage"; }
cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand);
protected:
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
- virtual bool CheckArgumentKeyword(std::string const& arg);
- virtual bool CheckArgumentValue(std::string const& arg);
+ bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE;
+ bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE;
enum
{
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index daefb59..2eb64bf 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -13,7 +13,6 @@
#include "cmCTest.h"
#include "cmGeneratedFileStream.h"
-#include "cmMakefile.h"
#include "cmParseBlanketJSCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmParseCoberturaCoverage.h"
@@ -25,14 +24,19 @@
#include "cmXMLWriter.h"
#include "cmake.h"
+#include <algorithm>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
-
-#include <float.h>
-#include <math.h>
+#include <iomanip>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
#include <stdlib.h>
+#include <utility>
+
+class cmMakefile;
#define SAFEDIV(x, y) (((y) != 0) ? ((x) / (y)) : (0))
@@ -76,7 +80,7 @@ public:
i != this->CommandLineStrings.end(); ++i) {
args.push_back(i->c_str());
}
- args.push_back(0); // null terminate
+ args.push_back(CM_NULLPTR); // null terminate
cmsysProcess_SetCommand(this->Process, &*args.begin());
if (!this->WorkingDirectory.empty()) {
cmsysProcess_SetWorkingDirectory(this->Process,
@@ -90,11 +94,8 @@ public:
cmsysProcess_Execute(this->Process);
this->PipeState = cmsysProcess_GetState(this->Process);
// if the process is running or exited return true
- if (this->PipeState == cmsysProcess_State_Executing ||
- this->PipeState == cmsysProcess_State_Exited) {
- return true;
- }
- return false;
+ return this->PipeState == cmsysProcess_State_Executing ||
+ this->PipeState == cmsysProcess_State_Exited;
}
void SetStdoutFile(const char* fname)
{
@@ -104,7 +105,7 @@ public:
{
cmsysProcess_SetPipeFile(this->Process, cmsysProcess_Pipe_STDERR, fname);
}
- int WaitForExit(double* timeout = 0)
+ int WaitForExit(double* timeout = CM_NULLPTR)
{
this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout);
return this->PipeState;
@@ -705,13 +706,8 @@ bool IsFileInDir(const std::string& infile, const std::string& indir)
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
- if (file.size() > dir.size() &&
- (fnc(file.substr(0, dir.size())) == fnc(dir)) &&
- file[dir.size()] == '/') {
- return true;
- }
-
- return false;
+ return file.size() > dir.size() &&
+ fnc(file.substr(0, dir.size())) == fnc(dir) && file[dir.size()] == '/';
}
int cmCTestCoverageHandler::HandlePHPCoverage(
@@ -735,10 +731,8 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage(
// if it doesn't exist or is empty, assume the
// binary directory is used.
std::string coverageXMLFile;
- const char* covDir = cmSystemTools::GetEnv("COBERTURADIR");
- if (covDir && strlen(covDir) != 0) {
- coverageXMLFile = std::string(covDir);
- } else {
+ if (!cmSystemTools::GetEnv("COBERTURADIR", coverageXMLFile) ||
+ coverageXMLFile.empty()) {
coverageXMLFile = this->CTest->GetBinaryDir();
}
// build the find file string with the directory from above
@@ -773,12 +767,11 @@ int cmCTestCoverageHandler::HandleMumpsCoverage(
this->Quiet);
cov.ReadCoverageFile(coverageFile.c_str());
return static_cast<int>(cont->TotalCoverage.size());
- } else {
- cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- " Cannot find GTM coverage file: " << coverageFile
- << std::endl,
- this->Quiet);
}
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ " Cannot find GTM coverage file: " << coverageFile
+ << std::endl,
+ this->Quiet);
cmParseCacheCoverage ccov(*cont, this->CTest);
coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov";
if (cmSystemTools::FileExists(coverageFile.c_str())) {
@@ -799,7 +792,8 @@ struct cmCTestCoverageHandlerLocale
{
cmCTestCoverageHandlerLocale()
{
- if (const char* l = cmSystemTools::GetEnv("LC_ALL")) {
+ std::string l;
+ if (cmSystemTools::GetEnv("LC_ALL", l)) {
lc_all = l;
}
if (lc_all != "C") {
@@ -1020,7 +1014,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"-o \"" + fileDir + "\" " + "\"" + *it + "\"";
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- command.c_str() << std::endl, this->Quiet);
+ command << std::endl, this->Quiet);
std::string output = "";
std::string errors = "";
@@ -1385,7 +1379,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
"Current coverage dir: " << fileDir << std::endl,
this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- command.c_str() << std::endl, this->Quiet);
+ command << std::endl, this->Quiet);
std::string output = "";
std::string errors = "";
@@ -1789,7 +1783,7 @@ const char* bullseyeHelp[] = {
" condition evaluated true or false, respectively.",
" * A k indicates a constant decision or condition.",
" * The slash / means this probe is excluded from summary results. ",
- 0
+ CM_NULLPTR
};
}
@@ -1817,7 +1811,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"run covbr: " << std::endl, this->Quiet);
- if (!this->RunBullseyeCommand(cont, "covbr", 0, outputFile)) {
+ if (!this->RunBullseyeCommand(cont, "covbr", CM_NULLPTR, outputFile)) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for."
<< "\n");
return -1;
@@ -1890,7 +1884,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
covLogXML.StartElement("Report");
// write the bullseye header
line = 0;
- for (int k = 0; bullseyeHelp[k] != 0; ++k) {
+ for (int k = 0; bullseyeHelp[k] != CM_NULLPTR; ++k) {
covLogXML.StartElement("Line");
covLogXML.Attribute("Number", line);
covLogXML.Attribute("Count", -1);
@@ -2129,8 +2123,8 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
int cmCTestCoverageHandler::HandleBullseyeCoverage(
cmCTestCoverageHandlerContainer* cont)
{
- const char* covfile = cmSystemTools::GetEnv("COVFILE");
- if (!covfile || strlen(covfile) == 0) {
+ std::string covfile;
+ if (!cmSystemTools::GetEnv("COVFILE", covfile) || covfile.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" COVFILE environment variable not found, not running "
" bullseye\n",
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 1773218..12a7e19 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -13,14 +13,22 @@
#ifndef cmCTestCoverageHandler_h
#define cmCTestCoverageHandler_h
-#include "cmCTestGenericHandler.h"
+#include <cmConfigure.h>
-#include "cmListFileCache.h"
+#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
class cmGeneratedFileStream;
+class cmMakefile;
class cmXMLWriter;
+
class cmCTestCoverageHandlerContainer
{
public:
@@ -45,16 +53,16 @@ public:
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
cmCTestCoverageHandler();
- virtual void Initialize();
+ void Initialize() CM_OVERRIDE;
/**
* This method is called when reading CTest custom file
*/
- void PopulateCustomVectors(cmMakefile* mf);
+ void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
/** Report coverage only for sources with these labels. */
void SetLabelFilter(std::set<std::string> const& labels);
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 59675dd..941df29 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -14,6 +14,10 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
+#include <cmConfigure.h>
+#include <ostream>
+#include <stdio.h>
+
cmCTestCurl::cmCTestCurl(cmCTest* ctest)
{
this->CTest = ctest;
@@ -54,8 +58,8 @@ static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
return realsize;
}
-static size_t curlDebugCallback(CURL*, curl_infotype, char* chPtr, size_t size,
- void* data)
+static size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
+ char* chPtr, size_t size, void* data)
{
std::vector<char>* vec = static_cast<std::vector<char>*>(data);
vec->insert(vec->end(), chPtr, chPtr + size);
@@ -88,10 +92,10 @@ bool cmCTestCurl::InitCurl()
if (this->VerifyHostOff) {
curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0);
}
- if (this->HTTPProxy.size()) {
+ if (!this->HTTPProxy.empty()) {
curl_easy_setopt(this->Curl, CURLOPT_PROXY, this->HTTPProxy.c_str());
curl_easy_setopt(this->Curl, CURLOPT_PROXYTYPE, this->HTTPProxyType);
- if (this->HTTPProxyAuth.size() > 0) {
+ if (!this->HTTPProxyAuth.empty()) {
curl_easy_setopt(this->Curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str());
}
@@ -147,7 +151,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION, curlDebugCallback);
// Be sure to set Content-Type to satisfy fussy modsecurity rules
struct curl_slist* headers =
- ::curl_slist_append(NULL, "Content-Type: text/xml");
+ ::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
std::vector<char> responseData;
std::vector<char> debugData;
@@ -160,17 +164,17 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL);
::curl_slist_free_all(headers);
- if (responseData.size() > 0) {
+ if (!responseData.empty()) {
response = std::string(responseData.begin(), responseData.end());
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: ["
<< response << "]\n");
}
std::string curlDebug;
- if (debugData.size() > 0) {
+ if (!debugData.empty()) {
curlDebug = std::string(debugData.begin(), debugData.end());
cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
}
- if (response.size() == 0) {
+ if (response.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n"
<< curlDebug);
return false;
@@ -205,11 +209,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
CURLcode res = ::curl_easy_perform(this->Curl);
- if (responseData.size() > 0) {
+ if (!responseData.empty()) {
response = std::string(responseData.begin(), responseData.end());
cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n");
}
- if (debugData.size() > 0) {
+ if (!debugData.empty()) {
std::string curlDebug = std::string(debugData.begin(), debugData.end());
cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
}
@@ -219,16 +223,18 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
void cmCTestCurl::SetProxyType()
{
- if (cmSystemTools::GetEnv("HTTP_PROXY")) {
- this->HTTPProxy = cmSystemTools::GetEnv("HTTP_PROXY");
- if (cmSystemTools::GetEnv("HTTP_PROXY_PORT")) {
+ this->HTTPProxy = "";
+ // this is the default
+ this->HTTPProxyType = CURLPROXY_HTTP;
+ this->HTTPProxyAuth = "";
+ if (cmSystemTools::GetEnv("HTTP_PROXY", this->HTTPProxy)) {
+ std::string port;
+ if (cmSystemTools::GetEnv("HTTP_PROXY_PORT", port)) {
this->HTTPProxy += ":";
- this->HTTPProxy += cmSystemTools::GetEnv("HTTP_PROXY_PORT");
+ this->HTTPProxy += port;
}
- if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE")) {
- // this is the default
- this->HTTPProxyType = CURLPROXY_HTTP;
- std::string type = cmSystemTools::GetEnv("HTTP_PROXY_TYPE");
+ std::string type;
+ if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE", type)) {
// HTTP/SOCKS4/SOCKS5
if (type == "HTTP") {
this->HTTPProxyType = CURLPROXY_HTTP;
@@ -238,12 +244,11 @@ void cmCTestCurl::SetProxyType()
this->HTTPProxyType = CURLPROXY_SOCKS5;
}
}
- if (cmSystemTools::GetEnv("HTTP_PROXY_USER")) {
- this->HTTPProxyAuth = cmSystemTools::GetEnv("HTTP_PROXY_USER");
- }
- if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD")) {
+ cmSystemTools::GetEnv("HTTP_PROXY_USER", this->HTTPProxyAuth);
+ std::string passwd;
+ if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD", passwd)) {
this->HTTPProxyAuth += ":";
- this->HTTPProxyAuth += cmSystemTools::GetEnv("HTTP_PROXY_PASSWD");
+ this->HTTPProxyAuth += passwd;
}
}
}
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index 82601e3..c91c88c 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -12,9 +12,11 @@
#ifndef cmCTestCurl_h
#define cmCTestCurl_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cm_curl.h"
+#include <cm_curl.h>
+#include <string>
+#include <vector>
class cmCTest;
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
index 1bda9be..cc0b013 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
@@ -13,8 +13,12 @@
#include "cmCTestScriptHandler.h"
+#include <sstream>
+
+class cmExecutionStatus;
+
bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+ std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
{
if (args.size() != 1) {
this->SetError("called with incorrect number of arguments");
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index e904d19..a64e55a 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -12,7 +12,16 @@
#ifndef cmCTestEmptyBinaryDirectoryCommand_h
#define cmCTestEmptyBinaryDirectoryCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestEmptyBinaryDirectory
* \brief Run a ctest script
@@ -28,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestEmptyBinaryDirectoryCommand* ni =
new cmCTestEmptyBinaryDirectoryCommand;
@@ -41,13 +50,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const
+ std::string GetName() const CM_OVERRIDE
{
return "ctest_empty_binary_directory";
}
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 8b392f2..cec871f 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -13,15 +13,17 @@
#include "cmAlgorithms.h"
#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
-#include <cmsys/RegularExpression.hxx>
-
#include <ctype.h>
-#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <time.h>
+#include <vector>
static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
unsigned int minor, unsigned int fix)
@@ -52,7 +54,7 @@ public:
private:
std::string& Line1;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
// Only the first line is of interest.
this->Line1 = this->Line;
@@ -64,7 +66,8 @@ std::string cmCTestGIT::GetWorkingRevision()
{
// Run plumbing "git rev-list" to get work tree revision.
const char* git = this->CommandLineTool.c_str();
- const char* git_rev_list[] = { git, "rev-list", "-n", "1", "HEAD", "--", 0 };
+ const char* git_rev_list[] = { git, "rev-list", "-n", "1",
+ "HEAD", "--", CM_NULLPTR };
std::string rev;
OneLineParser out(this, "rl-out> ", rev);
OutputLogger err(this->Log, "rl-err> ");
@@ -93,7 +96,7 @@ std::string cmCTestGIT::FindGitDir()
// Run "git rev-parse --git-dir" to locate the real .git directory.
const char* git = this->CommandLineTool.c_str();
- char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", 0 };
+ char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", CM_NULLPTR };
std::string git_dir_line;
OneLineParser rev_parse_out(this, "rev-parse-out> ", git_dir_line);
OutputLogger rev_parse_err(this->Log, "rev-parse-err> ");
@@ -135,7 +138,8 @@ std::string cmCTestGIT::FindTopDir()
// Run "git rev-parse --show-cdup" to locate the top of the tree.
const char* git = this->CommandLineTool.c_str();
- char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup", 0 };
+ char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup",
+ CM_NULLPTR };
std::string cdup;
OneLineParser rev_parse_out(this, "rev-parse-out> ", cdup);
OutputLogger rev_parse_err(this->Log, "rev-parse-err> ");
@@ -169,7 +173,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
}
// Sentinel argument.
- git_fetch.push_back(0);
+ git_fetch.push_back(CM_NULLPTR);
// Fetch upstream refs.
OutputLogger fetch_out(this->Log, "fetch-out> ");
@@ -204,7 +208,8 @@ bool cmCTestGIT::UpdateByFetchAndReset()
}
// Reset the local branch to point at that tracked from upstream.
- char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(), 0 };
+ char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(),
+ CM_NULLPTR };
OutputLogger reset_out(this->Log, "reset-out> ");
OutputLogger reset_err(this->Log, "reset-err> ");
return this->RunChild(&git_reset[0], &reset_out, &reset_err);
@@ -219,7 +224,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom)
i != git_custom_command.end(); ++i) {
git_custom.push_back(i->c_str());
}
- git_custom.push_back(0);
+ git_custom.push_back(CM_NULLPTR);
OutputLogger custom_out(this->Log, "custom-out> ");
OutputLogger custom_err(this->Log, "custom-err> ");
@@ -248,7 +253,7 @@ bool cmCTestGIT::UpdateImpl()
// Git < 1.6.5 did not support submodule --recursive
if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) {
- recursive = 0;
+ recursive = CM_NULLPTR;
// No need to require >= 1.6.5 if there are no submodules.
if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
this->Log << "Git < 1.6.5 cannot update submodules recursively\n";
@@ -257,7 +262,7 @@ bool cmCTestGIT::UpdateImpl()
// Git < 1.8.1 did not support sync --recursive
if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) {
- sync_recursive = 0;
+ sync_recursive = CM_NULLPTR;
// No need to require >= 1.8.1 if there are no submodules.
if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n";
@@ -272,7 +277,8 @@ bool cmCTestGIT::UpdateImpl()
std::string init_submodules =
this->CTest->GetCTestConfiguration("GITInitSubmodules");
if (cmSystemTools::IsOn(init_submodules.c_str())) {
- char const* git_submodule_init[] = { git, "submodule", "init", 0 };
+ char const* git_submodule_init[] = { git, "submodule", "init",
+ CM_NULLPTR };
ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
top_dir.c_str());
@@ -282,7 +288,7 @@ bool cmCTestGIT::UpdateImpl()
}
char const* git_submodule_sync[] = { git, "submodule", "sync",
- sync_recursive, 0 };
+ sync_recursive, CM_NULLPTR };
ret = this->RunChild(git_submodule_sync, &submodule_out, &submodule_err,
top_dir.c_str());
@@ -290,7 +296,8 @@ bool cmCTestGIT::UpdateImpl()
return false;
}
- char const* git_submodule[] = { git, "submodule", "update", recursive, 0 };
+ char const* git_submodule[] = { git, "submodule", "update", recursive,
+ CM_NULLPTR };
return this->RunChild(git_submodule, &submodule_out, &submodule_err,
top_dir.c_str());
}
@@ -299,7 +306,7 @@ unsigned int cmCTestGIT::GetGitVersion()
{
if (!this->CurrentGitVersion) {
const char* git = this->CommandLineTool.c_str();
- char const* git_version[] = { git, "--version", 0 };
+ char const* git_version[] = { git, "--version", CM_NULLPTR };
std::string version;
OneLineParser version_out(this, "version-out> ", version);
OutputLogger version_err(this->Log, "version-err> ");
@@ -355,7 +362,7 @@ protected:
this->Changes.clear();
}
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->Line[0] == ':') {
this->DiffField = DiffFieldChange;
@@ -513,7 +520,7 @@ private:
person.TimeZone = strtol(c, (char**)&c, 10);
}
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->Line.empty()) {
if (this->Section == SectionBody && this->LineEnd == '\0') {
@@ -611,10 +618,10 @@ void cmCTestGIT::LoadRevisions()
std::string range = this->OldRevision + ".." + this->NewRevision;
const char* git = this->CommandLineTool.c_str();
const char* git_rev_list[] = { git, "rev-list", "--reverse",
- range.c_str(), "--", 0 };
+ range.c_str(), "--", CM_NULLPTR };
const char* git_diff_tree[] = {
git, "diff-tree", "--stdin", "--always", "-z",
- "-r", "--pretty=raw", "--encoding=utf-8", 0
+ "-r", "--pretty=raw", "--encoding=utf-8", CM_NULLPTR
};
this->Log << this->ComputeCommandLine(git_rev_list) << " | "
<< this->ComputeCommandLine(git_diff_tree) << "\n";
@@ -639,13 +646,15 @@ void cmCTestGIT::LoadModifications()
const char* git = this->CommandLineTool.c_str();
// Use 'git update-index' to refresh the index w.r.t. the work tree.
- const char* git_update_index[] = { git, "update-index", "--refresh", 0 };
+ const char* git_update_index[] = { git, "update-index", "--refresh",
+ CM_NULLPTR };
OutputLogger ui_out(this->Log, "ui-out> ");
OutputLogger ui_err(this->Log, "ui-err> ");
this->RunChild(git_update_index, &ui_out, &ui_err);
// Use 'git diff-index' to get modified files.
- const char* git_diff_index[] = { git, "diff-index", "-z", "HEAD", "--", 0 };
+ const char* git_diff_index[] = { git, "diff-index", "-z",
+ "HEAD", "--", CM_NULLPTR };
DiffParser out(this, "di-out> ");
OutputLogger err(this->Log, "di-err> ");
this->RunChild(git_diff_index, &out, &err);
diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h
index 685cc31..d61d155 100644
--- a/Source/CTest/cmCTestGIT.h
+++ b/Source/CTest/cmCTestGIT.h
@@ -12,8 +12,15 @@
#ifndef cmCTestGIT_h
#define cmCTestGIT_h
+#include <cmConfigure.h>
+
#include "cmCTestGlobalVC.h"
+#include <iosfwd>
+#include <string>
+
+class cmCTest;
+
/** \class cmCTestGIT
* \brief Interaction with git command-line tool
*
@@ -24,15 +31,15 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestGIT(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestGIT();
+ ~cmCTestGIT() CM_OVERRIDE;
private:
unsigned int CurrentGitVersion;
unsigned int GetGitVersion();
std::string GetWorkingRevision();
- virtual void NoteOldRevision();
- virtual void NoteNewRevision();
- virtual bool UpdateImpl();
+ void NoteOldRevision() CM_OVERRIDE;
+ void NoteNewRevision() CM_OVERRIDE;
+ bool UpdateImpl() CM_OVERRIDE;
std::string FindGitDir();
std::string FindTopDir();
@@ -41,18 +48,19 @@ private:
bool UpdateByCustom(std::string const& custom);
bool UpdateInternal();
- void LoadRevisions();
- void LoadModifications();
+ void LoadRevisions() CM_OVERRIDE;
+ void LoadModifications() CM_OVERRIDE;
// "public" needed by older Sun compilers
public:
// Parsing helper classes.
- class OneLineParser;
- class DiffParser;
class CommitParser;
- friend class OneLineParser;
- friend class DiffParser;
+ class DiffParser;
+ class OneLineParser;
+
friend class CommitParser;
+ friend class DiffParser;
+ friend class OneLineParser;
};
#endif
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 18caabe..aab1781 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -12,14 +12,16 @@
#include "cmCTestGenericHandler.h"
+#include "cmCTest.h"
#include "cmSystemTools.h"
-#include "cmCTest.h"
+#include <sstream>
+#include <utility>
cmCTestGenericHandler::cmCTestGenericHandler()
{
this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
- this->CTest = 0;
+ this->CTest = CM_NULLPTR;
this->SubmitIndex = 0;
this->AppendXML = false;
this->Quiet = false;
@@ -77,7 +79,7 @@ const char* cmCTestGenericHandler::GetOption(const std::string& op)
cmCTestGenericHandler::t_StringToString::iterator remit =
this->Options.find(op);
if (remit == this->Options.end()) {
- return 0;
+ return CM_NULLPTR;
}
return remit->second.c_str();
}
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index ad349ac..88905ed 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -13,14 +13,20 @@
#ifndef cmCTestGenericHandler_h
#define cmCTestGenericHandler_h
-#include "cmObject.h"
+#include <cmConfigure.h>
#include "cmCTest.h"
-#include "cmSystemTools.h" //OutputOption
+#include "cmObject.h"
+#include "cmSystemTools.h"
+
+#include <map>
+#include <stddef.h>
+#include <string>
+#include <vector>
-class cmMakefile;
class cmCTestCommand;
class cmGeneratedFileStream;
+class cmMakefile;
/** \class cmCTestGenericHandler
* \brief A superclass of all CTest Handlers
@@ -74,7 +80,7 @@ public:
* Construct handler
*/
cmCTestGenericHandler();
- virtual ~cmCTestGenericHandler();
+ ~cmCTestGenericHandler() CM_OVERRIDE;
typedef std::map<std::string, std::string> t_StringToString;
diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx
index 0c7ca4d..c575853 100644
--- a/Source/CTest/cmCTestGlobalVC.cxx
+++ b/Source/CTest/cmCTestGlobalVC.cxx
@@ -15,7 +15,8 @@
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include <cmsys/RegularExpression.hxx>
+#include <ostream>
+#include <utility>
cmCTestGlobalVC::cmCTestGlobalVC(cmCTest* ct, std::ostream& log)
: cmCTestVC(ct, log)
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index 9a5357f..b48b835 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -12,9 +12,18 @@
#ifndef cmCTestGlobalVC_h
#define cmCTestGlobalVC_h
+#include <cmConfigure.h>
+
#include "cmCTestVC.h"
+#include <iosfwd>
#include <list>
+#include <map>
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmXMLWriter;
/** \class cmCTestGlobalVC
* \brief Base class for handling globally-versioned trees
@@ -26,11 +35,11 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestGlobalVC(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestGlobalVC();
+ ~cmCTestGlobalVC() CM_OVERRIDE;
protected:
// Implement cmCTestVC internal API.
- virtual bool WriteXMLUpdates(cmXMLWriter& xml);
+ bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE;
/** Represent a vcs-reported action for one path in a revision. */
struct Change
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index c6cfa44..c576cf0 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -12,10 +12,14 @@
#include "cmCTestHG.h"
#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include <cmsys/RegularExpression.hxx>
+#include <ostream>
+#include <vector>
cmCTestHG::cmCTestHG(cmCTest* ct, std::ostream& log)
: cmCTestGlobalVC(ct, log)
@@ -41,7 +45,7 @@ private:
std::string& Rev;
cmsys::RegularExpression RegexIdentify;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexIdentify.find(this->Line)) {
this->Rev = this->RegexIdentify.match(1);
@@ -65,7 +69,7 @@ private:
cmCTestHG* HG;
cmsys::RegularExpression RegexStatus;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexStatus.find(this->Line)) {
this->DoPath(this->RegexStatus.match(1)[0], this->RegexStatus.match(2));
@@ -75,8 +79,9 @@ private:
void DoPath(char status, std::string const& path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
// See "hg help status". Note that there is no 'conflict' status.
switch (status) {
@@ -100,7 +105,7 @@ std::string cmCTestHG::GetWorkingRevision()
{
// Run plumbing "hg identify" to get work tree revision.
const char* hg = this->CommandLineTool.c_str();
- const char* hg_identify[] = { hg, "identify", "-i", 0 };
+ const char* hg_identify[] = { hg, "identify", "-i", CM_NULLPTR };
std::string rev;
IdentifyParser out(this, "rev-out> ", rev);
OutputLogger err(this->Log, "rev-err> ");
@@ -128,7 +133,7 @@ bool cmCTestHG::UpdateImpl()
// Use "hg pull" followed by "hg update" to update the working tree.
{
const char* hg = this->CommandLineTool.c_str();
- const char* hg_pull[] = { hg, "pull", "-v", 0 };
+ const char* hg_pull[] = { hg, "pull", "-v", CM_NULLPTR };
OutputLogger out(this->Log, "pull-out> ");
OutputLogger err(this->Log, "pull-err> ");
this->RunChild(&hg_pull[0], &out, &err);
@@ -153,7 +158,7 @@ bool cmCTestHG::UpdateImpl()
}
// Sentinel argument.
- hg_update.push_back(0);
+ hg_update.push_back(CM_NULLPTR);
OutputLogger out(this->Log, "update-out> ");
OutputLogger err(this->Log, "update-err> ");
@@ -170,7 +175,7 @@ public:
{
this->InitializeParser();
}
- ~LogParser() { this->CleanupParser(); }
+ ~LogParser() CM_OVERRIDE { this->CleanupParser(); }
private:
cmCTestHG* HG;
@@ -181,14 +186,14 @@ private:
Change CurChange;
std::vector<char> CData;
- virtual bool ProcessChunk(const char* data, int length)
+ bool ProcessChunk(const char* data, int length) CM_OVERRIDE
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
this->CData.clear();
if (name == "logentry") {
@@ -200,12 +205,12 @@ private:
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
this->CData.insert(this->CData.end(), data, data + length);
}
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "logentry") {
this->HG->DoRevision(this->Rev, this->Changes);
@@ -260,7 +265,7 @@ private:
return output;
}
- virtual void ReportError(int, int, const char* msg)
+ void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE
{
this->HG->Log << "Error parsing hg log xml: " << msg << "\n";
}
@@ -287,7 +292,8 @@ void cmCTestHG::LoadRevisions()
" <file_dels>{file_dels}</file_dels>\n"
"</logentry>\n";
const char* hg_log[] = {
- hg, "log", "--removed", "-r", range.c_str(), "--template", hgXMLTemplate, 0
+ hg, "log", "--removed", "-r", range.c_str(),
+ "--template", hgXMLTemplate, CM_NULLPTR
};
LogParser out(this, "log-out> ");
@@ -302,7 +308,7 @@ void cmCTestHG::LoadModifications()
{
// Use 'hg status' to get modified files.
const char* hg = this->CommandLineTool.c_str();
- const char* hg_status[] = { hg, "status", 0 };
+ const char* hg_status[] = { hg, "status", CM_NULLPTR };
StatusParser out(this, "status-out> ");
OutputLogger err(this->Log, "status-err> ");
this->RunChild(hg_status, &out, &err);
diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h
index 8cc8c7a..08b479c 100644
--- a/Source/CTest/cmCTestHG.h
+++ b/Source/CTest/cmCTestHG.h
@@ -12,8 +12,15 @@
#ifndef cmCTestHG_h
#define cmCTestHG_h
+#include <cmConfigure.h>
+
#include "cmCTestGlobalVC.h"
+#include <iosfwd>
+#include <string>
+
+class cmCTest;
+
/** \class cmCTestHG
* \brief Interaction with Mercurial command-line tool
*
@@ -24,24 +31,25 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestHG(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestHG();
+ ~cmCTestHG() CM_OVERRIDE;
private:
std::string GetWorkingRevision();
- virtual void NoteOldRevision();
- virtual void NoteNewRevision();
- virtual bool UpdateImpl();
+ void NoteOldRevision() CM_OVERRIDE;
+ void NoteNewRevision() CM_OVERRIDE;
+ bool UpdateImpl() CM_OVERRIDE;
- void LoadRevisions();
- void LoadModifications();
+ void LoadRevisions() CM_OVERRIDE;
+ void LoadModifications() CM_OVERRIDE;
// Parsing helper classes.
class IdentifyParser;
- class StatusParser;
class LogParser;
+ class StatusParser;
+
friend class IdentifyParser;
- friend class StatusParser;
friend class LogParser;
+ friend class StatusParser;
};
#endif
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 76f971d..e8e2956 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -13,6 +13,14 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <sstream>
+#include <stdlib.h>
+
+class cmExecutionStatus;
cmCTestHandlerCommand::cmCTestHandlerCommand()
{
@@ -20,7 +28,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
size_t cc;
this->Arguments.reserve(INIT_SIZE);
for (cc = 0; cc < INIT_SIZE; ++cc) {
- this->Arguments.push_back(0);
+ this->Arguments.push_back(CM_NULLPTR);
}
this->Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
this->Arguments[ct_SOURCE] = "SOURCE";
@@ -32,11 +40,11 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
}
bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
// Allocate space for argument values.
this->Values.clear();
- this->Values.resize(this->Last, 0);
+ this->Values.resize(this->Last, CM_NULLPTR);
// Process input arguments.
this->ArgumentDoing = ArgumentDoingNone;
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index 7248832..7c9fd50 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -12,9 +12,17 @@
#ifndef cmCTestHandlerCommand_h
#define cmCTestHandlerCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <stddef.h>
+#include <string>
+#include <vector>
class cmCTestGenericHandler;
+class cmExecutionStatus;
/** \class cmCTestHandler
* \brief Run a ctest script
@@ -30,8 +38,8 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 4a408a2..333f4a0 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -11,15 +11,24 @@
============================================================================*/
#include "cmCTestLaunch.h"
+#include <cmConfigure.h>
+
#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
+#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/MD5.h>
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
#ifdef _WIN32
#include <fcntl.h> // for _O_BINARY
@@ -30,7 +39,7 @@
cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
{
this->Passthru = true;
- this->Process = 0;
+ this->Process = CM_NULLPTR;
this->ExitCode = 1;
this->CWD = cmSystemTools::GetCurrentWorkingDirectory();
@@ -126,12 +135,11 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
this->HandleRealArg(this->RealArgV[i]);
}
return true;
- } else {
- this->RealArgC = 0;
- this->RealArgV = 0;
- std::cerr << "No launch/command separator ('--') found!\n";
- return false;
}
+ this->RealArgC = 0;
+ this->RealArgV = CM_NULLPTR;
+ std::cerr << "No launch/command separator ('--') found!\n";
+ return false;
}
void cmCTestLaunch::HandleRealArg(const char* arg)
@@ -227,9 +235,9 @@ void cmCTestLaunch::RunChild()
// Record child stdout and stderr if necessary.
if (!this->Passthru) {
- char* data = 0;
+ char* data = CM_NULLPTR;
int length = 0;
- while (int p = cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+ while (int p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
if (p == cmsysProcess_Pipe_STDOUT) {
fout.write(data, length);
std::cout.write(data, length);
@@ -243,7 +251,7 @@ void cmCTestLaunch::RunChild()
}
// Wait for the real command to finish.
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
this->ExitCode = cmsysProcess_GetExitValue(cp);
}
@@ -384,7 +392,7 @@ void cmCTestLaunch::WriteXMLAction(cmXMLWriter& xml)
}
// OutputType
- const char* outputType = 0;
+ const char* outputType = CM_NULLPTR;
if (!this->OptionTargetType.empty()) {
if (this->OptionTargetType == "EXECUTABLE") {
outputType = "executable";
@@ -594,12 +602,8 @@ bool cmCTestLaunch::Match(std::string const& line,
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{
- if (!this->OptionFilterPrefix.empty() &&
- cmSystemTools::StringStartsWith(line.c_str(),
- this->OptionFilterPrefix.c_str())) {
- return true;
- }
- return false;
+ return !this->OptionFilterPrefix.empty() &&
+ cmSystemTools::StringStartsWith(line, this->OptionFilterPrefix.c_str());
}
int cmCTestLaunch::Main(int argc, const char* const argv[])
@@ -613,10 +617,6 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
return self.Run();
}
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-#include <cmsys/auto_ptr.hxx>
void cmCTestLaunch::LoadConfig()
{
cmake cm;
@@ -624,7 +624,7 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if (cmSystemTools::FileExists(fname.c_str()) &&
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index cbcc9ec..5f465ac 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -12,9 +12,12 @@
#ifndef cmCTestLaunch_h
#define cmCTestLaunch_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <cmsys/RegularExpression.hxx>
+#include <set>
+#include <string>
+#include <vector>
class cmXMLWriter;
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index 245892c..69f77af 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -12,9 +12,15 @@
#ifndef cmCTestMemCheckCommand_h
#define cmCTestMemCheckCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestMemCheck
* \brief Run a ctest script
@@ -29,7 +35,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestMemCheckCommand* ni = new cmCTestMemCheckCommand;
ni->CTest = this->CTest;
@@ -40,12 +46,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_memcheck"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; }
cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand);
protected:
- cmCTestGenericHandler* InitializeActualHandler();
+ cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE;
};
#endif
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 5ae98af..7a975dd 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -13,20 +13,16 @@
#include "cmCTestMemCheckHandler.h"
#include "cmCTest.h"
-#include "cmGeneratedFileStream.h"
-#include "cmMakefile.h"
+#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#include "cmake.h"
-#include <cmsys/Base64.h>
+
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
-#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
-
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
+#include <iostream>
+#include <sstream>
+#include <string.h>
struct CatToErrorType
{
@@ -42,7 +38,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = {
{ "Allocation Conflict", cmCTestMemCheckHandler::FMM },
{ "Bad Pointer Use", cmCTestMemCheckHandler::FMW },
{ "Dangling Pointer", cmCTestMemCheckHandler::FMR },
- { 0, 0 }
+ { CM_NULLPTR, 0 }
};
static void xmlReportError(int line, const char* msg, void* data)
@@ -61,7 +57,7 @@ public:
this->CTest = c;
this->SetErrorCallback(xmlReportError, (void*)c);
}
- void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
if (name == "MemoryLeak" || name == "ResourceLeak") {
this->Errors.push_back(cmCTestMemCheckHandler::MLK);
@@ -72,23 +68,23 @@ public:
std::ostringstream ostr;
ostr << name << ":\n";
int i = 0;
- for (; atts[i] != 0; i += 2) {
+ for (; atts[i] != CM_NULLPTR; i += 2) {
ostr << " " << atts[i] << " - " << atts[i + 1] << "\n";
}
ostr << "\n";
this->Log += ostr.str();
}
- void EndElement(const std::string&) {}
+ void EndElement(const std::string& /*name*/) CM_OVERRIDE {}
const char* GetAttribute(const char* name, const char** atts)
{
int i = 0;
- for (; atts[i] != 0; ++i) {
+ for (; atts[i] != CM_NULLPTR; ++i) {
if (strcmp(name, atts[i]) == 0) {
return atts[i + 1];
}
}
- return 0;
+ return CM_NULLPTR;
}
void ParseError(const char** atts)
{
@@ -241,9 +237,9 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
// define the standard set of errors
//----------------------------------------------------------------------
static const char* cmCTestMemCheckResultStrings[] = {
- "ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM", "FMM",
- "FMR", "FMW", "FUM", "IPR", "IPW", "MAF", "MLK", "MPK",
- "NPR", "ODS", "PAR", "PLK", "UMC", "UMR", 0
+ "ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM", "FMM",
+ "FMR", "FMW", "FUM", "IPR", "IPW", "MAF", "MLK", "MPK",
+ "NPR", "ODS", "PAR", "PLK", "UMC", "UMR", CM_NULLPTR
};
static const char* cmCTestMemCheckResultLongStrings[] = {
"Threading Problem",
@@ -268,10 +264,10 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
"PLK",
"Uninitialized Memory Conditional",
"Uninitialized Memory Read",
- 0
+ CM_NULLPTR
};
this->GlobalResults.clear();
- for (int i = 0; cmCTestMemCheckResultStrings[i] != 0; ++i) {
+ for (int i = 0; cmCTestMemCheckResultStrings[i] != CM_NULLPTR; ++i) {
this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]);
this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]);
this->GlobalResults.push_back(0);
@@ -499,11 +495,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
// Setup the options
std::string memoryTesterOptions;
- if (this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size()) {
+ if (!this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions")
+ .empty()) {
memoryTesterOptions =
this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions");
- } else if (this->CTest->GetCTestConfiguration("ValgrindCommandOptions")
- .size()) {
+ } else if (!this->CTest->GetCTestConfiguration("ValgrindCommandOptions")
+ .empty()) {
memoryTesterOptions =
this->CTest->GetCTestConfiguration("ValgrindCommandOptions");
}
@@ -522,8 +519,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterOptions.push_back("--show-reachable=yes");
this->MemoryTesterOptions.push_back("--num-callers=50");
}
- if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
- .size()) {
+ if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
+ .empty()) {
if (!cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
.c_str())) {
@@ -637,27 +634,24 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
std::string& log,
std::vector<int>& results)
{
- if (this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND) {
- return this->ProcessMemCheckValgrindOutput(str, log, results);
- } else if (this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY) {
- return this->ProcessMemCheckPurifyOutput(str, log, results);
- } else if (this->MemoryTesterStyle ==
- cmCTestMemCheckHandler::ADDRESS_SANITIZER ||
- this->MemoryTesterStyle ==
- cmCTestMemCheckHandler::THREAD_SANITIZER ||
- this->MemoryTesterStyle ==
- cmCTestMemCheckHandler::MEMORY_SANITIZER ||
- this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER) {
- return this->ProcessMemCheckSanitizerOutput(str, log, results);
- } else if (this->MemoryTesterStyle ==
- cmCTestMemCheckHandler::BOUNDS_CHECKER) {
- return this->ProcessMemCheckBoundsCheckerOutput(str, log, results);
- } else {
- log.append("\nMemory checking style used was: ");
- log.append("None that I know");
- log = str;
+ switch (this->MemoryTesterStyle) {
+ case cmCTestMemCheckHandler::VALGRIND:
+ return this->ProcessMemCheckValgrindOutput(str, log, results);
+ case cmCTestMemCheckHandler::PURIFY:
+ return this->ProcessMemCheckPurifyOutput(str, log, results);
+ case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
+ case cmCTestMemCheckHandler::THREAD_SANITIZER:
+ case cmCTestMemCheckHandler::MEMORY_SANITIZER:
+ case cmCTestMemCheckHandler::UB_SANITIZER:
+ return this->ProcessMemCheckSanitizerOutput(str, log, results);
+ case cmCTestMemCheckHandler::BOUNDS_CHECKER:
+ return this->ProcessMemCheckBoundsCheckerOutput(str, log, results);
+ default:
+ log.append("\nMemory checking style used was: ");
+ log.append("None that I know");
+ log = str;
+ return true;
}
- return true;
}
std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning(
@@ -722,10 +716,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
ostr << *i << std::endl;
}
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string& str, std::string& log, std::vector<int>& results)
@@ -766,10 +757,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
@@ -904,10 +892,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
<< (cmSystemTools::GetTime() - sttime) << std::endl,
this->Quiet);
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
@@ -999,7 +984,7 @@ void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(
cmsys::ifstream ifs(ofile.c_str());
if (!ifs) {
std::string log = "Cannot read memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
return;
}
res.Output += BOUNDS_CHECKER_MARKER;
@@ -1032,7 +1017,7 @@ void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res,
cmsys::ifstream ifs(ofile.c_str());
if (!ifs) {
std::string log = "Cannot read memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
return;
}
std::string line;
@@ -1064,7 +1049,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
g.FindFiles(ofile);
if (g.GetFiles().empty()) {
std::string log = "Cannot find memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
ofile = "";
} else {
files = g.GetFiles();
@@ -1072,7 +1057,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
}
} else if (!cmSystemTools::FileExists(ofile.c_str())) {
std::string log = "Cannot find memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
ofile = "";
}
files.push_back(ofile);
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 8f0cc47..a4ff684 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -13,9 +13,11 @@
#ifndef cmCTestMemCheckHandler_h
#define cmCTestMemCheckHandler_h
+#include <cmConfigure.h>
+
#include "cmCTestTestHandler.h"
+#include "cmTypeMacro.h"
-#include "cmListFileCache.h"
#include <string>
#include <vector>
@@ -33,16 +35,17 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler
public:
cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
- void PopulateCustomVectors(cmMakefile* mf);
+ void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
cmCTestMemCheckHandler();
- void Initialize();
+ void Initialize() CM_OVERRIDE;
protected:
- virtual int PreProcessHandler();
- virtual int PostProcessHandler();
- virtual void GenerateTestCommand(std::vector<std::string>& args, int test);
+ int PreProcessHandler() CM_OVERRIDE;
+ int PostProcessHandler() CM_OVERRIDE;
+ void GenerateTestCommand(std::vector<std::string>& args,
+ int test) CM_OVERRIDE;
private:
enum
@@ -125,7 +128,7 @@ private:
/**
* Generate the Dart compatible output
*/
- void GenerateDartOutput(cmXMLWriter& xml);
+ void GenerateDartOutput(cmXMLWriter& xml) CM_OVERRIDE;
std::vector<std::string> CustomPreMemCheck;
std::vector<std::string> CustomPostMemCheck;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 6f19b32..d65c915 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -12,17 +12,22 @@
#include "cmCTestMultiProcessHandler.h"
#include "cmCTest.h"
+#include "cmCTestRunTest.h"
#include "cmCTestScriptHandler.h"
-#include "cmProcess.h"
-#include "cmStandardIncludes.h"
+#include "cmCTestTestHandler.h"
#include "cmSystemTools.h"
+
+#include <algorithm>
#include <cmsys/FStream.hxx>
+#include <cmsys/String.hxx>
#include <cmsys/SystemInformation.hxx>
-#include <float.h>
+#include <iomanip>
#include <list>
#include <math.h>
+#include <sstream>
#include <stack>
#include <stdlib.h>
+#include <utility>
class TestComparator
{
@@ -261,12 +266,14 @@ void cmCTestMultiProcessHandler::StartNextTests()
allTestsFailedTestLoadCheck = true;
// Check for a fake load average value used in testing.
- if (const char* fake_load_value =
- cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING")) {
+ std::string fake_load_value;
+ if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING",
+ fake_load_value)) {
usedFakeLoadForTesting = true;
- if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad)) {
+ if (!cmSystemTools::StringToULong(fake_load_value.c_str(),
+ &systemLoad)) {
cmSystemTools::Error("Failed to parse fake load value: ",
- fake_load_value);
+ fake_load_value.c_str());
}
}
// If it's not set, look up the true load average.
@@ -413,12 +420,14 @@ void cmCTestMultiProcessHandler::UpdateCostData()
std::string line;
while (std::getline(fin, line)) {
- if (line == "---")
+ if (line == "---") {
break;
+ }
std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
// Format: <name> <previous_runs> <avg_cost>
- if (parts.size() < 3)
+ if (parts.size() < 3) {
break;
+ }
std::string name = parts[0];
int prev = atoi(parts[1].c_str());
@@ -449,7 +458,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
fout << "---\n";
for (std::vector<std::string>::iterator i = this->Failed->begin();
i != this->Failed->end(); ++i) {
- fout << i->c_str() << "\n";
+ fout << *i << "\n";
}
fout.close();
cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str());
@@ -464,8 +473,9 @@ void cmCTestMultiProcessHandler::ReadCostData()
fin.open(fname.c_str());
std::string line;
while (std::getline(fin, line)) {
- if (line == "---")
+ if (line == "---") {
break;
+ }
std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
@@ -480,8 +490,9 @@ void cmCTestMultiProcessHandler::ReadCostData()
float cost = static_cast<float>(atof(parts[2].c_str()));
int index = this->SearchByName(name);
- if (index == -1)
+ if (index == -1) {
continue;
+ }
this->Properties[index]->PreviousRuns = prev;
// When not running in parallel mode, don't use cost data
@@ -710,8 +721,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
<< indexStr.str(),
this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- p.Name.c_str() << std::endl, this->Quiet);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, p.Name << std::endl,
+ this->Quiet);
// pop working dir
cmSystemTools::ChangeDirectory(current_dir);
}
@@ -818,9 +829,8 @@ bool cmCTestMultiProcessHandler::CheckCycles()
<< this->Properties[root]->Name
<< "\".\nPlease fix the cycle and run ctest again.\n");
return false;
- } else {
- s.push(*d);
}
+ s.push(*d);
}
}
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 9ec1528..08068c5 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -12,9 +12,17 @@
#ifndef cmCTestMultiProcessHandler_h
#define cmCTestMultiProcessHandler_h
-#include <cmCTestTestHandler.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include <cmCTestRunTest.h>
+#include <cmCTestTestHandler.h>
+#include <map>
+#include <set>
+#include <stddef.h>
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestRunTest;
/** \class cmCTestMultiProcessHandler
* \brief run parallel ctest
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 07f9dad..cf7b2ca 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -12,14 +12,15 @@
#include "cmCTestP4.h"
#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
-#include <cmsys/Process.h>
+#include <algorithm>
#include <cmsys/RegularExpression.hxx>
-
-#include <ctype.h>
-#include <sys/types.h>
+#include <ostream>
#include <time.h>
+#include <utility>
cmCTestP4::cmCTestP4(cmCTest* ct, std::ostream& log)
: cmCTestGlobalVC(ct, log)
@@ -45,7 +46,7 @@ private:
std::string& Rev;
cmsys::RegularExpression RegexIdentify;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexIdentify.find(this->Line)) {
this->Rev = this->RegexIdentify.match(1);
@@ -69,7 +70,7 @@ private:
cmsys::RegularExpression RegexIdentify;
cmCTestP4* P4;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexIdentify.find(this->Line)) {
P4->ChangeLists.push_back(this->RegexIdentify.match(1));
@@ -92,7 +93,7 @@ private:
cmsys::RegularExpression RegexUser;
cmCTestP4* P4;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexUser.find(this->Line)) {
User NewUser;
@@ -135,7 +136,7 @@ private:
std::string CurrentPath;
cmsys::RegularExpression RegexDiff;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (!this->Line.empty() && this->Line[0] == '=' &&
this->RegexDiff.find(this->Line)) {
@@ -163,7 +164,7 @@ cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
p4_users.push_back("-m");
p4_users.push_back("1");
p4_users.push_back(username.c_str());
- p4_users.push_back(0);
+ p4_users.push_back(CM_NULLPTR);
UserParser out(this, "users-out> ");
OutputLogger err(this->Log, "users-err> ");
@@ -225,7 +226,7 @@ private:
SectionType Section;
Revision Rev;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->Line.empty()) {
this->NextSection();
@@ -358,7 +359,7 @@ std::string cmCTestP4::GetWorkingRevision()
std::string source = this->SourceDirectory + "/...#have";
p4_identify.push_back(source.c_str());
- p4_identify.push_back(0);
+ p4_identify.push_back(CM_NULLPTR);
std::string rev;
IdentifyParser out(this, "p4_changes-out> ", rev);
@@ -373,9 +374,8 @@ std::string cmCTestP4::GetWorkingRevision()
if (rev.empty()) {
return "0";
- } else {
- return rev;
}
+ return rev;
}
void cmCTestP4::NoteOldRevision()
@@ -418,7 +418,7 @@ void cmCTestP4::LoadRevisions()
p4_changes.push_back("changes");
p4_changes.push_back(range.c_str());
- p4_changes.push_back(0);
+ p4_changes.push_back(CM_NULLPTR);
ChangesParser out(this, "p4_changes-out> ");
OutputLogger err(this->Log, "p4_changes-err> ");
@@ -426,8 +426,9 @@ void cmCTestP4::LoadRevisions()
ChangeLists.clear();
this->RunChild(&p4_changes[0], &out, &err);
- if (ChangeLists.empty())
+ if (ChangeLists.empty()) {
return;
+ }
// p4 describe -s ...@1111111,2222222
std::vector<char const*> p4_describe;
@@ -437,7 +438,7 @@ void cmCTestP4::LoadRevisions()
p4_describe.push_back("describe");
p4_describe.push_back("-s");
p4_describe.push_back(i->c_str());
- p4_describe.push_back(0);
+ p4_describe.push_back(CM_NULLPTR);
DescribeParser outDescribe(this, "p4_describe-out> ");
OutputLogger errDescribe(this->Log, "p4_describe-err> ");
@@ -456,7 +457,7 @@ void cmCTestP4::LoadModifications()
p4_diff.push_back("-dn");
std::string source = this->SourceDirectory + "/...";
p4_diff.push_back(source.c_str());
- p4_diff.push_back(0);
+ p4_diff.push_back(CM_NULLPTR);
DiffParser out(this, "p4_diff-out> ");
OutputLogger err(this->Log, "p4_diff-err> ");
@@ -473,7 +474,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom)
i != p4_custom_command.end(); ++i) {
p4_custom.push_back(i->c_str());
}
- p4_custom.push_back(0);
+ p4_custom.push_back(CM_NULLPTR);
OutputLogger custom_out(this->Log, "p4_customsync-out> ");
OutputLogger custom_err(this->Log, "p4_customsync-err> ");
@@ -524,7 +525,7 @@ bool cmCTestP4::UpdateImpl()
}
p4_sync.push_back(source.c_str());
- p4_sync.push_back(0);
+ p4_sync.push_back(CM_NULLPTR);
OutputLogger out(this->Log, "p4_sync-out> ");
OutputLogger err(this->Log, "p4_sync-err> ");
diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h
index 917751e..549936b 100644
--- a/Source/CTest/cmCTestP4.h
+++ b/Source/CTest/cmCTestP4.h
@@ -12,11 +12,17 @@
#ifndef cmCTestP4_h
#define cmCTestP4_h
+#include <cmConfigure.h>
+
#include "cmCTestGlobalVC.h"
+#include <iosfwd>
#include <map>
+#include <string>
#include <vector>
+class cmCTest;
+
/** \class cmCTestP4
* \brief Interaction with the Perforce command-line tool
*
@@ -27,7 +33,7 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestP4(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestP4();
+ ~cmCTestP4() CM_OVERRIDE;
private:
std::vector<std::string> ChangeLists;
@@ -54,20 +60,21 @@ private:
void SetP4Options(std::vector<char const*>& options);
std::string GetWorkingRevision();
- virtual void NoteOldRevision();
- virtual void NoteNewRevision();
- virtual bool UpdateImpl();
+ void NoteOldRevision() CM_OVERRIDE;
+ void NoteNewRevision() CM_OVERRIDE;
+ bool UpdateImpl() CM_OVERRIDE;
bool UpdateCustom(const std::string& custom);
- void LoadRevisions();
- void LoadModifications();
+ void LoadRevisions() CM_OVERRIDE;
+ void LoadModifications() CM_OVERRIDE;
- // Parsing helper classes.
- class IdentifyParser;
class ChangesParser;
- class UserParser;
class DescribeParser;
class DiffParser;
+ // Parsing helper classes.
+ class IdentifyParser;
+ class UserParser;
+
friend class IdentifyParser;
friend class ChangesParser;
friend class UserParser;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
index 2613c1c..50a00f6 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
@@ -13,10 +13,12 @@
#include "cmCTest.h"
+class cmExecutionStatus;
+
bool cmCTestReadCustomFilesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+ std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 713fc66..4dcde62 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -12,7 +12,16 @@
#ifndef cmCTestReadCustomFilesCommand_h
#define cmCTestReadCustomFilesCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestReadCustomFiles
* \brief Run a ctest script
@@ -28,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand;
ni->CTest = this->CTest;
@@ -39,13 +48,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_read_custom_files"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; }
cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand);
};
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index e143d50..29aa279 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -12,11 +12,16 @@
#include "cmCTestRunScriptCommand.h"
#include "cmCTestScriptHandler.h"
+#include "cmMakefile.h"
+
+#include <sstream>
+
+class cmExecutionStatus;
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->CTestScriptHandler->RunCurrentScript();
return true;
}
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index c503516..9705f57 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -12,7 +12,16 @@
#ifndef cmCTestRunScriptCommand_h
#define cmCTestRunScriptCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestRunScript
* \brief Run a ctest script
@@ -28,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand;
ni->CTest = this->CTest;
@@ -40,13 +49,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_run_script"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; }
cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand);
};
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 9dda865..e7e51d5 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -14,22 +14,32 @@
#include "cmCTest.h"
#include "cmCTestMemCheckHandler.h"
+#include "cmCTestTestHandler.h"
+#include "cmProcess.h"
#include "cmSystemTools.h"
-#include "cm_curl.h"
+#include <cmConfigure.h>
+#include <cm_curl.h>
#include <cm_zlib.h>
#include <cmsys/Base64.h>
+#include <cmsys/Process.h>
+#include <cmsys/RegularExpression.hxx>
+#include <iomanip>
+#include <sstream>
+#include <stdio.h>
+#include <time.h>
+#include <utility>
cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler)
{
this->CTest = handler->CTest;
this->TestHandler = handler;
- this->TestProcess = 0;
+ this->TestProcess = CM_NULLPTR;
this->TestResult.ExecutionTime = 0;
this->TestResult.ReturnValue = 0;
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
- this->TestResult.Properties = 0;
+ this->TestResult.Properties = CM_NULLPTR;
this->ProcessOutput = "";
this->CompressedOutput = "";
this->CompressionRatio = 2;
@@ -54,7 +64,8 @@ bool cmCTestRunTest::CheckOutput()
if (p == cmsysProcess_Pipe_None) {
// Process has terminated and all output read.
return false;
- } else if (p == cmsysProcess_Pipe_STDOUT) {
+ }
+ if (p == cmsysProcess_Pipe_STDOUT) {
// Store this line of output.
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex()
<< ": " << line << std::endl);
@@ -82,8 +93,7 @@ bool cmCTestRunTest::CheckOutput()
}
}
}
- } else // if(p == cmsysProcess_Pipe_Timeout)
- {
+ } else { // if(p == cmsysProcess_Pipe_Timeout)
break;
}
}
@@ -207,7 +217,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
}
if (res == cmsysProcess_State_Exited) {
bool success = !forceFail &&
- (retVal == 0 || this->TestProperties->RequiredRegularExpressions.size());
+ (retVal == 0 ||
+ !this->TestProperties->RequiredRegularExpressions.empty());
if (this->TestProperties->SkipReturnCode >= 0 &&
this->TestProperties->SkipReturnCode == retVal) {
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
@@ -537,7 +548,7 @@ void cmCTestRunTest::ComputeArguments()
<< " command: " << testCommand << std::endl);
// Print any test-specific env vars in verbose mode
- if (this->TestProperties->Environment.size()) {
+ if (!this->TestProperties->Environment.empty()) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index
<< ": "
<< "Environment variables: " << std::endl);
@@ -576,7 +587,7 @@ double cmCTestRunTest::ResolveTimeout()
return timeout;
}
struct tm* lctime;
- time_t current_time = time(0);
+ time_t current_time = time(CM_NULLPTR);
lctime = gmtime(&current_time);
int gm_hour = lctime->tm_hour;
time_t gm_time = mktime(lctime);
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 3dcc026..0ca434d 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -12,9 +12,15 @@
#ifndef cmCTestRunTest_h
#define cmCTestRunTest_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include <cmCTestTestHandler.h>
+#include <stddef.h>
+#include <string>
+#include <vector>
-#include <cmProcess.h>
+class cmCTest;
+class cmProcess;
/** \class cmRunTest
* \brief represents a single test to be run
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index a6885aa..f680612 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -12,11 +12,17 @@
#include "cmCTestSVN.h"
#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessTools.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <ostream>
+#include <stdlib.h>
+#include <string.h>
struct cmCTestSVN::Revision : public cmCTestVC::Revision
{
@@ -62,7 +68,7 @@ private:
cmsys::RegularExpression RegexRev;
cmsys::RegularExpression RegexURL;
cmsys::RegularExpression RegexRoot;
- virtual bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexRev.find(this->Line)) {
this->Rev = this->RegexRev.match(1);
@@ -80,11 +86,11 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2)
// Does path p1 start with path p2?
if (p1.size() == p2.size()) {
return p1 == p2;
- } else if (p1.size() > p2.size() && p1[p2.size()] == '/') {
+ }
+ if (p1.size() > p2.size() && p1[p2.size()] == '/') {
return strncmp(p1.c_str(), p2.c_str(), p2.size()) == 0;
- } else {
- return false;
}
+ return false;
}
std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo)
@@ -206,7 +212,7 @@ private:
cmCTestSVN* SVN;
cmsys::RegularExpression RegexUpdate;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexUpdate.find(this->Line)) {
this->DoPath(this->RegexUpdate.match(1)[0],
@@ -271,8 +277,9 @@ bool cmCTestSVN::UpdateImpl()
bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
OutputParser* out, OutputParser* err)
{
- if (parameters.empty())
+ if (parameters.empty()) {
return false;
+ }
std::vector<char const*> args;
args.push_back(this->CommandLineTool.c_str());
@@ -290,13 +297,12 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
args.push_back(i->c_str());
}
- args.push_back(0);
+ args.push_back(CM_NULLPTR);
if (strcmp(parameters[0], "update") == 0) {
return RunUpdateCommand(&args[0], out, err);
- } else {
- return RunChild(&args[0], out, err);
}
+ return RunChild(&args[0], out, err);
}
class cmCTestSVN::LogParser : public cmCTestVC::OutputLogger,
@@ -310,7 +316,7 @@ public:
{
this->InitializeParser();
}
- ~LogParser() { this->CleanupParser(); }
+ ~LogParser() CM_OVERRIDE { this->CleanupParser(); }
private:
cmCTestSVN* SVN;
cmCTestSVN::SVNInfo& SVNRepo;
@@ -322,14 +328,14 @@ private:
Change CurChange;
std::vector<char> CData;
- virtual bool ProcessChunk(const char* data, int length)
+ bool ProcessChunk(const char* data, int length) CM_OVERRIDE
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
this->CData.clear();
if (name == "logentry") {
@@ -347,12 +353,12 @@ private:
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
this->CData.insert(this->CData.end(), data, data + length);
}
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "logentry") {
this->SVN->DoRevisionSVN(this->Rev, this->Changes);
@@ -371,7 +377,7 @@ private:
this->CData.clear();
}
- virtual void ReportError(int, int, const char* msg)
+ void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE
{
this->SVN->Log << "Error parsing svn log xml: " << msg << "\n";
}
@@ -440,7 +446,7 @@ public:
private:
cmCTestSVN* SVN;
cmsys::RegularExpression RegexStatus;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexStatus.find(this->Line)) {
this->DoPath(this->RegexStatus.match(1)[0],
@@ -505,7 +511,7 @@ public:
private:
cmCTestSVN* SVN;
cmsys::RegularExpression RegexExternal;
- bool ProcessLine()
+ bool ProcessLine() CM_OVERRIDE
{
if (this->RegexExternal.find(this->Line)) {
this->DoPath(this->RegexExternal.match(1));
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index e596bdc..6f2374d 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -12,9 +12,17 @@
#ifndef cmCTestSVN_h
#define cmCTestSVN_h
+#include <cmConfigure.h>
+
#include "cmCTestGlobalVC.h"
+#include <iosfwd>
#include <list>
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmXMLWriter;
/** \class cmCTestSVN
* \brief Interaction with subversion command-line tool
@@ -26,14 +34,14 @@ public:
/** Construct with a CTest instance and update log stream. */
cmCTestSVN(cmCTest* ctest, std::ostream& log);
- virtual ~cmCTestSVN();
+ ~cmCTestSVN() CM_OVERRIDE;
private:
// Implement cmCTestVC internal API.
- virtual void CleanupImpl();
- virtual void NoteOldRevision();
- virtual void NoteNewRevision();
- virtual bool UpdateImpl();
+ void CleanupImpl() CM_OVERRIDE;
+ void NoteOldRevision() CM_OVERRIDE;
+ void NoteNewRevision() CM_OVERRIDE;
+ bool UpdateImpl() CM_OVERRIDE;
bool RunSVNCommand(std::vector<char const*> const& parameters,
OutputParser* out, OutputParser* err);
@@ -68,6 +76,7 @@ private:
// Extended revision structure to include info about external it refers to.
struct Revision;
+
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
@@ -78,8 +87,8 @@ private:
std::string LoadInfo(SVNInfo& svninfo);
void LoadExternals();
- void LoadModifications();
- void LoadRevisions();
+ void LoadModifications() CM_OVERRIDE;
+ void LoadRevisions() CM_OVERRIDE;
void LoadRevisions(SVNInfo& svninfo);
void GuessBase(SVNInfo& svninfo, std::vector<Change> const& changes);
@@ -87,14 +96,15 @@ private:
void DoRevisionSVN(Revision const& revision,
std::vector<Change> const& changes);
- void WriteXMLGlobal(cmXMLWriter& xml);
+ void WriteXMLGlobal(cmXMLWriter& xml) CM_OVERRIDE;
+ class ExternalParser;
// Parsing helper classes.
class InfoParser;
class LogParser;
class StatusParser;
class UpdateParser;
- class ExternalParser;
+
friend class InfoParser;
friend class LogParser;
friend class StatusParser;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 6389a9d..a31d789 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -13,32 +13,8 @@
#include "cmCTestScriptHandler.h"
#include "cmCTest.h"
-#include "cmFunctionBlocker.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-//#include <cmsys/RegularExpression.hxx>
-#include <cmsys/Directory.hxx>
-#include <cmsys/Process.h>
-
-// used for sleep
-#ifdef _WIN32
-#include "windows.h"
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
-#include <time.h>
-
-// needed for sleep
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
-
#include "cmCTestBuildCommand.h"
+#include "cmCTestCommand.h"
#include "cmCTestConfigureCommand.h"
#include "cmCTestCoverageCommand.h"
#include "cmCTestEmptyBinaryDirectoryCommand.h"
@@ -51,6 +27,31 @@
#include "cmCTestTestCommand.h"
#include "cmCTestUpdateCommand.h"
#include "cmCTestUploadCommand.h"
+#include "cmFunctionBlocker.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <cmsys/Directory.hxx>
+#include <cmsys/Process.h>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+class cmExecutionStatus;
+struct cmListFileFunction;
#define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log"
@@ -59,9 +60,9 @@ class cmCTestScriptFunctionBlocker : public cmFunctionBlocker
{
public:
cmCTestScriptFunctionBlocker() {}
- virtual ~cmCTestScriptFunctionBlocker() {}
- virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
- cmExecutionStatus&);
+ ~cmCTestScriptFunctionBlocker() CM_OVERRIDE {}
+ bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
+ cmExecutionStatus& /*status*/) CM_OVERRIDE;
// virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
// virtual void ScopeEnded(cmMakefile &mf);
@@ -69,9 +70,9 @@ public:
};
// simply update the time and don't block anything
-bool cmCTestScriptFunctionBlocker::IsFunctionBlocked(const cmListFileFunction&,
- cmMakefile&,
- cmExecutionStatus&)
+bool cmCTestScriptFunctionBlocker::IsFunctionBlocked(
+ const cmListFileFunction& /*lff*/, cmMakefile& /*mf*/,
+ cmExecutionStatus& /*status*/)
{
this->CTestScriptHandler->UpdateElapsedTime();
return false;
@@ -82,9 +83,9 @@ cmCTestScriptHandler::cmCTestScriptHandler()
this->Backup = false;
this->EmptyBinDir = false;
this->EmptyBinDirOnce = false;
- this->Makefile = 0;
- this->CMake = 0;
- this->GlobalGenerator = 0;
+ this->Makefile = CM_NULLPTR;
+ this->CMake = CM_NULLPTR;
+ this->GlobalGenerator = CM_NULLPTR;
this->ScriptStartTime = 0;
@@ -121,10 +122,10 @@ void cmCTestScriptHandler::Initialize()
this->ScriptStartTime = 0;
delete this->Makefile;
- this->Makefile = 0;
+ this->Makefile = CM_NULLPTR;
delete this->GlobalGenerator;
- this->GlobalGenerator = 0;
+ this->GlobalGenerator = CM_NULLPTR;
delete this->CMake;
}
@@ -200,7 +201,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
for (size_t i = 1; i < initArgs.size(); ++i) {
argv.push_back(initArgs[i].c_str());
}
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
// Now create process object
cmsysProcess* cp = cmsysProcess_New();
@@ -226,7 +227,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
}
// Properly handle output of the build command
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
int result = cmsysProcess_GetState(cp);
int retVal = 0;
bool failed = false;
@@ -265,7 +266,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
return retVal;
}
-static void ctestScriptProgressCallback(const char* m, float, void* cd)
+static void ctestScriptProgressCallback(const char* m, float /*unused*/,
+ void* cd)
{
cmCTest* ctest = static_cast<cmCTest*>(cd);
if (m && *m) {
@@ -863,7 +865,7 @@ bool cmCTestScriptHandler::WriteInitialCache(const char* directory,
return false;
}
- if (text != 0) {
+ if (text != CM_NULLPTR) {
fout.write(text, strlen(text));
}
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index e09e040..17d7aef 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -13,14 +13,19 @@
#ifndef cmCTestScriptHandler_h
#define cmCTestScriptHandler_h
+#include <cmConfigure.h>
+
#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
-#include "cmListFileCache.h"
+#include <string>
+#include <vector>
-class cmMakefile;
+class cmCTest;
+class cmCTestCommand;
class cmGlobalGenerator;
+class cmMakefile;
class cmake;
-class cmCTestCommand;
/** \class cmCTestScriptHandler
* \brief A class that handles ctest -S invocations
@@ -71,7 +76,7 @@ public:
/**
* Run a dashboard using a specified confiuration script
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
/*
* Run a script
@@ -104,9 +109,9 @@ public:
double GetRemainingTimeAllowed();
cmCTestScriptHandler();
- ~cmCTestScriptHandler();
+ ~cmCTestScriptHandler() CM_OVERRIDE;
- void Initialize();
+ void Initialize() CM_OVERRIDE;
void CreateCMake();
cmake* GetCMake() { return this->CMake; }
diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx
index 102a303..0954a7e 100644
--- a/Source/CTest/cmCTestSleepCommand.cxx
+++ b/Source/CTest/cmCTestSleepCommand.cxx
@@ -12,12 +12,15 @@
#include "cmCTestSleepCommand.h"
#include "cmCTestScriptHandler.h"
-#include <stdlib.h> // required for atoi
+
+#include <stdlib.h>
+
+class cmExecutionStatus;
bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index ff7f146..2a3fa00 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -12,7 +12,16 @@
#ifndef cmCTestSleepCommand_h
#define cmCTestSleepCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestSleep
* \brief Run a ctest script
@@ -28,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestSleepCommand* ni = new cmCTestSleepCommand;
ni->CTest = this->CTest;
@@ -40,13 +49,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_sleep"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; }
cmTypeMacro(cmCTestSleepCommand, cmCTestCommand);
};
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index d561393..803e01c 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -14,7 +14,13 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+#include <sstream>
+#include <stddef.h>
+
+class cmExecutionStatus;
cmCTestStartCommand::cmCTestStartCommand()
{
@@ -23,21 +29,21 @@ cmCTestStartCommand::cmCTestStartCommand()
}
bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
size_t cnt = 0;
const char* smodel = args[cnt].c_str();
- const char* src_dir = 0;
- const char* bld_dir = 0;
+ const char* src_dir = CM_NULLPTR;
+ const char* bld_dir = CM_NULLPTR;
cnt++;
- this->CTest->SetSpecificTrack(0);
+ this->CTest->SetSpecificTrack(CM_NULLPTR);
if (cnt < args.size() - 1) {
if (args[cnt] == "TRACK") {
cnt++;
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index 2aa6281..22035fa 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -12,7 +12,17 @@
#ifndef cmCTestStartCommand_h
#define cmCTestStartCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestCommand.h"
+#include "cmTypeMacro.h"
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestStart
* \brief Run a ctest script
@@ -27,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestStartCommand* ni = new cmCTestStartCommand;
ni->CTest = this->CTest;
@@ -41,8 +51,8 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* Will this invocation of ctest_start create a new TAG file?
@@ -57,7 +67,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_start"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_start"; }
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 664552a..c7c3584 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -14,6 +14,13 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestSubmitHandler.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <sstream>
+
+class cmExecutionStatus;
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
{
@@ -88,7 +95,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
extraFiles.end());
if (!this->CTest->SubmitExtraFiles(newExtraFiles)) {
this->SetError("problem submitting extra files.");
- return 0;
+ return CM_NULLPTR;
}
}
@@ -96,7 +103,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->CTest->GetInitializedHandler("submit");
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate submit handler");
- return 0;
+ return CM_NULLPTR;
}
// If no FILES or PARTS given, *all* PARTS are submitted by default.
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 6323d8c..03165bf 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -12,9 +12,19 @@
#ifndef cmCTestSubmitCommand_h
#define cmCTestSubmitCommand_h
-#include "cmCTestHandlerCommand.h"
+#include <cmConfigure.h>
#include "cmCTest.h"
+#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <set>
+#include <string>
+#include <vector>
+
+class cmCTestGenericHandler;
+class cmCommand;
+class cmExecutionStatus;
/** \class cmCTestSubmit
* \brief Run a ctest script
@@ -38,7 +48,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
ni->CTest = this->CTest;
@@ -46,21 +56,21 @@ public:
return ni;
}
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_submit"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_submit"; }
cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
protected:
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
- virtual bool CheckArgumentKeyword(std::string const& arg);
- virtual bool CheckArgumentValue(std::string const& arg);
+ bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE;
+ bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE;
enum
{
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index f373348..67f7c89 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -12,26 +12,28 @@
#include "cmCTestSubmitHandler.h"
#include "cmCTest.h"
+#include "cmCTestCurl.h"
#include "cmCTestScriptHandler.h"
+#include "cmCurl.h"
#include "cmGeneratedFileStream.h"
#include "cmState.h"
#include "cmSystemTools.h"
-#include "cmVersion.h"
#include "cmXMLParser.h"
#include "cmake.h"
-#include <cmsys/Base64.h>
-#include <cmsys/Process.h>
-
-// For XML-RPC submission
-#include "cm_xmlrpc.h"
-
+#include <cm_curl.h>
#include <cm_jsoncpp_reader.h>
-// For curl submission
-#include "cmCTestCurl.h"
-#include "cmCurl.h"
+#include <cm_jsoncpp_value.h>
+#include <cmsys/Process.h>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(CTEST_USE_XMLRPC)
+#include "cmVersion.h"
+#include <cm_xmlrpc.h>
#include <sys/stat.h>
+#endif
#define SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT 120
@@ -41,7 +43,7 @@ class cmCTestSubmitHandler::ResponseParser : public cmXMLParser
{
public:
ResponseParser() { this->Status = STATUS_OK; }
- ~ResponseParser() {}
+ ~ResponseParser() CM_OVERRIDE {}
public:
enum StatusType
@@ -69,7 +71,7 @@ private:
return val;
}
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
this->CurrentValue.clear();
if (name == "cdash") {
@@ -77,12 +79,12 @@ private:
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
this->CurrentValue.insert(this->CurrentValue.end(), data, data + length);
}
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "status") {
std::string status = cmSystemTools::UpperCase(this->GetCurrentValue());
@@ -116,7 +118,8 @@ static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size,
return realsize;
}
-static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL*, curl_infotype,
+static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/,
+ curl_infotype /*unused*/,
char* chPtr, size_t size,
void* data)
{
@@ -150,7 +153,7 @@ void cmCTestSubmitHandler::Initialize()
this->HTTPProxyAuth = "";
this->FTPProxy = "";
this->FTPProxyType = 0;
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
this->Files.clear();
}
@@ -308,7 +311,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
FILE* ftpfile;
char error_buffer[1024];
struct curl_slist* headers =
- ::curl_slist_append(NULL, "Content-Type: text/xml");
+ ::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
@@ -507,10 +510,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
// If curl failed for any reason, or checksum fails, wait and retry
//
if (res != CURLE_OK || this->HasErrors) {
- std::string retryDelay = this->GetOption("RetryDelay") == NULL
+ std::string retryDelay = this->GetOption("RetryDelay") == CM_NULLPTR
? ""
: this->GetOption("RetryDelay");
- std::string retryCount = this->GetOption("RetryCount") == NULL
+ std::string retryCount = this->GetOption("RetryCount") == CM_NULLPTR
? ""
: this->GetOption("RetryCount");
@@ -776,7 +779,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
argv.push_back(scp_command.c_str()); // Scp command
argv.push_back(scp_command.c_str()); // Dummy string for file
argv.push_back(scp_command.c_str()); // Dummy string for remote url
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
@@ -807,12 +810,12 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
char* data;
int length;
- while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+ while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(data, length), this->Quiet);
}
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
int result = cmsysProcess_GetState(cp);
@@ -845,10 +848,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
}
}
cmsysProcess_Delete(cp);
- if (problems) {
- return false;
- }
- return true;
+ return problems == 0;
}
bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
@@ -870,7 +870,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
cmCTest::SetOfStrings::const_iterator file;
- bool problems = false;
for (file = files.begin(); file != files.end(); ++file) {
std::string lfname = localprefix;
cmSystemTools::ConvertToUnixSlashes(lfname);
@@ -883,9 +882,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
std::string tagDoneFile = destination + "/" + remoteprefix + "DONE";
cmSystemTools::Touch(tagDoneFile, true);
- if (problems) {
- return false;
- }
return true;
}
@@ -909,8 +905,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
/* Call the famous server at UserLand. */
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: "
- << realURL.c_str() << " (" << remoteprefix.c_str()
- << ")" << std::endl,
+ << realURL << " (" << remoteprefix << ")" << std::endl,
this->Quiet);
cmCTest::SetOfStrings::const_iterator file;
for (file = files.begin(); file != files.end(); ++file) {
@@ -921,12 +916,12 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
local_file = localprefix + "/" + *file;
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Submit file: " << local_file.c_str() << std::endl,
+ " Submit file: " << local_file << std::endl,
this->Quiet);
struct stat st;
if (::stat(local_file.c_str(), &st)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
- " Cannot find file: " << local_file.c_str() << std::endl);
+ " Cannot find file: " << local_file << std::endl);
return false;
}
@@ -934,15 +929,15 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
// make sure the file is not too big.
if (static_cast<off_t>(static_cast<size_t>(st.st_size)) !=
static_cast<off_t>(st.st_size)) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- " File too big: " << local_file.c_str() << std::endl);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, " File too big: " << local_file
+ << std::endl);
return false;
}
size_t fileSize = static_cast<size_t>(st.st_size);
FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
if (!fp) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
- " Cannot open file: " << local_file.c_str() << std::endl);
+ " Cannot open file: " << local_file << std::endl);
return false;
}
@@ -951,7 +946,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
delete[] fileBuffer;
fclose(fp);
cmCTestLog(this->CTest, ERROR_MESSAGE,
- " Cannot read file: " << local_file.c_str() << std::endl);
+ " Cannot read file: " << local_file << std::endl);
return false;
}
fclose(fp);
@@ -984,10 +979,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
return true;
}
#else
-bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&,
- std::set<std::string> const&,
- std::string const&,
- std::string const&)
+bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
+ std::string const& /*unused*/, std::set<std::string> const& /*unused*/,
+ std::string const& /*unused*/, std::string const& /*unused*/)
{
return false;
}
@@ -999,12 +993,12 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod,
dropMethod = this->CTest->GetCTestConfiguration("DropMethod");
url = dropMethod;
url += "://";
- if (this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0) {
+ if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) {
url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestOptionalLog(
this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), this->Quiet);
- if (this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0) {
+ if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet);
}
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 87fa142..0e5aea6 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -12,7 +12,16 @@
#ifndef cmCTestSubmitHandler_h
#define cmCTestSubmitHandler_h
+#include <cmConfigure.h>
+
+#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
+
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
/** \class cmCTestSubmitHandler
* \brief Helper class for CTest
@@ -26,14 +35,14 @@ public:
cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler);
cmCTestSubmitHandler();
- ~cmCTestSubmitHandler() { this->LogFile = 0; }
+ ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = CM_NULLPTR; }
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
- void Initialize();
+ void Initialize() CM_OVERRIDE;
/** Specify a set of parts (by name) to submit. */
void SelectParts(std::set<cmCTest::Part> const& parts);
@@ -84,6 +93,7 @@ private:
std::string GetSubmitResultsPrefix();
class ResponseParser;
+
std::string HTTPProxy;
int HTTPProxyType;
std::string HTTPProxyAuth;
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 7b437c6..8ac4c69 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -13,6 +13,12 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+#include <sstream>
+#include <stdlib.h>
+#include <vector>
cmCTestTestCommand::cmCTestTestCommand()
{
@@ -27,7 +33,7 @@ cmCTestTestCommand::cmCTestTestCommand()
this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
this->Arguments[ctt_STOP_TIME] = "STOP_TIME";
this->Arguments[ctt_TEST_LOAD] = "TEST_LOAD";
- this->Arguments[ctt_LAST] = 0;
+ this->Arguments[ctt_LAST] = CM_NULLPTR;
this->Last = ctt_LAST;
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 212213e..89e37b9 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -12,7 +12,15 @@
#ifndef cmCTestTestCommand_h
#define cmCTestTestCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+
+class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestTest
* \brief Run a ctest script
@@ -27,7 +35,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestTestCommand* ni = new cmCTestTestCommand;
ni->CTest = this->CTest;
@@ -38,13 +46,13 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_test"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_test"; }
cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand);
protected:
virtual cmCTestGenericHandler* InitializeActualHandler();
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
enum
{
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 20ef693..479c516 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -15,26 +15,32 @@
#include "cmCTest.h"
#include "cmCTestBatchTestHandler.h"
#include "cmCTestMultiProcessHandler.h"
-#include "cmCTestRunTest.h"
#include "cmCommand.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
+#include "cm_auto_ptr.hxx"
#include "cm_utf8.h"
#include "cmake.h"
+
+#include <algorithm>
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
-#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
-
-#include <float.h>
-#include <math.h>
+#include <functional>
+#include <iomanip>
+#include <set>
+#include <sstream>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <time.h>
-#include <set>
+class cmExecutionStatus;
class cmCTestSubdirCommand : public cmCommand
{
@@ -42,7 +48,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestSubdirCommand* c = new cmCTestSubdirCommand;
c->TestHandler = this->TestHandler;
@@ -53,13 +59,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& /*unused*/) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "subdirs"; }
+ std::string GetName() const CM_OVERRIDE { return "subdirs"; }
cmTypeMacro(cmCTestSubdirCommand, cmCommand);
@@ -67,9 +73,9 @@ public:
};
bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
@@ -123,7 +129,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand;
c->TestHandler = this->TestHandler;
@@ -134,13 +140,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& /*unused*/) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_subdirectory"; }
+ std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
@@ -148,9 +154,9 @@ public:
};
bool cmCTestAddSubdirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+ std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
@@ -197,7 +203,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestAddTestCommand* c = new cmCTestAddTestCommand;
c->TestHandler = this->TestHandler;
@@ -208,13 +214,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const& /*args*/,
+ cmExecutionStatus& /*unused*/) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_test"; }
+ std::string GetName() const CM_OVERRIDE { return "add_test"; }
cmTypeMacro(cmCTestAddTestCommand, cmCommand);
@@ -222,7 +228,7 @@ public:
};
bool cmCTestAddTestCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+ cmExecutionStatus& /*unused*/)
{
if (args.size() < 2) {
this->SetError("called with incorrect number of arguments");
@@ -237,7 +243,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand;
c->TestHandler = this->TestHandler;
@@ -248,13 +254,13 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const& /*args*/,
+ cmExecutionStatus& /*unused*/) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_tests_properties"; }
+ std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand);
@@ -262,7 +268,7 @@ public:
};
bool cmCTestSetTestsPropertiesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+ std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
{
return this->TestHandler->SetTestsProperties(args);
}
@@ -284,14 +290,13 @@ inline int GetNextNumber(std::string const& in, int& val,
}
pos = pos2 + 1;
return 1;
+ }
+ if (in.size() - pos == 0) {
+ val = -1;
} else {
- if (in.size() - pos == 0) {
- val = -1;
- } else {
- val = atoi(in.substr(pos, in.size() - pos).c_str());
- }
- return 0;
+ val = atoi(in.substr(pos, in.size() - pos).c_str());
}
+ return 0;
}
// get the next number in a string with numbers separated by ,
@@ -311,14 +316,13 @@ inline int GetNextRealNumber(std::string const& in, double& val,
}
pos = pos2 + 1;
return 1;
+ }
+ if (in.size() - pos == 0) {
+ val = -1;
} else {
- if (in.size() - pos == 0) {
- val = -1;
- } else {
- val = atof(in.substr(pos, in.size() - pos).c_str());
- }
- return 0;
+ val = atof(in.substr(pos, in.size() - pos).c_str());
}
+ return 0;
}
cmCTestTestHandler::cmCTestTestHandler()
@@ -336,7 +340,7 @@ cmCTestTestHandler::cmCTestTestHandler()
this->MemCheck = false;
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
// regex to detect <DartMeasurement>...</DartMeasurement>
this->DartStuff.compile("(<DartMeasurement.*/DartMeasurement[a-zA-Z]*>)");
@@ -550,7 +554,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create "
<< (this->MemCheck ? "memory check" : "testing")
<< " XML file" << std::endl);
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
return 1;
}
cmXMLWriter xml(xmlfile);
@@ -558,15 +562,15 @@ int cmCTestTestHandler::ProcessHandler()
}
if (!this->PostProcessHandler()) {
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
return -1;
}
if (!failed.empty()) {
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
return -1;
}
- this->LogFile = 0;
+ this->LogFile = CM_NULLPTR;
return 0;
}
@@ -936,7 +940,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
bool randomSchedule = this->CTest->GetScheduleType() == "Random";
if (randomSchedule) {
- srand((unsigned)time(0));
+ srand((unsigned)time(CM_NULLPTR));
}
for (ListOfTests::iterator it = this->TestList.begin();
@@ -986,7 +990,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
*this->LogFile << "End testing: " << this->CTest->CurrentTime() << std::endl;
}
-void cmCTestTestHandler::GenerateTestCommand(std::vector<std::string>&, int)
+void cmCTestTestHandler::GenerateTestCommand(
+ std::vector<std::string>& /*unused*/, int /*unused*/)
{
}
@@ -1125,7 +1130,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml,
cmCTestTestResult* result)
{
if (result->Status != cmCTestTestHandler::COMPLETED &&
- result->Properties->AttachOnFail.size()) {
+ !result->Properties->AttachOnFail.empty()) {
result->Properties->AttachedFiles.insert(
result->Properties->AttachedFiles.end(),
result->Properties->AttachOnFail.begin(),
@@ -1154,7 +1159,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
int retVal = 0;
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run command: " << *it << std::endl, this->Quiet);
- if (!cmSystemTools::RunSingleCommand(it->c_str(), 0, 0, &retVal, 0,
+ if (!cmSystemTools::RunSingleCommand(it->c_str(), CM_NULLPTR, CM_NULLPTR,
+ &retVal, CM_NULLPTR,
cmSystemTools::OUTPUT_MERGE
/*this->Verbose*/) ||
retVal != 0) {
@@ -1321,7 +1327,7 @@ std::string cmCTestTestHandler::FindExecutable(
<< "Looked in the following places:\n");
for (std::vector<std::string>::iterator i = failed.begin();
i != failed.end(); ++i) {
- cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n");
+ cmCTestLog(ctest, HANDLER_OUTPUT, *i << "\n");
}
}
@@ -1351,7 +1357,7 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());
@@ -1406,7 +1412,7 @@ void cmCTestTestHandler::UseIncludeRegExp()
void cmCTestTestHandler::UseExcludeRegExp()
{
this->UseExcludeRegExpFlag = true;
- this->UseExcludeRegExpFirst = this->UseIncludeRegExpFlag ? false : true;
+ this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag;
}
const char* cmCTestTestHandler::GetTestStatus(int status)
@@ -1677,7 +1683,7 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml,
xml.Attribute(measurementfile.match(3).c_str(),
measurementfile.match(4));
xml.Attribute("encoding", "base64");
- std::stringstream ostr;
+ std::ostringstream ostr;
for (size_t cc = 0; cc < rlen; cc++) {
ostr << encoded_buffer[cc];
if (cc % 60 == 0 && cc) {
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 4b74ce0..a5e62dc 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -13,10 +13,21 @@
#ifndef cmCTestTestHandler_h
#define cmCTestTestHandler_h
+#include <cmConfigure.h>
+
#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
-
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <stddef.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+class cmCTest;
class cmMakefile;
class cmXMLWriter;
@@ -36,7 +47,7 @@ public:
/**
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
/**
* When both -R and -I are used should te resulting test list be the
@@ -54,7 +65,7 @@ public:
/**
* This method is called when reading CTest custom file
*/
- void PopulateCustomVectors(cmMakefile* mf);
+ void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
///! Control the use of the regular expresisons, call these methods to turn
/// them on
@@ -90,7 +101,7 @@ public:
*/
bool SetTestsProperties(const std::vector<std::string>& args);
- void Initialize();
+ void Initialize() CM_OVERRIDE;
// NOTE: This struct is Saved/Restored
// in cmCTestTestHandler, if you add to this class
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index f1bae5d..53382c9 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -13,6 +13,10 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+#include <vector>
cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
{
@@ -83,12 +87,12 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
this->CTest->GetInitializedHandler("update");
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate update handler");
- return 0;
+ return CM_NULLPTR;
}
handler->SetCommand(this);
if (source_dir.empty()) {
this->SetError("source directory not specified. Please use SOURCE tag");
- return 0;
+ return CM_NULLPTR;
}
handler->SetOption("SourceDirectory", source_dir.c_str());
handler->SetQuiet(this->Quiet);
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index e807193..89470e1 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -12,7 +12,15 @@
#ifndef cmCTestUpdateCommand_h
#define cmCTestUpdateCommand_h
+#include <cmConfigure.h>
+
#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+
+class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestUpdate
* \brief Run a ctest script
@@ -27,7 +35,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestUpdateCommand* ni = new cmCTestUpdateCommand;
ni->CTest = this->CTest;
@@ -38,12 +46,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_update"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_update"; }
cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand);
protected:
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
};
#endif
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 4eaa16b..bbb9430 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -14,14 +14,6 @@
#include "cmCLocaleEnvironmentScope.h"
#include "cmCTest.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmVersion.h"
-#include "cmXMLParser.h"
-#include "cmXMLWriter.h"
-#include "cmake.h"
-
#include "cmCTestBZR.h"
#include "cmCTestCVS.h"
#include "cmCTestGIT.h"
@@ -29,20 +21,13 @@
#include "cmCTestP4.h"
#include "cmCTestSVN.h"
#include "cmCTestVC.h"
+#include "cmGeneratedFileStream.h"
+#include "cmSystemTools.h"
+#include "cmVersion.h"
+#include "cmXMLWriter.h"
-#include <cmsys/auto_ptr.hxx>
-
-//#include <cmsys/RegularExpression.hxx>
-#include <cmsys/Process.h>
-
-// used for sleep
-#ifdef _WIN32
-#include "windows.h"
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
+#include <cm_auto_ptr.hxx>
+#include <sstream>
static const char* cmCTestUpdateHandlerUpdateStrings[] = {
"Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4"
@@ -159,7 +144,7 @@ int cmCTestUpdateHandler::ProcessHandler()
, this->Quiet);
// Create an object to interact with the VCS tool.
- cmsys::auto_ptr<cmCTestVC> vc;
+ CM_AUTO_PTR<cmCTestVC> vc;
switch (this->UpdateType) {
case e_CVS:
vc.reset(new cmCTestCVS(this->CTest, ofs));
@@ -334,7 +319,7 @@ bool cmCTestUpdateHandler::SelectVCS()
// If no update command was specified, lookup one for this VCS tool.
if (this->UpdateCommand.empty()) {
- const char* key = 0;
+ const char* key = CM_NULLPTR;
switch (this->UpdateType) {
case e_CVS:
key = "CVSCommand";
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
index d44e619..838ef0e 100644
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -13,9 +13,14 @@
#ifndef cmCTestUpdateHandler_h
#define cmCTestUpdateHandler_h
+#include <cmConfigure.h>
+
#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
-#include "cmListFileCache.h"
+#include <string>
+#include <utility>
+#include <vector>
/** \class cmCTestUpdateHandler
* \brief A class that handles ctest -S invocations
@@ -29,7 +34,7 @@ public:
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
cmCTestUpdateHandler();
@@ -48,7 +53,7 @@ public:
/**
* Initialize handler
*/
- virtual void Initialize();
+ void Initialize() CM_OVERRIDE;
private:
// Some structures needed for update
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index c85db02..5ea637e 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -14,6 +14,11 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestUploadHandler.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <sstream>
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
{
@@ -21,7 +26,7 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
this->CTest->GetInitializedHandler("upload");
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate upload handler");
- return 0;
+ return CM_NULLPTR;
}
static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
@@ -49,14 +54,13 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
if (cmSystemTools::FileExists(arg.c_str())) {
this->Files.insert(arg);
return true;
- } else {
- std::ostringstream e;
- e << "File \"" << arg << "\" does not exist. Cannot submit "
- << "a non-existent file.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- this->ArgumentDoing = ArgumentDoingError;
- return false;
}
+ std::ostringstream e;
+ e << "File \"" << arg << "\" does not exist. Cannot submit "
+ << "a non-existent file.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->ArgumentDoing = ArgumentDoingError;
+ return false;
}
// Look for other arguments.
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index 551be2b..da291f3 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -12,9 +12,16 @@
#ifndef cmCTestUploadCommand_h
#define cmCTestUploadCommand_h
-#include "cmCTestHandlerCommand.h"
+#include <cmConfigure.h>
#include "cmCTest.h"
+#include "cmCTestHandlerCommand.h"
+#include "cmTypeMacro.h"
+
+#include <string>
+
+class cmCTestGenericHandler;
+class cmCommand;
/** \class cmCTestUpload
* \brief Run a ctest script
@@ -30,7 +37,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmCTestUploadCommand* ni = new cmCTestUploadCommand;
ni->CTest = this->CTest;
@@ -41,15 +48,15 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "ctest_upload"; }
+ std::string GetName() const CM_OVERRIDE { return "ctest_upload"; }
cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand);
protected:
- cmCTestGenericHandler* InitializeHandler();
+ cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
- virtual bool CheckArgumentKeyword(std::string const& arg);
- virtual bool CheckArgumentValue(std::string const& arg);
+ bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE;
+ bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE;
enum
{
diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx
index 6a3b830..07d3ad7 100644
--- a/Source/CTest/cmCTestUploadHandler.cxx
+++ b/Source/CTest/cmCTestUploadHandler.cxx
@@ -15,6 +15,10 @@
#include "cmVersion.h"
#include "cmXMLWriter.h"
+#include <ostream>
+#include <set>
+#include <string>
+
cmCTestUploadHandler::cmCTestUploadHandler()
{
this->Initialize();
diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h
index 23ed35a..6503d08 100644
--- a/Source/CTest/cmCTestUploadHandler.h
+++ b/Source/CTest/cmCTestUploadHandler.h
@@ -12,7 +12,11 @@
#ifndef cmCTestUploadHandler_h
#define cmCTestUploadHandler_h
+#include <cmConfigure.h>
+
+#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmTypeMacro.h"
/** \class cmCTestUploadHandler
* \brief Helper class for CTest
@@ -26,14 +30,14 @@ public:
cmTypeMacro(cmCTestUploadHandler, cmCTestGenericHandler);
cmCTestUploadHandler();
- ~cmCTestUploadHandler() {}
+ ~cmCTestUploadHandler() CM_OVERRIDE {}
/*
* The main entry point for this class
*/
- int ProcessHandler();
+ int ProcessHandler() CM_OVERRIDE;
- void Initialize();
+ void Initialize() CM_OVERRIDE;
/** Specify a set of files to submit. */
void SetFiles(cmCTest::SetOfStrings const& files);
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index e9934e5..182364b 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -16,6 +16,10 @@
#include "cmXMLWriter.h"
#include <cmsys/Process.h>
+#include <sstream>
+#include <stdio.h>
+#include <time.h>
+#include <vector>
cmCTestVC::cmCTestVC(cmCTest* ct, std::ostream& log)
: CTest(ct)
@@ -65,7 +69,7 @@ bool cmCTestVC::InitialCheckout(const char* command)
ai != args.end(); ++ai) {
vc_co.push_back(ai->c_str());
}
- vc_co.push_back(0);
+ vc_co.push_back(CM_NULLPTR);
// Run the initial checkout command and log its output.
this->Log << "--- Begin Initial Checkout ---\n";
@@ -185,7 +189,7 @@ bool cmCTestVC::WriteXML(cmXMLWriter& xml)
return result;
}
-bool cmCTestVC::WriteXMLUpdates(cmXMLWriter&)
+bool cmCTestVC::WriteXMLUpdates(cmXMLWriter& /*unused*/)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"* CTest cannot extract updates for this VCS tool.\n");
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 4ae38eb..8063e40 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -12,8 +12,13 @@
#ifndef cmCTestVC_h
#define cmCTestVC_h
+#include <cmConfigure.h>
+
#include "cmProcessTools.h"
+#include <iosfwd>
+#include <string>
+
class cmCTest;
class cmXMLWriter;
@@ -93,7 +98,6 @@ public:
};
protected:
- struct File;
friend struct File;
/** Represent change to one file. */
@@ -104,8 +108,8 @@ protected:
Revision const* PriorRev;
File()
: Status(PathUpdated)
- , Rev(0)
- , PriorRev(0)
+ , Rev(CM_NULLPTR)
+ , PriorRev(CM_NULLPTR)
{
}
File(PathStatus status, Revision const* rev, Revision const* priorRev)
@@ -121,11 +125,11 @@ protected:
/** Run a command line and send output to given parsers. */
bool RunChild(char const* const* cmd, OutputParser* out, OutputParser* err,
- const char* workDir = 0);
+ const char* workDir = CM_NULLPTR);
/** Run VC update command line and send output to given parsers. */
bool RunUpdateCommand(char const* const* cmd, OutputParser* out,
- OutputParser* err = 0);
+ OutputParser* err = CM_NULLPTR);
/** Write xml element for one file. */
void WriteXMLEntry(cmXMLWriter& xml, std::string const& path,
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index fa539e4..28077ff 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -11,10 +11,11 @@
============================================================================*/
#include "cmParseBlanketJSCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
-#include <cmsys/Directory.hxx>
+
#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
#include <stdio.h>
#include <stdlib.h>
@@ -42,9 +43,8 @@ public:
std::string foundFileName =
line.substr(begIndex + 3, endIndex - (begIndex + 4));
return foundFileName;
- } else {
- return line.substr(begIndex, line.npos);
}
+ return line.substr(begIndex, line.npos);
}
bool ParseFile(std::string const& file)
{
diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h
index a4f6670..ece1efa 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.h
+++ b/Source/CTest/cmParseBlanketJSCoverage.h
@@ -13,7 +13,13 @@
#ifndef cmParseBlanketJSCoverage_h
#define cmParseBlanketJSCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParseBlanketJSCoverage
* \brief Parse BlanketJS coverage information
@@ -39,6 +45,7 @@ public:
protected:
class JSONParser;
+
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index 0916da2..23176b5 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -1,11 +1,15 @@
#include "cmParseCacheCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
+
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
+#include <map>
#include <stdio.h>
#include <stdlib.h>
+#include <utility>
cmParseCacheCoverage::cmParseCacheCoverage(
cmCTestCoverageHandlerContainer& cont, cmCTest* ctest)
diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h
index bd331d0..4fa6c26 100644
--- a/Source/CTest/cmParseCacheCoverage.h
+++ b/Source/CTest/cmParseCacheCoverage.h
@@ -13,8 +13,16 @@
#ifndef cmParseCacheCoverage_h
#define cmParseCacheCoverage_h
+#include <cmConfigure.h>
+
#include "cmParseMumpsCoverage.h"
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
+
/** \class cmParseCacheCoverage
* \brief Parse Cache coverage information
*
@@ -28,7 +36,7 @@ public:
protected:
// implement virtual from parent
- bool LoadCoverageData(const char* dir);
+ bool LoadCoverageData(const char* dir) CM_OVERRIDE;
// remove files with no coverage
void RemoveUnCoveredFiles();
// Read a single mcov file
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 3bdae17..0b6d3ce 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -1,9 +1,14 @@
#include "cmParseCoberturaCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
-#include <cmsys/Directory.hxx>
+
+#include <cmConfigure.h>
#include <cmsys/FStream.hxx>
+#include <stdlib.h>
+#include <string.h>
class cmParseCoberturaCoverage::XMLParser : public cmXMLParser
{
@@ -20,10 +25,10 @@ public:
this->CurFileName = "";
}
- virtual ~XMLParser() {}
+ ~XMLParser() CM_OVERRIDE {}
protected:
- virtual void EndElement(const std::string& name)
+ void EndElement(const std::string& name) CM_OVERRIDE
{
if (name == "source") {
this->InSource = false;
@@ -34,7 +39,7 @@ protected:
}
}
- virtual void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
std::string tmp;
tmp.insert(0, data, length);
@@ -46,7 +51,7 @@ protected:
}
}
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
std::string FoundSource;
std::string finalpath = "";
diff --git a/Source/CTest/cmParseCoberturaCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h
index 4fa6d10..f45ec95 100644
--- a/Source/CTest/cmParseCoberturaCoverage.h
+++ b/Source/CTest/cmParseCoberturaCoverage.h
@@ -13,7 +13,13 @@
#ifndef cmParseCoberturaCoverage_h
#define cmParseCoberturaCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParsePythonCoverage
* \brief Parse coverage.py Python coverage information
@@ -40,6 +46,7 @@ public:
private:
class XMLParser;
+
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
std::string CurFileName;
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 9d86ce9..7fe91f4 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -1,8 +1,9 @@
#include "cmParseDelphiCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
-#include "cmXMLParser.h"
-#include <cmsys/Directory.hxx>
+
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <stdio.h>
diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h
index c1c495c..82557d9 100644
--- a/Source/CTest/cmParseDelphiCoverage.h
+++ b/Source/CTest/cmParseDelphiCoverage.h
@@ -13,7 +13,13 @@
#ifndef cmParseDelphiCoverage_h
#define cmParseDelphiCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParseDelphiCoverage
* \brief Parse Delphi coverage information
@@ -35,6 +41,7 @@ public:
protected:
class HTMLParser;
+
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 33ad839..214ce5a 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -1,11 +1,15 @@
#include "cmParseGTMCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
+
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
+#include <map>
#include <stdio.h>
#include <stdlib.h>
+#include <vector>
cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest)
diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h
index bc2f2ec..623cd5a 100644
--- a/Source/CTest/cmParseGTMCoverage.h
+++ b/Source/CTest/cmParseGTMCoverage.h
@@ -13,8 +13,15 @@
#ifndef cmParseGTMCoverage_h
#define cmParseGTMCoverage_h
+#include <cmConfigure.h>
+
#include "cmParseMumpsCoverage.h"
+#include <string>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
+
/** \class cmParseGTMCoverage
* \brief Parse GTM coverage information
*
@@ -28,7 +35,7 @@ public:
protected:
// implement virtual from parent
- bool LoadCoverageData(const char* dir);
+ bool LoadCoverageData(const char* dir) CM_OVERRIDE;
// Read a single mcov file
bool ReadMCovFile(const char* f);
// find out what line in a mumps file (filepath) the given entry point
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 335535d..0e36c01 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -1,12 +1,17 @@
#include "cmParseJacocoCoverage.h"
+#include <cmConfigure.h>
+
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
+
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
-#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
class cmParseJacocoCoverage::XMLParser : public cmXMLParser
{
@@ -20,12 +25,12 @@ public:
this->PackageName = "";
}
- virtual ~XMLParser() {}
+ ~XMLParser() CM_OVERRIDE {}
protected:
- virtual void EndElement(const std::string&) {}
+ void EndElement(const std::string& /*name*/) CM_OVERRIDE {}
- virtual void StartElement(const std::string& name, const char** atts)
+ void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
if (name == "package") {
this->PackageName = atts[1];
@@ -111,7 +116,7 @@ protected:
gl.RecurseThroughSymlinksOn();
gl.FindFiles(packageGlob);
std::vector<std::string> const& files = gl.GetFiles();
- if (files.size() == 0) {
+ if (files.empty()) {
return false;
}
diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h
index bcd472e..4b94725 100644
--- a/Source/CTest/cmParseJacocoCoverage.h
+++ b/Source/CTest/cmParseJacocoCoverage.h
@@ -13,7 +13,14 @@
#ifndef cmParseJacocoCoverage_h
#define cmParseJacocoCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
+#include <vector>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParseJacocoCoverage
* \brief Parse JaCoCO coverage information
@@ -47,6 +54,7 @@ private:
bool LoadSource(std::string d);
class XMLParser;
+
std::map<std::string, std::string> RoutineToDirectory;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index e5dd74a..ab8be76 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -1,11 +1,16 @@
-#include "cmParseGTMCoverage.h"
+#include "cmParseMumpsCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
-#include <cmsys/Directory.hxx>
+
+#include <cmConfigure.h>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
-#include <stdio.h>
-#include <stdlib.h>
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
cmParseMumpsCoverage::cmParseMumpsCoverage(
cmCTestCoverageHandlerContainer& cont, cmCTest* ctest)
@@ -128,16 +133,15 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
if (i != this->RoutineToDirectory.end()) {
filepath = i->second;
return true;
- } else {
- // try some alternate names
- const char* tryname[] = { "GUX", "GTM", "ONT", 0 };
- for (int k = 0; tryname[k] != 0; k++) {
- std::string routine2 = routine + tryname[k];
- i = this->RoutineToDirectory.find(routine2);
- if (i != this->RoutineToDirectory.end()) {
- filepath = i->second;
- return true;
- }
+ }
+ // try some alternate names
+ const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR };
+ for (int k = 0; tryname[k] != CM_NULLPTR; k++) {
+ std::string routine2 = routine + tryname[k];
+ i = this->RoutineToDirectory.find(routine2);
+ if (i != this->RoutineToDirectory.end()) {
+ filepath = i->second;
+ return true;
}
}
return false;
diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h
index 3761ba6..8b33bd7 100644
--- a/Source/CTest/cmParseMumpsCoverage.h
+++ b/Source/CTest/cmParseMumpsCoverage.h
@@ -13,7 +13,13 @@
#ifndef cmParseMumpsCoverage_h
#define cmParseMumpsCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParseMumpsCoverage
* \brief Parse Mumps coverage information
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index eb0d962..d8bb31b 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -1,8 +1,13 @@
#include "cmParsePHPCoverage.h"
+#include "cmCTest.h"
+#include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h"
+
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
+#include <stdlib.h>
+#include <string.h>
/*
To setup coverage for php.
@@ -27,10 +32,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
char c = 0;
while (in.get(c) && c != until) {
}
- if (c != until) {
- return false;
- }
- return true;
+ return c == until;
}
bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
std::string const& fileName)
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index 72f9129..b261a8d 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -13,7 +13,13 @@
#ifndef cmParsePHPCoverage_h
#define cmParsePHPCoverage_h
-#include "cmCTestCoverageHandler.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <iosfwd>
+#include <string>
+
+class cmCTest;
+class cmCTestCoverageHandlerContainer;
/** \class cmParsePHPCoverage
* \brief Parse xdebug PHP coverage information
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index db5151c..51aed79 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -9,14 +9,15 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
+#include "cmProcess.h"
-#include <cmProcess.h>
-
+#include <cmConfigure.h>
#include <cmSystemTools.h>
+#include <iostream>
cmProcess::cmProcess()
{
- this->Process = 0;
+ this->Process = CM_NULLPTR;
this->Timeout = 0;
this->TotalTime = 0;
this->ExitValue = 0;
@@ -52,7 +53,7 @@ bool cmProcess::StartProcess()
i != this->Arguments.end(); ++i) {
this->ProcessArgs.push_back(i->c_str());
}
- this->ProcessArgs.push_back(0); // null terminate the list
+ this->ProcessArgs.push_back(CM_NULLPTR); // null terminate the list
this->Process = cmsysProcess_New();
cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin());
if (!this->WorkingDirectory.empty()) {
@@ -124,10 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
int p = cmsysProcess_WaitForData(this->Process, &data, &length, &timeout);
if (p == cmsysProcess_Pipe_Timeout) {
return cmsysProcess_Pipe_Timeout;
- } else if (p == cmsysProcess_Pipe_STDOUT) {
+ }
+ if (p == cmsysProcess_Pipe_STDOUT) {
this->Output.insert(this->Output.end(), data, data + length);
- } else // p == cmsysProcess_Pipe_None
- {
+ } else { // p == cmsysProcess_Pipe_None
// The process will provide no more data.
break;
}
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index d5e2721..2a6fa7c 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -12,9 +12,11 @@
#ifndef cmProcess_h
#define cmProcess_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <cmsys/Process.h>
+#include <string>
+#include <vector>
/** \class cmProcess
* \brief run a process with c++
diff --git a/Source/Checks/cm_cxx11_unordered_map.cmake b/Source/Checks/cm_cxx11_unordered_map.cmake
deleted file mode 100644
index 80fe391..0000000
--- a/Source/Checks/cm_cxx11_unordered_map.cmake
+++ /dev/null
@@ -1,25 +0,0 @@
-
-if(CMAKE_CXX_STANDARD AND NOT DEFINED CMake_HAVE_CXX11_UNORDERED_MAP)
- message(STATUS "Checking if compiler supports C++11 unordered_map")
- try_compile(CMake_HAVE_CXX11_UNORDERED_MAP
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_LIST_DIR}/cm_cxx11_unordered_map.cpp
- CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
- OUTPUT_VARIABLE OUTPUT
- )
- if(CMake_HAVE_CXX11_UNORDERED_MAP)
- message(STATUS "Checking if compiler supports C++11 unordered_map - yes")
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if compiler supports C++11 unordered_map passed with the following output:\n"
- "${OUTPUT}\n"
- "\n"
- )
- else()
- message(STATUS "Checking if compiler supports C++11 unordered_map - no")
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if compiler supports C++11 unordered_map failed with the following output:\n"
- "${OUTPUT}\n"
- "\n"
- )
- endif()
-endif()
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
new file mode 100644
index 0000000..6fde7b6
--- /dev/null
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -0,0 +1,39 @@
+
+function(cm_check_cxx_feature name)
+ string(TOUPPER ${name} FEATURE)
+ if(NOT DEFINED CMake_HAVE_CXX_${FEATURE})
+ message(STATUS "Checking if compiler supports C++ ${name}")
+ try_compile(CMake_HAVE_CXX_${FEATURE}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
+ CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+ OUTPUT_VARIABLE OUTPUT
+ )
+ # If using the feature causes warnings, treat it as broken/unavailable.
+ if(OUTPUT MATCHES "warning")
+ set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
+ endif()
+ if(CMake_HAVE_CXX_${FEATURE})
+ message(STATUS "Checking if compiler supports C++ ${name} - yes")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if compiler supports C++ ${name} passed with the following output:\n"
+ "${OUTPUT}\n"
+ "\n"
+ )
+ else()
+ message(STATUS "Checking if compiler supports C++ ${name} - no")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if compiler supports C++ ${name} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "\n"
+ )
+ endif()
+ endif()
+endfunction()
+
+if(CMAKE_CXX_STANDARD)
+ cm_check_cxx_feature(nullptr)
+ cm_check_cxx_feature(override)
+ cm_check_cxx_feature(unordered_map)
+ cm_check_cxx_feature(unordered_set)
+endif()
diff --git a/Source/Checks/cm_cxx_nullptr.cxx b/Source/Checks/cm_cxx_nullptr.cxx
new file mode 100644
index 0000000..500684a
--- /dev/null
+++ b/Source/Checks/cm_cxx_nullptr.cxx
@@ -0,0 +1,14 @@
+int test(int)
+{
+ return -1;
+}
+
+int test(int*)
+{
+ return 0;
+}
+
+int main()
+{
+ return test(nullptr);
+}
diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx
new file mode 100644
index 0000000..5a33fbb
--- /dev/null
+++ b/Source/Checks/cm_cxx_override.cxx
@@ -0,0 +1,24 @@
+struct Foo
+{
+ Foo() {}
+ virtual ~Foo() {}
+ virtual int test() const = 0;
+};
+
+struct Bar : Foo
+{
+ Bar() {}
+ ~Bar() override {}
+ int test() const override { return 0; }
+};
+
+int test(Foo const& foo)
+{
+ return foo.test();
+}
+
+int main()
+{
+ Bar const bar;
+ return test(bar);
+}
diff --git a/Source/Checks/cm_cxx11_unordered_map.cpp b/Source/Checks/cm_cxx_unordered_map.cxx
index be3de25..be3de25 100644
--- a/Source/Checks/cm_cxx11_unordered_map.cpp
+++ b/Source/Checks/cm_cxx_unordered_map.cxx
diff --git a/Source/Checks/cm_cxx_unordered_set.cxx b/Source/Checks/cm_cxx_unordered_set.cxx
new file mode 100644
index 0000000..de4bb77
--- /dev/null
+++ b/Source/Checks/cm_cxx_unordered_set.cxx
@@ -0,0 +1,7 @@
+#include <unordered_set>
+int main()
+{
+ std::unordered_set<int> set;
+ set.insert(0);
+ return 0;
+}
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index 93ff425..55599b6 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -48,4 +48,4 @@ else()
endif()
CMake_OPTIONAL_COMPONENT(ccmake)
-install(TARGETS ccmake DESTINATION bin ${COMPONENT})
+install(TARGETS ccmake DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT})
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index be8751c..80bb55d 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -24,33 +24,34 @@
#include <form.h>
static const char* cmDocumentationName[][2] = {
- { 0, " ccmake - Curses Interface for CMake." },
- { 0, 0 }
+ { CM_NULLPTR, " ccmake - Curses Interface for CMake." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationUsage[][2] = {
- { 0, " ccmake <path-to-source>\n"
- " ccmake <path-to-existing-build>" },
- { 0, "Specify a source directory to (re-)generate a build system for "
- "it in the current working directory. Specify an existing build "
- "directory to re-generate its build system." },
- { 0, 0 }
+ { CM_NULLPTR, " ccmake <path-to-source>\n"
+ " ccmake <path-to-existing-build>" },
+ { CM_NULLPTR,
+ "Specify a source directory to (re-)generate a build system for "
+ "it in the current working directory. Specify an existing build "
+ "directory to re-generate its build system." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationUsageNote[][2] = {
- { 0, "Run 'ccmake --help' for more information." },
- { 0, 0 }
+ { CM_NULLPTR, "Run 'ccmake --help' for more information." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationOptions[]
[2] = { CMAKE_STANDARD_OPTIONS_TABLE,
- { 0, 0 } };
+ { CM_NULLPTR, CM_NULLPTR } };
-cmCursesForm* cmCursesForm::CurrentForm = 0;
+cmCursesForm* cmCursesForm::CurrentForm = CM_NULLPTR;
extern "C" {
-void onsig(int)
+void onsig(int /*unused*/)
{
if (cmCursesForm::CurrentForm) {
endwin();
@@ -69,8 +70,8 @@ void onsig(int)
}
}
-void CMakeMessageHandler(const char* message, const char* title, bool&,
- void* clientData)
+void CMakeMessageHandler(const char* message, const char* title,
+ bool& /*unused*/, void* clientData)
{
cmCursesForm* self = static_cast<cmCursesForm*>(clientData);
self->AddError(message, title);
@@ -176,7 +177,7 @@ int main(int argc, char const* const* argv)
touchwin(stdscr);
endwin();
delete cmCursesForm::CurrentForm;
- cmCursesForm::CurrentForm = 0;
+ cmCursesForm::CurrentForm = CM_NULLPTR;
std::cout << std::endl << std::endl;
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx
index 0055e88..99f7dcc 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.cxx
+++ b/Source/CursesDialog/cmCursesBoolWidget.cxx
@@ -24,11 +24,13 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left,
this->SetValueAsBool(false);
}
-bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w)
+bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/,
+ WINDOW* w)
{
+ // toggle boolean values with enter or space
// 10 == enter
- if (key == 10 || key == KEY_ENTER) {
+ if (key == 10 || key == KEY_ENTER || key == ' ') {
if (this->GetValueAsBool()) {
this->SetValueAsBool(false);
} else {
@@ -38,9 +40,8 @@ bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w)
touchwin(w);
wrefresh(w);
return true;
- } else {
- return false;
}
+ return false;
}
void cmCursesBoolWidget::SetValueAsBool(bool value)
@@ -54,9 +55,5 @@ void cmCursesBoolWidget::SetValueAsBool(bool value)
bool cmCursesBoolWidget::GetValueAsBool()
{
- if (this->Value == "ON") {
- return true;
- } else {
- return false;
- }
+ return this->Value == "ON";
}
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index 49be45a..d2899ee 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -25,7 +25,7 @@ public:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
// handled.
- virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
// Description:
// Set/Get the value (on/off).
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index bdfc8e9..462cb6e 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -32,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
{
this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key);
this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
- this->Entry = 0;
+ this->Entry = CM_NULLPTR;
this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
}
@@ -50,7 +50,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
}
- this->Entry = 0;
+ this->Entry = CM_NULLPTR;
const char* value = cm->GetState()->GetCacheEntryValue(key);
assert(value);
switch (cm->GetState()->GetCacheEntryType(key)) {
@@ -110,7 +110,6 @@ const char* cmCursesCacheEntryComposite::GetValue()
{
if (this->Label) {
return this->Label->GetValue();
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 8ed3902..c9c8238 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -14,6 +14,8 @@
#include "cmCursesLabelWidget.h"
+class cmake;
+
class cmCursesCacheEntryComposite
{
public:
diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx
index 3cd36af..a960090 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.cxx
+++ b/Source/CursesDialog/cmCursesDummyWidget.cxx
@@ -18,7 +18,8 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left,
this->Type = cmState::INTERNAL;
}
-bool cmCursesDummyWidget::HandleInput(int&, cmCursesMainForm*, WINDOW*)
+bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/,
+ WINDOW* /*w*/)
{
return false;
}
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index 9a3df29..e6ca91e 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -25,7 +25,7 @@ public:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
// handled.
- virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
protected:
cmCursesDummyWidget(const cmCursesDummyWidget& from);
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index aa4710f..b3320c9 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -16,7 +16,7 @@ bool cmCursesForm::Debug = false;
cmCursesForm::cmCursesForm()
{
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
cmCursesForm::~cmCursesForm()
@@ -24,7 +24,7 @@ cmCursesForm::~cmCursesForm()
if (this->Form) {
unpost_form(this->Form);
free_form(this->Form);
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
}
diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx
index e9da71e..784738b 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.cxx
+++ b/Source/CursesDialog/cmCursesLabelWidget.cxx
@@ -25,7 +25,8 @@ cmCursesLabelWidget::~cmCursesLabelWidget()
{
}
-bool cmCursesLabelWidget::HandleInput(int&, cmCursesMainForm*, WINDOW*)
+bool cmCursesLabelWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/,
+ WINDOW* /*w*/)
{
// Static text. No input is handled here.
return false;
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index c31a58c..ff645af 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -21,13 +21,13 @@ class cmCursesLabelWidget : public cmCursesWidget
public:
cmCursesLabelWidget(int width, int height, int left, int top,
const std::string& name);
- virtual ~cmCursesLabelWidget();
+ ~cmCursesLabelWidget() CM_OVERRIDE;
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
// handled
- virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
protected:
cmCursesLabelWidget(const cmCursesLabelWidget& from);
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 84672ae..47f98a2 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -32,8 +32,8 @@ cmCursesLongMessageForm::cmCursesLongMessageForm(
this->Messages += "\n\n";
}
this->Title = title;
- this->Fields[0] = 0;
- this->Fields[1] = 0;
+ this->Fields[0] = CM_NULLPTR;
+ this->Fields[1] = CM_NULLPTR;
}
cmCursesLongMessageForm::~cmCursesLongMessageForm()
@@ -54,9 +54,9 @@ void cmCursesLongMessageForm::UpdateStatusBar()
size = cmCursesMainForm::MAX_WIDTH - 1;
}
strncpy(bar, this->Title.c_str(), size);
- for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++)
+ for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) {
bar[i] = ' ';
-
+ }
int width;
if (x < cmCursesMainForm::MAX_WIDTH) {
width = x;
@@ -102,7 +102,8 @@ void cmCursesLongMessageForm::PrintKeys()
pos_form_cursor(this->Form);
}
-void cmCursesLongMessageForm::Render(int, int, int, int)
+void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
+ int /*height*/)
{
int x, y;
getmaxyx(stdscr, y, x);
@@ -110,7 +111,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
if (this->Form) {
unpost_form(this->Form);
free_form(this->Form);
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
const char* msg = this->Messages.c_str();
@@ -119,7 +120,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
if (this->Fields[0]) {
free_field(this->Fields[0]);
- this->Fields[0] = 0;
+ this->Fields[0] = CM_NULLPTR;
}
this->Fields[0] = new_field(y - 6, x - 2, 1, 1, 0, 0);
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index 73ccfc4..a12ed2f 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -23,16 +23,16 @@ class cmCursesLongMessageForm : public cmCursesForm
public:
cmCursesLongMessageForm(std::vector<std::string> const& messages,
const char* title);
- virtual ~cmCursesLongMessageForm();
+ ~cmCursesLongMessageForm() CM_OVERRIDE;
// Description:
// Handle user input.
- virtual void HandleInput();
+ void HandleInput() CM_OVERRIDE;
// Description:
// Display form. Use a window of size width x height, starting
// at top, left.
- virtual void Render(int left, int top, int width, int height);
+ void Render(int left, int top, int width, int height) CM_OVERRIDE;
// Description:
// This method should normally called only by the form.
@@ -42,7 +42,7 @@ public:
// Description:
// This method should normally called only by the form.
// The only exception is during a resize.
- virtual void UpdateStatusBar();
+ void UpdateStatusBar() CM_OVERRIDE;
protected:
cmCursesLongMessageForm(const cmCursesLongMessageForm& from);
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index b740eb0..1d036c4 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -36,8 +36,8 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
, InitialWidth(initWidth)
{
this->NumberOfPages = 0;
- this->Fields = 0;
- this->Entries = 0;
+ this->Fields = CM_NULLPTR;
+ this->Entries = CM_NULLPTR;
this->AdvancedMode = false;
this->NumberOfVisibleEntries = 0;
this->OkToGenerate = false;
@@ -64,7 +64,7 @@ cmCursesMainForm::~cmCursesMainForm()
if (this->Form) {
unpost_form(this->Form);
free_form(this->Form);
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
delete[] this->Fields;
@@ -75,7 +75,7 @@ cmCursesMainForm::~cmCursesMainForm()
delete this->Entries;
if (this->CMakeInstance) {
delete this->CMakeInstance;
- this->CMakeInstance = 0;
+ this->CMakeInstance = CM_NULLPTR;
}
}
@@ -185,7 +185,7 @@ void cmCursesMainForm::RePost()
if (this->Form) {
unpost_form(this->Form);
free_form(this->Form);
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
delete[] this->Fields;
if (this->AdvancedMode) {
@@ -215,7 +215,7 @@ void cmCursesMainForm::RePost()
this->Fields = new FIELD*[3 * this->NumberOfVisibleEntries + 1];
size_t cc;
for (cc = 0; cc < 3 * this->NumberOfVisibleEntries + 1; cc++) {
- this->Fields[cc] = 0;
+ this->Fields[cc] = CM_NULLPTR;
}
// Assign fields
@@ -244,7 +244,7 @@ void cmCursesMainForm::RePost()
this->NumberOfVisibleEntries = 1;
}
// Has to be null terminated.
- this->Fields[3 * this->NumberOfVisibleEntries] = 0;
+ this->Fields[3 * this->NumberOfVisibleEntries] = CM_NULLPTR;
}
void cmCursesMainForm::Render(int left, int top, int width, int height)
@@ -263,7 +263,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
// Delete the previous form
unpost_form(this->Form);
free_form(this->Form);
- this->Form = 0;
+ this->Form = CM_NULLPTR;
}
// Wrong window size
@@ -345,7 +345,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
}
// Give the current widget (if it exists), a chance to print keys
- cmCursesWidget* cw = 0;
+ cmCursesWidget* cw = CM_NULLPTR;
if (this->Form) {
FIELD* currentField = current_field(this->Form);
cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
@@ -388,7 +388,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
curses_move(y - 4, 0);
char fmt_s[] = "%s";
- char fmt[512] = "Press [enter] to edit option";
+ char fmt[512] = "Press [enter] to edit option Press [d] to delete an entry";
if (process) {
strcpy(fmt, " ");
}
@@ -434,7 +434,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Get the key of the current entry
FIELD* cur = current_field(this->Form);
int findex = field_index(cur);
- cmCursesWidget* lbl = 0;
+ cmCursesWidget* lbl = CM_NULLPTR;
if (findex >= 0) {
lbl = reinterpret_cast<cmCursesWidget*>(
field_userptr(this->Fields[findex - 2]));
@@ -566,7 +566,7 @@ int cmCursesMainForm::Configure(int noconfigure)
this->FillCacheManagerFromUI();
this->CMakeInstance->SaveCache(
this->CMakeInstance->GetHomeOutputDirectory());
- this->LoadCache(0);
+ this->LoadCache(CM_NULLPTR);
// Get rid of previous errors
this->Errors = std::vector<std::string>();
@@ -583,7 +583,7 @@ int cmCursesMainForm::Configure(int noconfigure)
} else {
retVal = this->CMakeInstance->Configure();
}
- this->CMakeInstance->SetProgressCallback(0, 0);
+ this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
keypad(stdscr, TRUE); /* Use key symbols as
KEY_DOWN*/
@@ -638,7 +638,7 @@ int cmCursesMainForm::Generate()
// run the generate process
int retVal = this->CMakeInstance->Generate();
- this->CMakeInstance->SetProgressCallback(0, 0);
+ this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
keypad(stdscr, TRUE); /* Use key symbols as
KEY_DOWN*/
@@ -675,7 +675,7 @@ int cmCursesMainForm::Generate()
return 0;
}
-void cmCursesMainForm::AddError(const char* message, const char*)
+void cmCursesMainForm::AddError(const char* message, const char* /*unused*/)
{
this->Errors.push_back(message);
}
@@ -837,7 +837,9 @@ void cmCursesMainForm::HandleInput()
// therefore, the label field for the prev. entry is index-5
// and the label field for the next entry is index+1
// (index always corresponds to the value field)
- else if (key == KEY_DOWN || key == ctrl('n')) {
+ // scroll down with arrow down, ctrl+n (emacs binding), or j (vim
+ // binding)
+ else if (key == KEY_DOWN || key == ctrl('n') || key == 'j') {
FIELD* cur = current_field(this->Form);
size_t findex = field_index(cur);
if (findex == 3 * this->NumberOfVisibleEntries - 1) {
@@ -854,7 +856,8 @@ void cmCursesMainForm::HandleInput()
// therefore, the label field for the prev. entry is index-5
// and the label field for the next entry is index+1
// (index always corresponds to the value field)
- else if (key == KEY_UP || key == ctrl('p')) {
+ // scroll down with arrow up, ctrl+p (emacs binding), or k (vim binding)
+ else if (key == KEY_UP || key == ctrl('p') || key == 'k') {
FIELD* cur = current_field(this->Form);
int findex = field_index(cur);
if (findex == 2) {
@@ -888,7 +891,7 @@ void cmCursesMainForm::HandleInput()
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(
field_userptr(this->Fields[findex - 2]));
const char* curField = lbl->GetValue();
- const char* helpString = 0;
+ const char* helpString = CM_NULLPTR;
const char* existingValue =
this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
@@ -973,7 +976,7 @@ void cmCursesMainForm::HandleInput()
// (findex always corresponds to the value field)
FIELD* nextCur;
if (findex == 2) {
- nextCur = 0;
+ nextCur = CM_NULLPTR;
} else if (findex == 3 * this->NumberOfVisibleEntries - 1) {
nextCur = this->Fields[findex - 5];
} else {
@@ -1003,7 +1006,7 @@ void cmCursesMainForm::HandleInput()
if (nextCur) {
// make the next or prev. current field after deletion
- nextCur = 0;
+ nextCur = CM_NULLPTR;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end();
++it) {
@@ -1025,7 +1028,7 @@ void cmCursesMainForm::HandleInput()
}
}
-int cmCursesMainForm::LoadCache(const char*)
+int cmCursesMainForm::LoadCache(const char* /*unused*/)
{
int r = this->CMakeInstance->LoadCache();
@@ -1052,7 +1055,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
int findex = start_index;
for (;;) {
if (!str.empty()) {
- cmCursesWidget* lbl = 0;
+ cmCursesWidget* lbl = CM_NULLPTR;
if (findex >= 0) {
lbl = reinterpret_cast<cmCursesWidget*>(
field_userptr(this->Fields[findex - 2]));
@@ -1122,16 +1125,17 @@ const char* cmCursesMainForm::s_ConstHelpMessage =
"Navigation: "
"You can use the arrow keys and page up, down to navigate the options. "
"Alternatively, you can use the following keys: \n"
- " C-n : next option\n"
- " C-p : previous options\n"
+ " C-n or j : next option\n"
+ " C-p or k : previous options\n"
" C-d : down one page\n"
" C-u : up one page\n\n"
"Editing options: "
"To change an option press enter or return. If the current options is a "
- "boolean, this will toggle it's value. "
- "Otherwise, ccmake will enter edit mode. In this mode you can edit an "
- "option using arrow keys and backspace. Alternatively, you can use the "
- "following keys:\n"
+ "boolean, this will toggle its value. "
+ "Otherwise, ccmake will enter edit mode. Alternatively, you can toggle "
+ "a bool variable by pressing space, and enter edit mode with i."
+ "In this mode you can edit an option using arrow keys and backspace. "
+ "Alternatively, you can use the following keys:\n"
" C-b : back one character\n"
" C-f : forward one character\n"
" C-a : go to the beginning of the field\n"
@@ -1140,7 +1144,6 @@ const char* cmCursesMainForm::s_ConstHelpMessage =
" C-k : kill the rest of the field\n"
" Esc : Restore field (discard last changes)\n"
" Enter : Leave edit mode\n"
- "You can also delete an option by pressing 'd'\n\n"
"Commands:\n"
" q : quit ccmake without generating build files\n"
" h : help, shows this screen\n"
@@ -1148,6 +1151,7 @@ const char* cmCursesMainForm::s_ConstHelpMessage =
" g : generate build files and exit, only available when there are no "
"new options and no errors have been detected during last configuration.\n"
" l : shows last errors\n"
+ " d : delete an option\n"
" t : toggles advanced mode. In normal mode, only the most important "
"options are shown. In advanced mode, all options are shown. We recommend "
"using normal mode unless you are an expert.\n"
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 9aa0f67..d17ee33 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -30,7 +30,7 @@ class cmCursesMainForm : public cmCursesForm
{
public:
cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
- virtual ~cmCursesMainForm();
+ ~cmCursesMainForm() CM_OVERRIDE;
/**
* Set the widgets which represent the cache entries.
@@ -40,13 +40,13 @@ public:
/**
* Handle user input.
*/
- virtual void HandleInput();
+ void HandleInput() CM_OVERRIDE;
/**
* Display form. Use a window of size width x height, starting
* at top, left.
*/
- virtual void Render(int left, int top, int width, int height);
+ void Render(int left, int top, int width, int height) CM_OVERRIDE;
/**
* Returns true if an entry with the given key is in the
@@ -67,7 +67,7 @@ public:
* exception is during a resize. The optional argument specifies the
* string to be displayed in the status bar.
*/
- virtual void UpdateStatusBar() { this->UpdateStatusBar(0); }
+ void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(CM_NULLPTR); }
virtual void UpdateStatusBar(const char* message);
/**
@@ -83,7 +83,7 @@ public:
* During a CMake run, an error handle should add errors
* to be displayed afterwards.
*/
- virtual void AddError(const char* message, const char* title);
+ void AddError(const char* message, const char* title) CM_OVERRIDE;
/**
* Used to do a configure. If argument is specified, it does only the check
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index 1a3a8c2..9a88aef 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -13,10 +13,7 @@
#include "cmCursesMainForm.h"
-inline int ctrl(int z)
-{
- return (z & 037);
-}
+#define ctrl(z) ((z)&037)
cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
int top)
@@ -31,27 +28,30 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
field_opts_off(this->Field, O_STATIC);
}
-bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w)
+bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/,
+ WINDOW* w)
{
-
- // 10 == enter
- if (key == 10 || key == KEY_ENTER) {
- this->NextOption();
- touchwin(w);
- wrefresh(w);
- return true;
- } else if (key == KEY_LEFT || key == ctrl('b')) {
- touchwin(w);
- wrefresh(w);
- this->PreviousOption();
- return true;
- } else if (key == KEY_RIGHT || key == ctrl('f')) {
- this->NextOption();
- touchwin(w);
- wrefresh(w);
- return true;
- } else {
- return false;
+ switch (key) {
+ case 10: // 10 == enter
+ case KEY_ENTER:
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ case KEY_LEFT:
+ case ctrl('b'):
+ touchwin(w);
+ wrefresh(w);
+ this->PreviousOption();
+ return true;
+ case KEY_RIGHT:
+ case ctrl('f'):
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ default:
+ return false;
}
}
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index a17f2d5..f88b6bc 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -25,7 +25,7 @@ public:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
// handled.
- virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
void SetOption(const std::string&);
void AddOption(std::string const&);
void NextOption();
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index 18d298a..cd26df6 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -23,9 +23,9 @@ public:
* This method is called when different keys are pressed. The
* subclass can have a special implementation handler for this.
*/
- virtual void OnTab(cmCursesMainForm* fm, WINDOW* w);
- virtual void OnReturn(cmCursesMainForm* fm, WINDOW* w);
- virtual void OnType(int& key, cmCursesMainForm* fm, WINDOW* w);
+ void OnTab(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
+ void OnReturn(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
+ void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
protected:
cmCursesPathWidget(const cmCursesPathWidget& from);
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 3707d0d..db98a00 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -29,12 +29,13 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left,
field_opts_off(this->Field, O_STATIC);
}
-void cmCursesStringWidget::OnTab(cmCursesMainForm*, WINDOW*)
+void cmCursesStringWidget::OnTab(cmCursesMainForm* /*unused*/,
+ WINDOW* /*unused*/)
{
// FORM* form = fm->GetForm();
}
-void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*)
+void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW* /*unused*/)
{
FORM* form = fm->GetForm();
if (this->InEdit) {
@@ -56,7 +57,8 @@ void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*)
}
}
-void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm, WINDOW*)
+void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm,
+ WINDOW* /*unused*/)
{
form_driver(fm->GetForm(), key);
}
@@ -67,12 +69,14 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
int x, y;
FORM* form = fm->GetForm();
+ // when not in edit mode, edit mode is entered by pressing enter or i (vim
+ // binding)
// 10 == enter
- if (!this->InEdit && (key != 10 && key != KEY_ENTER)) {
+ if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
- this->OriginalString = 0;
+ this->OriginalString = CM_NULLPTR;
this->Done = false;
char debugMessage[128];
@@ -90,18 +94,21 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
// quit
if (key == 'q') {
return false;
- } else {
- key = getch();
- continue;
}
+ key = getch();
+ continue;
}
// If resize occurred during edit, move out of edit mode
- if (!this->InEdit && (key != 10 && key != KEY_ENTER)) {
+ if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
- // 10 == enter
- if (key == 10 || key == KEY_ENTER) {
+ // enter edit with return and i (vim binding)
+ if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) {
+ this->OnReturn(fm, w);
+ }
+ // leave edit with return (but not i -- not a toggle)
+ else if (this->InEdit && (key == 10 || key == KEY_ENTER)) {
this->OnReturn(fm, w);
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||
@@ -199,7 +206,6 @@ bool cmCursesStringWidget::PrintKeys()
curses_move(y - 3, 0);
printw(fmt_s, "Editing option, press [enter] to leave edit.");
return true;
- } else {
- return false;
}
+ return false;
}
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index fc1b2ba..c8ca482 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -32,14 +32,14 @@ public:
* when this widget has focus. Returns true if the input was
* handled.
*/
- virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
/**
* Set/Get the string.
*/
void SetString(const std::string& value);
const char* GetString();
- virtual const char* GetValue();
+ const char* GetValue() CM_OVERRIDE;
/**
* Set/Get InEdit flag. Can be used to tell the widget to leave
@@ -61,7 +61,7 @@ public:
* in the toolbar and return true. Otherwise, return false
* and the parent widget will print.
*/
- virtual bool PrintKeys();
+ bool PrintKeys() CM_OVERRIDE;
protected:
cmCursesStringWidget(const cmCursesStringWidget& from);
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 100ed1d..49f2795 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -23,7 +23,7 @@ cmCursesWidget::~cmCursesWidget()
{
if (this->Field) {
free_field(this->Field);
- this->Field = 0;
+ this->Field = CM_NULLPTR;
}
}
diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake
new file mode 100644
index 0000000..7391aa7
--- /dev/null
+++ b/Source/Modules/FindLibUV.cmake
@@ -0,0 +1,131 @@
+#[=======================================================================[.rst:
+FindLibUV
+---------
+
+Find libuv includes and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+An :ref:`imported target <Imported targets>` named
+``LibUV::LibUV`` is provided if libuv has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``LibUV_FOUND``
+ True if libuv was found, false otherwise.
+``LibUV_INCLUDE_DIRS``
+ Include directories needed to include libuv headers.
+``LibUV_LIBRARIES``
+ Libraries needed to link to libuv.
+``LibUV_VERSION``
+ The version of libuv found.
+``LibUV_VERSION_MAJOR``
+ The major version of libuv.
+``LibUV_VERSION_MINOR``
+ The minor version of libuv.
+``LibUV_VERSION_PATCH``
+ The patch version of libuv.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+This module uses the following cache variables:
+
+``LibUV_LIBRARY``
+ The location of the libuv library file.
+``LibUV_INCLUDE_DIR``
+ The location of the libuv include directory containing ``uv.h``.
+
+The cache variables should not be used by project code.
+They may be set by end users to point at libuv components.
+#]=======================================================================]
+
+#=============================================================================
+# Copyright 2014-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+#-----------------------------------------------------------------------------
+find_library(LibUV_LIBRARY
+ NAMES uv
+ )
+mark_as_advanced(LibUV_LIBRARY)
+
+find_path(LibUV_INCLUDE_DIR
+ NAMES uv.h
+ )
+mark_as_advanced(LibUV_INCLUDE_DIR)
+
+#-----------------------------------------------------------------------------
+# Extract version number if possible.
+set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+")
+if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h")
+ file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
+elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h")
+ file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
+else()
+ set(_LibUV_H "")
+endif()
+foreach(c MAJOR MINOR PATCH)
+ if(_LibUV_H MATCHES "#[ \t]*define[ \t]+UV_VERSION_${c}[ \t]+([0-9]+)")
+ set(_LibUV_VERSION_${c} "${CMAKE_MATCH_1}")
+ else()
+ unset(_LibUV_VERSION_${c})
+ endif()
+endforeach()
+if(DEFINED _LibUV_VERSION_MAJOR AND DEFINED _LibUV_VERSION_MINOR)
+ set(LibUV_VERSION_MAJOR "${_LibUV_VERSION_MAJOR}")
+ set(LibUV_VERSION_MINOR "${_LibUV_VERSION_MINOR}")
+ set(LibUV_VERSION "${LibUV_VERSION_MAJOR}.${LibUV_VERSION_MINOR}")
+ if(DEFINED _LibUV_VERSION_PATCH)
+ set(LibUV_VERSION_PATCH "${_LibUV_VERSION_PATCH}")
+ set(LibUV_VERSION "${LibUV_VERSION}.${LibUV_VERSION_PATCH}")
+ else()
+ unset(LibUV_VERSION_PATCH)
+ endif()
+else()
+ set(LibUV_VERSION_MAJOR "")
+ set(LibUV_VERSION_MINOR "")
+ set(LibUV_VERSION_PATCH "")
+ set(LibUV_VERSION "")
+endif()
+unset(_LibUV_VERSION_MAJOR)
+unset(_LibUV_VERSION_MINOR)
+unset(_LibUV_VERSION_PATCH)
+unset(_LibUV_H_REGEX)
+unset(_LibUV_H)
+
+#-----------------------------------------------------------------------------
+include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV
+ FOUND_VAR LibUV_FOUND
+ REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR
+ VERSION_VAR LibUV_VERSION
+ )
+set(LIBUV_FOUND ${LibUV_FOUND})
+
+#-----------------------------------------------------------------------------
+# Provide documented result variables and targets.
+if(LibUV_FOUND)
+ set(LibUV_INCLUDE_DIRS ${LibUV_INCLUDE_DIR})
+ set(LibUV_LIBRARIES ${LibUV_LIBRARY})
+ if(NOT TARGET LibUV::LibUV)
+ add_library(LibUV::LibUV UNKNOWN IMPORTED)
+ set_target_properties(LibUV::LibUV PROPERTIES
+ IMPORTED_LOCATION "${LibUV_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LibUV_INCLUDE_DIRS}"
+ )
+ endif()
+endif()
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index a906f4a..80c0dc0 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -36,6 +36,12 @@ if (Qt5Widgets_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
+ if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES)
+ list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES})
+ set_property(SOURCE CMakeSetup.cxx
+ PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin)
+ endif()
+
# We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows.
# FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly
# Qt5 support is missing there.
@@ -150,12 +156,12 @@ if(APPLE)
MACOSX_PACKAGE_LOCATION Resources)
endif()
-if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
- install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt
+if(USE_LGPL)
+ install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt
DESTINATION ${CMAKE_DATA_DIR}/Licenses
${COMPONENT})
set_property(SOURCE CMakeSetupDialog.cxx
- PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
+ PROPERTY COMPILE_DEFINITIONS USE_LGPL="${USE_LGPL}")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index c3c1468..ee3389c 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -19,8 +19,10 @@
#include <QApplication>
#include <QDir>
#include <QLocale>
+#include <QString>
#include <QTextCodec>
#include <QTranslator>
+#include <QtPlugin>
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/SystemTools.hxx>
@@ -40,6 +42,11 @@ static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
#if defined(Q_OS_MAC)
static int cmOSXInstall(std::string dir);
+static void cmAddPluginPath();
+#endif
+
+#if defined(USE_QXcbIntegrationPlugin)
+Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
#endif
int main(int argc, char** argv)
@@ -81,6 +88,15 @@ int main(int argc, char** argv)
}
#endif
+// When we are on OSX and we are launching cmake-gui from a symlink, the
+// application will fail to launch as it can't find the qt.conf file which
+// tells it what the name of the plugin folder is. We need to add this path
+// BEFORE the application is constructed as that is what triggers the
+// searching for the platform plugins
+#if defined(Q_OS_MAC)
+ cmAddPluginPath();
+#endif
+
QApplication app(argc, argv);
setlocale(LC_NUMERIC, "C");
@@ -215,4 +231,27 @@ static int cmOSXInstall(std::string dir)
? 0
: 1;
}
+
+// Locate the PlugIns directory and add it to the QApplication library paths.
+// We need to resolve all symlinks so we have a known relative path between
+// MacOS/CMake and the PlugIns directory.
+//
+// Note we are using cmSystemTools since Qt can't provide the path to the
+// executable before the QApplication is created, and that is when plugin
+// searching occurs.
+static void cmAddPluginPath()
+{
+ std::string const& path = cmSystemTools::GetCMakeGUICommand();
+ if (path.empty()) {
+ return;
+ }
+ std::string const& realPath = cmSystemTools::GetRealPath(path);
+ QFileInfo appPath(QString::fromLocal8Bit(realPath.c_str()));
+ QDir pluginDir = appPath.dir();
+ bool const foundPluginDir = pluginDir.cd("../PlugIns");
+ if (foundPluginDir) {
+ QApplication::addLibraryPath(pluginDir.path());
+ }
+}
+
#endif
diff --git a/Source/QtDialog/CMakeSetup64.png b/Source/QtDialog/CMakeSetup64.png
new file mode 100644
index 0000000..43a8cc6
--- /dev/null
+++ b/Source/QtDialog/CMakeSetup64.png
Binary files differ
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 712611d..fda3e58 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -830,17 +830,18 @@ void CMakeSetupDialog::doAbout()
"\n"
"CMake GUI maintained by csimsoft,\n"
"built using Qt %2 (qt-project.org).\n"
-#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL
+#ifdef USE_LGPL
"\n"
"The Qt Toolkit is Copyright (C) Digia Plc and/or its subsidiary(-ies).\n"
- "Qt is licensed under terms of the GNU LGPLv2.1, available at:\n"
+ "Qt is licensed under terms of the GNU LGPLv" USE_LGPL ", available at:\n"
" \"%3\""
#endif
);
msg = msg.arg(cmVersion::GetCMakeVersion());
msg = msg.arg(qVersion());
-#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL
- std::string lgpl = cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv2.1.txt";
+#ifdef USE_LGPL
+ std::string lgpl =
+ cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv" USE_LGPL ".txt";
msg = msg.arg(lgpl.c_str());
#endif
diff --git a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in
new file mode 100644
index 0000000..e3d8554
--- /dev/null
+++ b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in
@@ -0,0 +1,21 @@
+// Component: CMake.Reference.DoxygenHTML
+
+function Component()
+{
+ // Default constructor
+}
+
+Component.prototype.createOperations = function()
+{
+ // Create shortcut
+ if (installer.value("os") === "win") {
+
+ component.addOperation("CreateShortcut",
+ installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/developer-reference/html/index.html",
+ installer.value("StartMenuDir") + "/CMake Developer Reference.lnk");
+
+ }
+
+ // Call default implementation
+ component.createOperations();
+}
diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in
index 3411e34..39a8795 100644
--- a/Source/QtIFW/installscript.qs.in
+++ b/Source/QtIFW/installscript.qs.in
@@ -1,6 +1,7 @@
function Component()
{
- // default constructor
+ // Do not show component selection page
+ installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
}
Component.prototype.createOperations = function()
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index b179f83..181cb77 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -244,9 +244,7 @@ public:
*----------------------------------------------------------------------
*/
void DumpObjFile() {
- if(!HaveExportedObjects()) {
- this->DumpExternalsObjects();
- }
+ this->DumpExternalsObjects();
}
/*
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 5c073c8..dba1acd 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -20,19 +20,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddCompileOptionsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddCompileOptionsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_compile_options"; }
+ std::string GetName() const CM_OVERRIDE { return "add_compile_options"; }
cmTypeMacro(cmAddCompileOptionsCommand, cmCommand);
};
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index d8fd1d8..2c4a4ca 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -15,6 +15,8 @@
#include "cmSourceFile.h"
+#include "cmGlobalGenerator.h"
+
// cmAddCustomCommandCommand
bool cmAddCustomCommandCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -28,9 +30,9 @@ bool cmAddCustomCommandCommand::InitialPass(
return false;
}
- std::string source, target, main_dependency, working;
+ std::string source, target, main_dependency, working, depfile;
std::string comment_buffer;
- const char* comment = 0;
+ const char* comment = CM_NULLPTR;
std::vector<std::string> depends, outputs, output, byproducts;
bool verbatim = false;
bool append = false;
@@ -60,6 +62,7 @@ bool cmAddCustomCommandCommand::InitialPass(
doing_byproducts,
doing_comment,
doing_working_directory,
+ doing_depfile,
doing_nothing
};
@@ -110,6 +113,13 @@ bool cmAddCustomCommandCommand::InitialPass(
doing = doing_implicit_depends_lang;
} else if (copy == "COMMENT") {
doing = doing_comment;
+ } else if (copy == "DEPFILE") {
+ doing = doing_depfile;
+ if (this->Makefile->GetGlobalGenerator()->GetName() != "Ninja") {
+ this->SetError("Option DEPFILE not supported by " +
+ this->Makefile->GetGlobalGenerator()->GetName());
+ return false;
+ }
} else {
std::string filename;
switch (doing) {
@@ -147,6 +157,9 @@ bool cmAddCustomCommandCommand::InitialPass(
filename = cmSystemTools::CollapseFullPath(filename);
}
switch (doing) {
+ case doing_depfile:
+ depfile = copy;
+ break;
case doing_working_directory:
working = copy;
break;
@@ -269,12 +282,12 @@ bool cmAddCustomCommandCommand::InitialPass(
std::vector<std::string> no_depends;
this->Makefile->AddCustomCommandToTarget(
target, byproducts, no_depends, commandLines, cctype, comment,
- working.c_str(), escapeOldStyle, uses_terminal);
+ working.c_str(), escapeOldStyle, uses_terminal, depfile);
} else if (target.empty()) {
// Target is empty, use the output.
this->Makefile->AddCustomCommandToOutput(
output, byproducts, depends, main_dependency, commandLines, comment,
- working.c_str(), false, escapeOldStyle, uses_terminal);
+ working.c_str(), false, escapeOldStyle, uses_terminal, depfile);
// Add implicit dependency scanning requests if any were given.
if (!implicit_depends.empty()) {
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index ccbd50c..1164d46 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddCustomCommandCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomCommandCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_custom_command"; }
+ std::string GetName() const CM_OVERRIDE { return "add_custom_command"; }
cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index ac08cb2..9dc7c59 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -47,7 +47,7 @@ bool cmAddCustomTargetCommand::InitialPass(
bool verbatim = false;
bool uses_terminal = false;
std::string comment_buffer;
- const char* comment = 0;
+ const char* comment = CM_NULLPTR;
std::vector<std::string> sources;
// Keep track of parser state.
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 9c376c0..120d4d4 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddCustomTargetCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomTargetCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_custom_target"; }
+ std::string GetName() const CM_OVERRIDE { return "add_custom_target"; }
cmTypeMacro(cmAddCustomTargetCommand, cmCommand);
};
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 959ed64..b30001c 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddDefinitionsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddDefinitionsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_definitions"; }
+ std::string GetName() const CM_OVERRIDE { return "add_definitions"; }
cmTypeMacro(cmAddDefinitionsCommand, cmCommand);
};
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 202d072..c059ff2 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddDependenciesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddDependenciesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_dependencies"; }
+ std::string GetName() const CM_OVERRIDE { return "add_dependencies"; }
cmTypeMacro(cmAddDependenciesCommand, cmCommand);
};
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 1e3181f..133f5bf 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddExecutableCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddExecutableCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_executable"; }
+ std::string GetName() const CM_OVERRIDE { return "add_executable"; }
cmTypeMacro(cmAddExecutableCommand, cmCommand);
};
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 0f0f768..20f1bc9 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddLibraryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddLibraryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_library"; }
+ std::string GetName() const CM_OVERRIDE { return "add_library"; }
cmTypeMacro(cmAddLibraryCommand, cmCommand);
};
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 786c8b0..ec1d2c8 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddSubDirectoryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddSubDirectoryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_subdirectory"; }
+ std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
};
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 295fb78..abff0c2 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAddTestCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAddTestCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "add_test"; }
+ std::string GetName() const CM_OVERRIDE { return "add_test"; }
cmTypeMacro(cmAddTestCommand, cmCommand);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index a0150ec..8869040 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -16,7 +16,11 @@
#include "cm_get_date.h"
#include <cm_libarchive.h>
#include <cmsys/Directory.hxx>
+#include <cmsys/Encoding.hxx>
#include <cmsys/FStream.hxx>
+#include <iostream>
+#include <string.h>
+#include <time.h>
#ifndef __LA_SSIZE_T
#define __LA_SSIZE_T la_ssize_t
@@ -64,15 +68,15 @@ public:
struct cmArchiveWrite::Callback
{
// archive_write_callback
- static __LA_SSIZE_T Write(struct archive*, void* cd, const void* b, size_t n)
+ static __LA_SSIZE_T Write(struct archive* /*unused*/, void* cd,
+ const void* b, size_t n)
{
cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd);
if (self->Stream.write(static_cast<const char*>(b),
static_cast<std::streamsize>(n))) {
return static_cast<__LA_SSIZE_T>(n);
- } else {
- return static_cast<__LA_SSIZE_T>(-1);
}
+ return static_cast<__LA_SSIZE_T>(-1);
}
};
@@ -151,9 +155,9 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
}
if (archive_write_open(
- this->Archive, this, 0,
+ this->Archive, this, CM_NULLPTR,
reinterpret_cast<archive_write_callback*>(&Callback::Write),
- 0) != ARCHIVE_OK) {
+ CM_NULLPTR) != ARCHIVE_OK) {
this->Error = "archive_write_open: ";
this->Error += cm_archive_error_string(this->Archive);
return;
@@ -229,7 +233,8 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
Entry e;
cm_archive_entry_copy_sourcepath(e, file);
cm_archive_entry_copy_pathname(e, dest);
- if (archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK) {
+ if (archive_read_disk_entry_from_file(this->Disk, e, -1, CM_NULLPTR) !=
+ ARCHIVE_OK) {
this->Error = "archive_read_disk_entry_from_file '";
this->Error += file;
this->Error += "': ";
@@ -255,7 +260,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
archive_entry_set_gid(e, this->Gid.Get());
}
- if (this->Uname.size() && this->Gname.size()) {
+ if (!this->Uname.empty() && !this->Gname.empty()) {
archive_entry_set_uname(e, this->Uname.c_str());
archive_entry_set_gname(e, this->Gname.c_str());
}
@@ -266,7 +271,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
}
if (this->PermissionsMask.IsSet()) {
- mode_t perm = archive_entry_perm(e);
+ int perm = archive_entry_perm(e);
archive_entry_set_perm(e, perm & this->PermissionsMask.Get());
}
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 72d8f3a..120453b 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -12,7 +12,11 @@
#ifndef cmArchiveWrite_h
#define cmArchiveWrite_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <iosfwd>
+#include <stddef.h>
+#include <string>
#if !defined(CMAKE_BUILD_WITH_CMAKE)
#error "cmArchiveWrite not allowed during bootstrap build!"
@@ -72,13 +76,13 @@ public:
* skip. The remaining part of the input path is appended to the
* "prefix" value to construct the final name in the archive.
*/
- bool Add(std::string path, size_t skip = 0, const char* prefix = 0,
+ bool Add(std::string path, size_t skip = 0, const char* prefix = CM_NULLPTR,
bool recursive = true);
/** Returns true if there has been no error. */
operator safe_bool() const
{
- return this->Okay() ? &cmArchiveWrite::safe_bool_true : 0;
+ return this->Okay() ? &cmArchiveWrite::safe_bool_true : CM_NULLPTR;
}
/** Returns true if there has been an error. */
@@ -94,7 +98,7 @@ public:
void SetMTime(std::string const& t) { this->MTime = t; }
//! Sets the permissions of the added files/folders
- void SetPermissions(mode_t permissions_)
+ void SetPermissions(int permissions_)
{
this->Permissions.Set(permissions_);
}
@@ -107,7 +111,7 @@ public:
//! The permissions will be copied from the existing file
//! or folder. The mask will then be applied to unset
//! some of them
- void SetPermissionsMask(mode_t permissionsMask_)
+ void SetPermissionsMask(int permissionsMask_)
{
this->PermissionsMask.Set(permissionsMask_);
}
@@ -177,8 +181,8 @@ private:
//!@}
//! Permissions on files/folders
- cmArchiveWriteOptional<mode_t> Permissions;
- cmArchiveWriteOptional<mode_t> PermissionsMask;
+ cmArchiveWriteOptional<int> Permissions;
+ cmArchiveWriteOptional<int> PermissionsMask;
};
#endif
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index b5943f5..6301cb2 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -29,19 +29,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmAuxSourceDirectoryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmAuxSourceDirectoryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "aux_source_directory"; }
+ std::string GetName() const CM_OVERRIDE { return "aux_source_directory"; }
cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand);
};
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index fd57705..b33494e 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmBreakCommand.h"
+#include "cmExecutionStatus.h"
+
// cmBreakCommand
bool cmBreakCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status)
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 270d3e6..3b585e2 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmBreakCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmBreakCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "break"; }
+ std::string GetName() const CM_OVERRIDE { return "break"; }
cmTypeMacro(cmBreakCommand, cmCommand);
};
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 586e8a8..9830867 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -36,8 +36,8 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
const char* variable = args[0].c_str();
// Parse remaining arguments.
- const char* configuration = 0;
- const char* project_name = 0;
+ std::string configuration;
+ std::string project_name;
std::string target;
enum Doing
{
@@ -56,10 +56,10 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
doing = DoingTarget;
} else if (doing == DoingConfiguration) {
doing = DoingNone;
- configuration = args[i].c_str();
+ configuration = args[i];
} else if (doing == DoingProjectName) {
doing = DoingNone;
- project_name = args[i].c_str();
+ project_name = args[i];
} else if (doing == DoingTarget) {
doing = DoingNone;
target = args[i];
@@ -76,14 +76,14 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
// so we put this code here to end up with the same default configuration
// as the original 2-arg build_command signature:
//
- if (!configuration || !*configuration) {
- configuration = getenv("CMAKE_CONFIG_TYPE");
+ if (configuration.empty()) {
+ cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configuration);
}
- if (!configuration || !*configuration) {
+ if (configuration.empty()) {
configuration = "Release";
}
- if (project_name && *project_name) {
+ if (!project_name.empty()) {
this->Makefile->IssueMessage(
cmake::AUTHOR_WARNING,
"Ignoring PROJECT_NAME option because it has no effect.");
@@ -91,7 +91,8 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
std::string makecommand =
this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
- target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
+ target, configuration.c_str(), "",
+ this->Makefile->IgnoreErrorsCMP0061());
this->Makefile->AddDefinition(variable, makecommand.c_str());
@@ -108,10 +109,10 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
const char* define = args[0].c_str();
const char* cacheValue = this->Makefile->GetDefinition(define);
- std::string configType = "Release";
- const char* cfg = getenv("CMAKE_CONFIG_TYPE");
- if (cfg && *cfg) {
- configType = cfg;
+ std::string configType;
+ if (!cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configType) ||
+ configType.empty()) {
+ configType = "Release";
}
std::string makecommand =
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 6cbf3ca..552e5ff 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -25,14 +25,14 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmBuildCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmBuildCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The primary command signature with optional, KEYWORD-based args.
@@ -47,7 +47,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "build_command"; }
+ std::string GetName() const CM_OVERRIDE { return "build_command"; }
cmTypeMacro(cmBuildCommand, cmCommand);
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 43c24b0..4a1641bd 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -18,11 +18,11 @@ class cmBuildNameCommand : public cmCommand
{
public:
cmTypeMacro(cmBuildNameCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmBuildNameCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "build_name"; }
- virtual bool IsScriptable() const { return true; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "build_name"; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx
index ee9acde..e38f531 100644
--- a/Source/cmCLocaleEnvironmentScope.cxx
+++ b/Source/cmCLocaleEnvironmentScope.cxx
@@ -15,6 +15,7 @@
#include "cmSystemTools.h"
#include <sstream>
+#include <utility>
cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope()
{
@@ -31,8 +32,9 @@ cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope()
std::string cmCLocaleEnvironmentScope::GetEnv(std::string const& key)
{
- const char* value = cmSystemTools::GetEnv(key);
- return value ? value : std::string();
+ std::string value;
+ cmSystemTools::GetEnv(key, value);
+ return value;
}
void cmCLocaleEnvironmentScope::SetEnv(std::string const& key,
@@ -45,7 +47,7 @@ void cmCLocaleEnvironmentScope::SetEnv(std::string const& key,
if (value.empty()) {
cmSystemTools::UnsetEnv(key.c_str());
} else {
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << key << "=" << value;
cmSystemTools::PutEnv(tmp.str());
}
@@ -55,7 +57,7 @@ cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope()
{
for (backup_map_t::const_iterator i = this->EnvironmentBackup.begin();
i != this->EnvironmentBackup.end(); ++i) {
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << i->first << "=" << i->second;
cmSystemTools::PutEnv(tmp.str());
}
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index b011741..572beaf 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -13,7 +13,10 @@
#ifndef cmCLocaleEnvironmentScope_h
#define cmCLocaleEnvironmentScope_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
class cmCLocaleEnvironmentScope
{
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index fbec6fd..fdbd5e7 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -84,7 +84,7 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
std::string cmCMakeHostSystemInformationCommand::ValueToString(
size_t value) const
{
- std::stringstream tmp;
+ std::ostringstream tmp;
tmp << value;
return tmp.str();
}
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 6981ea9..8e6f0f5 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -28,7 +28,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
return new cmCMakeHostSystemInformationCommand;
}
@@ -37,18 +37,18 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const
+ std::string GetName() const CM_OVERRIDE
{
return "cmake_host_system_information";
}
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index fc73e87..4231eb4 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmCMakeMinimumRequired; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmCMakeMinimumRequired; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "cmake_minimum_required"; }
+ std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
cmTypeMacro(cmCMakeMinimumRequired, cmCommand);
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index dbb91d5..fd4ab0a 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -26,24 +26,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmCMakePolicyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmCMakePolicyCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "cmake_policy"; }
+ std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
cmTypeMacro(cmCMakePolicyCommand, cmCommand);
diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx
index af01c7d..ae6b0a1 100644
--- a/Source/cmCPackPropertiesGenerator.cxx
+++ b/Source/cmCPackPropertiesGenerator.cxx
@@ -1,8 +1,13 @@
#include "cmCPackPropertiesGenerator.h"
-#include "cmLocalGenerator.h"
+#include "cmGeneratorExpression.h"
+#include "cmInstalledFile.h"
#include "cmOutputConverter.h"
+#include <map>
+#include <ostream>
+#include <utility>
+
cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
cmLocalGenerator* lg, cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations)
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index 4372b87..77018b0 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -12,9 +12,15 @@
#ifndef cmCPackPropertiesGenerator_h
#define cmCPackPropertiesGenerator_h
-#include "cmInstalledFile.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include "cmScriptGenerator.h"
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+class cmInstalledFile;
class cmLocalGenerator;
/** \class cmCPackPropertiesGenerator
@@ -29,9 +35,8 @@ public:
std::vector<std::string> const& configurations);
protected:
- virtual void GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
- Indent const& indent);
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent const& indent) CM_OVERRIDE;
cmLocalGenerator* LG;
cmInstalledFile const& InstalledFile;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index a78300c..f97791a 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -218,8 +218,8 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
}
// Pass the call to the makefile instance.
- mf->AddUtilityCommand(utilityName, (all ? false : true), 0, depends2,
- commandLines);
+ mf->AddUtilityCommand(utilityName, (all ? false : true), CM_NULLPTR,
+ depends2, commandLines);
}
void CCONV cmAddCustomCommand(void* arg, const char* source,
const char* command, int numArgs,
@@ -257,7 +257,7 @@ void CCONV cmAddCustomCommand(void* arg, const char* source,
}
// Pass the call to the makefile instance.
- const char* no_comment = 0;
+ const char* no_comment = CM_NULLPTR;
mf->AddCustomCommandOldStyle(target, outputs2, depends2, source,
commandLines, no_comment);
}
@@ -291,8 +291,8 @@ void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
}
// Pass the call to the makefile instance.
- const char* no_comment = 0;
- const char* no_working_dir = 0;
+ const char* no_comment = CM_NULLPTR;
+ const char* no_working_dir = CM_NULLPTR;
mf->AddCustomCommandToOutput(output, depends2, main_dependency, commandLines,
no_comment, no_working_dir);
}
@@ -333,8 +333,8 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
// Pass the call to the makefile instance.
std::vector<std::string> no_byproducts;
std::vector<std::string> no_depends;
- const char* no_comment = 0;
- const char* no_working_dir = 0;
+ const char* no_comment = CM_NULLPTR;
+ const char* no_working_dir = CM_NULLPTR;
mf->AddCustomCommandToTarget(target, no_byproducts, no_depends, commandLines,
cctype, no_comment, no_working_dir);
}
@@ -414,7 +414,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
result.push_back(args[i]);
}
int resargc = static_cast<int>(result.size());
- char** resargv = 0;
+ char** resargv = CM_NULLPTR;
if (resargc) {
resargv = (char**)malloc(resargc * sizeof(char*));
}
@@ -453,7 +453,7 @@ int CCONV cmGetTotalArgumentSize(int argc, char** argv)
struct cmCPluginAPISourceFile
{
cmCPluginAPISourceFile()
- : RealSourceFile(0)
+ : RealSourceFile(CM_NULLPTR)
{
}
cmSourceFile* RealSourceFile;
@@ -525,7 +525,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
}
return (void*)i->second;
} else {
- return 0;
+ return CM_NULLPTR;
}
}
@@ -534,7 +534,7 @@ void* CCONV cmAddSource(void* arg, void* arg2)
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmCPluginAPISourceFile* osf = static_cast<cmCPluginAPISourceFile*>(arg2);
if (osf->FullPath.empty()) {
- return 0;
+ return CM_NULLPTR;
}
// Create the real cmSourceFile instance and copy over saved information.
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index bc36c5a..b4ddc3e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -51,7 +51,7 @@
#include <math.h>
#include <stdlib.h>
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
#include <cm_zlib.h>
#include <cmsys/Base64.h>
@@ -70,7 +70,7 @@
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
{
struct tm* lctime;
- time_t tctime = time(0);
+ time_t tctime = time(CM_NULLPTR);
lctime = gmtime(&tctime);
char buf[1024];
// add todays year day and month to the time in str because
@@ -88,7 +88,7 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
// As such, this time may be in the past or in the future.
time_t ntime = curl_getdate(buf, &tctime);
cmCTestLog(this, DEBUG, " Get curl time: " << ntime << std::endl);
- tctime = time(0);
+ tctime = time(CM_NULLPTR);
cmCTestLog(this, DEBUG, " Get the current time: " << tctime << std::endl);
const int dayLength = 24 * 60 * 60;
@@ -134,7 +134,7 @@ std::string cmCTest::CleanString(const std::string& str)
std::string cmCTest::CurrentTime()
{
- time_t currenttime = time(0);
+ time_t currenttime = time(CM_NULLPTR);
struct tm* t = localtime(&currenttime);
// return ::CleanString(ctime(&currenttime));
char current_time[1024];
@@ -244,7 +244,7 @@ std::string cmCTest::DecodeURL(const std::string& in)
for (const char* c = in.c_str(); *c; ++c) {
if (*c == '%' && isxdigit(*(c + 1)) && isxdigit(*(c + 2))) {
char buf[3] = { *(c + 1), *(c + 2), 0 };
- out.append(1, char(strtoul(buf, 0, 16)));
+ out.append(1, char(strtoul(buf, CM_NULLPTR, 16)));
c += 2;
} else {
out.append(1, *c);
@@ -288,7 +288,7 @@ cmCTest::cmCTest()
this->ScheduleType = "";
this->StopTime = "";
this->NextDayStopTime = false;
- this->OutputLogFile = 0;
+ this->OutputLogFile = CM_NULLPTR;
this->OutputLogFileLastTag = -1;
this->SuppressUpdatingCTestConfiguration = false;
this->DartVersion = 1;
@@ -298,9 +298,10 @@ cmCTest::cmCTest()
this->ComputedCompressMemCheckOutput = false;
this->RepeatTests = 1; // default to run each test once
this->RepeatUntilFail = false;
- if (const char* outOnFail =
- cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) {
- this->OutputTestOutputOnTestFailure = !cmSystemTools::IsOff(outOnFail);
+ std::string outOnFail;
+ if (cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE", outOnFail)) {
+ this->OutputTestOutputOnTestFailure =
+ !cmSystemTools::IsOff(outOnFail.c_str());
}
this->InitStreams();
@@ -347,7 +348,7 @@ cmCTest::cmCTest()
cmCTest::~cmCTest()
{
cmDeleteAll(this->TestingHandlers);
- this->SetOutputLogFileName(0);
+ this->SetOutputLogFileName(CM_NULLPTR);
}
void cmCTest::SetParallelLevel(int level)
@@ -365,11 +366,8 @@ bool cmCTest::ShouldCompressTestOutput()
if (!this->ComputedCompressTestOutput) {
std::string cdashVersion = this->GetCDashVersion();
// version >= 1.6?
- bool cdashSupportsGzip =
- cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
- cdashVersion.c_str(), "1.6") ||
- cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
- cdashVersion.c_str(), "1.6");
+ bool cdashSupportsGzip = cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER_EQUAL, cdashVersion.c_str(), "1.6");
this->CompressTestOutput &= cdashSupportsGzip;
this->ComputedCompressTestOutput = true;
}
@@ -474,7 +472,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
mf.get())) {
cmCTestOptionalLog(
@@ -515,7 +513,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
std::string tag;
if (createNewTag) {
- time_t tctime = time(0);
+ time_t tctime = time(CM_NULLPTR);
if (this->TomorrowTag) {
tctime += (24 * 60 * 60);
}
@@ -540,7 +538,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
tfin.close();
}
- if (tag.empty() || (0 != command) || this->Parts[PartStart]) {
+ if (tag.empty() || (CM_NULLPTR != command) || this->Parts[PartStart]) {
cmCTestOptionalLog(
this, DEBUG,
"TestModel: " << this->GetTestModelString() << std::endl, quiet);
@@ -562,7 +560,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
ofs << this->GetTestModelString() << std::endl;
}
ofs.close();
- if (0 == command) {
+ if (CM_NULLPTR == command) {
cmCTestOptionalLog(this, OUTPUT, "Create new tag: "
<< tag << " - " << this->GetTestModelString()
<< std::endl,
@@ -783,13 +781,12 @@ bool cmCTest::SetTest(const char* ttype, bool report)
if (p != PartCount) {
this->Parts[p].Enable();
return true;
- } else {
- if (report) {
- cmCTestLog(this, ERROR_MESSAGE, "Don't know about test \""
- << ttype << "\" yet..." << std::endl);
- }
- return false;
}
+ if (report) {
+ cmCTestLog(this, ERROR_MESSAGE, "Don't know about test \""
+ << ttype << "\" yet..." << std::endl);
+ }
+ return false;
}
void cmCTest::Finalize()
@@ -860,7 +857,7 @@ cmCTestGenericHandler* cmCTest::GetInitializedHandler(const char* handler)
cmCTest::t_TestingHandlers::iterator it =
this->TestingHandlers.find(handler);
if (it == this->TestingHandlers.end()) {
- return 0;
+ return CM_NULLPTR;
}
it->second->Initialize();
return it->second;
@@ -871,7 +868,7 @@ cmCTestGenericHandler* cmCTest::GetHandler(const char* handler)
cmCTest::t_TestingHandlers::iterator it =
this->TestingHandlers.find(handler);
if (it == this->TestingHandlers.end()) {
- return 0;
+ return CM_NULLPTR;
}
return it->second;
}
@@ -886,7 +883,7 @@ int cmCTest::ExecuteHandler(const char* shandler)
return handler->ProcessHandler();
}
-int cmCTest::ProcessTests()
+int cmCTest::ProcessSteps()
{
int res = 0;
bool notest = true;
@@ -1020,7 +1017,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
// First generate the command and arguments
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
- if (args.size() < 1) {
+ if (args.empty()) {
return false;
}
@@ -1029,7 +1026,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
a != args.end(); ++a) {
argv.push_back(a->c_str());
}
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
output = "";
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:");
@@ -1057,7 +1054,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Each . represents "
<< tick_len << " bytes of output" << std::endl
<< " " << std::flush);
- while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+ while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
for (int cc = 0; cc < length; ++cc) {
if (data[cc] == 0) {
data[cc] = '\n';
@@ -1082,7 +1079,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size of output: "
<< int(double(output.size()) / 1024.0) << "K" << std::endl);
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
int result = cmsysProcess_GetState(cp);
@@ -1165,7 +1162,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
}
std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
- cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
+ CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) {
saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
cmSystemTools::AppendEnv(*environment);
@@ -1193,7 +1190,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
*output = "";
}
- cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
+ CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) {
saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
cmSystemTools::AppendEnv(*environment);
@@ -1211,7 +1208,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
char* data;
int length;
- while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+ while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
if (output) {
tempOutput.insert(tempOutput.end(), data, data + length);
}
@@ -1221,7 +1218,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
}
}
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
if (output && tempOutput.begin() != tempOutput.end()) {
output->append(&*tempOutput.begin(), tempOutput.size());
}
@@ -1245,16 +1242,16 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
if (output) {
*output += outerr;
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl
- << std::flush);
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl
+ << std::flush);
} else if (result == cmsysProcess_State_Error) {
std::string outerr = "\n*** ERROR executing: ";
outerr += cmsysProcess_GetErrorString(cp);
if (output) {
*output += outerr;
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl
- << std::flush);
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl
+ << std::flush);
}
cmsysProcess_Delete(cp);
@@ -2018,7 +2015,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// handle the script arguments -S -SR -SP
this->HandleScriptArguments(i, args, SRArgumentSpecified);
- // handle a request for a dashboard
+ // --dashboard: handle a request for a dashboard
std::string arg = args[i];
if (this->CheckArgument(arg, "-D", "--dashboard") && i < args.size() - 1) {
this->ProduceXML = true;
@@ -2044,54 +2041,18 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
this->AddVariableDefinition(input);
}
- if (this->CheckArgument(arg, "-T", "--test-action") &&
- (i < args.size() - 1)) {
- this->ProduceXML = true;
- i++;
- if (!this->SetTest(args[i].c_str(), false)) {
- executeTests = false;
- cmCTestLog(this, ERROR_MESSAGE,
- "CTest -T called with incorrect option: " << args[i]
- << std::endl);
- cmCTestLog(this, ERROR_MESSAGE, "Available options are:"
- << std::endl
- << " " << ctestExec << " -T all" << std::endl
- << " " << ctestExec << " -T start" << std::endl
- << " " << ctestExec << " -T update" << std::endl
- << " " << ctestExec << " -T configure" << std::endl
- << " " << ctestExec << " -T build" << std::endl
- << " " << ctestExec << " -T test" << std::endl
- << " " << ctestExec << " -T coverage" << std::endl
- << " " << ctestExec << " -T memcheck" << std::endl
- << " " << ctestExec << " -T notes" << std::endl
- << " " << ctestExec << " -T submit" << std::endl);
- }
+ // --test-action: calls SetTest(<stage>, /*report=*/ false) to enable
+ // the corresponding stage
+ if (!this->HandleTestActionArgument(ctestExec, i, args)) {
+ executeTests = false;
}
- // what type of test model
- if (this->CheckArgument(arg, "-M", "--test-model") &&
- (i < args.size() - 1)) {
- i++;
- std::string const& str = args[i];
- if (cmSystemTools::LowerCase(str) == "nightly") {
- this->SetTestModel(cmCTest::NIGHTLY);
- } else if (cmSystemTools::LowerCase(str) == "continuous") {
- this->SetTestModel(cmCTest::CONTINUOUS);
- } else if (cmSystemTools::LowerCase(str) == "experimental") {
- this->SetTestModel(cmCTest::EXPERIMENTAL);
- } else {
- executeTests = false;
- cmCTestLog(this, ERROR_MESSAGE,
- "CTest -M called with incorrect option: " << str
- << std::endl);
- cmCTestLog(this, ERROR_MESSAGE, "Available options are:"
- << std::endl
- << " " << ctestExec << " -M Continuous" << std::endl
- << " " << ctestExec << " -M Experimental" << std::endl
- << " " << ctestExec << " -M Nightly" << std::endl);
- }
+ // --test-model: what type of test model
+ if (!this->HandleTestModelArgument(ctestExec, i, args)) {
+ executeTests = false;
}
+ // --extra-submit
if (this->CheckArgument(arg, "--extra-submit") && i < args.size() - 1) {
this->ProduceXML = true;
this->SetTest("Submit");
@@ -2106,6 +2067,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
cmakeAndTest = true;
}
+ // --schedule-random
if (this->CheckArgument(arg, "--schedule-random")) {
this->ScheduleType = "Random";
}
@@ -2124,80 +2086,151 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
}
} // the close of the for argument loop
+ // handle CTEST_PARALLEL_LEVEL environment variable
if (!this->ParallelLevelSetInCli) {
- if (const char* parallel = cmSystemTools::GetEnv("CTEST_PARALLEL_LEVEL")) {
- int plevel = atoi(parallel);
+ std::string parallel;
+ if (cmSystemTools::GetEnv("CTEST_PARALLEL_LEVEL", parallel)) {
+ int plevel = atoi(parallel.c_str());
this->SetParallelLevel(plevel);
}
}
- // now what sould cmake do? if --build-and-test was specified then
+ // now what should cmake do? if --build-and-test was specified then
// we run the build and test handler and return
if (cmakeAndTest) {
- this->Verbose = true;
- cmCTestBuildAndTestHandler* handler =
- static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest"));
- int retv = handler->ProcessHandler();
- *output = handler->GetOutput();
-#ifdef CMAKE_BUILD_WITH_CMAKE
- cmDynamicLoader::FlushCache();
-#endif
- if (retv != 0) {
- cmCTestLog(this, DEBUG,
- "build and test failing returning: " << retv << std::endl);
- }
- return retv;
+ return this->RunCMakeAndTest(output);
}
if (executeTests) {
- int res;
- // call process directory
- if (this->RunConfigurationScript) {
- if (this->ExtraVerbose) {
- cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
- }
- cmCTest::t_TestingHandlers::iterator it;
- for (it = this->TestingHandlers.begin();
- it != this->TestingHandlers.end(); ++it) {
- it->second->SetVerbose(this->ExtraVerbose);
- it->second->SetSubmitIndex(this->SubmitIndex);
- }
- this->GetHandler("script")->SetVerbose(this->Verbose);
- res = this->GetHandler("script")->ProcessHandler();
- if (res != 0) {
- cmCTestLog(this, DEBUG,
- "running script failing returning: " << res << std::endl);
- }
+ return this->ExecuteTests();
+ }
+ return 1;
+}
+
+bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
+ const std::vector<std::string>& args)
+{
+ bool success = true;
+ std::string arg = args[i];
+ if (this->CheckArgument(arg, "-T", "--test-action") &&
+ (i < args.size() - 1)) {
+ this->ProduceXML = true;
+ i++;
+ if (!this->SetTest(args[i].c_str(), false)) {
+ success = false;
+ cmCTestLog(this, ERROR_MESSAGE, "CTest -T called with incorrect option: "
+ << args[i] << std::endl);
+ cmCTestLog(this, ERROR_MESSAGE, "Available options are:"
+ << std::endl
+ << " " << ctestExec << " -T all" << std::endl
+ << " " << ctestExec << " -T start" << std::endl
+ << " " << ctestExec << " -T update" << std::endl
+ << " " << ctestExec << " -T configure" << std::endl
+ << " " << ctestExec << " -T build" << std::endl
+ << " " << ctestExec << " -T test" << std::endl
+ << " " << ctestExec << " -T coverage" << std::endl
+ << " " << ctestExec << " -T memcheck" << std::endl
+ << " " << ctestExec << " -T notes" << std::endl
+ << " " << ctestExec << " -T submit" << std::endl);
+ }
+ }
+ return success;
+}
+
+bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i,
+ const std::vector<std::string>& args)
+{
+ bool success = true;
+ std::string arg = args[i];
+ if (this->CheckArgument(arg, "-M", "--test-model") &&
+ (i < args.size() - 1)) {
+ i++;
+ std::string const& str = args[i];
+ if (cmSystemTools::LowerCase(str) == "nightly") {
+ this->SetTestModel(cmCTest::NIGHTLY);
+ } else if (cmSystemTools::LowerCase(str) == "continuous") {
+ this->SetTestModel(cmCTest::CONTINUOUS);
+ } else if (cmSystemTools::LowerCase(str) == "experimental") {
+ this->SetTestModel(cmCTest::EXPERIMENTAL);
} else {
- // What is this? -V seems to be the same as -VV,
- // and Verbose is always on in this case
- this->ExtraVerbose = this->Verbose;
- this->Verbose = true;
- cmCTest::t_TestingHandlers::iterator it;
- for (it = this->TestingHandlers.begin();
- it != this->TestingHandlers.end(); ++it) {
- it->second->SetVerbose(this->Verbose);
- it->second->SetSubmitIndex(this->SubmitIndex);
- }
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- if (!this->Initialize(cwd.c_str(), 0)) {
- res = 12;
- cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard."
- << std::endl);
- } else {
- res = this->ProcessTests();
- }
- this->Finalize();
+ success = false;
+ cmCTestLog(this, ERROR_MESSAGE, "CTest -M called with incorrect option: "
+ << str << std::endl);
+ cmCTestLog(this, ERROR_MESSAGE, "Available options are:"
+ << std::endl
+ << " " << ctestExec << " -M Continuous" << std::endl
+ << " " << ctestExec << " -M Experimental" << std::endl
+ << " " << ctestExec << " -M Nightly" << std::endl);
+ }
+ }
+ return success;
+}
+
+int cmCTest::ExecuteTests()
+{
+ int res;
+ // call process directory
+ if (this->RunConfigurationScript) {
+ if (this->ExtraVerbose) {
+ cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
}
+ cmCTest::t_TestingHandlers::iterator it;
+ for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end();
+ ++it) {
+ it->second->SetVerbose(this->ExtraVerbose);
+ it->second->SetSubmitIndex(this->SubmitIndex);
+ }
+ this->GetHandler("script")->SetVerbose(this->Verbose);
+ res = this->GetHandler("script")->ProcessHandler();
if (res != 0) {
cmCTestLog(this, DEBUG,
- "Running a test(s) failed returning : " << res << std::endl);
+ "running script failing returning: " << res << std::endl);
+ }
+
+ } else {
+ // What is this? -V seems to be the same as -VV,
+ // and Verbose is always on in this case
+ this->ExtraVerbose = this->Verbose;
+ this->Verbose = true;
+ cmCTest::t_TestingHandlers::iterator it;
+ for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end();
+ ++it) {
+ it->second->SetVerbose(this->Verbose);
+ it->second->SetSubmitIndex(this->SubmitIndex);
}
- return res;
+ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) {
+ res = 12;
+ cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard."
+ << std::endl);
+ } else {
+ res = this->ProcessSteps();
+ }
+ this->Finalize();
+ }
+ if (res != 0) {
+ cmCTestLog(this, DEBUG,
+ "Running a test(s) failed returning : " << res << std::endl);
}
+ return res;
+}
- return 1;
+int cmCTest::RunCMakeAndTest(std::string* output)
+{
+ this->Verbose = true;
+ cmCTestBuildAndTestHandler* handler =
+ static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest"));
+ int retv = handler->ProcessHandler();
+ *output = handler->GetOutput();
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ cmDynamicLoader::FlushCache();
+#endif
+ if (retv != 0) {
+ cmCTestLog(this, DEBUG, "build and test failing returning: " << retv
+ << std::endl);
+ }
+ return retv;
}
void cmCTest::SetNotesFiles(const char* notes)
@@ -2325,7 +2358,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
bool inBld = bldRelpath.find("..") == bldRelpath.npos;
// TODO: Handle files with .. in their name
- std::string* res = 0;
+ std::string* res = CM_NULLPTR;
if (inSrc && inBld) {
// If both have relative path with no dots, pick the shorter one
@@ -2375,7 +2408,7 @@ void cmCTest::EmptyCTestConfiguration()
void cmCTest::DetermineNextDayStop()
{
struct tm* lctime;
- time_t current_time = time(0);
+ time_t current_time = time(CM_NULLPTR);
lctime = gmtime(&current_time);
int gm_hour = lctime->tm_hour;
time_t gm_time = mktime(lctime);
@@ -2459,7 +2492,7 @@ bool cmCTest::GetProduceXML()
const char* cmCTest::GetSpecificTrack()
{
if (this->SpecificTrack.empty()) {
- return 0;
+ return CM_NULLPTR;
}
return this->SpecificTrack.c_str();
}
@@ -2525,7 +2558,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
{
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
- if (args.size() < 1) {
+ if (args.empty()) {
return false;
}
@@ -2534,7 +2567,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
a != args.end(); ++a) {
argv.push_back(a->c_str());
}
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
*stdOut = "";
*stdErr = "";
@@ -2555,7 +2588,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
int res;
bool done = false;
while (!done) {
- res = cmsysProcess_WaitForData(cp, &data, &length, 0);
+ res = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR);
switch (res) {
case cmsysProcess_Pipe_STDOUT:
tempOutput.insert(tempOutput.end(), data, data + length);
@@ -2572,7 +2605,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
}
}
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
if (!tempOutput.empty()) {
stdOut->append(&*tempOutput.begin(), tempOutput.size());
}
@@ -2614,7 +2647,7 @@ void cmCTest::SetOutputLogFileName(const char* name)
{
if (this->OutputLogFile) {
delete this->OutputLogFile;
- this->OutputLogFile = 0;
+ this->OutputLogFile = CM_NULLPTR;
}
if (name) {
this->OutputLogFile = new cmGeneratedFileStream(name);
@@ -2628,7 +2661,7 @@ static const char* cmCTestStringLogType[] = { "DEBUG",
"HANDLER_VERBOSE_OUTPUT",
"WARNING",
"ERROR_MESSAGE",
- 0 };
+ CM_NULLPTR };
#ifdef cerr
#undef cerr
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 65ecaa4..b6657c9 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -53,6 +53,13 @@ class cmXMLWriter;
#endif
#define cout no_cout_use_cmCTestLog
+/** \class cmCTest
+ * \brief Represents a ctest invocation.
+ *
+ * This class represents a ctest invocation. It is the top level class when
+ * running ctest.
+ *
+ */
class cmCTest
{
friend class cmCTestRunTest;
@@ -119,8 +126,8 @@ public:
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);
+ /** Process Command line arguments */
+ int Run(std::vector<std::string>&, std::string* output = CM_NULLPTR);
/**
* Initialize and finalize testing
@@ -129,23 +136,30 @@ public:
void Finalize();
/**
- * Process the tests. This is the main routine. The execution of the
- * tests should look like this:
+ * Process the dashboard client steps.
*
+ * Steps are enabled using SetTest()
+ *
+ * The execution of the steps (or #Part) should look like this:
+ *
+ * /code
* ctest foo;
* foo.Initialize();
* // Set some things on foo
- * foo.ProcessTests();
+ * foo.ProcessSteps();
* foo.Finalize();
+ * /endcode
+ *
+ * \sa Initialize(), Finalize(), Part, PartInfo, SetTest()
*/
- int ProcessTests();
+ int ProcessSteps();
- /*
+ /**
* A utility function that returns the nightly time
*/
struct tm* GetNightlyTime(std::string const& str, bool tomorrowtag);
- /*
+ /**
* Is the tomorrow tag set?
*/
bool GetTomorrowTag() { return this->TomorrowTag; }
@@ -155,14 +169,14 @@ public:
*/
int TestDirectory(bool memcheck);
- ///! what is the configuraiton type, e.g. Debug, Release etc.
+ /** what is the configuraiton type, e.g. Debug, Release etc. */
std::string const& GetConfigType();
double GetTimeOut() { return this->TimeOut; }
void SetTimeOut(double t) { this->TimeOut = t; }
double GetGlobalTimeout() { return this->GlobalTimeout; }
- // how many test to run at the same time
+ /** how many test to run at the same time */
int GetParallelLevel() { return this->ParallelLevel; }
void SetParallelLevel(int);
@@ -200,19 +214,19 @@ public:
cmCTest();
~cmCTest();
- //! Set the notes files to be created.
+ /** Set the notes files to be created. */
void SetNotesFiles(const char* notes);
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
+ /** Get the current time as string */
std::string CurrentTime();
- //! tar/gzip and then base 64 encode a file
+ /** tar/gzip and then base 64 encode a file */
std::string Base64GzipEncodeFile(std::string const& file);
- //! base64 encode a file
+ /** base64 encode a file */
std::string Base64EncodeFile(std::string const& file);
/**
@@ -222,11 +236,13 @@ public:
*/
double GetRemainingTimeAllowed();
- ///! Open file in the output directory and set the stream
+ /**
+ * Open file in the output directory and set the stream
+ */
bool OpenOutputFile(const std::string& path, const std::string& name,
cmGeneratedFileStream& stream, bool compress = false);
- ///! Should we only show what we would do?
+ /** Should we only show what we would do? */
bool GetShowOnly();
bool ShouldUseHTTP10() { return this->UseHTTP10; }
@@ -242,11 +258,11 @@ public:
std::string GetStopTime() { return this->StopTime; }
void SetStopTime(std::string const& time);
- // Used for parallel ctest job scheduling
+ /** Used for parallel ctest job scheduling */
std::string GetScheduleType() { return this->ScheduleType; }
void SetScheduleType(std::string type) { this->ScheduleType = type; }
- ///! The max output width
+ /** The max output width */
int GetMaxTestNameWidth() const;
void SetMaxTestNameWidth(int w) { this->MaxTestNameWidth = w; }
@@ -271,34 +287,40 @@ public:
* escaped for this to with spaces.
*/
bool RunCommand(const char* command, std::string* stdOut,
- std::string* stdErr, int* retVal = 0, const char* dir = 0,
- double timeout = 0.0);
+ std::string* stdErr, int* retVal = CM_NULLPTR,
+ const char* dir = CM_NULLPTR, double timeout = 0.0);
- //! Clean/make safe for xml the given value such that it may be used as
- // one of the key fields by CDash when computing the buildid.
+ /**
+ * Clean/make safe for xml the given value such that it may be used as
+ * one of the key fields by CDash when computing the buildid.
+ */
static std::string SafeBuildIdField(const std::string& value);
- //! Start CTest XML output file
+ /** Start CTest XML output file */
void StartXML(cmXMLWriter& xml, bool append);
- //! End CTest XML output file
+ /** End CTest XML output file */
void EndXML(cmXMLWriter& xml);
- //! Run command specialized for make and configure. Returns process status
- // and retVal is return value or exception.
+ /**
+ * Run command specialized for make and configure. Returns process status
+ * and retVal is return value or exception.
+ */
int RunMakeCommand(const char* command, std::string& output, int* retVal,
const char* dir, int timeout, std::ostream& ofs);
- /*
- * return the current tag
- */
+ /** Return the current tag */
std::string GetCurrentTag();
- //! Get the path to the build tree
+ /** Get the path to the build tree */
std::string GetBinaryDir();
- //! Get the short path to the file. This means if the file is in binary or
- // source directory, it will become /.../relative/path/to/file
+ /**
+ * Get the short path to the file.
+ *
+ * This means if the file is in binary or
+ * source directory, it will become /.../relative/path/to/file
+ */
std::string GetShortPathToFile(const char* fname);
enum
@@ -308,7 +330,7 @@ public:
CONTINUOUS
};
- // provide some more detailed info on the return code for ctest
+ /** provide some more detailed info on the return code for ctest */
enum
{
UPDATE_ERRORS = 0x01,
@@ -320,14 +342,16 @@ public:
SUBMIT_ERRORS = 0x40
};
- ///! Are we producing XML
+ /** Are we producing XML */
bool GetProduceXML();
void SetProduceXML(bool v);
- //! Run command specialized for tests. Returns process status and retVal is
- // return value or exception. If environment is non-null, it is used to set
- // environment variables prior to running the test. After running the test,
- // environment variables are restored to their previous values.
+ /**
+ * Run command specialized for tests. Returns process status and retVal is
+ * return value or exception. If environment is non-null, it is used to set
+ * environment variables prior to running the test. After running the test,
+ * environment variables are restored to their previous values.
+ */
int RunTest(std::vector<const char*> args, std::string* output, int* retVal,
std::ostream* logfile, double testTimeOut,
std::vector<std::string>* environment);
@@ -338,13 +362,13 @@ public:
*/
int ExecuteHandler(const char* handler);
- /*
+ /**
* Get the handler object
*/
cmCTestGenericHandler* GetHandler(const char* handler);
cmCTestGenericHandler* GetInitializedHandler(const char* handler);
- /*
+ /**
* Set the CTest variable from CMake variable
*/
bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf,
@@ -352,37 +376,42 @@ public:
const std::string& cmake_var,
bool suppress = false);
- //! Make string safe to be send as an URL
+ /** Make string safe to be send as an URL */
static std::string MakeURLSafe(const std::string&);
/** Decode a URL to the original string. */
static std::string DecodeURL(const std::string&);
- //! Should ctect configuration be updated. When using new style ctest
- // script, this should be true.
+ /**
+ * Should ctect configuration be updated. When using new style ctest
+ * script, this should be true.
+ */
void SetSuppressUpdatingCTestConfiguration(bool val)
{
this->SuppressUpdatingCTestConfiguration = val;
}
- //! Add overwrite to ctest configuration.
- // The format is key=value
+ /**
+ * Add overwrite to ctest configuration.
+ *
+ * The format is key=value
+ */
void AddCTestConfigurationOverwrite(const std::string& encstr);
- //! Create XML file that contains all the notes specified
+ /** Create XML file that contains all the notes specified */
int GenerateNotesFile(const VectorOfStrings& files);
- //! Submit extra files to the server
+ /** Submit extra files to the server */
bool SubmitExtraFiles(const char* files);
bool SubmitExtraFiles(const VectorOfStrings& files);
- //! Set the output log file name
+ /** Set the output log file name */
void SetOutputLogFileName(const char* name);
- //! Set the visual studio or Xcode config type
+ /** Set the visual studio or Xcode config type */
void SetConfigType(const char* ct);
- //! Various log types
+ /** Various log types */
enum
{
DEBUG = 0,
@@ -395,15 +424,15 @@ public:
OTHER
};
- //! Add log to the output
+ /** Add log to the output */
void Log(int logType, const char* file, int line, const char* msg,
bool suppress = false);
- //! Get the version of dart server
+ /** Get the version of dart server */
int GetDartVersion() { return this->DartVersion; }
int GetDropSiteCDash() { return this->DropSiteCDash; }
- //! Add file to be submitted
+ /** Add file to be submitted */
void AddSubmitFile(Part part, const char* name);
std::vector<std::string> const& GetSubmitFiles(Part part)
{
@@ -411,7 +440,9 @@ public:
}
void ClearSubmitFiles(Part part) { this->Parts[part].SubmitFiles.clear(); }
- //! Read the custom configuration files and apply them to the current ctest
+ /**
+ * Read the custom configuration files and apply them to the current ctest
+ */
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf);
std::vector<std::string>& GetInitialCommandLineArguments()
@@ -419,7 +450,7 @@ public:
return this->InitialCommandLineArguments;
}
- //! Set the track to submit to
+ /** Set the track to submit to */
void SetSpecificTrack(const char* track);
const char* GetSpecificTrack();
@@ -447,10 +478,13 @@ public:
{
return this->Definitions;
}
- // return the number of times a test should be run
+
+ /** Return the number of times a test should be run */
int GetTestRepeat() { return this->RepeatTests; }
- // return true if test should run until fail
+
+ /** Return true if test should run until fail */
bool GetRepeatUntilFail() { return this->RepeatUntilFail; }
+
private:
int RepeatTests;
bool RepeatUntilFail;
@@ -485,7 +519,7 @@ private:
bool ShowOnly;
- //! Map of configuration properties
+ /** Map of configuration properties */
typedef std::map<std::string, std::string> CTestConfigurationMap;
std::string CTestConfigFile;
@@ -549,36 +583,47 @@ private:
*/
int Initialize(const char* binary_dir, cmCTestStartCommand* command);
- //! parse the option after -D and convert it into the appropriate steps
+ /** parse the option after -D and convert it into the appropriate steps */
bool AddTestsForDashboardType(std::string& targ);
- //! read as "emit an error message for an unknown -D value"
+ /** read as "emit an error message for an unknown -D value" */
void ErrorMessageUnknownDashDValue(std::string& val);
- //! add a variable definition from a command line -D value
+ /** add a variable definition from a command line -D value */
bool AddVariableDefinition(const std::string& arg);
- //! parse and process most common command line arguments
+ /** parse and process most common command line arguments */
bool HandleCommandLineArguments(size_t& i, std::vector<std::string>& args,
std::string& errormsg);
- //! hande the -S -SP and -SR arguments
+ /** hande the -S -SP and -SR arguments */
void HandleScriptArguments(size_t& i, std::vector<std::string>& args,
bool& SRArgumentSpecified);
- //! Reread the configuration file
+ /** Reread the configuration file */
bool UpdateCTestConfiguration();
- //! Create note from files.
+ /** Create note from files. */
int GenerateCTestNotesOutput(cmXMLWriter& xml, const VectorOfStrings& files);
- //! Check if the argument is the one specified
+ /** Check if the argument is the one specified */
bool CheckArgument(const std::string& arg, const char* varg1,
- const char* varg2 = 0);
+ const char* varg2 = CM_NULLPTR);
- //! Output errors from a test
+ /** Output errors from a test */
void OutputTestErrors(std::vector<char> const& process_output);
+ /** Handle the --test-action command line argument */
+ bool HandleTestActionArgument(const char* ctestExec, size_t& i,
+ const std::vector<std::string>& args);
+
+ /** Handle the --test-model command line argument */
+ bool HandleTestModelArgument(const char* ctestExec, size_t& i,
+ const std::vector<std::string>& args);
+
+ int RunCMakeAndTest(std::string* output);
+ int ExecuteTests();
+
bool SuppressUpdatingCTestConfiguration;
bool Debug;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index d143193..39d96b4 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -16,10 +16,12 @@
#include "cmVersion.h"
#include "cmake.h"
-#include <cmsys/Directory.hxx>
+#include <algorithm>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
cmCacheManager::cmCacheManager()
{
@@ -71,8 +73,9 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
while (*realbuffer != '0' &&
(*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\r' ||
*realbuffer == '\n')) {
- if (*realbuffer == '\n')
+ if (*realbuffer == '\n') {
lineno++;
+ }
realbuffer++;
}
// skip blank lines and comment lines
@@ -178,7 +181,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
}
const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED",
- "STRINGS", 0 };
+ "STRINGS", CM_NULLPTR };
bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
CacheEntry& e)
@@ -446,7 +449,7 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
if (i != this->Cache.end()) {
return &i->second;
}
- return 0;
+ return CM_NULLPTR;
}
cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char* key)
@@ -461,7 +464,7 @@ const char* cmCacheManager::GetInitializedCacheValue(
if (i != this->Cache.end() && i->second.Initialized) {
return i->second.Value.c_str();
}
- return 0;
+ return CM_NULLPTR;
}
void cmCacheManager::PrintCache(std::ostream& out) const
@@ -539,6 +542,11 @@ void cmCacheManager::CacheIterator::Next()
}
}
+std::vector<std::string> cmCacheManager::CacheIterator::GetPropertyList() const
+{
+ return this->GetEntry().GetPropertyList();
+}
+
void cmCacheManager::CacheIterator::SetValue(const char* value)
{
if (this->IsAtEnd()) {
@@ -558,12 +566,18 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
return cmSystemTools::IsOn(this->GetEntry().Value.c_str());
}
+std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
+{
+ return this->Properties.GetPropertyList();
+}
+
const char* cmCacheManager::CacheEntry::GetProperty(
const std::string& prop) const
{
if (prop == "TYPE") {
return cmState::CacheEntryTypeToString(this->Type);
- } else if (prop == "VALUE") {
+ }
+ if (prop == "VALUE") {
return this->Value.c_str();
}
return this->Properties.GetPropertyValue(prop);
@@ -605,7 +619,7 @@ const char* cmCacheManager::CacheIterator::GetProperty(
if (!this->IsAtEnd()) {
return this->GetEntry().GetProperty(prop);
}
- return 0;
+ return CM_NULLPTR;
}
void cmCacheManager::CacheIterator::SetProperty(const std::string& p,
@@ -642,5 +656,5 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
bool cmCacheManager::CacheIterator::PropertyExists(
const std::string& prop) const
{
- return this->GetProperty(prop) ? true : false;
+ return this->GetProperty(prop) != CM_NULLPTR;
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index e9b80cb..3e32cf0 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -12,12 +12,19 @@
#ifndef cmCacheManager_h
#define cmCacheManager_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmPropertyMap.h"
#include "cmState.h"
-class cmMarkAsAdvancedCommand;
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+class cmake;
/** \class cmCacheManager
* \brief Control class for cmake's cache
@@ -38,6 +45,7 @@ private:
std::string Value;
cmState::CacheEntryType Type;
cmPropertyMap Properties;
+ std::vector<std::string> GetPropertyList() const;
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,
@@ -60,6 +68,7 @@ public:
bool IsAtEnd() const;
void Next();
std::string GetName() const { return this->Position->first; }
+ std::vector<std::string> GetPropertyList() const;
const char* GetProperty(const std::string&) const;
bool GetPropertyAsBool(const std::string&) const;
bool PropertyExists(const std::string&) const;
@@ -111,7 +120,7 @@ public:
void PrintCache(std::ostream&) const;
///! Get the iterator for an entry with a given key.
- cmCacheManager::CacheIterator GetCacheIterator(const char* key = 0);
+ cmCacheManager::CacheIterator GetCacheIterator(const char* key = CM_NULLPTR);
///! Remove an entry from the cache
void RemoveCacheEntry(const std::string& key);
@@ -126,7 +135,7 @@ public:
{
cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
if (it.IsAtEnd()) {
- return 0;
+ return CM_NULLPTR;
}
return it.GetValue();
}
@@ -169,7 +178,8 @@ public:
void RemoveCacheEntryProperty(std::string const& key,
std::string const& propName)
{
- this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
+ this->GetCacheIterator(key.c_str())
+ .SetProperty(propName, (void*)CM_NULLPTR);
}
void AppendCacheEntryProperty(std::string const& key,
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index e608d6b..515699d 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -105,8 +105,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
std::ostringstream oss;
oss << std::endl;
oss << "Invoke(ExecuteCommand)" << std::endl;
- oss << " Macro: " << macro.c_str() << std::endl;
- oss << " Args: " << args.c_str() << std::endl;
+ oss << " Macro: " << macro << std::endl;
+ oss << " Args: " << args << std::endl;
if (DISP_E_EXCEPTION == hr) {
oss << "DISP_E_EXCEPTION EXCEPINFO:" << excep.wCode << std::endl;
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 0157293..a5f20e6 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -38,14 +38,14 @@ public:
*/
cmCommand()
{
- this->Makefile = 0;
+ this->Makefile = CM_NULLPTR;
this->Enabled = true;
}
/**
* Need virtual destructor to destroy real command type.
*/
- virtual ~cmCommand() {}
+ ~cmCommand() CM_OVERRIDE {}
/**
* Specify the makefile.
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index a4f3c7d..68111a0 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -25,7 +25,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
this->WarnUninitialized = false;
this->CheckSystemVars = false;
this->FileLine = -1;
- this->FileName = 0;
+ this->FileName = CM_NULLPTR;
this->RemoveEmpty = true;
this->EmptyVariable[0] = 0;
strcpy(this->DCURLYVariable, "${");
@@ -71,13 +71,12 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
return this->EmptyVariable;
}
if (strcmp(key, "ENV") == 0) {
- char* ptr = getenv(var);
- if (ptr) {
+ std::string str;
+ if (cmSystemTools::GetEnv(var, str)) {
if (this->EscapeQuotes) {
- return this->AddString(cmSystemTools::EscapeQuotes(ptr));
- } else {
- return ptr;
+ return this->AddString(cmSystemTools::EscapeQuotes(str.c_str()));
}
+ return this->AddString(str);
}
return this->EmptyVariable;
}
@@ -86,9 +85,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
this->Makefile->GetState()->GetInitializedCacheValue(var)) {
if (this->EscapeQuotes) {
return this->AddString(cmSystemTools::EscapeQuotes(c));
- } else {
- return this->AddString(c);
}
+ return this->AddString(c);
}
return this->EmptyVariable;
}
@@ -96,13 +94,13 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
e << "Syntax $" << key << "{} is not supported. "
<< "Only ${}, $ENV{}, and $CACHE{} are allowed.";
this->SetError(e.str());
- return 0;
+ return CM_NULLPTR;
}
char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
{
if (!var) {
- return 0;
+ return CM_NULLPTR;
}
if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
std::ostringstream ostr;
@@ -125,7 +123,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
}
}
- return 0;
+ return CM_NULLPTR;
}
if (this->EscapeQuotes && value) {
return this->AddString(cmSystemTools::EscapeQuotes(value));
@@ -162,7 +160,8 @@ char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
{
if (!in1) {
return in2;
- } else if (!in2) {
+ }
+ if (!in2) {
return in1;
}
size_t len = strlen(in1) + strlen(in2) + 1;
@@ -176,7 +175,7 @@ char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
void cmCommandArgumentParserHelper::AllocateParserType(
cmCommandArgumentParserHelper::ParserType* pt, const char* str, int len)
{
- pt->str = 0;
+ pt->str = CM_NULLPTR;
if (len == 0) {
len = static_cast<int>(strlen(str));
}
@@ -282,10 +281,9 @@ int cmCommandArgumentParserHelper::LexInput(char* buf, int maxlen)
this->CurrentLine++;
}
return (1);
- } else {
- buf[0] = '\n';
- return (0);
}
+ buf[0] = '\n';
+ return (0);
}
void cmCommandArgumentParserHelper::Error(const char* str)
diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx
index c336bc5..1345bd5 100644
--- a/Source/cmCommandArgumentsHelper.cxx
+++ b/Source/cmCommandArgumentsHelper.cxx
@@ -21,11 +21,11 @@ cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args,
, ArgumentsBeforeEmpty(true)
, CurrentIndex(0)
{
- if (args != 0) {
+ if (args != CM_NULLPTR) {
args->AddArgument(this);
}
- if (this->Group != 0) {
+ if (this->Group != CM_NULLPTR) {
this->Group->ContainedArguments.push_back(this);
}
}
@@ -45,7 +45,7 @@ void cmCommandArgument::Follows(const cmCommandArgument* arg)
void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group)
{
- if (group != 0) {
+ if (group != CM_NULLPTR) {
this->ArgumentsBeforeEmpty = false;
this->ArgumentsBefore.insert(group->ContainedArguments.begin(),
group->ContainedArguments.end());
@@ -69,7 +69,7 @@ bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const
bool cmCommandArgument::KeyMatches(const std::string& key) const
{
- if ((this->Key == 0) || (this->Key[0] == '\0')) {
+ if ((this->Key == CM_NULLPTR) || (this->Key[0] == '\0')) {
return true;
}
return (key == this->Key);
@@ -77,7 +77,7 @@ bool cmCommandArgument::KeyMatches(const std::string& key) const
void cmCommandArgument::ApplyOwnGroup()
{
- if (this->Group != 0) {
+ if (this->Group != CM_NULLPTR) {
for (std::vector<cmCommandArgument*>::const_iterator it =
this->Group->ContainedArguments.begin();
it != this->Group->ContainedArguments.end(); ++it) {
@@ -105,9 +105,9 @@ cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args,
const char* key,
cmCommandArgumentGroup* group)
: cmCommandArgument(args, key, group)
- , Ignore(0)
+ , Ignore(CM_NULLPTR)
{
- if ((key == 0) || (*key == 0)) {
+ if ((key == CM_NULLPTR) || (*key == 0)) {
this->DataStart = 0;
} else {
this->DataStart = 1;
@@ -117,7 +117,7 @@ cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args,
bool cmCAStringVector::DoConsume(const std::string& arg, unsigned int index)
{
if (index >= this->DataStart) {
- if ((this->Ignore == 0) || (arg != this->Ignore)) {
+ if ((this->Ignore == CM_NULLPTR) || (arg != this->Ignore)) {
this->Vector.push_back(arg);
}
}
@@ -134,7 +134,7 @@ cmCAString::cmCAString(cmCommandArgumentsHelper* args, const char* key,
cmCommandArgumentGroup* group)
: cmCommandArgument(args, key, group)
{
- if ((key == 0) || (*key == 0)) {
+ if ((key == CM_NULLPTR) || (*key == 0)) {
this->DataStart = 0;
} else {
this->DataStart = 1;
@@ -216,7 +216,7 @@ void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group)
void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
std::vector<std::string>* unconsumedArgs)
{
- if (args == 0) {
+ if (args == CM_NULLPTR) {
return;
}
@@ -227,8 +227,8 @@ void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
(*argIt)->Reset();
}
- cmCommandArgument* activeArgument = 0;
- const cmCommandArgument* previousArgument = 0;
+ cmCommandArgument* activeArgument = CM_NULLPTR;
+ const cmCommandArgument* previousArgument = CM_NULLPTR;
for (std::vector<std::string>::const_iterator it = args->begin();
it != args->end(); ++it) {
for (std::vector<cmCommandArgument*>::iterator argIt =
@@ -246,10 +246,10 @@ void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
bool argDone = activeArgument->Consume(*it);
previousArgument = activeArgument;
if (argDone) {
- activeArgument = 0;
+ activeArgument = CM_NULLPTR;
}
} else {
- if (unconsumedArgs != 0) {
+ if (unconsumedArgs != CM_NULLPTR) {
unconsumedArgs->push_back(*it);
}
}
diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h
index c2a6f92..9133148 100644
--- a/Source/cmCommandArgumentsHelper.h
+++ b/Source/cmCommandArgumentsHelper.h
@@ -43,7 +43,7 @@ class cmCommandArgument
{
public:
cmCommandArgument(cmCommandArgumentsHelper* args, const char* key,
- cmCommandArgumentGroup* group = 0);
+ cmCommandArgumentGroup* group = CM_NULLPTR);
virtual ~cmCommandArgument() {}
/// this argument may follow after arg. 0 means it comes first.
@@ -95,7 +95,7 @@ class cmCAStringVector : public cmCommandArgument
{
public:
cmCAStringVector(cmCommandArgumentsHelper* args, const char* key,
- cmCommandArgumentGroup* group = 0);
+ cmCommandArgumentGroup* group = CM_NULLPTR);
/// Return the vector of strings
const std::vector<std::string>& GetVector() const { return this->Vector; }
@@ -108,8 +108,8 @@ private:
unsigned int DataStart;
const char* Ignore;
cmCAStringVector();
- virtual bool DoConsume(const std::string& arg, unsigned int index);
- virtual void DoReset();
+ bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE;
+ void DoReset() CM_OVERRIDE;
};
/** cmCAString is to be used for arguments which consist of one value,
@@ -118,7 +118,7 @@ class cmCAString : public cmCommandArgument
{
public:
cmCAString(cmCommandArgumentsHelper* args, const char* key,
- cmCommandArgumentGroup* group = 0);
+ cmCommandArgumentGroup* group = CM_NULLPTR);
/// Return the string
const std::string& GetString() const { return this->String; }
@@ -126,8 +126,8 @@ public:
private:
std::string String;
unsigned int DataStart;
- virtual bool DoConsume(const std::string& arg, unsigned int index);
- virtual void DoReset();
+ bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE;
+ void DoReset() CM_OVERRIDE;
cmCAString();
};
@@ -137,14 +137,14 @@ class cmCAEnabler : public cmCommandArgument
{
public:
cmCAEnabler(cmCommandArgumentsHelper* args, const char* key,
- cmCommandArgumentGroup* group = 0);
+ cmCommandArgumentGroup* group = CM_NULLPTR);
/// Has it been enabled ?
bool IsEnabled() const { return this->Enabled; }
private:
bool Enabled;
- virtual bool DoConsume(const std::string& arg, unsigned int index);
- virtual void DoReset();
+ bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE;
+ void DoReset() CM_OVERRIDE;
cmCAEnabler();
};
@@ -154,14 +154,14 @@ class cmCADisabler : public cmCommandArgument
{
public:
cmCADisabler(cmCommandArgumentsHelper* args, const char* key,
- cmCommandArgumentGroup* group = 0);
+ cmCommandArgumentGroup* group = CM_NULLPTR);
/// Is it still enabled ?
bool IsEnabled() const { return this->Enabled; }
private:
bool Enabled;
- virtual bool DoConsume(const std::string& arg, unsigned int index);
- virtual void DoReset();
+ bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE;
+ void DoReset() CM_OVERRIDE;
cmCADisabler();
};
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index d0f1ab7..034c9c7 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -12,7 +12,7 @@
#ifndef cmCommands_h
#define cmCommands_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <vector>
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index c630971..6167e2c 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -11,25 +11,30 @@
============================================================================*/
#include "cmCommonTargetGenerator.h"
+#include <algorithm>
+#include <cmConfigure.h>
+#include <set>
+#include <sstream>
+#include <utility>
+
+#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
#include "cmLocalCommonGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmSystemTools.h"
+#include "cmState.h"
-cmCommonTargetGenerator::cmCommonTargetGenerator(
- cmOutputConverter::RelativeRoot wd, cmGeneratorTarget* gt)
- : WorkingDirectory(wd)
- , GeneratorTarget(gt)
+cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
+ : GeneratorTarget(gt)
, Makefile(gt->Makefile)
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
gt->LocalGenerator->GetGlobalGenerator()))
, ConfigName(LocalGenerator->GetConfigName())
, ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
- , FortranModuleDirectoryComputed(false)
{
}
@@ -91,99 +96,17 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
this->LocalGenerator->AppendFlags(flags, flag);
}
-std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
-{
- std::string mod_dir;
- const char* target_mod_dir =
- this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY");
- const char* moddir_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
- if (target_mod_dir && moddir_flag) {
- // Compute the full path to the module directory.
- if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
- // Already a full path.
- mod_dir = target_mod_dir;
- } else {
- // Interpret relative to the current output directory.
- mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
- mod_dir += "/";
- mod_dir += target_mod_dir;
- }
-
- // Make sure the module output directory exists.
- cmSystemTools::MakeDirectory(mod_dir);
- }
- return mod_dir;
-}
-
-std::string cmCommonTargetGenerator::GetFortranModuleDirectory()
-{
- // Compute the module directory.
- if (!this->FortranModuleDirectoryComputed) {
- this->FortranModuleDirectoryComputed = true;
- this->FortranModuleDirectory = this->ComputeFortranModuleDirectory();
- }
-
- // Return the computed directory.
- return this->FortranModuleDirectory;
-}
-
-void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
-{
- // Enable module output if necessary.
- if (const char* modout_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
- this->LocalGenerator->AppendFlags(flags, modout_flag);
- }
-
- // Add a module output directory flag if necessary.
- std::string mod_dir = this->GetFortranModuleDirectory();
- if (!mod_dir.empty()) {
- mod_dir =
- this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
- } else {
- mod_dir =
- this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
- }
- if (!mod_dir.empty()) {
- const char* moddir_flag =
- this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
- std::string modflag = moddir_flag;
- modflag += mod_dir;
- this->LocalGenerator->AppendFlags(flags, modflag);
- }
-
- // If there is a separate module path flag then duplicate the
- // include path with it. This compiler does not search the include
- // path for modules.
- if (const char* modpath_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
- std::vector<std::string> includes;
- const std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- this->LocalGenerator->GetIncludeDirectories(
- includes, this->GeneratorTarget, "C", config);
- for (std::vector<std::string>::const_iterator idi = includes.begin();
- idi != includes.end(); ++idi) {
- std::string flg = modpath_flag;
- flg +=
- this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
- this->LocalGenerator->AppendFlags(flags, flg);
- }
- }
-}
-
void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string& flags, cmSourceFile const& source)
{
const char* srcfmt = source.GetProperty("Fortran_FORMAT");
cmOutputConverter::FortranFormat format =
- this->LocalGenerator->GetFortranFormat(srcfmt);
+ cmOutputConverter::GetFortranFormat(srcfmt);
if (format == cmOutputConverter::FortranFormatNone) {
const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
- format = this->LocalGenerator->GetFortranFormat(tgtfmt);
+ format = cmOutputConverter::GetFortranFormat(tgtfmt);
}
- const char* var = 0;
+ const char* var = CM_NULLPTR;
switch (format) {
case cmOutputConverter::FortranFormatFixed:
var = "CMAKE_Fortran_FORMAT_FIXED_FLAG";
@@ -200,91 +123,14 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
}
-std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
-{
- if (!this->Makefile->IsOn("APPLE")) {
- return std::string();
- }
-
- std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
- if (!(fwSearchFlag && *fwSearchFlag)) {
- return std::string();
- }
-
- 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 std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
- "C", config);
- // check all include directories for frameworks as this
- // will already have added a -F for the framework
- for (std::vector<std::string>::iterator i = includes.begin();
- i != includes.end(); ++i) {
- if (this->GlobalGenerator->NameResolvesToFramework(*i)) {
- std::string frameworkDir = *i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
- emitted.insert(frameworkDir);
- }
- }
-
- std::string flags;
- const char* cfg = this->LocalGenerator->GetConfigName().c_str();
- if (cmComputeLinkInformation* cli =
- this->GeneratorTarget->GetLinkInformation(cfg)) {
- std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
- for (std::vector<std::string>::const_iterator i = frameworks.begin();
- i != frameworks.end(); ++i) {
- if (emitted.insert(*i).second) {
- flags += fwSearchFlag;
- flags += this->LocalGenerator->ConvertToOutputFormat(
- *i, cmOutputConverter::SHELL);
- flags += " ";
- }
- }
- }
- return flags;
-}
-
std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
{
ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
if (i == this->FlagsByLanguage.end()) {
std::string flags;
- const char* lang = l.c_str();
-
- // Add language feature flags.
- this->AddFeatureFlags(flags, lang);
-
- this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
- lang, this->ConfigName);
-
- // Fortran-specific flags computed for this target.
- if (l == "Fortran") {
- this->AddFortranFlags(flags);
- }
-
- this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
- this->ConfigName);
- this->LocalGenerator->AddVisibilityPresetFlags(
- flags, this->GeneratorTarget, lang);
-
- // Append old-style preprocessor definition flags.
- this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags());
-
- // Add framework directory flags.
- this->LocalGenerator->AppendFlags(flags, this->GetFrameworkFlags(l));
-
- // Add target-specific flags.
- this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
- this->ConfigName);
+ this->LocalGenerator->GetTargetCompileFlags(this->GeneratorTarget,
+ this->ConfigName, l, flags);
ByLanguageMap::value_type entry(l, flags);
i = this->FlagsByLanguage.insert(entry).first;
@@ -297,19 +143,11 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
- const char* lang = l.c_str();
- // Add the export symbol definition for shared library objects.
- if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) {
- this->LocalGenerator->AppendDefines(defines, exportMacro);
- }
-
- // Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AddCompileDefinitions(
- defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(),
- l);
+ this->LocalGenerator->GetTargetDefines(this->GeneratorTarget,
+ this->ConfigName, l, defines);
std::string definesString;
- this->LocalGenerator->JoinDefines(defines, definesString, lang);
+ this->LocalGenerator->JoinDefines(defines, definesString, l);
ByLanguageMap::value_type entry(l, definesString);
i = this->DefinesByLanguage.insert(entry).first;
@@ -367,7 +205,8 @@ std::string cmCommonTargetGenerator::GetManifests()
for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
mi != manifest_srcs.end(); ++mi) {
manifests.push_back(this->Convert(
- (*mi)->GetFullPath(), this->WorkingDirectory, cmOutputConverter::SHELL));
+ (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(),
+ cmOutputConverter::SHELL));
}
return cmJoin(manifests, " ");
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index c9645e7..b433c18 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -12,9 +12,13 @@
#ifndef cmCommonTargetGenerator_h
#define cmCommonTargetGenerator_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
+
+#include <map>
+#include <string>
+#include <vector>
class cmGeneratorTarget;
class cmGlobalCommonGenerator;
@@ -28,8 +32,7 @@ class cmSourceFile;
class cmCommonTargetGenerator
{
public:
- cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd,
- cmGeneratorTarget* gt);
+ cmCommonTargetGenerator(cmGeneratorTarget* gt);
virtual ~cmCommonTargetGenerator();
std::string const& GetConfigName() const;
@@ -45,7 +48,6 @@ protected:
// Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(std::string& flags);
- cmOutputConverter::RelativeRoot WorkingDirectory;
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
cmLocalCommonGenerator* LocalGenerator;
@@ -55,25 +57,13 @@ protected:
// The windows module definition source file (.def), if any.
cmSourceFile const* ModuleDefinitionFile;
- // Target-wide Fortran module output directory.
- bool FortranModuleDirectoryComputed;
- std::string FortranModuleDirectory;
- std::string GetFortranModuleDirectory();
- virtual std::string ComputeFortranModuleDirectory() const;
-
- // Compute target-specific Fortran language flags.
- void AddFortranFlags(std::string& flags);
-
- std::string Convert(
- std::string const& source, cmOutputConverter::RelativeRoot relative,
- cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
+ std::string Convert(std::string const& source,
+ cmOutputConverter::RelativeRoot relative,
+ cmOutputConverter::OutputFormat output);
void AppendFortranFormatFlags(std::string& flags,
cmSourceFile const& source);
- // Return the a string with -F flags on apple
- std::string GetFrameworkFlags(std::string const& l);
-
virtual void AddIncludeFlags(std::string& flags,
std::string const& lang) = 0;
diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h
index fb95f9a..cc468d9 100644
--- a/Source/cmComputeComponentGraph.h
+++ b/Source/cmComputeComponentGraph.h
@@ -12,11 +12,12 @@
#ifndef cmComputeComponentGraph_h
#define cmComputeComponentGraph_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmGraphAdjacencyList.h"
#include <stack>
+#include <vector>
/** \class cmComputeComponentGraph
* \brief Analyze a graph to determine strongly connected components.
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 2129394..98405cf 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -13,13 +13,22 @@
#include "cmAlgorithms.h"
#include "cmComputeComponentGraph.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
+#include <algorithm>
#include <assert.h>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+#include <utility>
/*
@@ -194,7 +203,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
this->OldLinkDirMode = false;
// No computation has been done.
- this->CCG = 0;
+ this->CCG = CM_NULLPTR;
}
cmComputeLinkDepends::~cmComputeLinkDepends()
@@ -286,7 +295,7 @@ std::map<std::string, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
std::map<std::string, int>::iterator lei =
this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.push_back(LinkEntry());
- this->InferredDependSets.push_back(0);
+ this->InferredDependSets.push_back(CM_NULLPTR);
this->EntryConstraintGraph.push_back(EdgeList());
return lei;
}
@@ -314,7 +323,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
// If the item has dependencies queue it to follow them.
if (entry.Target) {
// Target dependencies are always known. Follow them.
- BFSEntry qe = { index, 0 };
+ BFSEntry qe = { index, CM_NULLPTR };
this->BFSQueue.push(qe);
} else {
// Look for an old-style <item>_LIB_DEPENDS variable.
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 6aa40c3..7cd4140 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -12,17 +12,22 @@
#ifndef cmComputeLinkDepends_h
#define cmComputeLinkDepends_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmGraphAdjacencyList.h"
#include "cmLinkItem.h"
+#include "cmTargetLinkLibraryType.h"
+#include <map>
#include <queue>
+#include <set>
+#include <string>
+#include <vector>
class cmComputeComponentGraph;
+class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
-class cmGeneratorTarget;
class cmake;
/** \class cmComputeLinkDepends
@@ -44,7 +49,7 @@ public:
bool IsFlag;
LinkEntry()
: Item()
- , Target(0)
+ , Target(CM_NULLPTR)
, IsSharedDep(false)
, IsFlag(false)
{
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e1a7bee..82877f3 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -11,19 +11,25 @@
============================================================================*/
#include "cmComputeLinkInformation.h"
-#include "cmComputeLinkDepends.h"
-#include "cmOrderDirectories.h"
-
#include "cmAlgorithms.h"
+#include "cmComputeLinkDepends.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmOrderDirectories.h"
#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
#include "cmake.h"
+#include <algorithm>
#include <ctype.h>
+#include <sstream>
+#include <string.h>
+#include <utility>
//#define CM_COMPUTE_LINK_INFO_DEBUG
@@ -262,7 +268,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
this->GlobalGenerator, target, "linker search path");
this->OrderRuntimeSearchPath = new cmOrderDirectories(
this->GlobalGenerator, target, "runtime search path");
- this->OrderDependentRPath = 0;
+ this->OrderDependentRPath = CM_NULLPTR;
// Get the language used for linking this target.
this->LinkLanguage = this->Target->GetLinkerLanguage(config);
@@ -274,8 +280,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Check whether we should use an import library for linking a target.
this->UseImportLibrary =
- this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX") ? true
- : false;
+ this->Makefile->IsDefinitionSet("CMAKE_IMPORT_LIBRARY_SUFFIX");
// Check whether we should skip dependencies on shared library files.
this->LinkDependsNoShared =
@@ -284,7 +289,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// On platforms without import libraries there may be a special flag
// to use when creating a plugin (module) that obtains symbols from
// the program that will load it.
- this->LoaderFlag = 0;
+ this->LoaderFlag = CM_NULLPTR;
if (!this->UseImportLibrary &&
this->Target->GetType() == cmState::MODULE_LIBRARY) {
std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
@@ -562,7 +567,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
for (std::vector<std::string>::const_iterator i = libsVec.begin();
i != libsVec.end(); ++i) {
if (this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end()) {
- this->AddItem(*i, 0);
+ this->AddItem(*i, CM_NULLPTR);
}
}
}
@@ -694,7 +699,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
// Check if we need to include the dependent shared library in other
// path ordering.
- cmOrderDirectories* order = 0;
+ cmOrderDirectories* order = CM_NULLPTR;
if (this->SharedDependencyMode == SharedDepModeLibDir &&
!this->LinkWithRuntimePath /* AddLibraryRuntimeInfo adds it */) {
// Add the item to the linker search path.
@@ -706,7 +711,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
if (order) {
if (tgt) {
std::string soName = tgt->GetSOName(this->Config);
- const char* soname = soName.empty() ? 0 : soName.c_str();
+ const char* soname = soName.empty() ? CM_NULLPTR : soName.c_str();
order->AddRuntimeLibrary(lib, soname);
} else {
order->AddRuntimeLibrary(lib);
@@ -725,9 +730,9 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
this->LinkTypeEnabled = false;
// Lookup link type selection flags.
- const char* static_link_type_flag = 0;
- const char* shared_link_type_flag = 0;
- const char* target_type_str = 0;
+ const char* static_link_type_flag = CM_NULLPTR;
+ const char* shared_link_type_flag = CM_NULLPTR;
+ const char* target_type_str = CM_NULLPTR;
switch (this->Target->GetType()) {
case cmState::EXECUTABLE:
target_type_str = "EXE";
@@ -1607,7 +1612,7 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
std::string soName = target->GetSOName(this->Config);
- const char* soname = soName.empty() ? 0 : soName.c_str();
+ const char* soname = soName.empty() ? CM_NULLPTR : soName.c_str();
// Include this library in the runtime path ordering.
this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index c0ddc53..7a67567 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -12,15 +12,19 @@
#ifndef cmComputeLinkInformation_h
#define cmComputeLinkInformation_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <cmsys/RegularExpression.hxx>
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
-class cmake;
+class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
-class cmGeneratorTarget;
class cmOrderDirectories;
+class cmake;
/** \class cmComputeLinkInformation
* \brief Compute link information for a target in one configuration.
@@ -38,7 +42,7 @@ public:
Item()
: Value()
, IsPath(true)
- , Target(0)
+ , Target(CM_NULLPTR)
{
}
Item(Item const& item)
@@ -47,7 +51,8 @@ public:
, Target(item.Target)
{
}
- Item(std::string const& v, bool p, cmGeneratorTarget const* target = 0)
+ Item(std::string const& v, bool p,
+ cmGeneratorTarget const* target = CM_NULLPTR)
: Value(v)
, IsPath(p)
, Target(target)
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 570405a..dd07300 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -12,18 +12,25 @@
#include "cmComputeTargetDepends.h"
#include "cmComputeComponentGraph.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetDepend.h"
#include "cmake.h"
-#include <algorithm>
-
#include <assert.h>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
+class cmListFileBacktrace;
/*
@@ -291,7 +298,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
// within the project.
if (dependee && dependee->GetType() == cmState::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
- dependee = 0;
+ dependee = CM_NULLPTR;
}
if (dependee) {
@@ -355,7 +362,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
// within the project.
if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
- dependee = 0;
+ dependee = CM_NULLPTR;
}
if (dependee) {
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 9e51d4d..587ac66 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -12,16 +12,19 @@
#ifndef cmComputeTargetDepends_h
#define cmComputeTargetDepends_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmGraphAdjacencyList.h"
-#include <stack>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
class cmComputeComponentGraph;
+class cmGeneratorTarget;
class cmGlobalGenerator;
class cmLinkItem;
-class cmGeneratorTarget;
class cmTargetDependSet;
/** \class cmComputeTargetDepends
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 7006b62..d7532b3 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -21,12 +21,14 @@ static std::string const keyDEFINED = "DEFINED";
static std::string const keyEQUAL = "EQUAL";
static std::string const keyEXISTS = "EXISTS";
static std::string const keyGREATER = "GREATER";
+static std::string const keyGREATER_EQUAL = "GREATER_EQUAL";
static std::string const keyIN_LIST = "IN_LIST";
static std::string const keyIS_ABSOLUTE = "IS_ABSOLUTE";
static std::string const keyIS_DIRECTORY = "IS_DIRECTORY";
static std::string const keyIS_NEWER_THAN = "IS_NEWER_THAN";
static std::string const keyIS_SYMLINK = "IS_SYMLINK";
static std::string const keyLESS = "LESS";
+static std::string const keyLESS_EQUAL = "LESS_EQUAL";
static std::string const keyMATCHES = "MATCHES";
static std::string const keyNOT = "NOT";
static std::string const keyOR = "OR";
@@ -35,12 +37,16 @@ static std::string const keyParenR = ")";
static std::string const keyPOLICY = "POLICY";
static std::string const keySTREQUAL = "STREQUAL";
static std::string const keySTRGREATER = "STRGREATER";
+static std::string const keySTRGREATER_EQUAL = "STRGREATER_EQUAL";
static std::string const keySTRLESS = "STRLESS";
+static std::string const keySTRLESS_EQUAL = "STRLESS_EQUAL";
static std::string const keyTARGET = "TARGET";
static std::string const keyTEST = "TEST";
static std::string const keyVERSION_EQUAL = "VERSION_EQUAL";
static std::string const keyVERSION_GREATER = "VERSION_GREATER";
+static std::string const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL";
static std::string const keyVERSION_LESS = "VERSION_LESS";
+static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL";
cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
const cmListFileContext& context,
@@ -130,7 +136,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
if ((this->Policy54Status != cmPolicies::WARN &&
this->Policy54Status != cmPolicies::OLD) &&
argument.WasQuoted()) {
- return 0;
+ return CM_NULLPTR;
}
const char* def = this->Makefile.GetDefinition(argument.GetValue());
@@ -486,7 +492,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
if (argP1len > 4 && argP1->GetValue().substr(0, 4) == "ENV{" &&
argP1->GetValue().operator[](argP1len - 1) == '}') {
std::string env = argP1->GetValue().substr(4, argP1len - 5);
- bdef = cmSystemTools::GetEnv(env.c_str()) ? true : false;
+ bdef = cmSystemTools::HasEnv(env.c_str());
} else {
bdef = this->Makefile.IsDefinitionSet(argP1->GetValue());
}
@@ -559,7 +565,9 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
(this->IsKeyword(keyLESS, *argP1) ||
+ this->IsKeyword(keyLESS_EQUAL, *argP1) ||
this->IsKeyword(keyGREATER, *argP1) ||
+ this->IsKeyword(keyGREATER_EQUAL, *argP1) ||
this->IsKeyword(keyEQUAL, *argP1))) {
def = this->GetVariableOrString(*arg);
def2 = this->GetVariableOrString(*argP2);
@@ -570,8 +578,12 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
result = false;
} else if (*(argP1) == keyLESS) {
result = (lhs < rhs);
+ } else if (*(argP1) == keyLESS_EQUAL) {
+ result = (lhs <= rhs);
} else if (*(argP1) == keyGREATER) {
result = (lhs > rhs);
+ } else if (*(argP1) == keyGREATER_EQUAL) {
+ result = (lhs >= rhs);
} else {
result = (lhs == rhs);
}
@@ -580,16 +592,22 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
(this->IsKeyword(keySTRLESS, *argP1) ||
- this->IsKeyword(keySTREQUAL, *argP1) ||
- this->IsKeyword(keySTRGREATER, *argP1))) {
+ this->IsKeyword(keySTRLESS_EQUAL, *argP1) ||
+ this->IsKeyword(keySTRGREATER, *argP1) ||
+ this->IsKeyword(keySTRGREATER_EQUAL, *argP1) ||
+ this->IsKeyword(keySTREQUAL, *argP1))) {
def = this->GetVariableOrString(*arg);
def2 = this->GetVariableOrString(*argP2);
int val = strcmp(def, def2);
bool result;
if (*(argP1) == keySTRLESS) {
result = (val < 0);
+ } else if (*(argP1) == keySTRLESS_EQUAL) {
+ result = (val <= 0);
} else if (*(argP1) == keySTRGREATER) {
result = (val > 0);
+ } else if (*(argP1) == keySTRGREATER_EQUAL) {
+ result = (val >= 0);
} else // strequal
{
result = (val == 0);
@@ -599,15 +617,23 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
(this->IsKeyword(keyVERSION_LESS, *argP1) ||
+ this->IsKeyword(keyVERSION_LESS_EQUAL, *argP1) ||
this->IsKeyword(keyVERSION_GREATER, *argP1) ||
+ this->IsKeyword(keyVERSION_GREATER_EQUAL, *argP1) ||
this->IsKeyword(keyVERSION_EQUAL, *argP1))) {
def = this->GetVariableOrString(*arg);
def2 = this->GetVariableOrString(*argP2);
- cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL;
+ cmSystemTools::CompareOp op;
if (*argP1 == keyVERSION_LESS) {
op = cmSystemTools::OP_LESS;
+ } else if (*argP1 == keyVERSION_LESS_EQUAL) {
+ op = cmSystemTools::OP_LESS_EQUAL;
} else if (*argP1 == keyVERSION_GREATER) {
op = cmSystemTools::OP_GREATER;
+ } else if (*argP1 == keyVERSION_GREATER_EQUAL) {
+ op = cmSystemTools::OP_GREATER_EQUAL;
+ } else { // version_equal
+ op = cmSystemTools::OP_EQUAL;
}
bool result = cmSystemTools::VersionCompare(op, def, def2);
this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2);
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 62128a7..cb671dd 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -9,10 +9,44 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
+#ifndef cmConfigure_h
+#define cmConfigure_h
+
+#include <cmsys/Configure.hxx>
+
+#ifdef _MSC_VER
+#pragma warning(disable : 4786)
+#pragma warning(disable : 4503)
+#endif
+
+#ifdef __ICL
+#pragma warning(disable : 985)
+#pragma warning(disable : 1572) /* floating-point equality test */
+#endif
+
#cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE
#cmakedefine HAVE_UNSETENV
#cmakedefine CMAKE_USE_ELF_PARSER
#cmakedefine CMAKE_USE_MACH_PARSER
+#cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMAKE_ENCODING_UTF8
-#cmakedefine CMake_HAVE_CXX11_UNORDERED_MAP
+#cmakedefine CMake_HAVE_CXX_NULLPTR
+#cmakedefine CMake_HAVE_CXX_OVERRIDE
+#cmakedefine CMake_HAVE_CXX_UNORDERED_MAP
+#cmakedefine CMake_HAVE_CXX_UNORDERED_SET
+#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
+
+#ifdef CMake_HAVE_CXX_NULLPTR
+#define CM_NULLPTR nullptr
+#else
+#define CM_NULLPTR 0
+#endif
+
+#ifdef CMake_HAVE_CXX_OVERRIDE
+#define CM_OVERRIDE override
+#else
+#define CM_OVERRIDE
+#endif
+
+#endif
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 79f00bc..1da65c8 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -19,24 +19,24 @@ class cmConfigureFileCommand : public cmCommand
public:
cmTypeMacro(cmConfigureFileCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmConfigureFileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmConfigureFileCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "configure_file"; }
+ std::string GetName() const CM_OVERRIDE { return "configure_file"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
private:
int ConfigureFile();
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 63ae59d..6fa9af2 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmContinueCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmContinueCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "continue"; }
+ std::string GetName() const CM_OVERRIDE { return "continue"; }
cmTypeMacro(cmContinueCommand, cmCommand);
};
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 0149fdf..e9367b1 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -77,7 +77,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
const char* sourceDirectory = argv[2].c_str();
- const char* projectName = 0;
+ const char* projectName = CM_NULLPTR;
std::string targetName;
std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
std::vector<std::string> compileDefs;
@@ -333,14 +333,43 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n",
li->c_str(), li->c_str());
- static std::string const cfgDefault = "DEBUG";
- std::string const cfg =
- !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault;
- std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg;
- const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg);
- fprintf(
- fout, "set(%s %s)\n", langFlagsCfg.c_str(),
- cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "").c_str());
+ }
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0066)) {
+ case cmPolicies::WARN:
+ if (this->Makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0066")) {
+ std::ostringstream w;
+ /* clang-format off */
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0066) << "\n"
+ "For compatibility with older versions of CMake, try_compile "
+ "is not honoring caller config-specific compiler flags "
+ "(e.g. CMAKE_C_FLAGS_DEBUG) in the test project."
+ ;
+ /* clang-format on */
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ case cmPolicies::OLD:
+ // OLD behavior is to do nothing.
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066));
+ case cmPolicies::NEW: {
+ // NEW behavior is to pass config-specific compiler flags.
+ static std::string const cfgDefault = "DEBUG";
+ std::string const cfg =
+ !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault;
+ for (std::set<std::string>::iterator li = testLangs.begin();
+ li != testLangs.end(); ++li) {
+ std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg;
+ const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg);
+ fprintf(fout, "set(%s %s)\n", langFlagsCfg.c_str(),
+ cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "")
+ .c_str());
+ }
+ } break;
}
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0056)) {
case cmPolicies::WARN:
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index cfaca2e..2025ecd 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmCreateTestSourceList; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmCreateTestSourceList; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "create_test_sourcelist"; }
+ std::string GetName() const CM_OVERRIDE { return "create_test_sourcelist"; }
cmTypeMacro(cmCreateTestSourceList, cmCommand);
};
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 85049ca..8e2d87e 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -15,26 +15,64 @@
#include <cmsys/FStream.hxx>
#include <cmsys/MD5.h>
-cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
+CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo)
{
if (strcmp(algo, "MD5") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashMD5);
- } else if (strcmp(algo, "SHA1") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA1);
- } else if (strcmp(algo, "SHA224") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA224);
- } else if (strcmp(algo, "SHA256") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA256);
- } else if (strcmp(algo, "SHA384") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA384);
- } else if (strcmp(algo, "SHA512") == 0) {
- return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512);
- } else {
- return cmsys::auto_ptr<cmCryptoHash>(0);
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashMD5);
}
+ if (strcmp(algo, "SHA1") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA1);
+ }
+ if (strcmp(algo, "SHA224") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA224);
+ }
+ if (strcmp(algo, "SHA256") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA256);
+ }
+ if (strcmp(algo, "SHA384") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA384);
+ }
+ if (strcmp(algo, "SHA512") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA512);
+ }
+ return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR);
}
-std::string cmCryptoHash::HashString(const std::string& input)
+bool cmCryptoHash::IntFromHexDigit(char input, char& output)
+{
+ if (input >= '0' && input <= '9') {
+ output = char(input - '0');
+ return true;
+ }
+ if (input >= 'a' && input <= 'f') {
+ output = char(input - 'a' + 0xA);
+ return true;
+ }
+ if (input >= 'A' && input <= 'F') {
+ output = char(input - 'A' + 0xA);
+ return true;
+ }
+ return false;
+}
+
+std::string cmCryptoHash::ByteHashToString(
+ const std::vector<unsigned char>& hash)
+{
+ // Map from 4-bit index to hexadecimal representation.
+ static char const hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ std::string res;
+ for (std::vector<unsigned char>::const_iterator vit = hash.begin();
+ vit != hash.end(); ++vit) {
+ res.push_back(hex[(*vit) >> 4]);
+ res.push_back(hex[(*vit) & 0xF]);
+ }
+ return res;
+}
+
+std::vector<unsigned char> cmCryptoHash::ByteHashString(
+ const std::string& input)
{
this->Initialize();
this->Append(reinterpret_cast<unsigned char const*>(input.c_str()),
@@ -42,35 +80,48 @@ std::string cmCryptoHash::HashString(const std::string& input)
return this->Finalize();
}
-std::string cmCryptoHash::HashFile(const std::string& file)
+std::vector<unsigned char> cmCryptoHash::ByteHashFile(const std::string& file)
{
cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary);
- if (!fin) {
- return "";
+ if (fin) {
+ this->Initialize();
+ {
+ // Should be efficient enough on most system:
+ cm_sha2_uint64_t buffer[512];
+ char* buffer_c = reinterpret_cast<char*>(buffer);
+ unsigned char const* buffer_uc =
+ reinterpret_cast<unsigned char const*>(buffer);
+ // This copy loop is very sensitive on certain platforms with
+ // slightly broken stream libraries (like HPUX). Normally, it is
+ // incorrect to not check the error condition on the fin.read()
+ // before using the data, but the fin.gcount() will be zero if an
+ // error occurred. Therefore, the loop should be safe everywhere.
+ while (fin) {
+ fin.read(buffer_c, sizeof(buffer));
+ if (int gcount = static_cast<int>(fin.gcount())) {
+ this->Append(buffer_uc, gcount);
+ }
+ }
+ }
+ if (fin.eof()) {
+ // Success
+ return this->Finalize();
+ }
+ // Finalize anyway
+ this->Finalize();
}
+ // Return without success
+ return std::vector<unsigned char>();
+}
- this->Initialize();
+std::string cmCryptoHash::HashString(const std::string& input)
+{
+ return ByteHashToString(this->ByteHashString(input));
+}
- // Should be efficient enough on most system:
- cm_sha2_uint64_t buffer[512];
- char* buffer_c = reinterpret_cast<char*>(buffer);
- unsigned char const* buffer_uc =
- reinterpret_cast<unsigned char const*>(buffer);
- // This copy loop is very sensitive on certain platforms with
- // slightly broken stream libraries (like HPUX). Normally, it is
- // incorrect to not check the error condition on the fin.read()
- // before using the data, but the fin.gcount() will be zero if an
- // error occurred. Therefore, the loop should be safe everywhere.
- while (fin) {
- fin.read(buffer_c, sizeof(buffer));
- if (int gcount = static_cast<int>(fin.gcount())) {
- this->Append(buffer_uc, gcount);
- }
- }
- if (fin.eof()) {
- return this->Finalize();
- }
- return "";
+std::string cmCryptoHash::HashFile(const std::string& file)
+{
+ return ByteHashToString(this->ByteHashFile(file));
}
cmCryptoHashMD5::cmCryptoHashMD5()
@@ -93,11 +144,11 @@ void cmCryptoHashMD5::Append(unsigned char const* buf, int sz)
cmsysMD5_Append(this->MD5, buf, sz);
}
-std::string cmCryptoHashMD5::Finalize()
+std::vector<unsigned char> cmCryptoHashMD5::Finalize()
{
- char md5out[32];
- cmsysMD5_FinalizeHex(this->MD5, md5out);
- return std::string(md5out, 32);
+ std::vector<unsigned char> hash(16, 0);
+ cmsysMD5_Finalize(this->MD5, &hash[0]);
+ return hash;
}
#define cmCryptoHash_SHA_CLASS_IMPL(SHA) \
@@ -111,11 +162,11 @@ std::string cmCryptoHashMD5::Finalize()
{ \
SHA##_Update(this->SHA, buf, sz); \
} \
- std::string cmCryptoHash##SHA::Finalize() \
+ std::vector<unsigned char> cmCryptoHash##SHA::Finalize() \
{ \
- char out[SHA##_DIGEST_STRING_LENGTH]; \
- SHA##_End(this->SHA, out); \
- return std::string(out, SHA##_DIGEST_STRING_LENGTH - 1); \
+ std::vector<unsigned char> hash(SHA##_DIGEST_LENGTH, 0); \
+ SHA##_Final(&hash[0], this->SHA); \
+ return hash; \
}
cmCryptoHash_SHA_CLASS_IMPL(SHA1) cmCryptoHash_SHA_CLASS_IMPL(SHA224)
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index a0c5eab..4e92b06 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -14,20 +14,56 @@
#include "cmStandardIncludes.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
+/**
+ * @brief Abstract base class for cryptographic hash generators
+ */
class cmCryptoHash
{
public:
virtual ~cmCryptoHash() {}
- static cmsys::auto_ptr<cmCryptoHash> New(const char* algo);
+
+ /// @brief Returns a new hash generator of the requested type
+ /// @arg algo Hash type name. Supported hash types are
+ /// MD5, SHA1, SHA224, SHA256, SHA384, SHA512
+ /// @return A valid auto pointer if algo is supported or
+ /// an invalid/NULL pointer otherwise
+ static CM_AUTO_PTR<cmCryptoHash> New(const char* algo);
+
+ /// @brief Converts a hex character to its binary value (4 bits)
+ /// @arg input Hex character [0-9a-fA-F].
+ /// @arg output Binary value of the input character (4 bits)
+ /// @return True if input was a valid hex character
+ static bool IntFromHexDigit(char input, char& output);
+
+ /// @brief Converts a byte hash to a sequence of hex character pairs
+ static std::string ByteHashToString(const std::vector<unsigned char>& hash);
+
+ /// @brief Calculates a binary hash from string input data
+ /// @return Binary hash vector
+ std::vector<unsigned char> ByteHashString(const std::string& input);
+
+ /// @brief Calculates a binary hash from file content
+ /// @see ByteHashString()
+ /// @return Non empty binary hash vector if the file was read successfully.
+ /// An empty vector otherwise.
+ std::vector<unsigned char> ByteHashFile(const std::string& file);
+
+ /// @brief Calculates a hash string from string input data
+ /// @return Sequence of hex characters pairs for each byte of the binary hash
std::string HashString(const std::string& input);
+
+ /// @brief Calculates a hash string from file content
+ /// @see HashString()
+ /// @return Non empty hash string if the file was read successfully.
+ /// An empty string otherwise.
std::string HashFile(const std::string& file);
protected:
virtual void Initialize() = 0;
virtual void Append(unsigned char const*, int) = 0;
- virtual std::string Finalize() = 0;
+ virtual std::vector<unsigned char> Finalize() = 0;
};
class cmCryptoHashMD5 : public cmCryptoHash
@@ -36,12 +72,12 @@ class cmCryptoHashMD5 : public cmCryptoHash
public:
cmCryptoHashMD5();
- ~cmCryptoHashMD5();
+ ~cmCryptoHashMD5() CM_OVERRIDE;
protected:
- virtual void Initialize();
- virtual void Append(unsigned char const* buf, int sz);
- virtual std::string Finalize();
+ void Initialize() CM_OVERRIDE;
+ void Append(unsigned char const* buf, int sz) CM_OVERRIDE;
+ std::vector<unsigned char> Finalize() CM_OVERRIDE;
};
#define cmCryptoHash_SHA_CLASS_DECL(SHA) \
@@ -56,7 +92,7 @@ protected:
protected: \
virtual void Initialize(); \
virtual void Append(unsigned char const* buf, int sz); \
- virtual std::string Finalize(); \
+ virtual std::vector<unsigned char> Finalize(); \
}
cmCryptoHash_SHA_CLASS_DECL(SHA1);
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index eac7f13..26bf94e 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -16,6 +16,6 @@
#include "cm_curl.h"
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = 0);
+std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = CM_NULLPTR);
#endif
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 7c00c80..eaa49b0 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -13,7 +13,7 @@
#include "cmMakefile.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
cmCustomCommand::cmCustomCommand()
: Backtrace()
@@ -38,7 +38,7 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
, Backtrace()
, Comment(comment ? comment : "")
, WorkingDirectory(workingDirectory ? workingDirectory : "")
- , HaveComment(comment ? true : false)
+ , HaveComment(comment != CM_NULLPTR)
, EscapeAllowMakeVars(false)
, EscapeOldStyle(true)
{
@@ -69,7 +69,7 @@ const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
const char* cmCustomCommand::GetComment() const
{
- const char* no_comment = 0;
+ const char* no_comment = CM_NULLPTR;
return this->HaveComment ? this->Comment.c_str() : no_comment;
}
@@ -135,3 +135,13 @@ void cmCustomCommand::SetUsesTerminal(bool b)
{
this->UsesTerminal = b;
}
+
+const std::string& cmCustomCommand::GetDepfile() const
+{
+ return this->Depfile;
+}
+
+void cmCustomCommand::SetDepfile(const std::string& depfile)
+{
+ this->Depfile = depfile;
+}
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index c2b9738..34753f4 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -88,6 +88,10 @@ public:
bool GetUsesTerminal() const;
void SetUsesTerminal(bool b);
+ /** Set/Get the depfile (used by the Ninja generator) */
+ const std::string& GetDepfile() const;
+ void SetDepfile(const std::string& depfile);
+
private:
std::vector<std::string> Outputs;
std::vector<std::string> Byproducts;
@@ -97,6 +101,7 @@ private:
ImplicitDependsList ImplicitDepends;
std::string Comment;
std::string WorkingDirectory;
+ std::string Depfile;
bool HaveComment;
bool EscapeAllowMakeVars;
bool EscapeOldStyle;
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 99bb601..6165bcf 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -45,7 +45,7 @@ bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
if (target && target->GetType() == cmState::EXECUTABLE) {
- return target->GetProperty("CROSSCOMPILING_EMULATOR") != 0;
+ return target->GetProperty("CROSSCOMPILING_EMULATOR") != CM_NULLPTR;
}
return false;
}
@@ -66,7 +66,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
}
}
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0);
std::string exe = cge->Evaluate(this->LG, this->Config);
return exe;
@@ -145,7 +145,7 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
std::vector<std::string> depends = this->CC.GetDepends();
for (std::vector<std::string>::const_iterator i = depends.begin();
i != depends.end(); ++i) {
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i);
std::vector<std::string> result;
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
result);
diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h
new file mode 100644
index 0000000..c67550e
--- /dev/null
+++ b/Source/cmCustomCommandLines.h
@@ -0,0 +1,38 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCustomCommandLines_h
+#define cmCustomCommandLines_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+/** Data structure to represent a single command line. */
+class cmCustomCommandLine : public std::vector<std::string>
+{
+public:
+ typedef std::vector<std::string> Superclass;
+ typedef Superclass::iterator iterator;
+ typedef Superclass::const_iterator const_iterator;
+};
+
+/** Data structure to represent a list of command lines. */
+class cmCustomCommandLines : public std::vector<cmCustomCommandLine>
+{
+public:
+ typedef std::vector<cmCustomCommandLine> Superclass;
+ typedef Superclass::iterator iterator;
+ typedef Superclass::const_iterator const_iterator;
+};
+
+#endif
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 4248bbe..9cc19c4 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -17,19 +17,19 @@
class cmDefinePropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmDefinePropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmDefinePropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "define_property"; }
+ std::string GetName() const CM_OVERRIDE { return "define_property"; }
cmTypeMacro(cmDefinePropertyCommand, cmCommand);
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 28b6677..e0fb59b 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -41,7 +41,7 @@ const char* cmDefinitions::Get(const std::string& key, StackIter begin,
StackIter end)
{
Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
- return def.Exists ? def.c_str() : 0;
+ return def.Exists ? def.c_str() : CM_NULLPTR;
}
void cmDefinitions::Raise(const std::string& key, StackIter begin,
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 7be0098..8f1813c 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -17,7 +17,7 @@
#include "cmLinkedTree.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map>
#else
#include "cmsys/hash_map.hxx"
@@ -92,7 +92,7 @@ private:
static Def NoDef;
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string, Def> MapType;
#else
typedef cmsys::hash_map<std::string, Def> MapType;
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 5df3cc1..ce72eda 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -23,7 +23,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir)
: CompileDirectory()
, LocalGenerator(lg)
, Verbose(false)
- , FileComparison(0)
+ , FileComparison(CM_NULLPTR)
, TargetDirectory(targetDir)
, MaxPath(16384)
, Dependee(new char[MaxPath])
@@ -72,7 +72,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
return this->Finalize(makeDepends, internalDepends);
}
-bool cmDepends::Finalize(std::ostream&, std::ostream&)
+bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/)
{
return true;
}
@@ -123,9 +123,10 @@ void cmDepends::Clear(const char* file)
<< std::endl;
}
-bool cmDepends::WriteDependencies(const std::set<std::string>&,
- const std::string&, std::ostream&,
- std::ostream&)
+bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/,
+ const std::string& /*unused*/,
+ std::ostream& /*unused*/,
+ std::ostream& /*unused*/)
{
// This should be implemented by the subclass.
return false;
@@ -140,7 +141,7 @@ bool cmDepends::CheckDependencies(
// regenerated.
bool okay = true;
bool dependerExists = false;
- DependencyVector* currentDependencies = 0;
+ DependencyVector* currentDependencies = CM_NULLPTR;
while (internalDepends.getline(this->Dependee, this->MaxPath)) {
if (this->Dependee[0] == 0 || this->Dependee[0] == '#' ||
@@ -182,7 +183,7 @@ bool cmDepends::CheckDependencies(
bool regenerate = false;
const char* dependee = this->Dependee + 1;
const char* depender = this->Depender;
- if (currentDependencies != 0) {
+ if (currentDependencies != CM_NULLPTR) {
currentDependencies->push_back(dependee);
}
@@ -242,9 +243,9 @@ bool cmDepends::CheckDependencies(
// Remove the information of this depender from the map, it needs
// to be rescanned
- if (currentDependencies != 0) {
+ if (currentDependencies != CM_NULLPTR) {
validDeps.erase(this->Depender);
- currentDependencies = 0;
+ currentDependencies = CM_NULLPTR;
}
// Remove the depender to be sure it is rebuilt.
@@ -261,7 +262,7 @@ bool cmDepends::CheckDependencies(
void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
{
// Look for the new per "TARGET_" variant first:
- const char* includePath = 0;
+ const char* includePath = CM_NULLPTR;
std::string includePathVar = "CMAKE_";
includePathVar += lang;
includePathVar += "_TARGET_INCLUDE_PATH";
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index a62f8c2..0e1cbb9 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -29,7 +29,7 @@ class cmDepends
public:
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
- cmDepends(cmLocalGenerator* lg = 0, const char* targetDir = "");
+ cmDepends(cmLocalGenerator* lg = CM_NULLPTR, const char* targetDir = "");
/** at what level will the compile be done from */
void SetCompileDirectory(const char* dir) { this->CompileDirectory = dir; }
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 78bb1b2..928f7ec 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -29,7 +29,7 @@
#define INCLUDE_REGEX_TRANSFORM_MARKER "#IncludeRegexTransform: "
cmDependsC::cmDependsC()
- : ValidDeps(0)
+ : ValidDeps(CM_NULLPTR)
{
}
@@ -105,7 +105,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
std::set<std::string> dependencies;
bool haveDeps = false;
- if (this->ValidDeps != 0) {
+ if (this->ValidDeps != CM_NULLPTR) {
std::map<std::string, DependencyVector>::const_iterator tmpIt =
this->ValidDeps->find(obj);
if (tmpIt != this->ValidDeps->end()) {
@@ -158,7 +158,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->HeaderLocationCache.find(current.FileName);
if (headerLocationIt != this->HeaderLocationCache.end()) {
fullName = headerLocationIt->second;
- } else
+ } else {
for (std::vector<std::string>::const_iterator i =
this->IncludePath.begin();
i != this->IncludePath.end(); ++i) {
@@ -175,6 +175,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
break;
}
}
+ }
}
// Complain if the file cannot be found and matches the complain
@@ -237,8 +238,8 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// written by the original local generator for this directory
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
- std::string obj_i =
- this->LocalGenerator->Convert(obj, cmOutputConverter::HOME_OUTPUT);
+ std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
+ obj, cmOutputConverter::HOME_OUTPUT);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl;
@@ -268,31 +269,31 @@ void cmDependsC::ReadCacheFile()
}
std::string line;
- cmIncludeLines* cacheEntry = 0;
+ cmIncludeLines* cacheEntry = CM_NULLPTR;
bool haveFileName = false;
while (cmSystemTools::GetLineFromStream(fin, line)) {
if (line.empty()) {
- cacheEntry = 0;
+ cacheEntry = CM_NULLPTR;
haveFileName = false;
continue;
}
// the first line after an empty line is the name of the parsed file
- if (haveFileName == false) {
+ if (!haveFileName) {
haveFileName = true;
int newer = 0;
cmFileTimeComparison comp;
bool res = comp.FileTimeCompare(this->CacheFileName.c_str(),
line.c_str(), &newer);
- if ((res == true) && (newer == 1)) // cache is newer than the parsed file
+ if (res && newer == 1) // cache is newer than the parsed file
{
cacheEntry = new cmIncludeLines;
this->FileCache[line] = cacheEntry;
}
// file doesn't exist, check that the regular expressions
// haven't changed
- else if (res == false) {
+ else if (!res) {
if (line.find(INCLUDE_REGEX_LINE_MARKER) == 0) {
if (line != this->IncludeRegexLineString) {
return;
@@ -311,7 +312,7 @@ void cmDependsC::ReadCacheFile()
}
}
}
- } else if (cacheEntry != 0) {
+ } else if (cacheEntry != CM_NULLPTR) {
UnscannedEntry entry;
entry.FileName = line;
if (cmSystemTools::GetLineFromStream(fin, line)) {
@@ -343,16 +344,16 @@ void cmDependsC::WriteCacheFile() const
this->FileCache.begin();
fileIt != this->FileCache.end(); ++fileIt) {
if (fileIt->second->Used) {
- cacheOut << fileIt->first.c_str() << std::endl;
+ cacheOut << fileIt->first << std::endl;
for (std::vector<UnscannedEntry>::const_iterator incIt =
fileIt->second->UnscannedEntries.begin();
incIt != fileIt->second->UnscannedEntries.end(); ++incIt) {
- cacheOut << incIt->FileName.c_str() << std::endl;
+ cacheOut << incIt->FileName << std::endl;
if (incIt->QuotedLocation.empty()) {
cacheOut << "-" << std::endl;
} else {
- cacheOut << incIt->QuotedLocation.c_str() << std::endl;
+ cacheOut << incIt->QuotedLocation << std::endl;
}
}
cacheOut << std::endl;
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index e830aa8..bde07b7 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -31,14 +31,13 @@ public:
const std::map<std::string, DependencyVector>* validDeps);
/** Virtual destructor to cleanup subclasses properly. */
- virtual ~cmDependsC();
+ ~cmDependsC() CM_OVERRIDE;
protected:
// Implement writing/checking methods required by superclass.
- virtual bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj,
- std::ostream& makeDepends,
- std::ostream& internalDepends);
+ bool WriteDependencies(const std::set<std::string>& sources,
+ const std::string& obj, std::ostream& makeDepends,
+ std::ostream& internalDepends) CM_OVERRIDE;
// Method to scan a single file.
void Scan(std::istream& is, const char* directory,
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 38e319d..8c0acce 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -53,7 +53,7 @@ public:
};
cmDependsFortran::cmDependsFortran()
- : Internal(0)
+ : Internal(CM_NULLPTR)
{
}
@@ -91,8 +91,9 @@ cmDependsFortran::~cmDependsFortran()
}
bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
- const std::string& obj, std::ostream&,
- std::ostream&)
+ const std::string& obj,
+ std::ostream& /*makeDepends*/,
+ std::ostream& /*internalDepends*/)
{
// Make sure this is a scanning instance.
if (sources.empty() || sources.begin()->empty()) {
@@ -192,15 +193,15 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
stamp += ".mod.stamp";
fcStream << "\n";
fcStream << " \""
- << this->LocalGenerator->Convert(
+ << this->LocalGenerator->ConvertToRelativePath(
mod_lower, cmOutputConverter::START_OUTPUT)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->Convert(
+ << this->LocalGenerator->ConvertToRelativePath(
mod_upper, cmOutputConverter::START_OUTPUT)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->Convert(
+ << this->LocalGenerator->ConvertToRelativePath(
stamp, cmOutputConverter::START_OUTPUT)
<< "\"\n";
}
@@ -316,8 +317,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
const char* src = info.Source.c_str();
// Write the include dependencies to the output stream.
- std::string obj_i =
- this->LocalGenerator->Convert(obj, cmOutputConverter::HOME_OUTPUT);
+ std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
+ obj, cmOutputConverter::HOME_OUTPUT);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl;
@@ -520,7 +521,8 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
}
}
return true;
- } else if (cmSystemTools::FileExists(mod_lower.c_str(), true)) {
+ }
+ if (cmSystemTools::FileExists(mod_lower.c_str(), true)) {
if (cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(),
compilerId.c_str())) {
if (!cmSystemTools::CopyFileAlways(mod_lower, stamp)) {
@@ -633,8 +635,8 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
cmsys::ifstream finModFile(modFile, std::ios::in | std::ios::binary);
cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
#else
- cmsys::ifstream finModFile(modFile, std::ios::in);
- cmsys::ifstream finStampFile(stampFile, std::ios::in);
+ cmsys::ifstream finModFile(modFile);
+ cmsys::ifstream finStampFile(stampFile);
#endif
if (!finModFile || !finStampFile) {
// At least one of the files does not exist. The modules differ.
@@ -654,10 +656,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// but also do not include a date so we can fall through to
// compare them without skipping any prefix.
unsigned char hdr[2];
- bool okay =
- finModFile.read(reinterpret_cast<char*>(hdr), 2) ? true : false;
+ bool okay = !finModFile.read(reinterpret_cast<char*>(hdr), 2).fail();
finModFile.seekg(0);
- if (!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) {
+ if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) {
const char seq[1] = { '\n' };
const int seqlen = 1;
@@ -677,6 +678,12 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
const char seq[2] = { '\n', '\0' };
const int seqlen = 2;
+ // Skip the leading byte which appears to be a version number.
+ // We do not need to check for an error because the sequence search
+ // below will fail in that case.
+ finModFile.get();
+ finStampFile.get();
+
if (!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) {
// The module is of unexpected format. Assume it is different.
std::cerr << compilerId << " fortran module " << modFile
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index 5ff0b6c..f4385eb 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -34,7 +34,7 @@ public:
cmDependsFortran(cmLocalGenerator* lg);
/** Virtual destructor to cleanup subclasses properly. */
- virtual ~cmDependsFortran();
+ ~cmDependsFortran() CM_OVERRIDE;
/** Callback from build system after a .mod file has been generated
by a Fortran90 compiler to copy the .mod file to the
@@ -48,8 +48,8 @@ public:
protected:
// Finalize the dependency information for the target.
- virtual bool Finalize(std::ostream& makeDepends,
- std::ostream& internalDepends);
+ bool Finalize(std::ostream& makeDepends,
+ std::ostream& internalDepends) CM_OVERRIDE;
// Find all the modules required by the target.
void LocateModules();
@@ -59,10 +59,9 @@ protected:
bool FindModule(std::string const& name, std::string& module);
// Implement writing/checking methods required by superclass.
- virtual bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& file,
- std::ostream& makeDepends,
- std::ostream& internalDepends);
+ bool WriteDependencies(const std::set<std::string>& sources,
+ const std::string& file, std::ostream& makeDepends,
+ std::ostream& internalDepends) CM_OVERRIDE;
// Actually write the depenencies to the streams.
bool WriteDependenciesReal(const char* obj, cmFortranSourceInfo const& info,
diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx
index 4f5e2ae..a9130e6 100644
--- a/Source/cmDependsJava.cxx
+++ b/Source/cmDependsJava.cxx
@@ -23,8 +23,9 @@ cmDependsJava::~cmDependsJava()
}
bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources,
- const std::string&, std::ostream&,
- std::ostream&)
+ const std::string& /*obj*/,
+ std::ostream& /*makeDepends*/,
+ std::ostream& /*internalDepends*/)
{
// Make sure this is a scanning instance.
if (sources.empty() || sources.begin()->empty()) {
@@ -35,8 +36,9 @@ bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources,
return true;
}
-bool cmDependsJava::CheckDependencies(std::istream&, const char*,
- std::map<std::string, DependencyVector>&)
+bool cmDependsJava::CheckDependencies(
+ std::istream& /*internalDepends*/, const char* /*internalDependsFileName*/,
+ std::map<std::string, DependencyVector>& /*validDeps*/)
{
return true;
}
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 44723fa..5bb3039 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -25,17 +25,16 @@ public:
cmDependsJava();
/** Virtual destructor to cleanup subclasses properly. */
- virtual ~cmDependsJava();
+ ~cmDependsJava() CM_OVERRIDE;
protected:
// Implement writing/checking methods required by superclass.
- virtual bool WriteDependencies(const std::set<std::string>& sources,
- const std::string& file,
- std::ostream& makeDepends,
- std::ostream& internalDepends);
- virtual bool CheckDependencies(
+ bool WriteDependencies(const std::set<std::string>& sources,
+ const std::string& file, std::ostream& makeDepends,
+ std::ostream& internalDepends) CM_OVERRIDE;
+ bool CheckDependencies(
std::istream& internalDepends, const char* internalDependsFileName,
- std::map<std::string, DependencyVector>& validDeps);
+ std::map<std::string, DependencyVector>& validDeps) CM_OVERRIDE;
private:
cmDependsJava(cmDependsJava const&); // Purposely not implemented.
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index bd3ee4d..79c4669 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
}
void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
- std::vector<std::string>* files, const char* prefix, const char* sep)
+ std::vector<std::string>* files, const char* prefix, const char* sep) const
{
std::string rname = "";
if (prefix) {
@@ -44,8 +44,8 @@ void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
}
rname += this->Name;
files->push_back(rname);
- std::vector<CurrentClass>::iterator it;
- for (it = this->NestedClasses->begin(); it != this->NestedClasses->end();
+ std::vector<CurrentClass>::const_iterator it;
+ for (it = this->NestedClasses.begin(); it != this->NestedClasses.end();
++it) {
it->AddFileNamesForPrinting(files, rname.c_str(), sep);
}
@@ -59,7 +59,7 @@ void cmDependsJavaParserHelper::DeallocateParserType(char** pt)
if (!*pt) {
return;
}
- *pt = 0;
+ *pt = CM_NULLPTR;
this->UnionsAvailable--;
}
@@ -160,13 +160,13 @@ void cmDependsJavaParserHelper::PrepareElement(
cmDependsJavaParserHelper::ParserType* me)
{
// Inititalize self
- me->str = 0;
+ me->str = CM_NULLPTR;
}
void cmDependsJavaParserHelper::AllocateParserType(
cmDependsJavaParserHelper::ParserType* pt, const char* str, int len)
{
- pt->str = 0;
+ pt->str = CM_NULLPTR;
if (len == 0) {
len = (int)strlen(str);
}
@@ -191,25 +191,19 @@ void cmDependsJavaParserHelper::StartClass(const char* cls)
void cmDependsJavaParserHelper::EndClass()
{
- CurrentClass* parent = 0;
- CurrentClass* current = 0;
- if (!this->ClassStack.empty()) {
- current = &(*(this->ClassStack.end() - 1));
- if (this->ClassStack.size() > 1) {
- parent = &(*(this->ClassStack.end() - 2));
- }
- }
- if (current == 0) {
+ if (this->ClassStack.empty()) {
std::cerr << "Error when parsing. Current class is null" << std::endl;
abort();
}
- if (parent == 0) {
+ if (this->ClassStack.size() <= 1) {
std::cerr << "Error when parsing. Parent class is null" << std::endl;
abort();
}
+ CurrentClass& current = this->ClassStack.back();
+ CurrentClass& parent = this->ClassStack[this->ClassStack.size() - 2];
this->CurrentDepth--;
- parent->NestedClasses->push_back(*current);
- this->ClassStack.erase(this->ClassStack.end() - 1, this->ClassStack.end());
+ parent.NestedClasses.push_back(current);
+ this->ClassStack.pop_back();
}
void cmDependsJavaParserHelper::PrintClasses()
@@ -228,11 +222,11 @@ void cmDependsJavaParserHelper::PrintClasses()
std::vector<std::string> cmDependsJavaParserHelper::GetFilesProduced()
{
std::vector<std::string> files;
- CurrentClass* toplevel = &(*(this->ClassStack.begin()));
- std::vector<CurrentClass>::iterator it;
- for (it = toplevel->NestedClasses->begin();
- it != toplevel->NestedClasses->end(); ++it) {
- it->AddFileNamesForPrinting(&files, 0, "$");
+ CurrentClass const& toplevel = this->ClassStack.front();
+ std::vector<CurrentClass>::const_iterator it;
+ for (it = toplevel.NestedClasses.begin(); it != toplevel.NestedClasses.end();
+ ++it) {
+ it->AddFileNamesForPrinting(&files, CM_NULLPTR, "$");
}
return files;
}
@@ -309,11 +303,10 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen)
if (buf[0] == '\n') {
this->CurrentLine++;
}
- return (1);
- } else {
- buf[0] = '\n';
- return (0);
+ return 1;
}
+ buf[0] = '\n';
+ return 0;
}
void cmDependsJavaParserHelper::Error(const char* str)
{
@@ -333,7 +326,7 @@ void cmDependsJavaParserHelper::Error(const char* str)
void cmDependsJavaParserHelper::UpdateCombine(const char* str1,
const char* str2)
{
- if (this->CurrentCombine == "" && str1 != 0) {
+ if (this->CurrentCombine == "" && str1 != CM_NULLPTR) {
this->CurrentCombine = str1;
}
this->CurrentCombine += ".";
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index a13d023..6ff0245 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -48,7 +48,7 @@ public:
// For yacc
void AddClassFound(const char* sclass);
- void PrepareElement(ParserType* opt);
+ void PrepareElement(ParserType* me);
void DeallocateParserType(char** pt);
void CheckEmpty(int line, int cnt, ParserType* pt);
void StartClass(const char* cls);
@@ -69,20 +69,9 @@ private:
{
public:
std::string Name;
- std::vector<CurrentClass>* NestedClasses;
- CurrentClass() { this->NestedClasses = new std::vector<CurrentClass>; }
- ~CurrentClass() { delete this->NestedClasses; }
- CurrentClass& operator=(CurrentClass const& c)
- {
- this->NestedClasses->clear();
- this->Name = c.Name;
- std::copy(c.NestedClasses->begin(), c.NestedClasses->end(),
- std::back_inserter(*this->NestedClasses));
- return *this;
- }
- CurrentClass(CurrentClass const& c) { (*this) = c; }
+ std::vector<CurrentClass> NestedClasses;
void AddFileNamesForPrinting(std::vector<std::string>* files,
- const char* prefix, const char* sep);
+ const char* prefix, const char* sep) const;
};
std::string CurrentPackage;
std::string::size_type InputBufferPos;
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 68a8488..5516cf1 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -49,12 +49,12 @@ static const char* cmDocumentationStandardOptions[][2] = {
{ "--help-variable-list [<f>]",
"List variables with help available and exit." },
{ "--help-variables [<f>]", "Print cmake-variables manual and exit." },
- { 0, 0 }
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationGeneratorsHeader[][2] = {
- { 0, "The following generators are available on this platform:" },
- { 0, 0 }
+ { CM_NULLPTR, "The following generators are available on this platform:" },
+ { CM_NULLPTR, CM_NULLPTR }
};
cmDocumentation::cmDocumentation()
@@ -137,10 +137,10 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
this->CurrentArgument = i->Argument;
// If a file name was given, use it. Otherwise, default to the
// given stream.
- cmsys::ofstream* fout = 0;
+ cmsys::ofstream* fout = CM_NULLPTR;
std::ostream* s = &os;
if (!i->Filename.empty()) {
- fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out);
+ fout = new cmsys::ofstream(i->Filename.c_str());
if (fout) {
s = fout;
} else {
@@ -420,7 +420,7 @@ void cmDocumentation::SetSections(
void cmDocumentation::PrependSection(const char* name, const char* docs[][2])
{
- cmDocumentationSection* sec = 0;
+ cmDocumentationSection* sec = CM_NULLPTR;
if (this->AllSections.find(name) == this->AllSections.end()) {
sec =
new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -434,7 +434,7 @@ void cmDocumentation::PrependSection(const char* name, const char* docs[][2])
void cmDocumentation::PrependSection(const char* name,
std::vector<cmDocumentationEntry>& docs)
{
- cmDocumentationSection* sec = 0;
+ cmDocumentationSection* sec = CM_NULLPTR;
if (this->AllSections.find(name) == this->AllSections.end()) {
sec =
new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -447,7 +447,7 @@ void cmDocumentation::PrependSection(const char* name,
void cmDocumentation::AppendSection(const char* name, const char* docs[][2])
{
- cmDocumentationSection* sec = 0;
+ cmDocumentationSection* sec = CM_NULLPTR;
if (this->AllSections.find(name) == this->AllSections.end()) {
sec =
new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -461,7 +461,7 @@ void cmDocumentation::AppendSection(const char* name, const char* docs[][2])
void cmDocumentation::AppendSection(const char* name,
std::vector<cmDocumentationEntry>& docs)
{
- cmDocumentationSection* sec = 0;
+ cmDocumentationSection* sec = CM_NULLPTR;
if (this->AllSections.find(name) == this->AllSections.end()) {
sec =
new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -719,9 +719,8 @@ const char* cmDocumentation::GetNameString() const
{
if (!this->NameString.empty()) {
return this->NameString.c_str();
- } else {
- return "CMake";
}
+ return "CMake";
}
bool cmDocumentation::IsOption(const char* arg) const
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index dd99ca8..ac36c8b 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -39,7 +39,7 @@ public:
* help arguments.
*/
bool CheckOptions(int argc, const char* const* argv,
- const char* exitOpt = 0);
+ const char* exitOpt = CM_NULLPTR);
/**
* Print help requested on the command line. Call after
diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h
new file mode 100644
index 0000000..f50839e
--- /dev/null
+++ b/Source/cmDocumentationEntry.h
@@ -0,0 +1,45 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmDocumentationEntry_h
+#define cmDocumentationEntry_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+
+/** Standard documentation entry for cmDocumentation's formatting. */
+struct cmDocumentationEntry
+{
+ std::string Name;
+ std::string Brief;
+ cmDocumentationEntry() {}
+ cmDocumentationEntry(const char* doc[2])
+ {
+ if (doc[0]) {
+ this->Name = doc[0];
+ }
+ if (doc[1]) {
+ this->Brief = doc[1];
+ }
+ }
+ cmDocumentationEntry(const char* n, const char* b)
+ {
+ if (n) {
+ this->Name = n;
+ }
+ if (b) {
+ this->Brief = b;
+ }
+ }
+};
+
+#endif
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 7d0bbdc..f6841ad 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -15,8 +15,10 @@ class cmDynamicLoaderCache
{
public:
~cmDynamicLoaderCache();
- void CacheFile(const char* path, const cmsys::DynamicLoader::LibraryHandle&);
- bool GetCacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle&);
+ void CacheFile(const char* path,
+ const cmsys::DynamicLoader::LibraryHandle& /*p*/);
+ bool GetCacheFile(const char* path,
+ cmsys::DynamicLoader::LibraryHandle& /*p*/);
bool FlushCache(const char* path);
void FlushCache();
static cmDynamicLoaderCache* GetInstance();
@@ -26,7 +28,7 @@ private:
static cmDynamicLoaderCache* Instance;
};
-cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = 0;
+cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = CM_NULLPTR;
cmDynamicLoaderCache::~cmDynamicLoaderCache()
{
@@ -75,7 +77,7 @@ void cmDynamicLoaderCache::FlushCache()
cmsys::DynamicLoader::CloseLibrary(it->second);
}
delete cmDynamicLoaderCache::Instance;
- cmDynamicLoaderCache::Instance = 0;
+ cmDynamicLoaderCache::Instance = CM_NULLPTR;
}
cmDynamicLoaderCache* cmDynamicLoaderCache::GetInstance()
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 26f1a44..150593b 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -13,8 +13,8 @@
#include "cmELF.h"
+#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx>
-#include <cmsys/auto_ptr.hxx>
// Include the ELF format information system header.
#if defined(__OpenBSD__)
@@ -46,23 +46,26 @@ typedef struct Elf32_Rela Elf32_Rela;
#if defined(__sun)
#include <sys/link.h> // For dynamic section information
#endif
+#ifdef _SCO_DS
+#include <link.h> // For DT_SONAME etc.
+#endif
// Low-level byte swapping implementation.
template <size_t s>
struct cmELFByteSwapSize
{
};
-void cmELFByteSwap(char*, cmELFByteSwapSize<1> const&)
+void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> const& /*unused*/)
{
}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<2> const&)
+void cmELFByteSwap(char* data, cmELFByteSwapSize<2> const& /*unused*/)
{
char one_byte;
one_byte = data[0];
data[0] = data[1];
data[1] = one_byte;
}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const&)
+void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const& /*unused*/)
{
char one_byte;
one_byte = data[0];
@@ -72,7 +75,7 @@ void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const&)
data[1] = data[2];
data[2] = one_byte;
}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<8> const&)
+void cmELFByteSwap(char* data, cmELFByteSwapSize<8> const& /*unused*/)
{
char one_byte;
one_byte = data[0];
@@ -107,7 +110,7 @@ public:
};
// Construct and take ownership of the file stream object.
- cmELFInternal(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin,
+ cmELFInternal(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
ByteOrderType order)
: External(external)
, Stream(*fin.release())
@@ -143,7 +146,7 @@ public:
{
this->Stream.seekg(pos);
this->Stream.read(buf, size);
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
// Lookup the SONAME in the DYNAMIC section.
@@ -214,6 +217,7 @@ struct cmELFTypes32
};
// Configure the implementation template for 64-bit ELF files.
+#ifndef _SCO_DS
struct cmELFTypes64
{
typedef Elf64_Ehdr ELF_Ehdr;
@@ -223,6 +227,7 @@ struct cmELFTypes64
typedef KWIML_INT_uint64_t tagtype;
static const char* GetName() { return "64-bit"; }
};
+#endif
// Parser implementation template.
template <class Types>
@@ -237,24 +242,24 @@ public:
typedef typename Types::tagtype tagtype;
// Construct with a stream and byte swap indicator.
- cmELFInternalImpl(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin,
+ cmELFInternalImpl(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
ByteOrderType order);
// Return the number of sections as specified by the ELF header.
- virtual unsigned int GetNumberOfSections() const
+ unsigned int GetNumberOfSections() const CM_OVERRIDE
{
return static_cast<unsigned int>(this->ELFHeader.e_shnum);
}
// Get the file position and size of a dynamic section entry.
- virtual unsigned int GetDynamicEntryCount();
- virtual unsigned long GetDynamicEntryPosition(int j);
+ unsigned int GetDynamicEntryCount() CM_OVERRIDE;
+ unsigned long GetDynamicEntryPosition(int j) CM_OVERRIDE;
// Lookup a string from the dynamic section with the given tag.
- virtual StringEntry const* GetDynamicSectionString(unsigned int tag);
+ StringEntry const* GetDynamicSectionString(unsigned int tag) CM_OVERRIDE;
// Print information about the ELF file.
- virtual void PrintInfo(std::ostream& os) const
+ void PrintInfo(std::ostream& os) const CM_OVERRIDE
{
os << "ELF " << Types::GetName();
if (this->ByteOrder == ByteOrderMSB) {
@@ -497,7 +502,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
bool Read(ELF_Dyn& x)
{
@@ -505,7 +510,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
bool LoadSectionHeader(ELF_Half i)
@@ -537,8 +542,9 @@ private:
};
template <class Types>
-cmELFInternalImpl<Types>::cmELFInternalImpl(
- cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, ByteOrderType order)
+cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
+ CM_AUTO_PTR<cmsys::ifstream>& fin,
+ ByteOrderType order)
: cmELFInternal(external, fin, order)
{
// Read the main header.
@@ -672,7 +678,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
if (dssi->second.Position > 0) {
return &dssi->second;
}
- return 0;
+ return CM_NULLPTR;
}
// Create an entry for this tag. Assume it is missing until found.
@@ -683,14 +689,14 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
// Try reading the dynamic section.
if (!this->LoadDynamicSection()) {
- return 0;
+ return CM_NULLPTR;
}
// Get the string table referenced by the DYNAMIC section.
ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
if (sec.sh_link >= this->SectionHeaders.size()) {
this->SetErrorMessage("Section DYNAMIC has invalid string table index.");
- return 0;
+ return CM_NULLPTR;
}
ELF_Shdr const& strtab = this->SectionHeaders[sec.sh_link];
@@ -705,7 +711,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
if (dyn.d_un.d_val >= strtab.sh_size) {
this->SetErrorMessage("Section DYNAMIC references string beyond "
"the end of its string section.");
- return 0;
+ return CM_NULLPTR;
}
// Seek to the position reported by the entry.
@@ -734,7 +740,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
if (!this->Stream) {
this->SetErrorMessage("Dynamic section specifies unreadable RPATH.");
se.Value = "";
- return 0;
+ return CM_NULLPTR;
}
// The value has been read successfully. Report it.
@@ -745,17 +751,17 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
return &se;
}
}
- return 0;
+ return CM_NULLPTR;
}
//============================================================================
// External class implementation.
cmELF::cmELF(const char* fname)
- : Internal(0)
+ : Internal(CM_NULLPTR)
{
// Try to open the file.
- cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
+ CM_AUTO_PTR<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened.
if (!fin.get() || !*fin) {
@@ -799,10 +805,14 @@ cmELF::cmELF(const char* fname)
if (ident[EI_CLASS] == ELFCLASS32) {
// 32-bit ELF
this->Internal = new cmELFInternalImpl<cmELFTypes32>(this, fin, order);
- } else if (ident[EI_CLASS] == ELFCLASS64) {
+ }
+#ifndef _SCO_DS
+ else if (ident[EI_CLASS] == ELFCLASS64) {
// 64-bit ELF
this->Internal = new cmELFInternalImpl<cmELFTypes64>(this, fin, order);
- } else {
+ }
+#endif
+ else {
this->ErrorMessage = "ELF file class is not 32-bit or 64-bit.";
return;
}
@@ -822,45 +832,40 @@ cmELF::FileType cmELF::GetFileType() const
{
if (this->Valid()) {
return this->Internal->GetFileType();
- } else {
- return FileTypeInvalid;
}
+ return FileTypeInvalid;
}
unsigned int cmELF::GetNumberOfSections() const
{
if (this->Valid()) {
return this->Internal->GetNumberOfSections();
- } else {
- return 0;
}
+ return 0;
}
unsigned int cmELF::GetDynamicEntryCount() const
{
if (this->Valid()) {
return this->Internal->GetDynamicEntryCount();
- } else {
- return 0;
}
+ return 0;
}
unsigned long cmELF::GetDynamicEntryPosition(int index) const
{
if (this->Valid()) {
return this->Internal->GetDynamicEntryPosition(index);
- } else {
- return 0;
}
+ return 0;
}
bool cmELF::ReadBytes(unsigned long pos, unsigned long size, char* buf) const
{
if (this->Valid()) {
return this->Internal->ReadBytes(pos, size, buf);
- } else {
- return false;
}
+ return false;
}
bool cmELF::GetSOName(std::string& soname)
@@ -868,9 +873,8 @@ bool cmELF::GetSOName(std::string& soname)
if (StringEntry const* se = this->GetSOName()) {
soname = se->Value;
return true;
- } else {
- return false;
}
+ return false;
}
cmELF::StringEntry const* cmELF::GetSOName()
@@ -878,9 +882,8 @@ cmELF::StringEntry const* cmELF::GetSOName()
if (this->Valid() &&
this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary) {
return this->Internal->GetSOName();
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
cmELF::StringEntry const* cmELF::GetRPath()
@@ -889,9 +892,8 @@ cmELF::StringEntry const* cmELF::GetRPath()
(this->Internal->GetFileType() == cmELF::FileTypeExecutable ||
this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) {
return this->Internal->GetRPath();
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
cmELF::StringEntry const* cmELF::GetRunPath()
@@ -900,9 +902,8 @@ cmELF::StringEntry const* cmELF::GetRunPath()
(this->Internal->GetFileType() == cmELF::FileTypeExecutable ||
this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) {
return this->Internal->GetRunPath();
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
void cmELF::PrintInfo(std::ostream& os) const
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
index 815825e..9acf4d8 100644
--- a/Source/cmElseCommand.h
+++ b/Source/cmElseCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmElseCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmElseCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "else"; }
+ std::string GetName() const CM_OVERRIDE { return "else"; }
cmTypeMacro(cmElseCommand, cmCommand);
};
diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h
index d0ffa5d..19c1885 100644
--- a/Source/cmElseIfCommand.h
+++ b/Source/cmElseIfCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmElseIfCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmElseIfCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "elseif"; }
+ std::string GetName() const CM_OVERRIDE { return "elseif"; }
cmTypeMacro(cmElseIfCommand, cmCommand);
};
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 657e4e5..31b6095 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -28,19 +28,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEnableLanguageCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEnableLanguageCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "enable_language"; }
+ std::string GetName() const CM_OVERRIDE { return "enable_language"; }
cmTypeMacro(cmEnableLanguageCommand, cmCommand);
};
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index a518f18..8c8ffbf 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -33,19 +33,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEnableTestingCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEnableTestingCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "enable_testing"; }
+ std::string GetName() const CM_OVERRIDE { return "enable_testing"; }
cmTypeMacro(cmEnableTestingCommand, cmCommand);
};
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
index ebc794f..b2c47b2 100644
--- a/Source/cmEndForEachCommand.h
+++ b/Source/cmEndForEachCommand.h
@@ -25,20 +25,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEndForEachCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
- virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&);
+ bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -46,12 +47,12 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "endforeach"; }
+ std::string GetName() const CM_OVERRIDE { return "endforeach"; }
cmTypeMacro(cmEndForEachCommand, cmCommand);
};
diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h
index b69dec0..856fdc5 100644
--- a/Source/cmEndFunctionCommand.h
+++ b/Source/cmEndFunctionCommand.h
@@ -25,20 +25,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEndFunctionCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
- virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&);
+ bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -46,12 +47,12 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "endfunction"; }
+ std::string GetName() const CM_OVERRIDE { return "endfunction"; }
cmTypeMacro(cmEndFunctionCommand, cmCommand);
};
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
index 457dfd3..13cf6f6 100644
--- a/Source/cmEndIfCommand.h
+++ b/Source/cmEndIfCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEndIfCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEndIfCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "endif"; }
+ std::string GetName() const CM_OVERRIDE { return "endif"; }
cmTypeMacro(cmEndIfCommand, cmCommand);
};
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
index 615e8dc..e176eaf 100644
--- a/Source/cmEndMacroCommand.h
+++ b/Source/cmEndMacroCommand.h
@@ -25,20 +25,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEndMacroCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
- virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&);
+ bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -46,12 +47,12 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "endmacro"; }
+ std::string GetName() const CM_OVERRIDE { return "endmacro"; }
cmTypeMacro(cmEndMacroCommand, cmCommand);
};
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
index 5eda7af..6b72514 100644
--- a/Source/cmEndWhileCommand.h
+++ b/Source/cmEndWhileCommand.h
@@ -25,20 +25,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmEndWhileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
- virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const& args,
- cmExecutionStatus& status);
+ bool InvokeInitialPass(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -46,12 +47,12 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "endwhile"; }
+ std::string GetName() const CM_OVERRIDE { return "endwhile"; }
cmTypeMacro(cmEndWhileCommand, cmCommand);
};
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index f3f8c2f..58bbc31 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -90,7 +90,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
args[1].c_str(), verbose);
} else {
result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal,
- 0, verbose);
+ CM_NULLPTR, verbose);
}
if (!result) {
retVal = -1;
@@ -209,7 +209,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
}
fflush(stdout);
fflush(stderr);
- const char* cmd[] = { "/bin/sh", "-c", command, 0 };
+ const char* cmd[] = { "/bin/sh", "-c", command, CM_NULLPTR };
cmsysProcess_SetCommand(cp, cmd);
#endif
@@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
int length;
char* data;
int p;
- while ((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+ while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) {
if (verbose) {
cmSystemTools::Stdout(data, length);
@@ -229,7 +229,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
}
// All output has been read. Wait for the process to exit.
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
// Check the result of running the process.
std::string msg;
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index e6e76d2..7cd4f9f 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -27,30 +27,31 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmExecProgramCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmExecProgramCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "exec_program"; }
+ std::string GetName() const CM_OVERRIDE { return "exec_program"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmExecProgramCommand, cmCommand);
private:
static bool RunCommand(const char* command, std::string& output, int& retVal,
- const char* directory = 0, bool verbose = true);
+ const char* directory = CM_NULLPTR,
+ bool verbose = true);
};
#endif
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 575cdc3..d97b25f 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -161,7 +161,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
return false;
} else {
// Add the null terminating pointer to the command argument list.
- cmds[i].push_back(0);
+ cmds[i].push_back(CM_NULLPTR);
}
}
@@ -228,7 +228,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
int length;
char* data;
int p;
- while ((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+ while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
// Put the output in the right place.
if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) {
if (output_variable.empty()) {
@@ -246,7 +246,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
// All output has been read. Wait for the process to exit.
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
// Fix the text in the output strings.
cmExecuteProcessCommandFixText(tempOutput, output_strip_trailing_whitespace);
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index a89e705..61687ef 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -26,24 +26,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmExecuteProcessCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmExecuteProcessCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "execute_process"; }
+ std::string GetName() const CM_OVERRIDE { return "execute_process"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmExecuteProcessCommand, cmCommand);
};
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index 508c6bd..8006514 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -38,16 +38,12 @@ public:
this->ReturnInvoked = false;
this->BreakInvoked = false;
this->ContinueInvoked = false;
- this->NestedError = false;
}
- void SetNestedError(bool val) { this->NestedError = val; }
- bool GetNestedError() { return this->NestedError; }
private:
bool ReturnInvoked;
bool BreakInvoked;
bool ContinueInvoked;
- bool NestedError;
};
#endif
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 8ca7a11..390477a 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -18,8 +18,8 @@
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
{
- this->LG = 0;
- this->ExportSet = 0;
+ this->LG = CM_NULLPTR;
+ this->ExportSet = CM_NULLPTR;
}
void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
@@ -211,11 +211,10 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
link_libs += missingTarget;
missingTargets.push_back(missingTarget);
return;
- } else {
- // We are not appending, so all exported targets should be
- // known here. This is probably user-error.
- this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
}
+ // We are not appending, so all exported targets should be
+ // known here. This is probably user-error.
+ this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
}
// Assume the target will be exported by another command.
// Append it with the export namespace.
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index be3c70a..417e8c9 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -50,14 +50,14 @@ public:
protected:
// Implement virtual methods from the superclass.
- virtual bool GenerateMainFile(std::ostream& os);
- virtual void GenerateImportTargetsConfig(
+ bool GenerateMainFile(std::ostream& os) CM_OVERRIDE;
+ void GenerateImportTargetsConfig(
std::ostream& os, const std::string& config, std::string const& suffix,
- std::vector<std::string>& missingTargets);
- virtual void HandleMissingTarget(std::string& link_libs,
- std::vector<std::string>& missingTargets,
- cmGeneratorTarget* depender,
- cmGeneratorTarget* dependee);
+ std::vector<std::string>& missingTargets) CM_OVERRIDE;
+ void HandleMissingTarget(std::string& link_libs,
+ std::vector<std::string>& missingTargets,
+ cmGeneratorTarget* depender,
+ cmGeneratorTarget* dependee) CM_OVERRIDE;
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
@@ -70,7 +70,7 @@ protected:
ImportPropertyMap& properties);
std::string InstallNameDir(cmGeneratorTarget* target,
- const std::string& config);
+ const std::string& config) CM_OVERRIDE;
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
const std::string& name);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index a0e7e45..fc62492 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -35,7 +35,7 @@ cmExportCommand::cmExportCommand()
, Filename(&Helper, "FILE", &ArgumentGroup)
, ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
{
- this->ExportSet = 0;
+ this->ExportSet = CM_NULLPTR;
}
// cmExportCommand
@@ -50,10 +50,10 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
if (args[0] == "PACKAGE") {
return this->HandlePackage(args);
} else if (args[0] == "EXPORT") {
- this->ExportSetName.Follows(0);
+ this->ExportSetName.Follows(CM_NULLPTR);
this->ArgumentGroup.Follows(&this->ExportSetName);
} else {
- this->Targets.Follows(0);
+ this->Targets.Follows(CM_NULLPTR);
this->ArgumentGroup.Follows(&this->Targets);
}
@@ -327,11 +327,10 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
fname += "/cmake/packages/";
fname += package;
#else
- const char* home = cmSystemTools::GetEnv("HOME");
- if (!home) {
+ std::string fname;
+ if (!cmSystemTools::GetEnv("HOME", fname)) {
return;
}
- std::string fname = home;
cmSystemTools::ConvertToUnixSlashes(fname);
fname += "/.cmake/packages/";
fname += package;
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index a71393a..0a149af 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -30,19 +30,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmExportCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmExportCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "export"; }
+ std::string GetName() const CM_OVERRIDE { return "export"; }
cmTypeMacro(cmExportCommand, cmCommand);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 736c7da..7f01196 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -25,8 +25,8 @@
#include "cmVersion.h"
#include <assert.h>
+#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx>
-#include <cmsys/auto_ptr.hxx>
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
@@ -69,15 +69,15 @@ const char* cmExportFileGenerator::GetMainExportFileName() const
bool cmExportFileGenerator::GenerateImportFile()
{
// Open the output file to generate it.
- cmsys::auto_ptr<cmsys::ofstream> foutPtr;
+ CM_AUTO_PTR<cmsys::ofstream> foutPtr;
if (this->AppendMode) {
// Open for append.
- cmsys::auto_ptr<cmsys::ofstream> ap(
+ CM_AUTO_PTR<cmsys::ofstream> ap(
new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
foutPtr = ap;
} else {
// Generate atomically and with copy-if-different.
- cmsys::auto_ptr<cmGeneratedFileStream> ap(
+ CM_AUTO_PTR<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->MainImportFile.c_str(), true));
ap->SetCopyIfDifferent(true);
foutPtr = ap;
@@ -93,7 +93,7 @@ bool cmExportFileGenerator::GenerateImportFile()
// Protect that file against use with older CMake versions.
/* clang-format off */
- os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
+ os << "# Generated by CMake\n\n";
os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"
<< " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
<< "endif()\n";
@@ -393,7 +393,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories, preprocessRule, true);
this->ReplaceInstallPrefix(dirs);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs =
cge->Evaluate(target->GetLocalGenerator(), "", false, target);
@@ -679,7 +679,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
}
}
-void cmExportFileGenerator::ReplaceInstallPrefix(std::string&)
+void cmExportFileGenerator::ReplaceInstallPrefix(std::string& /*unused*/)
{
// Do nothing
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 38b08f0..7747157 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -468,7 +468,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
}
std::string cmExportInstallFileGenerator::InstallNameDir(
- cmGeneratorTarget* target, const std::string&)
+ cmGeneratorTarget* target, const std::string& /*config*/)
{
std::string install_name_dir;
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 723b6e5..68960db 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -52,16 +52,16 @@ public:
protected:
// Implement virtual methods from the superclass.
- virtual bool GenerateMainFile(std::ostream& os);
- virtual void GenerateImportTargetsConfig(
+ bool GenerateMainFile(std::ostream& os) CM_OVERRIDE;
+ void GenerateImportTargetsConfig(
std::ostream& os, const std::string& config, std::string const& suffix,
- std::vector<std::string>& missingTargets);
- virtual void HandleMissingTarget(std::string& link_libs,
- std::vector<std::string>& missingTargets,
- cmGeneratorTarget* depender,
- cmGeneratorTarget* dependee);
+ std::vector<std::string>& missingTargets) CM_OVERRIDE;
+ void HandleMissingTarget(std::string& link_libs,
+ std::vector<std::string>& missingTargets,
+ cmGeneratorTarget* depender,
+ cmGeneratorTarget* dependee) CM_OVERRIDE;
- virtual void ReplaceInstallPrefix(std::string& input);
+ void ReplaceInstallPrefix(std::string& input) CM_OVERRIDE;
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
@@ -82,7 +82,7 @@ protected:
std::set<std::string>& importedLocations);
std::string InstallNameDir(cmGeneratorTarget* target,
- const std::string& config);
+ const std::string& config) CM_OVERRIDE;
cmInstallExportGenerator* IEGen;
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index ab43aa8..b422a2c 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -16,7 +16,7 @@
#include "cmVersion.h"
#include "cmake.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
bool cmExportLibraryDependenciesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -53,13 +53,13 @@ void cmExportLibraryDependenciesCommand::FinalPass()
void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
// Use copy-if-different if not appending.
- cmsys::auto_ptr<cmsys::ofstream> foutPtr;
+ CM_AUTO_PTR<cmsys::ofstream> foutPtr;
if (this->Append) {
- cmsys::auto_ptr<cmsys::ofstream> ap(
+ CM_AUTO_PTR<cmsys::ofstream> ap(
new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
foutPtr = ap;
} else {
- cmsys::auto_ptr<cmGeneratedFileStream> ap(
+ CM_AUTO_PTR<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->Filename.c_str(), true));
ap->SetCopyIfDifferent(true);
foutPtr = ap;
@@ -152,7 +152,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
// versions.
const char* vertest =
"\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
- fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
+ fout << "# Generated by CMake\n\n";
fout << "if(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n";
for (std::map<std::string, std::string>::const_iterator i =
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 3fb3565..4b3dc92 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -18,13 +18,19 @@ class cmExportLibraryDependenciesCommand : public cmCommand
{
public:
cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "export_library_dependencies"; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmExportLibraryDependenciesCommand;
+ }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "export_library_dependencies";
+ }
- virtual void FinalPass();
- virtual bool HasFinalPass() const { return true; }
+ void FinalPass() CM_OVERRIDE;
+ bool HasFinalPass() const CM_OVERRIDE { return true; }
private:
std::string Filename;
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 5a826f2..2916e6b 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -63,9 +63,10 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName,
+ CM_NULLPTR, CM_NULLPTR);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cmTarget dummyHead;
dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe");
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 26f4db1..1d13711 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -28,15 +28,15 @@ public:
void SetConfig(const std::string& config) { this->Config = config; }
protected:
// Implement virtual methods from the superclass.
- virtual bool GenerateMainFile(std::ostream& os);
+ bool GenerateMainFile(std::ostream& os) CM_OVERRIDE;
- virtual void GenerateImportTargetsConfig(std::ostream&, const std::string&,
- std::string const&,
- std::vector<std::string>&)
+ void GenerateImportTargetsConfig(std::ostream&, const std::string&,
+ std::string const&,
+ std::vector<std::string>&) CM_OVERRIDE
{
}
- virtual void HandleMissingTarget(std::string&, std::vector<std::string>&,
- cmGeneratorTarget*, cmGeneratorTarget*)
+ void HandleMissingTarget(std::string&, std::vector<std::string>&,
+ cmGeneratorTarget*, cmGeneratorTarget*) CM_OVERRIDE
{
}
@@ -45,7 +45,7 @@ protected:
std::set<const cmGeneratorTarget*>& emitted);
std::string InstallNameDir(cmGeneratorTarget* target,
- const std::string& config);
+ const std::string& config) CM_OVERRIDE;
private:
std::string FindTargets(const std::string& prop,
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index 2ba9b8d..1a101ab 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -21,7 +21,7 @@ int cmExpr_yyparse(yyscan_t yyscanner);
cmExprParserHelper::cmExprParserHelper()
{
this->FileLine = -1;
- this->FileName = 0;
+ this->FileName = CM_NULLPTR;
}
cmExprParserHelper::~cmExprParserHelper()
@@ -81,10 +81,9 @@ int cmExprParserHelper::LexInput(char* buf, int maxlen)
this->CurrentLine++;
}
return (1);
- } else {
- buf[0] = '\n';
- return (0);
}
+ buf[0] = '\n';
+ return (0);
}
void cmExprParserHelper::Error(const char* str)
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index 0e42d75..b01290c 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -15,7 +15,8 @@
#include <assert.h>
void cmExternalMakefileProjectGenerator::EnableLanguage(
- std::vector<std::string> const&, cmMakefile*, bool)
+ std::vector<std::string> const& /*unused*/, cmMakefile* /*unused*/,
+ bool /*unused*/)
{
}
@@ -33,28 +34,37 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
return fullName;
}
-std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
- const std::string& fullName)
+cmExternalMakefileProjectGeneratorFactory::
+ cmExternalMakefileProjectGeneratorFactory(const std::string& n,
+ const std::string& doc)
+ : Name(n)
+ , Documentation(doc)
{
- // at least one global generator must be supported
- assert(!this->SupportedGlobalGenerators.empty());
+}
- if (fullName.empty()) {
- return "";
- }
+cmExternalMakefileProjectGeneratorFactory::
+ ~cmExternalMakefileProjectGeneratorFactory()
+{
+}
- // if we get only the short name, take the first global generator as default
- if (fullName == this->GetName()) {
- return this->SupportedGlobalGenerators[0];
- }
+std::string cmExternalMakefileProjectGeneratorFactory::GetName() const
+{
+ return this->Name;
+}
- // otherwise search for the matching global generator
- for (std::vector<std::string>::const_iterator it =
- this->SupportedGlobalGenerators.begin();
- it != this->SupportedGlobalGenerators.end(); ++it) {
- if (this->CreateFullGeneratorName(*it, this->GetName()) == fullName) {
- return *it;
- }
- }
- return "";
+std::string cmExternalMakefileProjectGeneratorFactory::GetDocumentation() const
+{
+ return this->Documentation;
+}
+
+std::vector<std::string>
+cmExternalMakefileProjectGeneratorFactory::GetSupportedGlobalGenerators() const
+{
+ return this->SupportedGlobalGenerators;
+}
+
+void cmExternalMakefileProjectGeneratorFactory::AddSupportedGlobalGenerator(
+ const std::string& base)
+{
+ this->SupportedGlobalGenerators.push_back(base);
}
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 5d4d54d..6ae5533 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -35,11 +35,6 @@ class cmExternalMakefileProjectGenerator
public:
virtual ~cmExternalMakefileProjectGenerator() {}
- ///! Get the name for this generator.
- virtual std::string GetName() const = 0;
- /** Get the documentation entry for this generator. */
- virtual void GetDocumentation(cmDocumentationEntry& entry,
- const std::string& fullName) const = 0;
virtual void EnableLanguage(std::vector<std::string> const& languages,
cmMakefile*, bool optional);
@@ -55,8 +50,6 @@ public:
return this->SupportedGlobalGenerators;
}
- ///! Get the name of the global generator for the given full name
- std::string GetGlobalGeneratorName(const std::string& fullName);
/** Create a full name from the given global generator name and the
* extra generator name
*/
@@ -66,11 +59,59 @@ public:
///! Generate the project files, the Makefiles have already been generated
virtual void Generate() = 0;
+ void SetName(const std::string& n) { Name = n; }
+ std::string GetName() const { return Name; }
+
protected:
///! Contains the names of the global generators support by this generator.
std::vector<std::string> SupportedGlobalGenerators;
///! the global generator which creates the makefiles
const cmGlobalGenerator* GlobalGenerator;
+
+ std::string Name;
+};
+
+class cmExternalMakefileProjectGeneratorFactory
+{
+public:
+ cmExternalMakefileProjectGeneratorFactory(const std::string& n,
+ const std::string& doc);
+ virtual ~cmExternalMakefileProjectGeneratorFactory();
+
+ std::string GetName() const;
+ std::string GetDocumentation() const;
+ std::vector<std::string> GetSupportedGlobalGenerators() const;
+ std::vector<std::string> Aliases;
+
+ virtual cmExternalMakefileProjectGenerator*
+ CreateExternalMakefileProjectGenerator() const = 0;
+
+ void AddSupportedGlobalGenerator(const std::string& base);
+
+private:
+ std::string Name;
+ std::string Documentation;
+ std::vector<std::string> SupportedGlobalGenerators;
+};
+
+template <class T>
+class cmExternalMakefileProjectGeneratorSimpleFactory
+ : public cmExternalMakefileProjectGeneratorFactory
+{
+public:
+ cmExternalMakefileProjectGeneratorSimpleFactory(const std::string& n,
+ const std::string& doc)
+ : cmExternalMakefileProjectGeneratorFactory(n, doc)
+ {
+ }
+
+ cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator()
+ const
+ {
+ T* p = new T;
+ p->SetName(GetName());
+ return p;
+ }
};
#endif
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2070b1f..6eae26b 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -36,24 +36,30 @@ Discussion:
http://forums.codeblocks.org/index.php/topic,6789.0.html
*/
-void cmExtraCodeBlocksGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
+ : cmExternalMakefileProjectGenerator()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates CodeBlocks project files.";
}
-cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
- : cmExternalMakefileProjectGenerator()
+cmExternalMakefileProjectGeneratorFactory*
+cmExtraCodeBlocksGenerator::GetFactory()
{
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmExtraCodeBlocksGenerator>
+ factory("CodeBlocks", "Generates CodeBlocks project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
// disable until somebody actually tests it:
-// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
+// this->AddSupportedGlobalGenerator("MSYS Makefiles");
#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
void cmExtraCodeBlocksGenerator::Generate()
@@ -118,11 +124,10 @@ void Tree::InsertPath(const std::vector<std::string>& splitted,
if (start + 1 < splitted.size()) {
it->InsertPath(splitted, start + 1, fileName);
return;
- } else {
- // last part of splitted
- it->files.push_back(fileName);
- return;
}
+ // last part of splitted
+ it->files.push_back(fileName);
+ return;
}
}
// Not found in folders, thus insert
@@ -132,12 +137,11 @@ void Tree::InsertPath(const std::vector<std::string>& splitted,
newFolder.InsertPath(splitted, start + 1, fileName);
folders.push_back(newFolder);
return;
- } else {
- // last part of splitted
- newFolder.files.push_back(fileName);
- folders.push_back(newFolder);
- return;
}
+ // last part of splitted
+ newFolder.files.push_back(fileName);
+ folders.push_back(newFolder);
+ return;
}
void Tree::BuildVirtualFolder(cmXMLWriter& xml) const
@@ -248,7 +252,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// We don't want paths with CMakeFiles in them
// or do we?
// In speedcrunch those where purely internal
- if (splitted.size() >= 1 &&
+ if (!splitted.empty() &&
relative.find("CMakeFiles") == std::string::npos) {
tree.InsertPath(splitted, 1, fileName);
}
@@ -289,8 +293,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
xml.StartElement("Build");
- this->AppendTarget(xml, "all", 0, make.c_str(), lgs[0], compiler.c_str(),
- makeArgs);
+ this->AppendTarget(xml, "all", CM_NULLPTR, make.c_str(), lgs[0],
+ compiler.c_str(), makeArgs);
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
@@ -306,7 +310,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// not from the subdirs
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory()) == 0) {
- this->AppendTarget(xml, targetName, 0, make.c_str(), *lg,
+ this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
compiler.c_str(), makeArgs);
}
} break;
@@ -322,7 +326,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
break;
}
- this->AppendTarget(xml, targetName, 0, make.c_str(), *lg,
+ this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
compiler.c_str(), makeArgs);
break;
case cmState::EXECUTABLE:
@@ -376,8 +380,10 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si = sources.begin();
si != sources.end(); si++) {
- // don't add source files which have the GENERATED property set:
- if ((*si)->GetPropertyAsBool("GENERATED")) {
+ // don't add source files from UTILITY target which have the
+ // GENERATED property set:
+ if (gt->GetType() == cmState::UTILITY &&
+ (*si)->GetPropertyAsBool("GENERATED")) {
continue;
}
@@ -513,7 +519,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
xml.StartElement("Target");
xml.Attribute("title", targetName);
- if (target != 0) {
+ if (target != CM_NULLPTR) {
int cbTargetType = this->GetCBTargetType(target);
std::string workingDir = lg->GetCurrentBinaryDirectory();
if (target->GetType() == cmState::EXECUTABLE) {
@@ -521,12 +527,12 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
// set the working directory to this dir.
const char* runtimeOutputDir =
makefile->GetDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY");
- if (runtimeOutputDir != 0) {
+ if (runtimeOutputDir != CM_NULLPTR) {
workingDir = runtimeOutputDir;
} else {
const char* executableOutputDir =
makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
- if (executableOutputDir != 0) {
+ if (executableOutputDir != CM_NULLPTR) {
workingDir = executableOutputDir;
}
}
@@ -578,33 +584,37 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
}
// the include directories for this target
- std::set<std::string> uniqIncludeDirs;
+ std::vector<std::string> allIncludeDirs;
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, target, "C", buildType);
- uniqIncludeDirs.insert(includes.begin(), includes.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), includes.begin(),
+ includes.end());
std::string systemIncludeDirs = makefile->GetSafeDefinition(
- "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
systemIncludeDirs = makefile->GetSafeDefinition(
- "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
- for (std::set<std::string>::const_iterator dirIt = uniqIncludeDirs.begin();
- dirIt != uniqIncludeDirs.end(); ++dirIt) {
+ std::vector<std::string>::const_iterator end =
+ cmRemoveDuplicates(allIncludeDirs);
+
+ for (std::vector<std::string>::const_iterator i = allIncludeDirs.begin();
+ i != end; ++i) {
xml.StartElement("Add");
- xml.Attribute("directory", *dirIt);
+ xml.Attribute("directory", *i);
xml.EndElement();
}
@@ -655,11 +665,11 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
// projects with C/C++ and Fortran are handled as C/C++ projects
bool pureFortran = false;
std::string compilerIdVar;
- if (this->GlobalGenerator->GetLanguageEnabled("CXX") == true) {
+ if (this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_CXX_COMPILER_ID";
- } else if (this->GlobalGenerator->GetLanguageEnabled("C") == true) {
+ } else if (this->GlobalGenerator->GetLanguageEnabled("C")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
- } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran") == true) {
+ } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran")) {
compilerIdVar = "CMAKE_Fortran_COMPILER_ID";
pureFortran = true;
}
@@ -667,7 +677,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
std::string compilerId = mf->GetSafeDefinition(compilerIdVar);
std::string compiler = "gcc"; // default to gcc
if (compilerId == "MSVC") {
- if (mf->IsDefinitionSet("MSVC10") == true) {
+ if (mf->IsDefinitionSet("MSVC10")) {
compiler = "msvc10";
} else {
compiler = "msvc8";
@@ -705,21 +715,22 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
// Translate the cmake target type into the CodeBlocks target type id
int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
{
- if (target->GetType() == cmState::EXECUTABLE) {
- if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) ||
- (target->GetPropertyAsBool("MACOSX_BUNDLE"))) {
- return 0;
- } else {
+ switch (target->GetType()) {
+ case cmState::EXECUTABLE:
+ if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) ||
+ (target->GetPropertyAsBool("MACOSX_BUNDLE"))) {
+ return 0;
+ }
return 1;
- }
- } else if ((target->GetType() == cmState::STATIC_LIBRARY) ||
- (target->GetType() == cmState::OBJECT_LIBRARY)) {
- return 2;
- } else if ((target->GetType() == cmState::SHARED_LIBRARY) ||
- (target->GetType() == cmState::MODULE_LIBRARY)) {
- return 3;
+ case cmState::STATIC_LIBRARY:
+ case cmState::OBJECT_LIBRARY:
+ return 2;
+ case cmState::SHARED_LIBRARY:
+ case cmState::MODULE_LIBRARY:
+ return 3;
+ default:
+ return 4;
}
- return 4;
}
// Create the command line for building the given target using the selected
@@ -729,7 +740,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
const std::string& makeFlags)
{
std::string command = make;
- if (makeFlags.size() > 0) {
+ if (!makeFlags.empty()) {
command += " ";
command += makeFlags;
}
@@ -738,7 +749,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
if (generator == "NMake Makefiles") {
// For Windows ConvertToOutputPath already adds quotes when required.
// These need to be escaped, see
- // http://public.kitware.com/Bug/view.php?id=13952
+ // https://gitlab.kitware.com/cmake/cmake/issues/13952
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
command += " /NOLOGO /f ";
command += makefileName;
@@ -746,7 +757,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += target;
} else if (generator == "MinGW Makefiles") {
// no escaping of spaces in this case, see
- // http://public.kitware.com/Bug/view.php?id=10014
+ // https://gitlab.kitware.com/cmake/cmake/issues/10014
std::string makefileName = makefile;
command += " -f \"";
command += makefileName;
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index fe4f513..b39080c 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -28,20 +28,9 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator
public:
cmExtraCodeBlocksGenerator();
- virtual std::string GetName() const
- {
- return cmExtraCodeBlocksGenerator::GetActualName();
- }
- 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 std::string& fullName) const;
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
private:
struct CbpUnit
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index ba58767..eda6867 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -27,24 +27,30 @@
#include <cmsys/SystemInformation.hxx>
#include <cmsys/SystemTools.hxx>
-void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
-{
- entry.Name = this->GetName();
- entry.Brief = "Generates CodeLite project files.";
-}
-
cmExtraCodeLiteGenerator::cmExtraCodeLiteGenerator()
: cmExternalMakefileProjectGenerator()
, ConfigName("NoConfig")
, CpuCount(2)
{
+}
+
+cmExternalMakefileProjectGeneratorFactory*
+cmExtraCodeLiteGenerator::GetFactory()
+{
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmExtraCodeLiteGenerator>
+ factory("CodeLite", "Generates CodeLite project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
void cmExtraCodeLiteGenerator::Generate()
@@ -407,7 +413,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
// figure out which language to use
// for now care only for C and C++
std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID";
- if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false) {
+ if (!this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
}
diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h
index 01ff31f..e20e745 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -36,20 +36,9 @@ protected:
public:
cmExtraCodeLiteGenerator();
- virtual std::string GetName() const
- {
- return cmExtraCodeLiteGenerator::GetActualName();
- }
- 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 std::string& fullName) const;
-
- virtual void Generate();
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
+
+ void Generate() CM_OVERRIDE;
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index f24e7fb..945ee40 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -46,16 +46,6 @@ void AppendDictionary(cmXMLWriter& xml, const char* key, T const& value)
cmExtraEclipseCDT4Generator::cmExtraEclipseCDT4Generator()
: cmExternalMakefileProjectGenerator()
{
-// TODO: Verify if __CYGWIN__ should be checked.
-//#if defined(_WIN32) && !defined(__CYGWIN__)
-#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
-// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
-#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
-
this->SupportsVirtualFolders = true;
this->GenerateLinkedResources = true;
this->SupportsGmakeErrorParser = true;
@@ -64,15 +54,31 @@ cmExtraEclipseCDT4Generator::cmExtraEclipseCDT4Generator()
this->CXXEnabled = false;
}
-void cmExtraEclipseCDT4Generator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmExternalMakefileProjectGeneratorFactory*
+cmExtraEclipseCDT4Generator::GetFactory()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates Eclipse CDT 4.0 project files.";
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmExtraEclipseCDT4Generator>
+ factory("Eclipse CDT4", "Generates Eclipse CDT 4.0 project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
+// TODO: Verify if __CYGWIN__ should be checked.
+//#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+// factory.AddSupportedGlobalGenerator("MSYS Makefiles");
+#endif
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
void cmExtraEclipseCDT4Generator::EnableLanguage(
- std::vector<std::string> const& languages, cmMakefile*, bool)
+ std::vector<std::string> const& languages, cmMakefile* /*unused*/,
+ bool /*optional*/)
{
for (std::vector<std::string>::const_iterator lit = languages.begin();
lit != languages.end(); ++lit) {
@@ -129,7 +135,7 @@ void cmExtraEclipseCDT4Generator::Generate()
(this->IsOutOfSourceBuild &&
mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT"));
- if ((this->GenerateSourceProject == false) &&
+ if (!this->GenerateSourceProject &&
(mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"))) {
mf->IssueMessage(
cmake::WARNING,
@@ -208,7 +214,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// get the variables from the environment and from the cache and then
// figure out which one to use:
- const char* envVarValue = getenv(envVar);
+ std::string envVarValue;
+ const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar;
@@ -217,17 +224,17 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// now we have both, decide which one to use
std::string valueToUse;
- if (envVarValue == 0 && cacheValue == 0) {
+ if (!envVarSet && cacheValue == CM_NULLPTR) {
// nothing known, do nothing
valueToUse = "";
- } else if (envVarValue != 0 && cacheValue == 0) {
+ } else if (envVarSet && cacheValue == CM_NULLPTR) {
// The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
cacheEntryName.c_str(), cmState::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
- } else if (envVarValue == 0 && cacheValue != 0) {
+ } else if (!envVarSet && cacheValue != CM_NULLPTR) {
// It is already in the cache, but not in the env, so use it from the cache
valueToUse = cacheValue;
} else {
@@ -311,7 +318,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"false");
// set project specific environment
- std::stringstream environment;
+ std::ostringstream environment;
environment << "VERBOSE=1|CMAKE_NO_VERBOSE=1|"; // verbose Makefile output
// set vsvars32.bat environment available at CMake time,
// but not necessarily when eclipse is open
@@ -341,7 +348,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all");
// set error parsers
- std::stringstream errorOutputParser;
+ std::ostringstream errorOutputParser;
if (compilerId == "MSVC") {
errorOutputParser << "org.eclipse.cdt.core.VCErrorParser;";
@@ -398,8 +405,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->IsOutOfSourceBuild) {
// create a linked resource to CMAKE_SOURCE_DIR
// (this is not done anymore for each project because of
- // http://public.kitware.com/Bug/view.php?id=9978 and because I found it
- // actually quite confusing in bigger projects with many directories and
+ // https://gitlab.kitware.com/cmake/cmake/issues/9978 and because I found
+ // it actually quite confusing in bigger projects with many directories and
// projects, Alex
std::string sourceLinkedResourceName = "[Source directory]";
@@ -897,8 +904,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) {
const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
- std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ std::string subdir = (*it)->ConvertToRelativePath(
+ (*it)->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
if (subdir == ".") {
subdir = "";
}
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 0cef071..4b585c3 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -35,24 +35,12 @@ public:
cmExtraEclipseCDT4Generator();
- static cmExternalMakefileProjectGenerator* New()
- {
- return new cmExtraEclipseCDT4Generator;
- }
-
- virtual std::string GetName() const
- {
- return cmExtraEclipseCDT4Generator::GetActualName();
- }
-
- static std::string GetActualName() { return "Eclipse CDT4"; }
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
- virtual void GetDocumentation(cmDocumentationEntry& entry,
- const std::string& fullName) const;
- virtual void EnableLanguage(std::vector<std::string> const& languages,
- cmMakefile*, bool optional);
+ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
+ bool optional) CM_OVERRIDE;
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
private:
// create .project file in the source tree
@@ -82,7 +70,7 @@ private:
const std::string& make,
const std::string& makeArguments,
const std::string& path, const char* prefix = "",
- const char* makeTarget = NULL);
+ const char* makeTarget = CM_NULLPTR);
static void AppendScannerProfile(
cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled,
const std::string& openActionFilePath, bool pParserEnabled,
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 02159dd..4e72504 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -22,24 +22,28 @@
#include <cmsys/SystemTools.hxx>
-void cmExtraKateGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmExtraKateGenerator::cmExtraKateGenerator()
+ : cmExternalMakefileProjectGenerator()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates Kate project files.";
}
-cmExtraKateGenerator::cmExtraKateGenerator()
- : cmExternalMakefileProjectGenerator()
+cmExternalMakefileProjectGeneratorFactory* cmExtraKateGenerator::GetFactory()
{
+ static cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraKateGenerator>
+ factory("Kate", "Generates Kate project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
// disable until somebody actually tests it:
-// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
+// factory.AddSupportedGlobalGenerator("MSYS Makefiles");
#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
void cmExtraKateGenerator::Generate()
@@ -137,9 +141,9 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
if (targetName == "edit_cache") {
const char* editCommand =
(*it)->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND");
- if (editCommand == 0) {
+ if (editCommand == CM_NULLPTR) {
insertTarget = false;
- } else if (strstr(editCommand, "ccmake") != NULL) {
+ } else if (strstr(editCommand, "ccmake") != CM_NULLPTR) {
insertTarget = false;
}
}
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 71e88a9..3d16052 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -26,20 +26,9 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator
public:
cmExtraKateGenerator();
- virtual std::string GetName() const
- {
- return cmExtraKateGenerator::GetActualName();
- }
- 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 std::string& fullName) const;
-
- virtual void Generate();
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
+
+ void Generate() CM_OVERRIDE;
private:
void CreateKateProjectFile(const cmLocalGenerator* lg) const;
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 9b3ea0b..6e81ee1 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -38,24 +38,30 @@ http://www.sublimetext.com/docs/2/projects.html
http://sublimetext.info/docs/en/reference/build_systems.html
*/
-void cmExtraSublimeTextGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmExternalMakefileProjectGeneratorFactory*
+cmExtraSublimeTextGenerator::GetFactory()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates Sublime Text 2 project files.";
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmExtraSublimeTextGenerator>
+ factory("Sublime Text 2", "Generates Sublime Text 2 project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
+#if defined(_WIN32)
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
+// disable until somebody actually tests it:
+// factory.AddSupportedGlobalGenerator("MSYS Makefiles");
+#endif
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator()
: cmExternalMakefileProjectGenerator()
{
-#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
-// disable until somebody actually tests it:
-// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
-#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
}
void cmExtraSublimeTextGenerator::Generate()
@@ -134,9 +140,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string compiler = "";
if (!lgs.empty()) {
- this->AppendTarget(fout, "all", lgs[0], 0, make.c_str(), mf,
+ this->AppendTarget(fout, "all", lgs[0], CM_NULLPTR, make.c_str(), mf,
compiler.c_str(), sourceFileFlags, true);
- this->AppendTarget(fout, "clean", lgs[0], 0, make.c_str(), mf,
+ this->AppendTarget(fout, "clean", lgs[0], CM_NULLPTR, make.c_str(), mf,
compiler.c_str(), sourceFileFlags, false);
}
@@ -155,7 +161,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
// not from the subdirs
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory()) == 0) {
- this->AppendTarget(fout, targetName, *lg, 0, make.c_str(),
+ this->AppendTarget(fout, targetName, *lg, CM_NULLPTR, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
}
@@ -172,8 +178,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
break;
}
- this->AppendTarget(fout, targetName, *lg, 0, make.c_str(), makefile,
- compiler.c_str(), sourceFileFlags, false);
+ this->AppendTarget(fout, targetName, *lg, CM_NULLPTR, make.c_str(),
+ makefile, compiler.c_str(), sourceFileFlags,
+ false);
break;
case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY:
@@ -199,12 +206,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
void cmExtraSublimeTextGenerator::AppendTarget(
cmGeneratedFileStream& fout, const std::string& targetName,
cmLocalGenerator* lg, cmGeneratorTarget* target, const char* make,
- const cmMakefile* makefile,
- const char*, // compiler
+ const cmMakefile* makefile, const char* /*compiler*/,
MapSourceFileFlags& sourceFileFlags, bool firstTarget)
{
- if (target != 0) {
+ if (target != CM_NULLPTR) {
std::vector<cmSourceFile*> sourceFiles;
target->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
@@ -295,7 +301,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
std::string makefileName;
if (generator == "MinGW Makefiles") {
// no escaping of spaces in this case, see
- // http://public.kitware.com/Bug/view.php?id=10014
+ // https://gitlab.kitware.com/cmake/cmake/issues/10014
makefileName = makefile;
} else {
makefileName = cmSystemTools::ConvertToOutputPath(makefile);
@@ -314,27 +320,14 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt)
{
std::string flags;
-
- cmMakefile* makefile = lg->GetMakefile();
std::string language = source->GetLanguage();
if (language.empty()) {
language = "C";
}
- const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- // Add language-specific flags.
- lg->AddLanguageFlags(flags, language, config);
-
- lg->AddArchitectureFlags(flags, gtgt, language, config);
+ std::string const& config =
+ lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
- // TODO: Fortran support.
- // // Fortran-specific flags computed for this target.
- // if(*l == "Fortran")
- // {
- // this->AddFortranFlags(flags);
- // }
-
- // Add shared-library flags if needed.
- lg->AddCMP0018Flags(flags, gtgt, language, config);
+ lg->GetTargetCompileFlags(gtgt, config, language, flags);
// Add include directory flags.
{
@@ -345,17 +338,9 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
lg->AppendFlags(flags, includeFlags);
}
- // Append old-style preprocessor definition flags.
- lg->AppendFlags(flags, makefile->GetDefineFlags());
-
- // Add target-specific flags.
- lg->AddCompileOptions(flags, gtgt, language, config);
-
// Add source file specific flags.
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
- // TODO: Handle Apple frameworks.
-
return flags;
}
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 6efec7a..c087825 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -27,23 +27,11 @@ class cmGeneratorTarget;
class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
{
public:
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
cmExtraSublimeTextGenerator();
- virtual std::string GetName() const
- {
- return cmExtraSublimeTextGenerator::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 std::string& fullName) const;
-
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
private:
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index ebd6223..03ee31e 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -73,8 +73,8 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
// Add command for generating the .h and .cxx files
std::string no_main_dependency = "";
- const char* no_comment = 0;
- const char* no_working_dir = 0;
+ const char* no_comment = CM_NULLPTR;
+ const char* no_working_dir = CM_NULLPTR;
this->Makefile->AddCustomCommandToOutput(
cxxres, depends, no_main_dependency, commandLines, no_comment,
no_working_dir);
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 2e60051..72b468e 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -28,14 +28,14 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFLTKWrapUICommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFLTKWrapUICommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This is called at the end after all the information
@@ -43,13 +43,13 @@ public:
* not implement this method. At this point, reading and
* writing to the cache can be done.
*/
- virtual void FinalPass();
- virtual bool HasFinalPass() const { return true; }
+ void FinalPass() CM_OVERRIDE;
+ bool HasFinalPass() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "fltk_wrap_ui"; }
+ std::string GetName() const CM_OVERRIDE { return "fltk_wrap_ui"; }
private:
/**
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4e72f36..835b118 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -34,12 +34,12 @@
// include sys/stat.h after sys/types.h
#include <sys/stat.h>
+#include <cm_auto_ptr.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/auto_ptr.hxx>
// Table of permissions flags.
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -231,17 +231,17 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
cmCommandArgumentGroup group;
cmCAString readArg(&argHelper, "READ");
- cmCAString fileNameArg(&argHelper, 0);
- cmCAString resultArg(&argHelper, 0);
+ cmCAString fileNameArg(&argHelper, CM_NULLPTR);
+ cmCAString resultArg(&argHelper, CM_NULLPTR);
cmCAString offsetArg(&argHelper, "OFFSET", &group);
cmCAString limitArg(&argHelper, "LIMIT", &group);
cmCAEnabler hexOutputArg(&argHelper, "HEX", &group);
- readArg.Follows(0);
+ readArg.Follows(CM_NULLPTR);
fileNameArg.Follows(&readArg);
resultArg.Follows(&fileNameArg);
group.Follows(&resultArg);
- argHelper.Parse(&args, 0);
+ argHelper.Parse(&args, CM_NULLPTR);
std::string fileName = fileNameArg.GetString();
if (!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) {
@@ -257,7 +257,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
fileName.c_str(), std::ios::in |
(hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in));
#else
- cmsys::ifstream file(fileName.c_str(), std::ios::in);
+ cmsys::ifstream file(fileName.c_str());
#endif
if (!file) {
@@ -330,7 +330,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
return false;
}
- cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash.get()) {
std::string out = hash->HashFile(args[1]);
if (!out.empty()) {
@@ -526,7 +526,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
#if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary);
#else
- cmsys::ifstream fin(fileName.c_str(), std::ios::in);
+ cmsys::ifstream fin(fileName.c_str());
#endif
if (!fin) {
std::ostringstream e;
@@ -901,9 +901,9 @@ bool cmFileCommand::HandleDifferentCommand(
*/
// Evaluate arguments.
- const char* file_lhs = 0;
- const char* file_rhs = 0;
- const char* var = 0;
+ const char* file_lhs = CM_NULLPTR;
+ const char* file_rhs = CM_NULLPTR;
+ const char* var = CM_NULLPTR;
enum Doing
{
DoingNone,
@@ -958,7 +958,7 @@ struct cmFileCopier
, MatchlessFiles(true)
, FilePermissions(0)
, DirPermissions(0)
- , CurrentMatchRule(0)
+ , CurrentMatchRule(CM_NULLPTR)
, UseGivenPermissionsFile(false)
, UseGivenPermissionsDir(false)
, UseSourcePermissions(true)
@@ -1609,13 +1609,15 @@ struct cmFileInstaller : public cmFileCopier
// Installation does not use source permissions by default.
this->UseSourcePermissions = false;
// Check whether to copy files always or only if they have changed.
- this->Always =
- cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_INSTALL_ALWAYS"));
+ std::string install_always;
+ if (cmSystemTools::GetEnv("CMAKE_INSTALL_ALWAYS", install_always)) {
+ this->Always = cmSystemTools::IsOn(install_always.c_str());
+ }
// Get the current manifest.
this->Manifest =
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_MANIFEST_FILES");
}
- ~cmFileInstaller()
+ ~cmFileInstaller() CM_OVERRIDE
{
// Save the updated install manifest.
this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES",
@@ -1640,12 +1642,12 @@ protected:
this->Manifest += file.substr(this->DestDirLength);
}
- virtual std::string const& ToName(std::string const& fromName)
+ std::string const& ToName(std::string const& fromName) CM_OVERRIDE
{
return this->Rename.empty() ? fromName : this->Rename;
}
- virtual void ReportCopy(const char* toFile, Type type, bool copy)
+ void ReportCopy(const char* toFile, Type type, bool copy) CM_OVERRIDE
{
if (!this->MessageNever && (copy || !this->MessageLazy)) {
std::string message = (copy ? "Installing: " : "Up-to-date: ");
@@ -1657,11 +1659,11 @@ protected:
this->ManifestAppend(toFile);
}
}
- virtual bool ReportMissing(const char* fromFile)
+ bool ReportMissing(const char* fromFile) CM_OVERRIDE
{
return (this->Optional || this->cmFileCopier::ReportMissing(fromFile));
}
- virtual bool Install(const char* fromFile, const char* toFile)
+ bool Install(const char* fromFile, const char* toFile) CM_OVERRIDE
{
// Support installing from empty source to make a directory.
if (this->InstallType == cmInstallType_DIRECTORY && !*fromFile) {
@@ -1670,16 +1672,16 @@ protected:
return this->cmFileCopier::Install(fromFile, toFile);
}
- virtual bool Parse(std::vector<std::string> const& args);
+ bool Parse(std::vector<std::string> const& args) CM_OVERRIDE;
enum
{
DoingType = DoingLast1,
DoingRename,
DoingLast2
};
- virtual bool CheckKeyword(std::string const& arg);
- virtual bool CheckValue(std::string const& arg);
- virtual void DefaultFilePermissions()
+ bool CheckKeyword(std::string const& arg) CM_OVERRIDE;
+ bool CheckValue(std::string const& arg) CM_OVERRIDE;
+ void DefaultFilePermissions() CM_OVERRIDE
{
this->cmFileCopier::DefaultFilePermissions();
// Add execute permissions based on the target type.
@@ -1869,9 +1871,8 @@ bool cmFileInstaller::HandleInstallDestination()
return false;
}
- const char* destdir = cmSystemTools::GetEnv("DESTDIR");
- if (destdir && *destdir) {
- std::string sdestdir = destdir;
+ std::string sdestdir;
+ if (cmSystemTools::GetEnv("DESTDIR", sdestdir) && !sdestdir.empty()) {
cmSystemTools::ConvertToUnixSlashes(sdestdir);
char ch1 = destination[0];
char ch2 = destination[1];
@@ -1942,9 +1943,9 @@ bool cmFileCommand::HandleRPathChangeCommand(
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = 0;
- const char* oldRPath = 0;
- const char* newRPath = 0;
+ const char* file = CM_NULLPTR;
+ const char* oldRPath = CM_NULLPTR;
+ const char* newRPath = CM_NULLPTR;
enum Doing
{
DoingNone,
@@ -2032,7 +2033,7 @@ bool cmFileCommand::HandleRPathRemoveCommand(
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = 0;
+ const char* file = CM_NULLPTR;
enum Doing
{
DoingNone,
@@ -2096,8 +2097,8 @@ bool cmFileCommand::HandleRPathCheckCommand(
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = 0;
- const char* rpath = 0;
+ const char* file = CM_NULLPTR;
+ const char* rpath = CM_NULLPTR;
enum Doing
{
DoingNone,
@@ -2438,7 +2439,7 @@ public:
inline void release(void)
{
- this->Easy = 0;
+ this->Easy = CM_NULLPTR;
return;
}
@@ -2478,7 +2479,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO");
std::string expectedHash;
std::string hashMatchMSG;
- cmsys::auto_ptr<cmCryptoHash> hash;
+ CM_AUTO_PTR<cmCryptoHash> hash;
bool showProgress = false;
while (i != args.end()) {
@@ -2534,7 +2535,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false;
}
- hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New("MD5"));
+ hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New("MD5"));
hashMatchMSG = "MD5 sum";
expectedHash = cmSystemTools::LowerCase(*i);
} else if (*i == "SHOW_PROGRESS") {
@@ -2555,7 +2556,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
std::string algo = i->substr(0, pos);
expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1));
- hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
+ hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
if (!hash.get()) {
std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: ";
err += algo;
@@ -2934,7 +2935,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
::curl_global_cleanup();
fclose(fin);
- fin = NULL;
+ fin = CM_NULLPTR;
if (!logVar.empty()) {
std::string log;
@@ -2971,11 +2972,11 @@ void cmFileCommand::AddEvaluationFile(const std::string& inputName,
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression outputGe(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> outputCge =
outputGe.Parse(outputExpr);
cmGeneratorExpression conditionGe(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> conditionCge =
conditionGe.Parse(condition);
this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge,
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 84bb456..9121d3c 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -26,24 +26,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFileCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "file"; }
+ std::string GetName() const CM_OVERRIDE { return "file"; }
cmTypeMacro(cmFileCommand, cmCommand);
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index 7c51459..5521ac4 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -140,10 +140,9 @@ cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename,
if (result.IsOk()) {
this->Locks.push_back(lock);
return cmFileLockResult::MakeOk();
- } else {
- delete lock;
- return result;
}
+ delete lock;
+ return result;
}
cmFileLockResult cmFileLockPool::ScopePool::Release(
diff --git a/Source/cmFilePathUuid.cxx b/Source/cmFilePathUuid.cxx
new file mode 100644
index 0000000..2839b63
--- /dev/null
+++ b/Source/cmFilePathUuid.cxx
@@ -0,0 +1,132 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2016 Sebastian Holtermann (sebholt@xwmw.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmFilePathUuid.h"
+
+#include "cmCryptoHash.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmsys/Base64.h"
+
+cmFilePathUuid::cmFilePathUuid(cmMakefile* makefile)
+{
+ initParentDirs(makefile->GetCurrentSourceDirectory(),
+ makefile->GetCurrentBinaryDirectory(),
+ makefile->GetHomeDirectory(),
+ makefile->GetHomeOutputDirectory());
+}
+
+cmFilePathUuid::cmFilePathUuid(const std::string& currentSrcDir,
+ const std::string& currentBinDir,
+ const std::string& projectSrcDir,
+ const std::string& projectBinDir)
+{
+ initParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
+}
+
+void cmFilePathUuid::initParentDirs(const std::string& currentSrcDir,
+ const std::string& currentBinDir,
+ const std::string& projectSrcDir,
+ const std::string& projectBinDir)
+{
+ parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
+ parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
+ parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
+ parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
+
+ parentDirs[0].second = "CurrentSource";
+ parentDirs[1].second = "CurrentBinary";
+ parentDirs[2].second = "ProjectSource";
+ parentDirs[3].second = "ProjectBinary";
+}
+
+std::string cmFilePathUuid::get(const std::string& filePath,
+ const char* outputPrefix,
+ const char* outputSuffix)
+{
+ std::string sourceFilename = cmsys::SystemTools::GetFilenameName(filePath);
+ std::string sourceBasename =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(sourceFilename);
+
+ // Acquire checksum string
+ std::string checksum;
+ {
+ std::string sourceRelPath;
+ std::string sourceRelSeed;
+ GetRelPathSeed(filePath, sourceRelPath, sourceRelSeed);
+ checksum = GetChecksumString(sourceFilename, sourceRelPath, sourceRelSeed);
+ }
+
+ // Compose the file name
+ std::string uuid;
+ if (outputPrefix) {
+ uuid += outputPrefix;
+ }
+ uuid += sourceBasename.substr(0, partLengthName);
+ uuid += "_";
+ uuid += checksum.substr(0, partLengthCheckSum);
+ if (outputSuffix) {
+ uuid += outputSuffix;
+ }
+ return uuid;
+}
+
+void cmFilePathUuid::GetRelPathSeed(const std::string& filePath,
+ std::string& sourceRelPath,
+ std::string& sourceRelSeed)
+{
+ const std::string sourceNameReal = cmsys::SystemTools::GetRealPath(filePath);
+ std::string parentDirectory;
+ // Find closest project parent directory
+ for (size_t ii = 0; ii != numParentDirs; ++ii) {
+ const std::string& pDir = parentDirs[ii].first;
+ if (!pDir.empty() &&
+ cmsys::SystemTools::IsSubDirectory(sourceNameReal, pDir)) {
+ sourceRelSeed = parentDirs[ii].second;
+ parentDirectory = pDir;
+ break;
+ }
+ }
+ // Check if the file path is below a known project directory
+ if (parentDirectory.empty()) {
+ // Use file syste root as fallback parent directory
+ sourceRelSeed = "FileSystemRoot";
+ cmsys::SystemTools::SplitPathRootComponent(sourceNameReal,
+ &parentDirectory);
+ }
+ sourceRelPath = cmsys::SystemTools::RelativePath(
+ parentDirectory, cmsys::SystemTools::GetParentDirectory(sourceNameReal));
+}
+
+std::string cmFilePathUuid::GetChecksumString(
+ const std::string& sourceFilename, const std::string& sourceRelPath,
+ const std::string& sourceRelSeed)
+{
+ std::string checksumBase64;
+ {
+ // Calculate the file ( seed + relative path + name ) checksum
+ std::vector<unsigned char> hashBytes =
+ cmCryptoHash::New("SHA256")->ByteHashString(
+ (sourceRelSeed + sourceRelPath + sourceFilename).c_str());
+ // Convert hash bytes to Base64 text string
+ std::vector<unsigned char> base64Bytes(hashBytes.size() * 2, 0);
+ cmsysBase64_Encode(&hashBytes[0], hashBytes.size(), &base64Bytes[0], 0);
+ checksumBase64 = reinterpret_cast<const char*>(&base64Bytes[0]);
+ }
+ // Base64 allows '/', '+' and '=' characters which are problematic
+ // when used in file names. Replace them with safer alternatives.
+ std::replace(checksumBase64.begin(), checksumBase64.end(), '/', '-');
+ std::replace(checksumBase64.begin(), checksumBase64.end(), '+', '_');
+ std::replace(checksumBase64.begin(), checksumBase64.end(), '=', '_');
+
+ return checksumBase64;
+}
diff --git a/Source/cmFilePathUuid.h b/Source/cmFilePathUuid.h
new file mode 100644
index 0000000..42e89b1
--- /dev/null
+++ b/Source/cmFilePathUuid.h
@@ -0,0 +1,77 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2016 Sebastian Holtermann (sebholt@xwmw.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmFilePathUuid_h
+#define cmFilePathUuid_h
+
+#include "cmStandardIncludes.h"
+
+#include <string>
+#include <utility>
+
+class cmMakefile;
+
+/** \class cmFilePathUuid
+ * @brief Generates a unique pathless file name with a checksum component
+ * calculated from the file path.
+ *
+ * The checksum is calculated from the relative file path to the
+ * closest known project directory. This guarantees reproducibility
+ * when source and build directory differ e.g. for different project
+ * build directories.
+ */
+class cmFilePathUuid
+{
+public:
+ /// Maximum number of characters to use from the file name
+ static const size_t partLengthName = 14;
+ /// Maximum number of characters to use from the path checksum
+ static const size_t partLengthCheckSum = 14;
+
+ /// @brief Initilizes the parent directories from a makefile
+ cmFilePathUuid(cmMakefile* makefile);
+
+ /// @brief Initilizes the parent directories manually
+ cmFilePathUuid(const std::string& currentSrcDir,
+ const std::string& currentBinDir,
+ const std::string& projectSrcDir,
+ const std::string& projectBinDir);
+
+ /* @brief Calculates and returns the uuid for a file path
+ *
+ * @arg outputPrefix optional string to prepend to the result
+ * @arg outputSuffix optional string to append to the result
+ */
+ std::string get(const std::string& filePath, const char* outputPrefix = NULL,
+ const char* outputSuffix = NULL);
+
+private:
+ void initParentDirs(const std::string& currentSrcDir,
+ const std::string& currentBinDir,
+ const std::string& projectSrcDir,
+ const std::string& projectBinDir);
+
+ /// Returns the relative path and the parent directory key string (seed)
+ void GetRelPathSeed(const std::string& filePath, std::string& sourceRelPath,
+ std::string& sourceRelSeed);
+
+ std::string GetChecksumString(const std::string& sourceFilename,
+ const std::string& sourceRelPath,
+ const std::string& sourceRelSeed);
+
+ /// Size of the parent directory list
+ static const size_t numParentDirs = 4;
+ /// List of (directory name, seed name) pairs
+ std::pair<std::string, std::string> parentDirs[numParentDirs];
+};
+
+#endif
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 7efe194..1360b44 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -13,7 +13,7 @@
// Use a hash table to avoid duplicate file time checks from disk.
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map>
#else
#include <cmsys/hash_map.hxx>
@@ -47,13 +47,13 @@ private:
{
public:
size_t operator()(const std::string& s) const { return h(s.c_str()); }
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
std::hash<const char*> h;
#else
cmsys::hash<const char*> h;
#endif
};
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string,
#else
typedef cmsys::hash_map<std::string,
@@ -140,11 +140,14 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1,
// Compare using nanosecond resolution.
if (s1->st_mtim.tv_sec < s2->st_mtim.tv_sec) {
return -1;
- } else if (s1->st_mtim.tv_sec > s2->st_mtim.tv_sec) {
+ }
+ if (s1->st_mtim.tv_sec > s2->st_mtim.tv_sec) {
return 1;
- } else if (s1->st_mtim.tv_nsec < s2->st_mtim.tv_nsec) {
+ }
+ if (s1->st_mtim.tv_nsec < s2->st_mtim.tv_nsec) {
return -1;
- } else if (s1->st_mtim.tv_nsec > s2->st_mtim.tv_nsec) {
+ }
+ if (s1->st_mtim.tv_nsec > s2->st_mtim.tv_nsec) {
return 1;
}
#elif CMake_STAT_HAS_ST_MTIMESPEC
@@ -185,11 +188,11 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1,
long long t2 = s2->st_mtim.tv_sec * bil + s2->st_mtim.tv_nsec;
if (t1 < t2) {
return (t2 - t1) >= bil;
- } else if (t2 < t1) {
+ }
+ if (t2 < t1) {
return (t1 - t2) >= bil;
- } else {
- return false;
}
+ return false;
#elif CMake_STAT_HAS_ST_MTIMESPEC
// Times are integers in units of 1ns.
long long bil = 1000000000;
@@ -240,11 +243,10 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1,
// Compare the two modification times.
*result = this->Compare(&s1, &s2);
return true;
- } else {
- // No comparison available. Default to the same time.
- *result = 0;
- return false;
}
+ // No comparison available. Default to the same time.
+ *result = 0;
+ return false;
}
bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1,
@@ -256,8 +258,7 @@ bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1,
if (this->Stat(f1, &s1) && this->Stat(f2, &s2)) {
// Compare the two modification times.
return this->TimesDiffer(&s1, &s2);
- } else {
- // No comparison available. Default to different times.
- return true;
}
+ // No comparison available. Default to different times.
+ return true;
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 082bbf0..c785e6c 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -226,12 +226,10 @@ void cmFindBase::FillSystemEnvironmentPath()
paths.AddEnvPath(this->EnvironmentPath);
#if defined(_WIN32) || defined(__CYGWIN__)
paths.AddEnvPrefixPath("PATH", true);
- paths.AddEnvPath("PATH");
#endif
- } else {
- // Add PATH
- paths.AddEnvPath("PATH");
}
+ // Add PATH
+ paths.AddEnvPath("PATH");
paths.AddSuffixes(this->SearchPathSuffixes);
}
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 638c1d1..d255ceb 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -234,13 +234,13 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
{
// null-terminated list of paths.
static const char* paths[] = { "CMAKE_SYSTEM_IGNORE_PATH",
- "CMAKE_IGNORE_PATH", 0 };
+ "CMAKE_IGNORE_PATH", CM_NULLPTR };
// Construct the list of path roots with no trailing slashes.
for (const char** pathName = paths; *pathName; ++pathName) {
// Get the list of paths to ignore from the variable.
const char* ignorePath = this->Makefile->GetDefinition(*pathName);
- if ((ignorePath == 0) || (strlen(ignorePath) == 0)) {
+ if ((ignorePath == CM_NULLPTR) || (strlen(ignorePath) == 0)) {
continue;
}
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index ebec884..0f8d826 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -27,7 +27,7 @@ class cmFindCommon : public cmCommand
{
public:
cmFindCommon();
- ~cmFindCommon();
+ ~cmFindCommon() CM_OVERRIDE;
cmTypeMacro(cmFindCommon, cmCommand);
protected:
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 74b01f1..68bd5b9 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -29,8 +29,8 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFindFileCommand; }
- virtual std::string GetName() const { return "find_file"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; }
+ std::string GetName() const CM_OVERRIDE { return "find_file"; }
cmTypeMacro(cmFindFileCommand, cmFindPathCommand);
};
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index a4d4dbb..3094fcf 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -40,11 +40,10 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
return true;
}
- if (const char* abi_name =
- this->Makefile->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
- std::string abi = abi_name;
- if (abi.find("ELF N32") != abi.npos) {
- // Convert lib to lib32.
+ if (this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIB32_PATHS")) {
+ // add special 32 bit paths if this is a 32 bit compile.
+ if (this->Makefile->PlatformIs32Bit()) {
this->AddArchitecturePaths("32");
}
}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index a08e151..813decd 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -28,24 +28,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFindLibraryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFindLibraryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "find_library"; }
+ std::string GetName() const CM_OVERRIDE { return "find_library"; }
cmTypeMacro(cmFindLibraryCommand, cmFindBase);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7908afe..8338c2a 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -43,6 +43,7 @@ cmFindPackageCommand::cmFindPackageCommand()
this->UseConfigFiles = true;
this->UseFindModules = true;
this->DebugMode = false;
+ this->UseLib32Paths = false;
this->UseLib64Paths = false;
this->PolicyScope = true;
this->VersionMajor = 0;
@@ -110,6 +111,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->LibraryArchitecture = arch;
}
+ // Lookup whether lib32 paths should be used.
+ if (this->Makefile->PlatformIs32Bit() &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIB32_PATHS")) {
+ this->UseLib32Paths = true;
+ }
+
// Lookup whether lib64 paths should be used.
if (this->Makefile->PlatformIs64Bit() &&
this->Makefile->GetState()->GetGlobalPropertyAsBool(
@@ -664,16 +672,18 @@ bool cmFindPackageCommand::HandlePackageMode()
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
else if (!this->ConsideredConfigs.empty()) {
+ std::vector<ConfigFileInfo>::const_iterator duplicate_end =
+ cmRemoveDuplicates(this->ConsideredConfigs);
e << "Could not find a configuration file for package \"" << this->Name
<< "\" that "
<< (this->VersionExact ? "exactly matches" : "is compatible with")
<< " requested version \"" << this->Version << "\".\n"
<< "The following configuration files were considered but not "
"accepted:\n";
- for (std::vector<ConfigFileInfo>::size_type i = 0;
- i < this->ConsideredConfigs.size(); i++) {
- e << " " << this->ConsideredConfigs[i].filename
- << ", version: " << this->ConsideredConfigs[i].version << "\n";
+ for (std::vector<ConfigFileInfo>::const_iterator i =
+ this->ConsideredConfigs.begin();
+ i != duplicate_end; ++i) {
+ e << " " << i->filename << ", version: " << i->version << "\n";
}
} else {
std::string requestedVersionString;
@@ -766,12 +776,13 @@ bool cmFindPackageCommand::HandlePackageMode()
std::string consideredVersions;
const char* sep = "";
- for (std::vector<ConfigFileInfo>::size_type i = 0;
- i < this->ConsideredConfigs.size(); i++) {
+ for (std::vector<ConfigFileInfo>::const_iterator i =
+ this->ConsideredConfigs.begin();
+ i != this->ConsideredConfigs.end(); ++i) {
consideredConfigFiles += sep;
consideredVersions += sep;
- consideredConfigFiles += this->ConsideredConfigs[i].filename;
- consideredVersions += this->ConsideredConfigs[i].version;
+ consideredConfigFiles += i->filename;
+ consideredVersions += i->version;
sep = ";";
}
@@ -1066,8 +1077,8 @@ void cmFindPackageCommand::FillPrefixesUserRegistry()
this->LabeledPaths[PathLabel::UserRegistry]);
}
#else
- if (const char* home = cmSystemTools::GetEnv("HOME")) {
- std::string dir = home;
+ std::string dir;
+ if (cmSystemTools::GetEnv("HOME", dir)) {
dir += "/.cmake/packages/";
dir += this->Name;
this->LoadPackageRegistryDir(dir,
@@ -1188,7 +1199,7 @@ public:
cmSystemTools::RemoveFile(this->File);
}
}
- void Release() { this->File = 0; }
+ void Release() { this->File = CM_NULLPTR; }
};
void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
@@ -1489,9 +1500,9 @@ void cmFindPackageCommand::StoreVersionFound()
this->Makefile->AddDefinition(ver + "_COUNT", buf);
}
+#include <cm_auto_ptr.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/String.h>
-#include <cmsys/auto_ptr.hxx>
class cmFileList;
class cmFileListGeneratorBase
@@ -1504,10 +1515,10 @@ protected:
private:
bool Search(cmFileList&);
virtual bool Search(std::string const& parent, cmFileList&) = 0;
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const = 0;
+ virtual CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const = 0;
friend class cmFileList;
cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next);
- cmsys::auto_ptr<cmFileListGeneratorBase> Next;
+ CM_AUTO_PTR<cmFileListGeneratorBase> Next;
};
class cmFileList
@@ -1515,7 +1526,7 @@ class cmFileList
public:
cmFileList()
: First()
- , Last(0)
+ , Last(CM_NULLPTR)
{
}
virtual ~cmFileList() {}
@@ -1540,7 +1551,7 @@ public:
private:
virtual bool Visit(std::string const& fullPath) = 0;
friend class cmFileListGeneratorBase;
- cmsys::auto_ptr<cmFileListGeneratorBase> First;
+ CM_AUTO_PTR<cmFileListGeneratorBase> First;
cmFileListGeneratorBase* Last;
};
@@ -1555,7 +1566,7 @@ public:
}
private:
- bool Visit(std::string const& fullPath)
+ bool Visit(std::string const& fullPath) CM_OVERRIDE
{
if (this->UseSuffixes) {
return this->FPC->SearchDirectory(fullPath);
@@ -1605,14 +1616,14 @@ public:
private:
std::string String;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
std::string fullPath = parent + this->String;
return this->Consider(fullPath, lister);
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorFixed(*this));
return g;
}
@@ -1634,7 +1645,7 @@ public:
private:
std::vector<std::string> const& Vector;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
for (std::vector<std::string>::const_iterator i = this->Vector.begin();
i != this->Vector.end(); ++i) {
@@ -1644,9 +1655,9 @@ private:
}
return false;
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorEnumerate(*this));
return g;
}
@@ -1668,7 +1679,7 @@ public:
private:
std::vector<std::string> const& Names;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
// Construct a list of matches.
std::vector<std::string> matches;
@@ -1695,9 +1706,9 @@ private:
}
return false;
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorProject(*this));
return g;
}
@@ -1723,7 +1734,7 @@ public:
private:
std::vector<std::string> const& Names;
std::string Extension;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
// Construct a list of matches.
std::vector<std::string> matches;
@@ -1752,9 +1763,9 @@ private:
}
return false;
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorMacProject(*this));
return g;
}
@@ -1777,7 +1788,7 @@ public:
private:
std::string String;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
// Look for matching files.
std::vector<std::string> matches;
@@ -1796,9 +1807,9 @@ private:
}
return false;
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorCaseInsensitive(*this));
return g;
}
@@ -1820,7 +1831,7 @@ public:
private:
std::string Pattern;
- virtual bool Search(std::string const& parent, cmFileList& lister)
+ bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
{
// Glob the set of matching files.
std::string expr = parent;
@@ -1842,10 +1853,9 @@ private:
}
return false;
}
- virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const
+ CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{
- cmsys::auto_ptr<cmFileListGeneratorBase> g(
- new cmFileListGeneratorGlob(*this));
+ CM_AUTO_PTR<cmFileListGeneratorBase> g(new cmFileListGeneratorGlob(*this));
return g;
}
};
@@ -1907,6 +1917,9 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
if (!this->LibraryArchitecture.empty()) {
common.push_back("lib/" + this->LibraryArchitecture);
}
+ if (this->UseLib32Paths) {
+ common.push_back("lib32");
+ }
if (this->UseLib64Paths) {
common.push_back("lib64");
}
@@ -1948,6 +1961,44 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
}
}
+ // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/cmake/(Foo|foo|FOO).*/
+ {
+ cmFindPackageFileList lister(this);
+ lister / cmFileListGeneratorFixed(prefix) /
+ cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorEnumerate(common) /
+ cmFileListGeneratorFixed("cmake") /
+ cmFileListGeneratorProject(this->Names);
+ if (lister.Search()) {
+ return true;
+ }
+ }
+
+ // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/
+ {
+ cmFindPackageFileList lister(this);
+ lister / cmFileListGeneratorFixed(prefix) /
+ cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorEnumerate(common) /
+ cmFileListGeneratorProject(this->Names);
+ if (lister.Search()) {
+ return true;
+ }
+ }
+
+ // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/(cmake|CMake)/
+ {
+ cmFindPackageFileList lister(this);
+ lister / cmFileListGeneratorFixed(prefix) /
+ cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorEnumerate(common) /
+ cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorCaseInsensitive("cmake");
+ if (lister.Search()) {
+ return true;
+ }
+ }
+
return false;
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index eff6b80..087107e 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -29,24 +29,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFindPackageCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFindPackageCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "find_package"; }
+ std::string GetName() const CM_OVERRIDE { return "find_package"; }
cmTypeMacro(cmFindPackageCommand, cmFindCommon);
@@ -148,6 +148,7 @@ private:
bool NoUserRegistry;
bool NoSystemRegistry;
bool DebugMode;
+ bool UseLib32Paths;
bool UseLib64Paths;
bool PolicyScope;
std::string LibraryArchitecture;
@@ -159,6 +160,21 @@ private:
{
std::string filename;
std::string version;
+
+ bool operator<(ConfigFileInfo const& rhs) const
+ {
+ return this->filename < rhs.filename;
+ }
+
+ bool operator==(ConfigFileInfo const& rhs) const
+ {
+ return this->filename == rhs.filename;
+ }
+
+ bool operator!=(ConfigFileInfo const& rhs) const
+ {
+ return !(*this == rhs);
+ }
};
std::vector<ConfigFileInfo> ConsideredConfigs;
};
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index d24be6a..d71fc1a 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -117,7 +117,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
if (this->IncludeFileInPath) {
return fheader;
}
- fheader = cmSystemTools::GetFilenamePath(fheader);
+ fheader.resize(fheader.size() - file.size());
return fheader;
}
return "";
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index e14626a..52ce3b0 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -28,24 +28,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFindPathCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFindPathCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "find_path"; }
+ std::string GetName() const CM_OVERRIDE { return "find_path"; }
cmTypeMacro(cmFindPathCommand, cmFindBase);
bool IncludeFileInPath;
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 3f2ac0e..1953f59 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -29,24 +29,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFindProgramCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFindProgramCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "find_program"; }
+ std::string GetName() const CM_OVERRIDE { return "find_program"; }
cmTypeMacro(cmFindProgramCommand, cmFindBase);
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index daf43e6..c6e5f06 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmForEachCommand.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
: Makefile(mf)
@@ -36,8 +36,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endofreach for this statement
if (!this->Depth) {
// Remove the function blocker for this scope or bail.
- cmsys::auto_ptr<cmFunctionBlocker> fb(
- mf.RemoveFunctionBlocker(this, lff));
+ CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
@@ -184,7 +183,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
{
- cmsys::auto_ptr<cmForEachFunctionBlocker> f(
+ CM_AUTO_PTR<cmForEachFunctionBlocker> f(
new cmForEachFunctionBlocker(this->Makefile));
f->Args.push_back(args[0]);
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 60956aa..887e6e9 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -21,10 +21,10 @@ class cmForEachFunctionBlocker : public cmFunctionBlocker
{
public:
cmForEachFunctionBlocker(cmMakefile* mf);
- ~cmForEachFunctionBlocker();
- virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
- cmExecutionStatus&);
- virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf);
+ ~cmForEachFunctionBlocker() CM_OVERRIDE;
+ bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
+ cmExecutionStatus&) CM_OVERRIDE;
+ bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE;
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -41,24 +41,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmForEachCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmForEachCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "foreach"; }
+ std::string GetName() const CM_OVERRIDE { return "foreach"; }
cmTypeMacro(cmForEachCommand, cmCommand);
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 934e928..30a33b4 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -22,29 +22,27 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
if (cmSystemTools::FileIsFullPath(includeName)) {
fileName = includeName;
return cmSystemTools::FileExists(fileName.c_str(), true);
- } else {
- // Check for the file in the directory containing the including
- // file.
- std::string fullName = dir;
+ }
+ // Check for the file in the directory containing the including
+ // file.
+ std::string fullName = dir;
+ fullName += "/";
+ fullName += includeName;
+ if (cmSystemTools::FileExists(fullName.c_str(), true)) {
+ fileName = fullName;
+ return true;
+ }
+
+ // Search the include path for the file.
+ for (std::vector<std::string>::const_iterator i = this->IncludePath.begin();
+ i != this->IncludePath.end(); ++i) {
+ fullName = *i;
fullName += "/";
fullName += includeName;
if (cmSystemTools::FileExists(fullName.c_str(), true)) {
fileName = fullName;
return true;
}
-
- // Search the include path for the file.
- for (std::vector<std::string>::const_iterator i =
- this->IncludePath.begin();
- i != this->IncludePath.end(); ++i) {
- fullName = *i;
- fullName += "/";
- fullName += includeName;
- if (cmSystemTools::FileExists(fullName.c_str(), true)) {
- fileName = fullName;
- return true;
- }
- }
}
return false;
}
@@ -65,7 +63,8 @@ cmFortranParser_s::cmFortranParser_s(std::vector<std::string> const& includes,
// Create a dummy buffer that is never read but is the fallback
// buffer when the last file is popped off the stack.
- YY_BUFFER_STATE buffer = cmFortran_yy_create_buffer(0, 4, this->Scanner);
+ YY_BUFFER_STATE buffer =
+ cmFortran_yy_create_buffer(CM_NULLPTR, 4, this->Scanner);
cmFortran_yy_switch_to_buffer(buffer, this->Scanner);
}
@@ -83,13 +82,12 @@ bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
std::string dir = cmSystemTools::GetParentDirectory(fname);
cmFortranFile f(file, current, dir);
YY_BUFFER_STATE buffer =
- cmFortran_yy_create_buffer(0, 16384, parser->Scanner);
+ cmFortran_yy_create_buffer(CM_NULLPTR, 16384, parser->Scanner);
cmFortran_yy_switch_to_buffer(buffer, parser->Scanner);
parser->FileStack.push(f);
return 1;
- } else {
- return 0;
}
+ return 0;
}
bool cmFortranParser_FilePop(cmFortranParser* parser)
@@ -98,15 +96,14 @@ bool cmFortranParser_FilePop(cmFortranParser* parser)
// to the next one on the stack.
if (parser->FileStack.empty()) {
return 0;
- } else {
- cmFortranFile f = parser->FileStack.top();
- parser->FileStack.pop();
- fclose(f.File);
- YY_BUFFER_STATE current = cmFortranLexer_GetCurrentBuffer(parser->Scanner);
- cmFortran_yy_delete_buffer(current, parser->Scanner);
- cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner);
- return 1;
}
+ cmFortranFile f = parser->FileStack.top();
+ parser->FileStack.pop();
+ fclose(f.File);
+ YY_BUFFER_STATE current = cmFortranLexer_GetCurrentBuffer(parser->Scanner);
+ cmFortran_yy_delete_buffer(current, parser->Scanner);
+ cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner);
+ return 1;
}
int cmFortranParser_Input(cmFortranParser* parser, char* buffer,
@@ -160,7 +157,7 @@ int cmFortranParser_GetOldStartcond(cmFortranParser* parser)
return parser->OldStartcond;
}
-void cmFortranParser_Error(cmFortranParser*, const char*)
+void cmFortranParser_Error(cmFortranParser* /*unused*/, const char* /*unused*/)
{
// If there is a parser error just ignore it. The source will not
// compile and the user will edit it. Then dependencies will have
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index de9887e..f0e4854 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -20,7 +20,7 @@ public:
cmFunctionHelperCommand() {}
///! clean up any memory allocated by the function
- ~cmFunctionHelperCommand() {}
+ ~cmFunctionHelperCommand() CM_OVERRIDE {}
/**
* This is used to avoid including this command
@@ -28,12 +28,12 @@ public:
* cmMacroHelperCommand and cmFunctionHelperCommand
* which cannot provide appropriate documentation.
*/
- virtual bool ShouldAppearInDocumentation() const { return false; }
+ bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; }
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmFunctionHelperCommand* newC = new cmFunctionHelperCommand;
// we must copy when we clone
@@ -47,16 +47,17 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&);
+ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus&) CM_OVERRIDE;
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -64,7 +65,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return this->Args[0]; }
+ std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
cmTypeMacro(cmFunctionHelperCommand, cmCommand);
@@ -75,7 +76,7 @@ public:
};
bool cmFunctionHelperCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus)
+ const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
{
// Expand the argument list to the function.
std::vector<std::string> expandedArgs;
@@ -128,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
for (unsigned int c = 0; c < this->Functions.size(); ++c) {
cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(this->Functions[c], status) ||
- status.GetNestedError()) {
+ (cmSystemTools::GetErrorOccuredFlag() &&
+ !cmSystemTools::GetFatalErrorOccured())) {
// The error message should have already included the call stack
// so we do not need to report an error here.
functionScope.Quiet();
- inStatus.SetNestedError(true);
return false;
}
if (status.GetReturnInvoked()) {
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 08f7f0f..2c7a884 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -20,10 +20,10 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker
{
public:
cmFunctionFunctionBlocker() { this->Depth = 0; }
- virtual ~cmFunctionFunctionBlocker() {}
- virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
- cmExecutionStatus&);
- virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf);
+ ~cmFunctionFunctionBlocker() CM_OVERRIDE {}
+ bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
+ cmExecutionStatus&) CM_OVERRIDE;
+ bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE;
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -37,24 +37,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmFunctionCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmFunctionCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "function"; }
+ std::string GetName() const CM_OVERRIDE { return "function"; }
cmTypeMacro(cmFunctionCommand, cmCommand);
};
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 2c05913..c35a1bc 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -42,7 +42,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream()
// stream will be destroyed which will close the temporary file.
// Finally the base destructor will be called to replace the
// destination file.
- this->Okay = (*this) ? true : false;
+ this->Okay = !this->fail();
}
cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
@@ -56,7 +56,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
this->Stream::open(this->TempName.c_str(),
std::ios::out | std::ios::binary);
} else {
- this->Stream::open(this->TempName.c_str(), std::ios::out);
+ this->Stream::open(this->TempName.c_str());
}
// Check if the file opened.
@@ -71,7 +71,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
bool cmGeneratedFileStream::Close()
{
// Save whether the temporary output file is valid before closing.
- this->Okay = (*this) ? true : false;
+ this->Okay = !this->fail();
// Close the temporary output file.
this->Stream::close();
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index a2de5bc..3480c5b 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -99,7 +99,7 @@ public:
* file was successfully written before allowing the original to be
* replaced.
*/
- ~cmGeneratedFileStream();
+ ~cmGeneratedFileStream() CM_OVERRIDE;
/**
* Open an output file by name. This should be used only with a
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 53243b8..6cd6439 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -26,14 +26,14 @@ cmGeneratorExpression::cmGeneratorExpression(
{
}
-cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
+CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
std::string const& input)
{
- return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
+ return CM_AUTO_PTR<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(this->Backtrace, input));
}
-cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
+CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
const char* input)
{
return this->Parse(std::string(input ? input : ""));
@@ -352,7 +352,8 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input,
{
if (context == StripAllGeneratorExpressions) {
return stripAllGeneratorExpressions(input);
- } else if (context == BuildInterface || context == InstallInterface) {
+ }
+ if (context == BuildInterface || context == InstallInterface) {
return stripExportInterface(input, context, resolveRelative);
}
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 71fbba3..2f91608 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -17,8 +17,8 @@
#include "cmListFileCache.h"
+#include <cm_auto_ptr.hxx>
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/auto_ptr.hxx>
class cmGeneratorTarget;
class cmLocalGenerator;
@@ -47,9 +47,8 @@ public:
cmListFileBacktrace const& backtrace = cmListFileBacktrace());
~cmGeneratorExpression();
- cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(
- std::string const& input);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(std::string const& input);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(const char* input);
enum PreprocessContext
{
@@ -81,12 +80,12 @@ private:
class cmCompiledGeneratorExpression
{
public:
- const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
- bool quiet = false,
- cmGeneratorTarget const* headTarget = 0,
- cmGeneratorTarget const* currentTarget = 0,
- cmGeneratorExpressionDAGChecker* dagChecker = 0,
- std::string const& language = std::string()) const;
+ const char* Evaluate(
+ cmLocalGenerator* lg, const std::string& config, bool quiet = false,
+ cmGeneratorTarget const* headTarget = CM_NULLPTR,
+ cmGeneratorTarget const* currentTarget = CM_NULLPTR,
+ cmGeneratorExpressionDAGChecker* dagChecker = CM_NULLPTR,
+ std::string const& language = std::string()) const;
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
bool quiet, cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index c700156..045ded1 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -198,7 +198,7 @@ enum TransitiveProperty
};
template <TransitiveProperty>
-bool additionalTest(const char* const)
+bool additionalTest(const char* const /*unused*/)
{
return false;
}
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 28ca824..6b7fe9a 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -63,7 +63,7 @@ struct cmGeneratorExpressionDAGChecker
void ReportError(cmGeneratorExpressionContext* context,
const std::string& expr);
- bool EvaluatingLinkLibraries(const char* tgt = 0);
+ bool EvaluatingLinkLibraries(const char* tgt = CM_NULLPTR);
#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 5b48eea..c01c4fc 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -23,9 +23,8 @@
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
const std::string& input,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
- bool inputIsContent)
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent)
: Input(input)
, OutputFileExpr(outputFileExpr)
, Condition(condition)
@@ -40,8 +39,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(
{
std::string rawCondition = this->Condition->GetInput();
if (!rawCondition.empty()) {
- std::string condResult =
- this->Condition->Evaluate(lg, config, false, 0, 0, 0, lang);
+ std::string condResult = this->Condition->Evaluate(
+ lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
if (condResult == "0") {
return;
}
@@ -56,10 +55,10 @@ void cmGeneratorExpressionEvaluationFile::Generate(
}
}
- const std::string outputFileName =
- this->OutputFileExpr->Evaluate(lg, config, false, 0, 0, 0, lang);
- const std::string outputContent =
- inputExpression->Evaluate(lg, config, false, 0, 0, 0, lang);
+ const std::string outputFileName = this->OutputFileExpr->Evaluate(
+ lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
+ const std::string outputContent = inputExpression->Evaluate(
+ lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
std::map<std::string, std::string>::iterator it =
outputFiles.find(outputFileName);
@@ -97,8 +96,8 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
for (std::vector<std::string>::const_iterator le = enabledLanguages.begin();
le != enabledLanguages.end(); ++le) {
- std::string name =
- this->OutputFileExpr->Evaluate(lg, config, false, 0, 0, 0, *le);
+ std::string name = this->OutputFileExpr->Evaluate(
+ lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, *le);
cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource(name);
sf->SetProperty("GENERATED", "1");
@@ -135,7 +134,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace();
cmGeneratorExpression contentGE(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> inputExpression =
contentGE.Parse(inputContent);
std::map<std::string, std::string> outputFiles;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index bfd6add..52ba2d8 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -14,7 +14,7 @@
#include "cmGeneratorExpression.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
#include <sys/types.h>
class cmLocalGenerator;
@@ -24,9 +24,8 @@ class cmGeneratorExpressionEvaluationFile
public:
cmGeneratorExpressionEvaluationFile(
const std::string& input,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
- bool inputIsContent);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent);
void Generate(cmLocalGenerator* lg);
@@ -42,8 +41,8 @@ private:
private:
const std::string Input;
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition;
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> OutputFileExpr;
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> Condition;
std::vector<std::string> Files;
const bool InputIsContent;
};
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 66437eb..b4b74c5 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -154,20 +154,19 @@ std::string GeneratorExpressionContent::EvaluateParameters(
node, identifier, context, dagChecker, pit);
parameters.push_back(lastParam);
return std::string();
- } else {
- std::string parameter;
- std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
- pit->begin();
- const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator
- end = pit->end();
- for (; it != end; ++it) {
- parameter += (*it)->Evaluate(context, dagChecker);
- if (context->HadError) {
- return std::string();
- }
+ }
+ std::string parameter;
+ std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
+ pit->begin();
+ const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
+ pit->end();
+ for (; it != end; ++it) {
+ parameter += (*it)->Evaluate(context, dagChecker);
+ if (context->HadError) {
+ return std::string();
}
- parameters.push_back(parameter);
}
+ parameters.push_back(parameter);
}
}
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 7ca62c5..58e732b 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -52,12 +52,15 @@ struct TextContent : public cmGeneratorExpressionEvaluator
}
std::string Evaluate(cmGeneratorExpressionContext*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE
{
return std::string(this->Content, this->Length);
}
- Type GetType() const { return cmGeneratorExpressionEvaluator::Text; }
+ Type GetType() const CM_OVERRIDE
+ {
+ return cmGeneratorExpressionEvaluator::Text;
+ }
void Extend(size_t length) { this->Length += length; }
@@ -82,14 +85,17 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
this->ParamChildren = parameters;
}
- Type GetType() const { return cmGeneratorExpressionEvaluator::Generator; }
+ Type GetType() const CM_OVERRIDE
+ {
+ return cmGeneratorExpressionEvaluator::Generator;
+ }
std::string Evaluate(cmGeneratorExpressionContext* context,
- cmGeneratorExpressionDAGChecker*) const;
+ cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE;
std::string GetOriginalExpression() const;
- ~GeneratorExpressionContent();
+ ~GeneratorExpressionContent() CM_OVERRIDE;
private:
std::string EvaluateParameters(const cmGeneratorExpressionNode* node,
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index e750551..12cf980 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -24,7 +24,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
cmGeneratorExpressionDAGChecker* dagChecker)
{
cmGeneratorExpression ge(context->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
std::string result =
cge->Evaluate(lg, context->Config, context->Quiet, headTarget,
@@ -42,14 +42,15 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
{
ZeroNode() {}
- virtual bool GeneratesContent() const { return false; }
+ bool GeneratesContent() const CM_OVERRIDE { return false; }
- virtual bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
- std::string Evaluate(const std::vector<std::string>&,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return std::string();
}
@@ -59,12 +60,13 @@ static const struct OneNode : public cmGeneratorExpressionNode
{
OneNode() {}
- virtual bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return parameters.front();
}
@@ -90,7 +92,8 @@ static const struct ZeroNode installInterfaceNode;
for (; it != end; ++it) { \
if (*it == #FAILURE_VALUE) { \
return #FAILURE_VALUE; \
- } else if (*it != #SUCCESS_VALUE) { \
+ } \
+ if (*it != #SUCCESS_VALUE) { \
reportError(context, content->GetOriginalExpression(), \
"Parameters to $<" #OP \
"> must resolve to either '0' or '1'."); \
@@ -113,7 +116,8 @@ static const struct NotNode : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
if (*parameters.begin() != "0" && *parameters.begin() != "1") {
reportError(
@@ -129,12 +133,13 @@ static const struct BoolNode : public cmGeneratorExpressionNode
{
BoolNode() {}
- virtual int NumExpectedParameters() const { return 1; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 1; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0";
}
@@ -144,12 +149,13 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
{
StrEqualNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return *parameters.begin() == parameters[1] ? "1" : "0";
}
@@ -159,12 +165,13 @@ static const struct EqualNode : public cmGeneratorExpressionNode
{
EqualNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
char* pEnd;
@@ -236,12 +243,13 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
- bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::LowerCase(parameters.front());
}
@@ -251,12 +259,13 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode
{
UpperCaseNode() {}
- bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::UpperCase(parameters.front());
}
@@ -266,12 +275,13 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
{
MakeCIdentifierNode() {}
- bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::MakeCidentifier(parameters.front());
}
@@ -281,12 +291,13 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode
{
Angle_RNode() {}
- virtual int NumExpectedParameters() const { return 0; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 0; }
- std::string Evaluate(const std::vector<std::string>&,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return ">";
}
@@ -296,12 +307,13 @@ static const struct CommaNode : public cmGeneratorExpressionNode
{
CommaNode() {}
- virtual int NumExpectedParameters() const { return 0; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 0; }
- std::string Evaluate(const std::vector<std::string>&,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return ",";
}
@@ -311,12 +323,13 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode
{
SemicolonNode() {}
- virtual int NumExpectedParameters() const { return 0; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 0; }
- std::string Evaluate(const std::vector<std::string>&,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return ";";
}
@@ -326,12 +339,12 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
CompilerIdNode() {}
- virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*,
+ cmGeneratorExpressionDAGChecker* /*unused*/,
const std::string& lang) const
{
const char* compilerId = context->LG->GetMakefile()->GetSafeDefinition(
@@ -381,6 +394,7 @@ static const struct CCompilerIdNode : public CompilerIdNode
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (!context->HeadTarget) {
reportError(
@@ -402,6 +416,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (!context->HeadTarget) {
reportError(
@@ -419,12 +434,12 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
{
CompilerVersionNode() {}
- virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*,
+ cmGeneratorExpressionDAGChecker* /*unused*/,
const std::string& lang) const
{
const char* compilerVersion =
@@ -460,6 +475,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (!context->HeadTarget) {
reportError(
@@ -481,6 +497,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (!context->HeadTarget) {
reportError(
@@ -498,12 +515,13 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{
PlatformIdNode() {}
- virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
const char* platformId =
context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME");
@@ -526,12 +544,13 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode
{
VersionGreaterNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
parameters.front().c_str(),
@@ -541,16 +560,37 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode
}
} versionGreaterNode;
+static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode
+{
+ VersionGreaterEqNode() {}
+
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
+
+ std::string Evaluate(const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
+ {
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
+ parameters.front().c_str(),
+ parameters[1].c_str())
+ ? "1"
+ : "0";
+ }
+} versionGreaterEqNode;
+
static const struct VersionLessNode : public cmGeneratorExpressionNode
{
VersionLessNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
parameters.front().c_str(),
@@ -560,16 +600,37 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode
}
} versionLessNode;
+static const struct VersionLessEqNode : public cmGeneratorExpressionNode
+{
+ VersionLessEqNode() {}
+
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
+
+ std::string Evaluate(const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
+ {
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS_EQUAL,
+ parameters.front().c_str(),
+ parameters[1].c_str())
+ ? "1"
+ : "0";
+ }
+} versionLessEqNode;
+
static const struct VersionEqualNode : public cmGeneratorExpressionNode
{
VersionEqualNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
parameters.front().c_str(),
@@ -584,9 +645,10 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode
LinkOnlyNode() {}
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (!dagChecker->GetTransitivePropertiesOnly()) {
return parameters.front();
@@ -599,12 +661,13 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode
{
ConfigurationNode() {}
- virtual int NumExpectedParameters() const { return 0; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 0; }
- std::string Evaluate(const std::vector<std::string>&,
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
context->HadContextSensitiveCondition = true;
return context->Config;
@@ -615,15 +678,17 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
{
ConfigurationTestNode() {}
- virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
if (parameters.empty()) {
- return configurationNode.Evaluate(parameters, context, content, 0);
+ return configurationNode.Evaluate(parameters, context, content,
+ CM_NULLPTR);
}
static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
if (!configValidator.find(*parameters.begin())) {
@@ -642,8 +707,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
}
if (context->CurrentTarget && context->CurrentTarget->IsImported()) {
- const char* loc = 0;
- const char* imp = 0;
+ const char* loc = CM_NULLPTR;
+ const char* imp = CM_NULLPTR;
std::string suffix;
if (context->CurrentTarget->Target->GetMappedConfig(
context->Config, &loc, &imp, suffix)) {
@@ -673,14 +738,15 @@ static const struct JoinNode : public cmGeneratorExpressionNode
{
JoinNode() {}
- virtual int NumExpectedParameters() const { return 2; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 2; }
- virtual bool AcceptsArbitraryContentParameter() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
std::vector<std::string> list;
cmSystemTools::ExpandListArgument(parameters.front(), list);
@@ -692,12 +758,13 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
{
CompileLanguageNode() {}
- virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
if (context->Language.empty()) {
reportError(
@@ -724,7 +791,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
"$<COMPILE_LANGUAGE:...> may not be used with Visual Studio "
"generators.");
return std::string();
- } else if (genName.find("Xcode") != std::string::npos) {
+ }
+ if (genName.find("Xcode") != std::string::npos) {
if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
dagChecker->EvaluatingIncludeDirectories())) {
reportError(
@@ -753,7 +821,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
#define TRANSITIVE_PROPERTY_NAME(PROPERTY) , "INTERFACE_" #PROPERTY
static const char* targetPropertyTransitiveWhitelist[] = {
- 0 CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
+ CM_NULLPTR CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
};
#undef TRANSITIVE_PROPERTY_NAME
@@ -795,12 +863,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
TargetPropertyNode() {}
// This node handles errors on parameter count itself.
- virtual int NumExpectedParameters() const { return OneOrMoreParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagCheckerParent) const
+ CM_OVERRIDE
{
if (parameters.size() != 1 && parameters.size() != 2) {
reportError(
@@ -1087,20 +1156,21 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode
{
TargetNameNode() {}
- virtual bool GeneratesContent() const { return true; }
+ bool GeneratesContent() const CM_OVERRIDE { return true; }
- virtual bool AcceptsArbitraryContentParameter() const { return true; }
- virtual bool RequiresLiteralInput() const { return true; }
+ bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; }
+ bool RequiresLiteralInput() const CM_OVERRIDE { return true; }
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext*,
- const GeneratorExpressionContent*,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionContext* /*context*/,
+ const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
return parameters.front();
}
- virtual int NumExpectedParameters() const { return 1; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 1; }
} targetNameNode;
@@ -1111,7 +1181,8 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
if (!context->EvaluateForBuildsystem) {
std::ostringstream e;
@@ -1179,12 +1250,13 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
{
CompileFeaturesNode() {}
- virtual int NumExpectedParameters() const { return OneOrMoreParameters; }
+ int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
cmGeneratorTarget const* target = context->HeadTarget;
if (!target) {
@@ -1263,10 +1335,10 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
} compileFeaturesNode;
static const char* targetPolicyWhitelist[] = {
- 0
+ CM_NULLPTR
#define TARGET_POLICY_STRING(POLICY) , #POLICY
- CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
#undef TARGET_POLICY_STRING
};
@@ -1306,12 +1378,13 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
{
TargetPolicyNode() {}
- virtual int NumExpectedParameters() const { return 1; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 1; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
if (!context->HeadTarget) {
reportError(
@@ -1365,13 +1438,14 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
{
InstallPrefixNode() {}
- virtual bool GeneratesContent() const { return true; }
- virtual int NumExpectedParameters() const { return 0; }
+ bool GeneratesContent() const CM_OVERRIDE { return true; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 0; }
- std::string Evaluate(const std::vector<std::string>&,
+ std::string Evaluate(const std::vector<std::string>& /*parameters*/,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
reportError(context, content->GetOriginalExpression(),
"INSTALL_PREFIX is a marker for install(EXPORT) only. It "
@@ -1488,7 +1562,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
{
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext* context,
- const GeneratorExpressionContent*)
+ const GeneratorExpressionContent* /*unused*/)
{
return target->GetFullPath(context->Config, false, true);
}
@@ -1529,12 +1603,13 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
{
TargetFilesystemArtifact() {}
- virtual int NumExpectedParameters() const { return 1; }
+ int NumExpectedParameters() const CM_OVERRIDE { return 1; }
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
+ CM_OVERRIDE
{
// Lookup the referenced target.
std::string name = *parameters.begin();
@@ -1606,7 +1681,8 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker*) const
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const
+ CM_OVERRIDE
{
if (!cmSystemTools::FileIsFullPath(parameters.front())) {
reportError(context, content->GetOriginalExpression(),
@@ -1632,7 +1708,9 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
nodeMap["C_COMPILER_ID"] = &cCompilerIdNode;
nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode;
nodeMap["VERSION_GREATER"] = &versionGreaterNode;
+ nodeMap["VERSION_GREATER_EQUAL"] = &versionGreaterEqNode;
nodeMap["VERSION_LESS"] = &versionLessNode;
+ nodeMap["VERSION_LESS_EQUAL"] = &versionLessEqNode;
nodeMap["VERSION_EQUAL"] = &versionEqualNode;
nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode;
nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode;
@@ -1675,7 +1753,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
}
NodeMap::const_iterator i = nodeMap.find(identifier);
if (i == nodeMap.end()) {
- return 0;
+ return CM_NULLPTR;
}
return i->second;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3856091..8bd3b82 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -27,7 +27,10 @@
#include "assert.h"
#include <errno.h>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(CMake_HAVE_CXX_UNORDERED_SET)
+#include <unordered_set>
+#define UNORDERED_SET std::unordered_set
+#elif defined(CMAKE_BUILD_WITH_CMAKE)
#include <cmsys/hash_set.hxx>
#define UNORDERED_SET cmsys::hash_set
#else
@@ -39,13 +42,13 @@ class cmGeneratorTarget::TargetPropertyEntry
static cmLinkImplItem NoLinkImplItem;
public:
- TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
+ TargetPropertyEntry(CM_AUTO_PTR<cmCompiledGeneratorExpression> cge,
cmLinkImplItem const& item = NoLinkImplItem)
: ge(cge)
, LinkImplItem(item)
{
}
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem;
};
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
@@ -125,7 +128,7 @@ template <bool>
struct DoAccept
{
template <typename T>
- static void Do(T&, cmSourceFile*)
+ static void Do(T& /*unused*/, cmSourceFile* /*unused*/)
{
}
};
@@ -250,7 +253,7 @@ void CreatePropertyGeneratorExpressions(
for (std::vector<std::string>::const_iterator it = entries.begin();
it != entries.end(); ++it, ++btIt) {
cmGeneratorExpression ge(*btIt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
}
@@ -258,6 +261,7 @@ void CreatePropertyGeneratorExpressions(
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
: Target(t)
+ , FortranModuleDirectoryCreated(false)
, SourceFileFlagsConstructed(false)
, PolicyWarnedCMP0022(false)
, DebugIncludesDone(false)
@@ -357,10 +361,9 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
if (implib) {
// A DLL import library is treated as an archive target.
return "ARCHIVE";
- } else {
- // A DLL shared library is treated as a runtime target.
- return "RUNTIME";
}
+ // A DLL shared library is treated as a runtime target.
+ return "RUNTIME";
} else {
// For non-DLL platforms shared libraries are treated as
// library targets.
@@ -439,7 +442,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
// Now evaluate genex and update the previously-prepared map entry.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
i->second = cge->Evaluate(this->LocalGenerator, config);
} else if (i->second.empty()) {
// An empty map entry indicates we have been called recursively
@@ -457,7 +460,7 @@ void cmGeneratorTarget::AddSource(const std::string& src)
this->Target->AddSource(src);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(new TargetPropertyEntry(cge));
this->SourceFilesMap.clear();
@@ -473,7 +476,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -487,7 +490,7 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
if (i != this->SourceDepends.end()) {
return &i->second.Depends;
}
- return 0;
+ return CM_NULLPTR;
}
static void handleSystemIncludesDep(
@@ -798,7 +801,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
if (iter == this->SystemIncludesCache.end()) {
cmGeneratorExpressionDAGChecker dagChecker(
- this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+ this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
@@ -858,7 +861,7 @@ static void AddInterfaceEntries(
if (it->Target) {
std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">";
cmGeneratorExpression ge(it->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
cge->SetEvaluateForBuildsystem(true);
entries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge, *it));
@@ -994,7 +997,8 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
this->DebugSourcesDone = true;
}
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
+ CM_NULLPTR, CM_NULLPTR);
UNORDERED_SET<std::string> uniqueSrcs;
bool contextDependentDirectSources =
@@ -1306,11 +1310,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
this->GetName());
}
- if (cmp0042 == cmPolicies::NEW) {
- return true;
- }
-
- return false;
+ return cmp0042 == cmPolicies::NEW;
}
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
@@ -1323,37 +1323,40 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const
// The imported library has no builtin soname so the name
// searched at runtime will be just the filename.
return cmSystemTools::GetFilenameName(info->Location);
- } else {
- // Use the soname given if any.
- if (info->SOName.find("@rpath/") == 0) {
- return info->SOName.substr(6);
- }
- return info->SOName;
}
- } else {
- return "";
+ // Use the soname given if any.
+ if (info->SOName.find("@rpath/") == 0) {
+ return info->SOName.substr(6);
+ }
+ return info->SOName;
}
- } else {
- // Compute the soname that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return soName;
+ return "";
}
+ // Compute the soname that will be built.
+ std::string name;
+ std::string soName;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
+ return soName;
}
std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath = this->GetFullName(config, false);
- fpath += ".app";
+ fpath += ".";
+ const char* ext = this->GetProperty("BUNDLE_EXTENSION");
+ if (!ext) {
+ ext = "app";
+ }
+ fpath += ext;
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -1381,8 +1384,9 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
fpath += ext;
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -1392,7 +1396,12 @@ std::string cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
{
std::string fpath;
fpath += this->GetOutputName(config, false);
- fpath += ".framework";
+ fpath += ".";
+ const char* ext = this->GetProperty("BUNDLE_EXTENSION");
+ if (!ext) {
+ ext = "framework";
+ }
+ fpath += ext;
if (!rootDir && !this->Makefile->PlatformIsAppleIos()) {
fpath += "/Versions/";
fpath += this->GetFrameworkVersion();
@@ -1405,9 +1414,8 @@ std::string cmGeneratorTarget::GetFullName(const std::string& config,
{
if (this->IsImported()) {
return this->GetFullNameImported(config, implib);
- } else {
- return this->GetFullNameInternal(config, implib);
}
+ return this->GetFullNameInternal(config, implib);
}
std::string cmGeneratorTarget::GetInstallNameDirForBuildTree(
@@ -1431,9 +1439,8 @@ std::string cmGeneratorTarget::GetInstallNameDirForBuildTree(
}
dir += "/";
return dir;
- } else {
- return "";
}
+ return "";
}
std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
@@ -1455,9 +1462,8 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
}
}
return dir;
- } else {
- return "";
}
+ return "";
}
cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const
@@ -1503,9 +1509,8 @@ const char* cmGeneratorTarget::GetExportMacro() const
this->ExportMacro = cmSystemTools::MakeCidentifier(in);
}
return this->ExportMacro.c_str();
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
class cmTargetCollectLinkLanguages
@@ -1529,7 +1534,7 @@ public:
if (item.find("::") != std::string::npos) {
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
- std::stringstream e;
+ std::ostringstream e;
switch (this->Target->GetLocalGenerator()->GetPolicyStatus(
cmPolicies::CMP0028)) {
case cmPolicies::WARN: {
@@ -1629,8 +1634,9 @@ public:
{
if (this->Preferred.empty()) {
return "";
- } else if (this->Preferred.size() > 1) {
- std::stringstream e;
+ }
+ if (this->Preferred.size() > 1) {
+ std::ostringstream e;
e << "Target " << this->Target->GetName()
<< " contains multiple languages with the highest linker preference"
<< " (" << this->Preference << "):\n";
@@ -1748,7 +1754,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
{
// There is no compile information for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
if (this->GetType() > cmState::OBJECT_LIBRARY) {
@@ -1757,7 +1763,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
msg += " which has type ";
msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the compile information for this configuration.
@@ -1786,7 +1792,7 @@ cmSourceFile const* cmGeneratorTarget::GetModuleDefinitionFile(
return data.front();
}
- return 0;
+ return CM_NULLPTR;
}
bool cmGeneratorTarget::IsDLLPlatform() const
@@ -1839,8 +1845,8 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
}
cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "AUTOUIC_OPTIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "AUTOUIC_OPTIONS", CM_NULLPTR, CM_NULLPTR);
cmSystemTools::ExpandListArgument(
ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, this,
&dagChecker),
@@ -1925,7 +1931,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
this->Makefile = target->Target->GetMakefile();
this->LocalGenerator = target->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
- this->CurrentEntry = 0;
+ this->CurrentEntry = CM_NULLPTR;
// Queue all the source files already specified for the target.
if (target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -2000,7 +2006,7 @@ void cmTargetTraceDependencies::Trace()
this->CheckCustomCommand(*cc);
}
}
- this->CurrentEntry = 0;
+ this->CurrentEntry = CM_NULLPTR;
this->GeneratorTarget->AddTracedSources(this->NewSources);
}
@@ -2116,8 +2122,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for target references in generator expressions.
for (cmCustomCommandLine::const_iterator cli = cit->begin();
cli != cit->end(); ++cli) {
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(*cli);
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*cli);
cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true);
std::set<cmGeneratorTarget*> geTargets = cge->GetTargets();
targets.insert(geTargets.begin(), geTargets.end());
@@ -2200,7 +2205,7 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
- const char* archs = 0;
+ const char* archs = CM_NULLPTR;
if (!config.empty()) {
std::string defVarName = "OSX_ARCHITECTURES_";
defVarName += cmSystemTools::UpperCase(config);
@@ -2358,8 +2363,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
std::vector<std::string> includes;
UNORDERED_SET<std::string> uniqueIncludes;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "INCLUDE_DIRECTORIES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2402,7 +2407,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
libDir = frameworkCheck.match(1);
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
linkInterfaceIncludeDirectoriesEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -2485,8 +2490,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
{
UNORDERED_SET<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_OPTIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2537,8 +2542,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
{
UNORDERED_SET<std::string> uniqueFeatures;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_FEATURES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2587,8 +2592,8 @@ void cmGeneratorTarget::GetCompileDefinitions(
{
UNORDERED_SET<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_DEFINITIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2626,7 +2631,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
}
case cmPolicies::OLD: {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp);
linkInterfaceCompileDefinitionsEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -2711,9 +2716,8 @@ std::string cmGeneratorTarget::GetFullPath(const std::string& config,
{
if (this->IsImported()) {
return this->Target->ImportedGetFullPath(config, implib);
- } else {
- return this->NormalGetFullPath(config, implib, realname);
}
+ return this->NormalGetFullPath(config, implib, realname);
}
std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
@@ -2758,16 +2762,15 @@ std::string cmGeneratorTarget::NormalGetRealName(
std::string pdbName;
this->GetExecutableNames(name, realName, impName, pdbName, config);
return realName;
- } else {
- // Compute the real name that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return realName;
}
+ // Compute the real name that will be built.
+ std::string name;
+ std::string soName;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
+ return realName;
}
void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
@@ -2794,8 +2797,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
this->IsFrameworkOnApple()) {
// Versioning is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- version = 0;
- soversion = 0;
+ version = CM_NULLPTR;
+ soversion = CM_NULLPTR;
}
if (version && !soversion) {
// The soversion must be set if the library version is set. Use
@@ -2869,7 +2872,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
const char* version = this->GetProperty("VERSION");
if (this->GetType() != cmState::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
- version = 0;
+ version = CM_NULLPTR;
}
#endif
@@ -2969,7 +2972,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
: this->GetProperty("PREFIX"));
const char* targetSuffix = (implib ? this->GetProperty("IMPORT_SUFFIX")
: this->GetProperty("SUFFIX"));
- const char* configPostfix = 0;
+ const char* configPostfix = CM_NULLPTR;
if (!config.empty()) {
std::string configProp = cmSystemTools::UpperCase(config);
configProp += "_POSTFIX";
@@ -2977,7 +2980,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// Mac application bundles and frameworks have no postfix.
if (configPostfix &&
(this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) {
- configPostfix = 0;
+ configPostfix = CM_NULLPTR;
}
}
const char* prefixVar = this->Target->GetPrefixVariableInternal(implib);
@@ -3009,16 +3012,22 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
std::string fw_prefix;
if (this->IsFrameworkOnApple()) {
fw_prefix = this->GetOutputName(config, false);
- fw_prefix += ".framework/";
+ fw_prefix += ".";
+ const char* ext = this->GetProperty("BUNDLE_EXTENSION");
+ if (!ext) {
+ ext = "framework";
+ }
+ fw_prefix += ext;
+ fw_prefix += "/";
targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
+ targetSuffix = CM_NULLPTR;
}
if (this->IsCFBundleOnApple()) {
fw_prefix = this->GetCFBundleDirectory(config, false);
fw_prefix += "/";
targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
+ targetSuffix = CM_NULLPTR;
}
// Begin the final name with the prefix.
@@ -3253,7 +3262,8 @@ template <>
bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
const std::string& prop,
const std::string& config,
- CompatibleType, bool*)
+ CompatibleType /*unused*/,
+ bool* /*unused*/)
{
return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
}
@@ -3262,12 +3272,13 @@ template <>
const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
const std::string& prop,
const std::string& config,
- CompatibleType t, const char**)
+ CompatibleType t,
+ const char** /*unused*/)
{
switch (t) {
case BoolType:
assert(0 && "String compatibility check function called for boolean");
- return 0;
+ return CM_NULLPTR;
case StringType:
return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
case NumberMinType:
@@ -3276,7 +3287,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
}
assert(0 && "Unreachable!");
- return 0;
+ return CM_NULLPTR;
}
template <typename PropertyType>
@@ -3285,7 +3296,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
const std::string& propName,
std::set<std::string>& emitted,
const std::string& config, CompatibleType t,
- PropertyType*)
+ PropertyType* /*unused*/)
{
const char* prop = dependee->GetProperty(propName);
if (!prop) {
@@ -3314,7 +3325,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
}
if (emitted.insert(*pi).second) {
getLinkInterfaceDependentProperty<PropertyType>(depender, *pi, config, t,
- 0);
+ CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
@@ -3340,11 +3351,13 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3);
}
@@ -3355,14 +3368,17 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s4);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3, s4);
}
@@ -3387,24 +3403,25 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
}
checkPropertyConsistency<bool>(this, li->Target, strBool, emittedBools,
- config, BoolType, 0);
+ config, BoolType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
- checkPropertyConsistency<const char*>(
- this, li->Target, strString, emittedStrings, config, StringType, 0);
+ checkPropertyConsistency<const char*>(this, li->Target, strString,
+ emittedStrings, config, StringType,
+ CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
checkPropertyConsistency<const char*>(this, li->Target, strNumMin,
emittedMinNumbers, config,
- NumberMinType, 0);
+ NumberMinType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
checkPropertyConsistency<const char*>(this, li->Target, strNumMax,
emittedMaxNumbers, config,
- NumberMaxType, 0);
+ NumberMaxType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
@@ -3512,12 +3529,12 @@ std::string valueAsString<const char*>(const char* value)
template <typename PropertyType>
PropertyType impliedValue(PropertyType);
template <>
-bool impliedValue<bool>(bool)
+bool impliedValue<bool>(bool /*unused*/)
{
return false;
}
template <>
-const char* impliedValue<const char*>(const char*)
+const char* impliedValue<const char*>(const char* /*unused*/)
{
return "";
}
@@ -3528,7 +3545,8 @@ std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
CompatibleType t);
template <>
-std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
+std::pair<bool, bool> consistentProperty(bool lhs, bool rhs,
+ CompatibleType /*unused*/)
{
return std::make_pair(lhs == rhs, lhs);
}
@@ -3537,7 +3555,7 @@ std::pair<bool, const char*> consistentStringProperty(const char* lhs,
const char* rhs)
{
const bool b = strcmp(lhs, rhs) == 0;
- return std::make_pair(b, b ? lhs : 0);
+ return std::make_pair(b, b ? lhs : CM_NULLPTR);
}
std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
@@ -3546,7 +3564,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
{
char* pEnd;
- const char* const null_ptr = 0;
+ const char* const null_ptr = CM_NULLPTR;
long lnum = strtol(lhs, &pEnd, 0);
if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) {
@@ -3560,9 +3578,8 @@ std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
if (t == NumberMaxType) {
return std::make_pair(true, std::max(lnum, rnum) == lnum ? lhs : rhs);
- } else {
- return std::make_pair(true, std::min(lnum, rnum) == lnum ? lhs : rhs);
}
+ return std::make_pair(true, std::min(lnum, rnum) == lnum ? lhs : rhs);
}
template <>
@@ -3580,7 +3597,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
return std::make_pair(true, lhs);
}
- const char* const null_ptr = 0;
+ const char* const null_ptr = CM_NULLPTR;
switch (t) {
case BoolType:
@@ -3602,7 +3619,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
const std::string& config,
const char* defaultValue,
CompatibleType t,
- PropertyType*)
+ PropertyType* /*unused*/)
{
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
std::vector<std::string> headPropKeys = tgt->GetPropertyKeys();
@@ -3751,28 +3768,28 @@ bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
- BoolType, 0);
+ BoolType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", StringType, 0);
+ this, p, config, "empty", StringType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", NumberMinType, 0);
+ this, p, config, "empty", NumberMinType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", NumberMaxType, 0);
+ this, p, config, "empty", NumberMaxType, CM_NULLPTR);
}
cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
@@ -3787,7 +3804,7 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
new cmComputeLinkInformation(this, config);
if (!info || !info->Compute()) {
delete info;
- info = 0;
+ info = CM_NULLPTR;
}
// Store the information for this configuration.
@@ -3839,17 +3856,51 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
}
}
+std::string cmGeneratorTarget::GetFortranModuleDirectory() const
+{
+ if (!this->FortranModuleDirectoryCreated) {
+ this->FortranModuleDirectory = true;
+ this->FortranModuleDirectory = this->CreateFortranModuleDirectory();
+ }
+
+ return this->FortranModuleDirectory;
+}
+
+std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
+{
+ std::string mod_dir;
+ const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY");
+ const char* moddir_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
+ if (target_mod_dir && moddir_flag) {
+ // Compute the full path to the module directory.
+ if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
+ // Already a full path.
+ mod_dir = target_mod_dir;
+ } else {
+ // Interpret relative to the current output directory.
+ mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
+ mod_dir += "/";
+ mod_dir += target_mod_dir;
+ }
+
+ // Make sure the module output directory exists.
+ cmSystemTools::MakeDirectory(mod_dir);
+ }
+ return mod_dir;
+}
+
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) {
return fversion;
- } else if (const char* tversion = this->GetProperty("VERSION")) {
+ }
+ if (const char* tversion = this->GetProperty("VERSION")) {
return tversion;
- } else {
- return "A";
}
+ return "A";
}
void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
@@ -3930,14 +3981,15 @@ void cmGeneratorTarget::ExpandLinkItems(
std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition) const
{
cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, CM_NULLPTR,
+ CM_NULLPTR);
// The $<LINK_ONLY> expression may be in a link interface to specify private
// link dependencies that are otherwise excluded from usage requirements.
if (usage_requirements_only) {
dagChecker.SetTransitivePropertiesOnly();
}
std::vector<std::string> libs;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
false, headTarget, this,
&dagChecker),
@@ -3958,7 +4010,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
// export symbols.
if (this->GetType() == cmState::EXECUTABLE &&
!this->IsExecutableWithExports()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup any existing link interface for this configuration.
@@ -3982,7 +4034,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
}
}
- return iface.Exists ? &iface : 0;
+ return iface.Exists ? &iface : CM_NULLPTR;
}
void cmGeneratorTarget::ComputeLinkInterface(
@@ -4074,7 +4126,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
// export symbols.
if (this->GetType() == cmState::EXECUTABLE &&
!this->IsExecutableWithExports()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup any existing link interface for this configuration.
@@ -4097,7 +4149,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
usage_requirements_only);
}
- return iface.Exists ? &iface : 0;
+ return iface.Exists ? &iface : CM_NULLPTR;
}
std::string cmGeneratorTarget::GetDirectory(const std::string& config,
@@ -4107,7 +4159,8 @@ std::string cmGeneratorTarget::GetDirectory(const std::string& config,
// Return the directory from which the target is imported.
return cmSystemTools::GetFilenamePath(
this->Target->ImportedGetFullPath(config, implib));
- } else if (OutputInfo const* info = this->GetOutputInfo(config)) {
+ }
+ if (OutputInfo const* info = this->GetOutputInfo(config)) {
// Return the directory in which the target will be built.
return implib ? info->ImpDir : info->OutDir;
}
@@ -4126,7 +4179,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
{
// There is no output information for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Only libraries and executables have well-defined output files.
@@ -4136,7 +4189,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
msg += " which has type ";
msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the output information for this configuration.
@@ -4167,7 +4220,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
cmake::FATAL_ERROR,
"Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.",
this->GetBacktrace());
- return 0;
+ return CM_NULLPTR;
}
return &i->second;
}
@@ -4181,7 +4234,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(implib);
- const char* propertyName = 0;
+ const char* propertyName = CM_NULLPTR;
std::string propertyNameStr = targetTypeName;
if (!propertyNameStr.empty()) {
propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4190,7 +4243,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = 0;
+ const char* configProp = CM_NULLPTR;
std::string configPropStr = targetTypeName;
if (!configPropStr.empty()) {
configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4202,8 +4255,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(config_outdir);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(config_outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory.
@@ -4211,7 +4263,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
} else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a
@@ -4258,7 +4310,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
{
// Look for a target property defining the target output directory
// based on the target type.
- const char* propertyName = 0;
+ const char* propertyName = CM_NULLPTR;
std::string propertyNameStr = kind;
if (!propertyNameStr.empty()) {
propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4268,7 +4320,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = 0;
+ const char* configProp = CM_NULLPTR;
std::string configPropStr = kind;
if (!configPropStr.empty()) {
configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4326,7 +4378,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
- const char* explicitLibraries = 0;
+ const char* explicitLibraries = CM_NULLPTR;
std::string linkIfaceProp;
if (this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
this->GetPolicyStatusCMP0022() != cmPolicies::WARN) {
@@ -4452,7 +4504,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
{
cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config);
if (!info) {
- return 0;
+ return CM_NULLPTR;
}
std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4488,7 +4540,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
{
// There is no imported information for non-imported targets.
if (!this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the import information for this
@@ -4514,7 +4566,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
// If the location is empty then the target is not available for
// this configuration.
if (i->second.Location.empty() && i->second.ImportLibrary.empty()) {
- return 0;
+ return CM_NULLPTR;
}
// Return the import information.
@@ -4531,8 +4583,8 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
// Initialize members.
info.NoSOName = false;
- const char* loc = 0;
- const char* imp = 0;
+ const char* loc = CM_NULLPTR;
+ const char* imp = CM_NULLPTR;
std::string suffix;
if (!this->Target->GetMappedConfig(desired_config, &loc, &imp, suffix)) {
return;
@@ -4674,7 +4726,7 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
{
// There is no link implementation for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4903,7 +4955,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
{
// There is no link implementation for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Populate the link implementation libraries for this configuration.
@@ -4943,10 +4995,10 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
end = entryRange.end();
le != end; ++le, ++btIt) {
std::vector<std::string> llibs;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "LINK_LIBRARIES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR);
cmGeneratorExpression ge(*btIt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
std::string const evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
@@ -5037,7 +5089,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
// within the project.
if (tgt && tgt->GetType() == cmState::EXECUTABLE &&
!tgt->IsExecutableWithExports()) {
- tgt = 0;
+ tgt = CM_NULLPTR;
}
if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
@@ -5051,7 +5103,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
"with the ENABLE_EXPORTS property set.";
cmake* cm = this->LocalGenerator->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
- tgt = 0;
+ tgt = CM_NULLPTR;
}
return tgt;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 63208bc..f9987aa 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -215,7 +215,7 @@ public:
bool contentOnly = true) const;
/** @return the mac content directory for this target. */
- std::string GetMacContentDirectory(const std::string& config = 0,
+ std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR,
bool implib = false) const;
cmTarget* Target;
@@ -402,7 +402,7 @@ public:
{
SourceFileFlags()
: Type(SourceFileTypeNormal)
- , MacFolder(0)
+ , MacFolder(CM_NULLPTR)
{
}
SourceFileFlags(SourceFileFlags const& r)
@@ -453,7 +453,7 @@ public:
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
- const char* newExt = 0) const;
+ const char* newExt = CM_NULLPTR) const;
bool IsExecutableWithExports() const;
@@ -526,7 +526,13 @@ public:
void GetTargetVersion(bool soversion, int& major, int& minor,
int& patch) const;
+ std::string GetFortranModuleDirectory() const;
+
private:
+ std::string CreateFortranModuleDirectory() const;
+ mutable bool FortranModuleDirectoryCreated;
+ mutable std::string FortranModuleDirectory;
+
friend class cmTargetTraceDependencies;
struct SourceEntry
{
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 331aab9..c89d030 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -42,7 +42,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
this->Makefile->GetGlobalGenerator()->GetInstallComponents();
output = cmJoin(*components, ";");
} else {
- const char* prop = 0;
+ const char* prop = CM_NULLPTR;
if (!args[1].empty()) {
prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
}
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index fd247e8..7df9cc1 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -17,24 +17,24 @@
class cmGetCMakePropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmGetCMakePropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetCMakePropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_cmake_property"; }
+ std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
cmTypeMacro(cmGetCMakePropertyCommand, cmCommand);
};
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 1b5bcc9..a331e78 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -73,7 +73,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
return true;
}
- const char* prop = 0;
+ const char* prop = CM_NULLPTR;
if (!i->empty()) {
if (*i == "DEFINITIONS") {
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0059)) {
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 97394ec..1be9aa4 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -17,24 +17,24 @@
class cmGetDirectoryPropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmGetDirectoryPropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetDirectoryPropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_directory_property"; }
+ std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand);
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index a114b3d..d8609fe 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -26,24 +26,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmGetFilenameComponentCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetFilenameComponentCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_filename_component"; }
+ std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
cmTypeMacro(cmGetFilenameComponentCommand, cmCommand);
};
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 06f7504..2307e08 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -248,15 +248,14 @@ bool cmGetPropertyCommand::HandleTargetMode()
return false;
}
- if (this->PropertyName == "ALIASED_TARGET") {
- if (this->Makefile->IsAlias(this->Name)) {
- if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
+ if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
+ if (this->PropertyName == "ALIASED_TARGET") {
+ if (this->Makefile->IsAlias(this->Name)) {
return this->StoreResult(target->GetName().c_str());
+ } else {
+ return this->StoreResult(NULL);
}
}
- return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
- }
- if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
return this->StoreResult(
target->GetProperty(this->PropertyName, this->Makefile));
} else {
@@ -323,7 +322,7 @@ bool cmGetPropertyCommand::HandleCacheMode()
return false;
}
- const char* value = 0;
+ const char* value = CM_NULLPTR;
if (this->Makefile->GetState()->GetCacheEntryValue(this->Name)) {
value = this->Makefile->GetState()->GetCacheEntryProperty(
this->Name, this->PropertyName);
@@ -347,7 +346,7 @@ bool cmGetPropertyCommand::HandleInstallMode()
std::string value;
bool isSet = file->GetProperty(this->PropertyName, value);
- return this->StoreResult(isSet ? value.c_str() : 0);
+ return this->StoreResult(isSet ? value.c_str() : CM_NULLPTR);
} else {
std::ostringstream e;
e << "given INSTALL name that could not be found or created: "
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index aeed01d..558226b 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -19,24 +19,24 @@ class cmGetPropertyCommand : public cmCommand
public:
cmGetPropertyCommand();
- virtual cmCommand* Clone() { return new cmGetPropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetPropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_property"; }
+ std::string GetName() const CM_OVERRIDE { return "get_property"; }
cmTypeMacro(cmGetPropertyCommand, cmCommand);
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index e64befe..7b30a7d 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -34,7 +34,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
return true;
}
- const char* prop = 0;
+ const char* prop = CM_NULLPTR;
if (!args[2].empty()) {
prop = sf->GetPropertyForUser(args[2]);
}
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 06f582f..2d2477c 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -17,19 +17,22 @@
class cmGetSourceFilePropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmGetSourceFilePropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetSourceFilePropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_source_file_property"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "get_source_file_property";
+ }
cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand);
};
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index dded9f7..073cf32 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -24,22 +24,18 @@ bool cmGetTargetPropertyCommand::InitialPass(
std::string prop;
bool prop_exists = false;
- if (args[2] == "ALIASED_TARGET") {
- if (this->Makefile->IsAlias(targetName)) {
- if (cmTarget* target = this->Makefile->FindTargetToUse(targetName)) {
- prop = target->GetName();
+ if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
+ if (args[2] == "ALIASED_TARGET") {
+ if (this->Makefile->IsAlias(targetName)) {
+ prop = tgt->GetName();
+ prop_exists = true;
+ }
+ } else if (!args[2].empty()) {
+ const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile);
+ if (prop_cstr) {
+ prop = prop_cstr;
prop_exists = true;
}
- }
- } else if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
- cmTarget& target = *tgt;
- const char* prop_cstr = 0;
- if (!args[2].empty()) {
- prop_cstr = target.GetProperty(args[2], this->Makefile);
- }
- if (prop_cstr) {
- prop = prop_cstr;
- prop_exists = true;
}
} else {
bool issueMessage = false;
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 9a1e18e..3e0fe36 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -17,19 +17,19 @@
class cmGetTargetPropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmGetTargetPropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetTargetPropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_target_property"; }
+ std::string GetName() const CM_OVERRIDE { return "get_target_property"; }
cmTypeMacro(cmGetTargetPropertyCommand, cmCommand);
};
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index 6599021..5eaf872 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -27,7 +27,7 @@ bool cmGetTestPropertyCommand::InitialPass(
std::string var = args[2];
cmTest* test = this->Makefile->GetTest(testName);
if (test) {
- const char* prop = 0;
+ const char* prop = CM_NULLPTR;
if (!args[1].empty()) {
prop = test->GetProperty(args[1]);
}
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index fc281c4..e419c98 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -17,19 +17,19 @@
class cmGetTestPropertyCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmGetTestPropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmGetTestPropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "get_test_property"; }
+ std::string GetName() const CM_OVERRIDE { return "get_test_property"; }
cmTypeMacro(cmGetTestPropertyCommand, cmCommand);
};
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 8565fdb..3d35114 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -371,7 +371,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
bool useWatcomQuote =
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
this->LocalGenerator->GetTargetFlags(
- linkLibraries, flags, linkFlags, frameworkPath, linkPath,
+ config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
this->GeneratorTarget, useWatcomQuote);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h
index 92a1109..118cae6 100644
--- a/Source/cmGhsMultiTargetGenerator.h
+++ b/Source/cmGhsMultiTargetGenerator.h
@@ -16,13 +16,13 @@
#include "cmTarget.h"
+class cmCustomCommand;
class cmGeneratedFileStream;
+class cmGeneratorTarget;
class cmGlobalGhsMultiGenerator;
class cmLocalGhsMultiGenerator;
class cmMakefile;
class cmSourceFile;
-class cmGeneratedFileStream;
-class cmCustomCommand;
class cmGhsMultiTargetGenerator
{
diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h
index 7bb0e55..a48ff4f 100644
--- a/Source/cmGlobalCommonGenerator.h
+++ b/Source/cmGlobalCommonGenerator.h
@@ -21,7 +21,7 @@ class cmGlobalCommonGenerator : public cmGlobalGenerator
{
public:
cmGlobalCommonGenerator(cmake* cm);
- ~cmGlobalCommonGenerator();
+ ~cmGlobalCommonGenerator() CM_OVERRIDE;
};
#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a1764a3..50c5a42 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -81,9 +81,9 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
// how long to let try compiles run
this->TryCompileTimeout = 0;
- this->ExtraGenerator = 0;
- this->CurrentMakefile = 0;
- this->TryCompileOuterMakefile = 0;
+ this->ExtraGenerator = CM_NULLPTR;
+ this->CurrentMakefile = CM_NULLPTR;
+ this->TryCompileOuterMakefile = CM_NULLPTR;
this->ConfigureDoneCMP0026AndCMP0024 = false;
@@ -180,8 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
} else {
path = name;
}
- if ((path.empty() || !cmSystemTools::FileExists(path.c_str())) &&
- (optional == false)) {
+ if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
return;
}
const char* cname =
@@ -243,7 +242,7 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
}
delete it->second;
- it->second = 0;
+ it->second = CM_NULLPTR;
this->BuildExportSets.erase(it);
return result;
}
@@ -1082,7 +1081,7 @@ void cmGlobalGenerator::Configure()
std::ostringstream msg;
if (cmSystemTools::GetErrorOccuredFlag()) {
msg << "Configuring incomplete, errors occurred!";
- const char* logs[] = { "CMakeOutput.log", "CMakeError.log", 0 };
+ const char* logs[] = { "CMakeOutput.log", "CMakeError.log", CM_NULLPTR };
for (const char** log = logs; *log; ++log) {
std::string f = this->CMakeInstance->GetHomeOutputDirectory();
f += this->CMakeInstance->GetCMakeFilesDirectory();
@@ -1129,7 +1128,7 @@ cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
{
std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it =
this->BuildExportSets.find(filename);
- return it == this->BuildExportSets.end() ? 0 : it->second;
+ return it == this->BuildExportSets.end() ? CM_NULLPTR : it->second;
}
void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
@@ -1270,7 +1269,7 @@ void cmGlobalGenerator::Generate()
"Generating", (static_cast<float>(i) + 1.0f) /
static_cast<float>(this->LocalGenerators.size()));
}
- this->SetCurrentMakefile(0);
+ this->SetCurrentMakefile(CM_NULLPTR);
if (!this->GenerateCPackPropertiesFile()) {
this->GetCMakeInstance()->IssueMessage(
@@ -1292,7 +1291,7 @@ void cmGlobalGenerator::Generate()
this->WriteSummary();
- if (this->ExtraGenerator != 0) {
+ if (this->ExtraGenerator != CM_NULLPTR) {
this->ExtraGenerator->Generate();
}
@@ -1516,7 +1515,8 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->BinaryDirectories.clear();
}
-void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
+void cmGlobalGenerator::ComputeTargetObjectDirectory(
+ cmGeneratorTarget* /*unused*/) const
{
}
@@ -1645,15 +1645,17 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
}
void cmGlobalGenerator::GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const std::string&,
- const std::string&, const std::string&, const std::string&,
- const std::string&, bool, bool, std::vector<std::string> const&)
+ std::vector<std::string>& makeCommand, const std::string& /*unused*/,
+ const std::string& /*unused*/, const std::string& /*unused*/,
+ const std::string& /*unused*/, const std::string& /*unused*/,
+ bool /*unused*/, bool /*unused*/, std::vector<std::string> const& /*unused*/)
{
makeCommand.push_back(
"cmGlobalGenerator::GenerateBuildCommand not implemented");
}
-int cmGlobalGenerator::Build(const std::string&, const std::string& bindir,
+int cmGlobalGenerator::Build(const std::string& /*unused*/,
+ const std::string& bindir,
const std::string& projectName,
const std::string& target, std::string& output,
const std::string& makeCommandCSTR,
@@ -1699,7 +1701,8 @@ int cmGlobalGenerator::Build(const std::string&, const std::string& bindir,
output += "\n";
if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr, outputPtr,
- &retVal, 0, outputflag, timeout)) {
+ &retVal, CM_NULLPTR, outputflag,
+ timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make clean failed.");
output += *outputPtr;
@@ -1719,7 +1722,8 @@ int cmGlobalGenerator::Build(const std::string&, const std::string& bindir,
output += "\n";
if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr, outputPtr,
- &retVal, 0, outputflag, timeout)) {
+ &retVal, CM_NULLPTR, outputflag,
+ timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error(
"Generator: execution of make failed. Make command was: ",
@@ -1946,7 +1950,7 @@ cmMakefile* cmGlobalGenerator::FindMakefile(const std::string& start_dir) const
return *it;
}
}
- return 0;
+ return CM_NULLPTR;
}
///! Find a local generator by its startdirectory
@@ -1961,7 +1965,7 @@ cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(
return *it;
}
}
- return 0;
+ return CM_NULLPTR;
}
void cmGlobalGenerator::AddAlias(const std::string& name,
@@ -1995,7 +1999,7 @@ cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
if (i != this->TargetSearchIndex.end()) {
return i->second;
}
- return 0;
+ return CM_NULLPTR;
}
cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
@@ -2006,7 +2010,7 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
if (i != this->GeneratorTargetSearchIndex.end()) {
return i->second;
}
- return 0;
+ return CM_NULLPTR;
}
cmTarget* cmGlobalGenerator::FindTarget(const std::string& name,
@@ -2136,7 +2140,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[this->GetTestTargetName()] =
this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...",
- &cpackCommandLines, depends, 0,
+ &cpackCommandLines, depends, CM_NULLPTR,
/*uses_terminal*/ true);
}
@@ -2157,7 +2161,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[editCacheTargetName] = this->CreateGlobalTarget(
editCacheTargetName, "Running CMake cache editor...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
} else {
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("-E");
@@ -2166,7 +2170,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[editCacheTargetName] = this->CreateGlobalTarget(
editCacheTargetName, "No interactive CMake dialog available...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ false);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false);
}
}
@@ -2183,15 +2187,16 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget(
rebuildCacheTargetName, "Running CMake to regenerate build system...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
}
// Install
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) {
- mf->IssueMessage(cmake::WARNING,
- "CMAKE_SKIP_INSTALL_RULES was enabled even though "
- "installation rules have been specified");
+ this->CMakeInstance->IssueMessage(
+ cmake::WARNING, "CMAKE_SKIP_INSTALL_RULES was enabled even though "
+ "installation rules have been specified",
+ mf->GetBacktrace());
} else if (this->InstallTargetEnabled && !skipInstallRules) {
if (!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') {
std::set<std::string>* componentsSet = &this->InstallComponents;
@@ -2208,7 +2213,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back(ostr.str());
(*targets)["list_install_components"] = this->CreateGlobalTarget(
"list_install_components", ostr.str().c_str(), &cpackCommandLines,
- depends, 0, /*uses_terminal*/ false);
+ depends, CM_NULLPTR, /*uses_terminal*/ false);
}
std::string cmd = cmSystemTools::GetCMakeCommand();
cpackCommandLines.erase(cpackCommandLines.begin(),
@@ -2249,7 +2254,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
// install_local
if (const char* install_local = this->GetInstallLocalTargetName()) {
@@ -2263,12 +2268,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_local] = this->CreateGlobalTarget(
install_local, "Installing only the local directory...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
}
// install_strip
const char* install_strip = this->GetInstallStripTargetName();
- if ((install_strip != 0) && (mf->IsSet("CMAKE_STRIP"))) {
+ if ((install_strip != CM_NULLPTR) && (mf->IsSet("CMAKE_STRIP"))) {
cmCustomCommandLine stripCmdLine = singleLine;
stripCmdLine.insert(stripCmdLine.begin() + 1,
@@ -2279,7 +2284,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_strip] = this->CreateGlobalTarget(
install_strip, "Installing the project stripped...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+ &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
}
}
}
@@ -2327,8 +2332,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
std::vector<std::string> no_byproducts;
std::vector<std::string> no_depends;
// Store the custom command in the target.
- cmCustomCommand cc(0, no_outputs, no_byproducts, no_depends, *commandLines,
- 0, workingDirectory);
+ cmCustomCommand cc(CM_NULLPTR, no_outputs, no_byproducts, no_depends,
+ *commandLines, CM_NULLPTR, workingDirectory);
cc.SetUsesTerminal(uses_terminal);
target.AddPostBuildCommand(cc);
target.SetProperty("EchoString", message);
@@ -2370,10 +2375,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
return "";
}
-void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&,
- const std::string&,
- const std::string&,
- std::string&)
+void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/,
+ const std::string& /*unused*/,
+ const std::string& /*unused*/,
+ std::string& /*unused*/)
{
// Subclasses that support multiple configurations should implement
// this method to append the subdirectory for the given build
@@ -2406,7 +2411,7 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
cmExternalMakefileProjectGenerator* extraGenerator)
{
this->ExtraGenerator = extraGenerator;
- if (this->ExtraGenerator != 0) {
+ if (this->ExtraGenerator != CM_NULLPTR) {
this->ExtraGenerator->SetGlobalGenerator(this);
}
}
@@ -2542,8 +2547,8 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Shorten the output name (in expected use case).
cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot());
- std::string fname =
- converter.Convert(outputs[0], cmOutputConverter::HOME_OUTPUT);
+ std::string fname = converter.ConvertToRelativePath(
+ outputs[0], cmOutputConverter::HOME_OUTPUT);
// Associate the hash with this output.
this->RuleHashes[fname] = hash;
@@ -2571,7 +2576,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
#if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
#else
- cmsys::ifstream fin(pfile.c_str(), std::ios::in);
+ cmsys::ifstream fin(pfile.c_str());
#endif
if (!fin) {
return;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 2575911..089a637 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -25,7 +25,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmFileLockPool.h"
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map>
#else
#include <cmsys/hash_map.hxx>
@@ -277,15 +277,15 @@ public:
virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
virtual const char* GetInstallTargetName() const { return "INSTALL"; }
- virtual const char* GetInstallLocalTargetName() const { return 0; }
- virtual const char* GetInstallStripTargetName() const { return 0; }
- virtual const char* GetPreinstallTargetName() const { return 0; }
+ virtual const char* GetInstallLocalTargetName() const { return CM_NULLPTR; }
+ virtual const char* GetInstallStripTargetName() const { return CM_NULLPTR; }
+ virtual const char* GetPreinstallTargetName() const { return CM_NULLPTR; }
virtual const char* GetTestTargetName() const { return "RUN_TESTS"; }
virtual const char* GetPackageTargetName() const { return "PACKAGE"; }
- virtual const char* GetPackageSourceTargetName() const { return 0; }
- virtual const char* GetEditCacheTargetName() const { return 0; }
- virtual const char* GetRebuildCacheTargetName() const { return 0; }
- virtual const char* GetCleanTargetName() const { return 0; }
+ virtual const char* GetPackageSourceTargetName() const { return CM_NULLPTR; }
+ virtual const char* GetEditCacheTargetName() const { return CM_NULLPTR; }
+ virtual const char* GetRebuildCacheTargetName() const { return CM_NULLPTR; }
+ virtual const char* GetCleanTargetName() const { return CM_NULLPTR; }
// Lookup edit_cache target command preferred by this generator.
virtual std::string GetEditCacheCommand() const { return ""; }
@@ -319,7 +319,7 @@ public:
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
- virtual bool IsMultiConfig() { return false; }
+ virtual bool IsMultiConfig() const { return false; }
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
@@ -433,7 +433,7 @@ protected:
private:
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string, cmTarget*> TargetMap;
typedef std::unordered_map<std::string, cmGeneratorTarget*>
GeneratorTargetMap;
@@ -503,7 +503,7 @@ private:
void ClearGeneratorMembers();
- virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; }
+ virtual const char* GetBuildIgnoreErrorsFlag() const { return CM_NULLPTR; }
// Cache directory content and target files to be built.
struct DirectoryContent
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 640497a..74d3145 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -41,6 +41,9 @@ public:
/** Determine whether or not this generator supports toolsets */
virtual bool SupportsToolset() const = 0;
+
+ /** Determine whether or not this generator supports platforms */
+ virtual bool SupportsPlatform() const = 0;
};
template <class T>
@@ -48,28 +51,32 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
{
public:
/** Create a GlobalGenerator */
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
- if (name != T::GetActualName())
- return 0;
+ if (name != T::GetActualName()) {
+ return CM_NULLPTR;
+ }
return new T(cm);
}
/** Get the documentation entry for this factory */
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
T::GetDocumentation(entry);
}
/** Get the names of the current registered generators */
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(T::GetActualName());
}
/** Determine whether or not this generator supports toolsets */
- virtual bool SupportsToolset() const { return T::SupportsToolset(); }
+ bool SupportsToolset() const CM_OVERRIDE { return T::SupportsToolset(); }
+
+ /** Determine whether or not this generator supports platforms */
+ bool SupportsPlatform() const CM_OVERRIDE { return T::SupportsPlatform(); }
};
#endif
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 473d153..b2aac45 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -52,6 +52,12 @@ public:
static bool SupportsToolset() { return false; }
/**
+ * Utilized by the generator factory to determine if this generator
+ * supports platforms.
+ */
+ static bool SupportsPlatform() { return false; }
+
+ /**
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
*/
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 5c1e733..daf7003 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -25,20 +25,28 @@
#include <cmsys/FStream.hxx>
#include <cmsys/SystemTools.hxx>
-void cmGlobalKdevelopGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
+ : cmExternalMakefileProjectGenerator()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates KDevelop 3 project files.";
}
-cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
- : cmExternalMakefileProjectGenerator()
+cmExternalMakefileProjectGeneratorFactory*
+cmGlobalKdevelopGenerator::GetFactory()
{
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmGlobalKdevelopGenerator>
+ factory("KDevelop3", "Generates KDevelop 3 project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
#ifdef CMAKE_USE_NINJA
- this->SupportedGlobalGenerators.push_back("Ninja");
+ factory.AddSupportedGlobalGenerator("Ninja");
#endif
+
+ factory.Aliases.push_back("KDevelop3");
+ }
+
+ return &factory;
}
void cmGlobalKdevelopGenerator::Generate()
@@ -111,13 +119,13 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
// make sure the file is part of this source tree
if ((tmp[0] != '/') &&
(strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- 0)) {
+ CM_NULLPTR)) {
files.insert(tmp);
tmp = cmSystemTools::GetFilenameName(tmp);
// add all files which dont match the default
// */CMakeLists.txt;*cmake; to the file pattern
if ((tmp != "CMakeLists.txt") &&
- (strstr(tmp.c_str(), ".cmake") == 0)) {
+ (strstr(tmp.c_str(), ".cmake") == CM_NULLPTR)) {
cmakeFilePattern += tmp + ";";
}
}
@@ -142,7 +150,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
if ((tmp[0] != '/') &&
(strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- 0) &&
+ CM_NULLPTR) &&
(cmSystemTools::GetFilenameExtension(tmp) != ".moc")) {
files.insert(tmp);
@@ -166,7 +174,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
if ((tmp[0] != '/') &&
(strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
- 0)) {
+ CM_NULLPTR)) {
files.insert(tmp);
}
}
@@ -213,7 +221,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
// only put relative paths
if (!tmp.empty() && tmp[0] != '/') {
- fout << tmp.c_str() << "\n";
+ fout << tmp << "\n";
}
}
return true;
@@ -296,12 +304,12 @@ void cmGlobalKdevelopGenerator::MergeProjectFiles(
it != lines.end(); it++) {
const char* line = (*it).c_str();
// skip these tags as they are always replaced
- if ((strstr(line, "<projectdirectory>") != 0) ||
- (strstr(line, "<projectmanagement>") != 0) ||
- (strstr(line, "<absoluteprojectpath>") != 0) ||
- (strstr(line, "<filelistdirectory>") != 0) ||
- (strstr(line, "<buildtool>") != 0) ||
- (strstr(line, "<builddir>") != 0)) {
+ if ((strstr(line, "<projectdirectory>") != CM_NULLPTR) ||
+ (strstr(line, "<projectmanagement>") != CM_NULLPTR) ||
+ (strstr(line, "<absoluteprojectpath>") != CM_NULLPTR) ||
+ (strstr(line, "<filelistdirectory>") != CM_NULLPTR) ||
+ (strstr(line, "<buildtool>") != CM_NULLPTR) ||
+ (strstr(line, "<builddir>") != CM_NULLPTR)) {
continue;
}
diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h
index 315e38e..666527c 100644
--- a/Source/cmGlobalKdevelopGenerator.h
+++ b/Source/cmGlobalKdevelopGenerator.h
@@ -33,20 +33,9 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
public:
cmGlobalKdevelopGenerator();
- virtual std::string GetName() const
- {
- return cmGlobalKdevelopGenerator::GetActualName();
- }
- 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 std::string& fullName) const;
+ static cmExternalMakefileProjectGeneratorFactory* GetFactory();
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
private:
/*** Create the foo.kdevelop.filelist file, return false if it doesn't
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 143ad92..590f207 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -30,8 +30,9 @@ const char* cmGlobalNinjaGenerator::INDENT = " ";
void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
{
- for (int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i) {
os << cmGlobalNinjaGenerator::INDENT;
+ }
}
void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
@@ -43,8 +44,9 @@ void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
const std::string& comment)
{
- if (comment.empty())
+ if (comment.empty()) {
return;
+ }
std::string::size_type lpos = 0;
std::string::size_type rpos;
@@ -91,12 +93,11 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string& ident,
names << "ident" << VarNum++;
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
- } else {
- std::string result = ident;
- cmSystemTools::ReplaceString(result, " ", "$ ");
- cmSystemTools::ReplaceString(result, ":", "$:");
- return result;
}
+ std::string result = ident;
+ cmSystemTools::ReplaceString(result, " ", "$ ");
+ cmSystemTools::ReplaceString(result, ":", "$:");
+ return result;
}
std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit)
@@ -165,16 +166,18 @@ void cmGlobalNinjaGenerator::WriteBuild(
if (!implicitDeps.empty()) {
arguments += " |";
for (cmNinjaDeps::const_iterator i = implicitDeps.begin();
- i != implicitDeps.end(); ++i)
+ i != implicitDeps.end(); ++i) {
arguments += " " + EncodeIdent(EncodePath(*i), os);
+ }
}
// Write order-only dependencies.
if (!orderOnlyDeps.empty()) {
arguments += " ||";
for (cmNinjaDeps::const_iterator i = orderOnlyDeps.begin();
- i != orderOnlyDeps.end(); ++i)
+ i != orderOnlyDeps.end(); ++i) {
arguments += " " + EncodeIdent(EncodePath(*i), os);
+ }
}
arguments += "\n";
@@ -198,9 +201,10 @@ void cmGlobalNinjaGenerator::WriteBuild(
// Write the variables bound to this build statement.
std::ostringstream variable_assignments;
for (cmNinjaVars::const_iterator i = variables.begin(); i != variables.end();
- ++i)
+ ++i) {
cmGlobalNinjaGenerator::WriteVariable(variable_assignments, i->first,
i->second, "", 1);
+ }
// check if a response file rule should be used
std::string buildstr = build;
@@ -247,8 +251,8 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule()
void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
const std::string& command, const std::string& description,
- const std::string& comment, bool uses_terminal, bool restat,
- const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
+ const std::string& comment, const std::string& depfile, bool uses_terminal,
+ bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnly)
{
std::string cmd = command;
@@ -269,7 +273,9 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
if (uses_terminal && SupportsConsolePool()) {
vars["pool"] = "console";
}
-
+ if (!depfile.empty()) {
+ vars["depfile"] = depfile;
+ }
this->WriteBuild(*this->BuildFileStream, comment, "CUSTOM_COMMAND", outputs,
deps, cmNinjaDeps(), orderOnly, vars);
@@ -430,16 +436,17 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
cmGlobalNinjaGenerator::WriteComment(os, comment);
os << "default";
for (cmNinjaDeps::const_iterator i = targets.begin(); i != targets.end();
- ++i)
+ ++i) {
os << " " << *i;
+ }
os << "\n";
}
cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
: cmGlobalCommonGenerator(cm)
- , BuildFileStream(0)
- , RulesFileStream(0)
- , CompileCommandsStream(0)
+ , BuildFileStream(CM_NULLPTR)
+ , RulesFileStream(CM_NULLPTR)
+ , CompileCommandsStream(CM_NULLPTR)
, Rules()
, AllDependencies()
, UsingGCCOnWindows(false)
@@ -487,6 +494,8 @@ void cmGlobalNinjaGenerator::Generate()
this->OpenBuildFileStream();
this->OpenRulesFileStream();
+ this->TargetDependsClosures.clear();
+
this->InitOutputPathPrefix();
this->TargetAll = this->NinjaOutputPath("all");
this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt");
@@ -507,8 +516,8 @@ void cmGlobalNinjaGenerator::Generate()
this->WriteBuiltinTargets(*this->BuildFileStream);
if (cmSystemTools::GetErrorOccuredFlag()) {
- this->RulesFileStream->setstate(std::ios_base::failbit);
- this->BuildFileStream->setstate(std::ios_base::failbit);
+ this->RulesFileStream->setstate(std::ios::failbit);
+ this->BuildFileStream->setstate(std::ios::failbit);
}
this->CloseCompileCommandsStream();
@@ -525,8 +534,8 @@ void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
command.push_back(this->NinjaCommand);
command.push_back("--version");
std::string version;
- cmSystemTools::RunSingleCommand(command, &version, 0, 0, 0,
- cmSystemTools::OUTPUT_NONE);
+ cmSystemTools::RunSingleCommand(command, &version, CM_NULLPTR, CM_NULLPTR,
+ CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
this->NinjaVersion = cmSystemTools::TrimWhitespace(version);
}
}
@@ -546,11 +555,13 @@ void cmGlobalNinjaGenerator::EnableLanguage(
this->ResolveLanguageCompiler(*l, mf, optional);
}
#ifdef _WIN32
- if (mf->IsOn("CMAKE_COMPILER_IS_MINGW") ||
- strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "GNU") == 0 ||
- strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "GNU") == 0 ||
- strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "GNU") == 0 ||
- strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "GNU") == 0) {
+ if (strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "MSVC") != 0 &&
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "MSVC") != 0 &&
+ (mf->IsOn("CMAKE_COMPILER_IS_MINGW") ||
+ strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "GNU") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "GNU") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "Clang") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "Clang") == 0)) {
this->UsingGCCOnWindows = true;
}
#endif
@@ -670,7 +681,7 @@ void cmGlobalNinjaGenerator::CloseBuildFileStream()
{
if (this->BuildFileStream) {
delete this->BuildFileStream;
- this->BuildFileStream = 0;
+ this->BuildFileStream = CM_NULLPTR;
} else {
cmSystemTools::Error("Build file stream was not open.");
}
@@ -711,7 +722,7 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream()
{
if (this->RulesFileStream) {
delete this->RulesFileStream;
- this->RulesFileStream = 0;
+ this->RulesFileStream = CM_NULLPTR;
} else {
cmSystemTools::Error("Rules file stream was not open.");
}
@@ -738,7 +749,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
- std::string convPath = ng->Convert(path, cmOutputConverter::HOME_OUTPUT);
+ std::string convPath =
+ ng->ConvertToRelativePath(path, cmOutputConverter::HOME_OUTPUT);
convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
std::replace(convPath.begin(), convPath.end(), '/', '\\');
@@ -751,7 +763,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
- std::string convPath = ng->Convert(path + "/all", cmOutputConverter::HOME);
+ std::string convPath =
+ ng->ConvertToRelativePath(path + "/all", cmOutputConverter::HOME);
convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
std::replace(convPath.begin(), convPath.end(), '/', '\\');
@@ -799,7 +812,7 @@ void cmGlobalNinjaGenerator::CloseCompileCommandsStream()
if (this->CompileCommandsStream) {
*this->CompileCommandsStream << "\n]";
delete this->CompileCommandsStream;
- this->CompileCommandsStream = 0;
+ this->CompileCommandsStream = CM_NULLPTR;
}
}
@@ -830,7 +843,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
std::copy(i->second.begin(), i->second.end(), std::back_inserter(deps));
WriteCustomCommandBuild(/*command=*/"", /*description=*/"",
"Assume dependencies for generated source file.",
- /*uses_terminal*/ false,
+ /*depfile*/ "", /*uses_terminal*/ false,
/*restat*/ true, cmNinjaDeps(1, i->first), deps);
}
}
@@ -857,6 +870,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
break;
}
case cmState::OBJECT_LIBRARY:
+ case cmState::GLOBAL_TARGET:
case cmState::UTILITY: {
std::string path =
target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
@@ -865,12 +879,6 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
break;
}
- case cmState::GLOBAL_TARGET:
- // Always use the target in HOME instead of an unused duplicate in a
- // subdirectory.
- outputs.push_back(this->NinjaOutputPath(target->GetName()));
- break;
-
default:
return;
}
@@ -880,10 +888,15 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
cmGeneratorTarget const* target, cmNinjaDeps& outputs)
{
if (target->GetType() == cmState::GLOBAL_TARGET) {
- // Global targets only depend on other utilities, which may not appear in
- // the TargetDepends set (e.g. "all").
+ // These depend only on other CMake-provided targets, e.g. "all".
std::set<std::string> const& utils = target->GetUtilities();
- std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
+ for (std::set<std::string>::const_iterator i = utils.begin();
+ i != utils.end(); ++i) {
+ std::string d =
+ target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
+ std::string("/") + *i;
+ outputs.push_back(this->ConvertToNinjaPath(d));
+ }
} else {
cmNinjaDeps outs;
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
@@ -899,6 +912,42 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
}
}
+void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs)
+{
+ TargetDependsClosureMap::iterator i =
+ this->TargetDependsClosures.find(target);
+ if (i == this->TargetDependsClosures.end()) {
+ TargetDependsClosureMap::value_type e(
+ target, std::set<cmGeneratorTarget const*>());
+ i = this->TargetDependsClosures.insert(e).first;
+ this->ComputeTargetDependsClosure(target, i->second);
+ }
+ std::set<cmGeneratorTarget const*> const& targets = i->second;
+ cmNinjaDeps outs;
+ for (std::set<cmGeneratorTarget const*>::const_iterator ti = targets.begin();
+ ti != targets.end(); ++ti) {
+ this->AppendTargetOutputs(*ti, outs);
+ }
+ std::sort(outs.begin(), outs.end());
+ outputs.insert(outputs.end(), outs.begin(), outs.end());
+}
+
+void cmGlobalNinjaGenerator::ComputeTargetDependsClosure(
+ cmGeneratorTarget const* target, std::set<cmGeneratorTarget const*>& depends)
+{
+ cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
+ for (cmTargetDependSet::const_iterator i = targetDeps.begin();
+ i != targetDeps.end(); ++i) {
+ if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+ continue;
+ }
+ if (depends.insert(*i).second) {
+ this->ComputeTargetDependsClosure(*i, depends);
+ }
+ }
+}
+
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
cmGeneratorTarget* target)
{
@@ -907,15 +956,17 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
this->AppendTargetOutputs(target, outputs);
// Mark the target's outputs as ambiguous to ensure that no other target uses
// the output as an alias.
- for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i)
- TargetAliases[*i] = 0;
+ for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) {
+ TargetAliases[*i] = CM_NULLPTR;
+ }
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
TargetAliases.insert(std::make_pair(buildAlias, target));
- if (newAlias.second && newAlias.first->second != target)
- newAlias.first->second = 0;
+ if (newAlias.second && newAlias.first->second != target) {
+ newAlias.first->second = CM_NULLPTR;
+ }
}
void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
@@ -926,8 +977,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
for (TargetAliasMap::const_iterator i = TargetAliases.begin();
i != TargetAliases.end(); ++i) {
// Don't write ambiguous aliases.
- if (!i->second)
+ if (!i->second) {
continue;
+ }
cmNinjaDeps deps;
this->AppendTargetOutputs(i->second, deps);
@@ -1227,9 +1279,9 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
bool cmGlobalNinjaGenerator::SupportsConsolePool() const
{
- return cmSystemTools::VersionCompare(
- cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
- RequiredNinjaVersionForConsolePool().c_str()) == false;
+ return !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForConsolePool().c_str());
}
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 6d9bfe8..082ee3a 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -81,6 +81,12 @@ public:
static bool SupportsToolset() { return false; }
/**
+ * Utilized by the generator factory to determine if this generator
+ * supports platforms.
+ */
+ static bool SupportsPlatform() { return false; }
+
+ /**
* Write a build statement to @a os with the @a comment using
* the @a rule the list of @a outputs files and inputs.
* It also writes the variables bound to this build statement.
@@ -93,7 +99,7 @@ public:
const cmNinjaDeps& orderOnlyDeps,
const cmNinjaVars& variables,
const std::string& rspfile = std::string(),
- int cmdLineLimit = 0, bool* usedResponseFile = 0);
+ int cmdLineLimit = 0, bool* usedResponseFile = CM_NULLPTR);
/**
* Helper to write a build statement with the special 'phony' rule.
@@ -107,7 +113,8 @@ public:
void WriteCustomCommandBuild(const std::string& command,
const std::string& description,
- const std::string& comment, bool uses_terminal,
+ const std::string& comment,
+ const std::string& depfile, bool uses_terminal,
bool restat, const cmNinjaDeps& outputs,
const cmNinjaDeps& deps = cmNinjaDeps(),
const cmNinjaDeps& orderOnly = cmNinjaDeps());
@@ -161,11 +168,11 @@ public:
return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>();
}
- virtual ~cmGlobalNinjaGenerator() {}
+ ~cmGlobalNinjaGenerator() CM_OVERRIDE {}
- virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
+ cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE;
- virtual std::string GetName() const
+ std::string GetName() const CM_OVERRIDE
{
return cmGlobalNinjaGenerator::GetActualName();
}
@@ -174,39 +181,44 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
- virtual void EnableLanguage(std::vector<std::string> const& languages,
- cmMakefile* mf, bool optional);
+ void EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile* mf, bool optional) CM_OVERRIDE;
- virtual void GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const std::string& makeProgram,
- const std::string& projectName, const std::string& projectDir,
- const std::string& targetName, const std::string& config, bool fast,
- bool verbose,
- std::vector<std::string> const& makeOptions = std::vector<std::string>());
+ void GenerateBuildCommand(std::vector<std::string>& makeCommand,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config, bool fast, bool verbose,
+ std::vector<std::string> const& makeOptions =
+ std::vector<std::string>()) CM_OVERRIDE;
// Setup target names
- virtual const char* GetAllTargetName() const { return "all"; }
- virtual const char* GetInstallTargetName() const { return "install"; }
- virtual const char* GetInstallLocalTargetName() const
+ const char* GetAllTargetName() const CM_OVERRIDE { return "all"; }
+ const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; }
+ const char* GetInstallLocalTargetName() const CM_OVERRIDE
{
return "install/local";
}
- virtual const char* GetInstallStripTargetName() const
+ const char* GetInstallStripTargetName() const CM_OVERRIDE
{
return "install/strip";
}
- virtual const char* GetTestTargetName() const { return "test"; }
- virtual const char* GetPackageTargetName() const { return "package"; }
- virtual const char* GetPackageSourceTargetName() const
+ const char* GetTestTargetName() const CM_OVERRIDE { return "test"; }
+ const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; }
+ const char* GetPackageSourceTargetName() const CM_OVERRIDE
{
return "package_source";
}
- virtual const char* GetEditCacheTargetName() const { return "edit_cache"; }
- virtual const char* GetRebuildCacheTargetName() const
+ const char* GetEditCacheTargetName() const CM_OVERRIDE
+ {
+ return "edit_cache";
+ }
+ const char* GetRebuildCacheTargetName() const CM_OVERRIDE
{
return "rebuild_cache";
}
- virtual const char* GetCleanTargetName() const { return "clean"; }
+ const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; }
cmGeneratedFileStream* GetBuildFileStream() const
{
@@ -290,6 +302,8 @@ public:
cmNinjaDeps& outputs);
void AppendTargetDepends(cmGeneratorTarget const* target,
cmNinjaDeps& outputs);
+ void AppendTargetDependsClosure(cmGeneratorTarget const* target,
+ cmNinjaDeps& outputs);
void AddDependencyToAll(cmGeneratorTarget* target);
void AddDependencyToAll(const std::string& input);
@@ -307,7 +321,7 @@ public:
void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target);
- virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+ void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE;
// Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3
static std::string RequiredNinjaVersion() { return "1.3"; }
@@ -319,13 +333,13 @@ public:
void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
protected:
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
- virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
+ bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; }
private:
- virtual std::string GetEditCacheCommand() const;
- virtual void FindMakeProgram(cmMakefile* mf);
+ std::string GetEditCacheCommand() const CM_OVERRIDE;
+ void FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
void OpenBuildFileStream();
void CloseBuildFileStream();
@@ -350,6 +364,10 @@ private:
void WriteTargetClean(std::ostream& os);
void WriteTargetHelp(std::ostream& os);
+ void ComputeTargetDependsClosure(
+ cmGeneratorTarget const* target,
+ std::set<cmGeneratorTarget const*>& depends);
+
std::string ninjaCmd() const;
/// The file containing the build statement. (the relationship of the
@@ -399,6 +417,11 @@ private:
typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
TargetAliasMap TargetAliases;
+ typedef std::map<cmGeneratorTarget const*,
+ std::set<cmGeneratorTarget const*> >
+ TargetDependsClosureMap;
+ TargetDependsClosureMap TargetDependsClosures;
+
std::string NinjaCommand;
std::string NinjaVersion;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index cc5d1ba..77fbbe9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -32,7 +32,7 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
#else
this->UseLinkScript = true;
#endif
- this->CommandDatabase = NULL;
+ this->CommandDatabase = CM_NULLPTR;
this->IncludeDirective = "include";
this->DefineWindowsNULL = false;
@@ -155,10 +155,10 @@ void cmGlobalUnixMakefileGenerator3::Generate()
this->WriteMainMakefile2();
this->WriteMainCMakefile();
- if (this->CommandDatabase != NULL) {
+ if (this->CommandDatabase != CM_NULLPTR) {
*this->CommandDatabase << std::endl << "]";
delete this->CommandDatabase;
- this->CommandDatabase = NULL;
+ this->CommandDatabase = CM_NULLPTR;
}
}
@@ -166,7 +166,7 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
const std::string& sourceFile, const std::string& workingDirectory,
const std::string& compileCommand)
{
- if (this->CommandDatabase == NULL) {
+ if (this->CommandDatabase == CM_NULLPTR) {
std::string commandDatabaseName =
std::string(this->GetCMakeInstance()->GetHomeOutputDirectory()) +
"/compile_commands.json";
@@ -311,11 +311,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \"" << lg->Convert(cache, cmOutputConverter::START_OUTPUT) << "\"\n";
+ << " \""
+ << lg->ConvertToRelativePath(cache, cmOutputConverter::START_OUTPUT)
+ << "\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
cmakefileStream << " \""
- << lg->Convert(*i, cmOutputConverter::START_OUTPUT)
+ << lg->ConvertToRelativePath(
+ *i, cmOutputConverter::START_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -329,10 +332,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream << "# The corresponding makefile is:\n"
<< "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
- << lg->Convert(makefileName, cmOutputConverter::START_OUTPUT)
+ << lg->ConvertToRelativePath(makefileName,
+ cmOutputConverter::START_OUTPUT)
<< "\"\n"
<< " \""
- << lg->Convert(check, cmOutputConverter::START_OUTPUT)
+ << lg->ConvertToRelativePath(check,
+ cmOutputConverter::START_OUTPUT)
<< "\"\n";
cmakefileStream << " )\n\n";
@@ -345,7 +350,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
for (std::vector<std::string>::const_iterator k = outfiles.begin();
k != outfiles.end(); ++k) {
cmakefileStream << " \""
- << lg->Convert(*k, cmOutputConverter::HOME_OUTPUT)
+ << lg->ConvertToRelativePath(
+ *k, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
@@ -358,7 +364,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake";
cmakefileStream << " \""
- << lg->Convert(tmpStr, cmOutputConverter::HOME_OUTPUT)
+ << lg->ConvertToRelativePath(
+ tmpStr, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -519,7 +526,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
tname += "/fast";
}
cmOutputConverter conv(mf->GetStateSnapshot());
- tname = conv.Convert(tname, cmOutputConverter::HOME_OUTPUT);
+ tname = conv.ConvertToRelativePath(tname, cmOutputConverter::HOME_OUTPUT);
cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname);
if (this->Makefiles.empty()) {
@@ -716,8 +723,9 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target
- progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ progCmd << lg->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progress.Dir),
+ cmOutputConverter::SHELL);
//
std::set<cmGeneratorTarget const*> emitted;
progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted);
@@ -729,8 +737,9 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ progCmd << lg->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progress.Dir),
+ cmOutputConverter::SHELL);
progCmd << " 0";
commands.push_back(progCmd.str());
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index f951b2a..ceb4140 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -63,7 +63,7 @@ public:
}
///! Get the name for the generator.
- virtual std::string GetName() const
+ std::string GetName() const CM_OVERRIDE
{
return cmGlobalUnixMakefileGenerator3::GetActualName();
}
@@ -75,26 +75,32 @@ public:
*/
static bool SupportsToolset() { return false; }
+ /**
+ * Utilized by the generator factory to determine if this generator
+ * supports platforms.
+ */
+ static bool SupportsPlatform() { return false; }
+
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
- virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
+ cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE;
/**
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(std::vector<std::string> const& languages,
- cmMakefile*, bool optional);
+ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
+ bool optional) CM_OVERRIDE;
- virtual void Configure();
+ void Configure() CM_OVERRIDE;
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
* requests that they Generate.
*/
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
std::vector<cmLocalGenerator*>&);
@@ -116,12 +122,14 @@ public:
std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; }
// change the build command for speed
- virtual void GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const std::string& makeProgram,
- const std::string& projectName, const std::string& projectDir,
- const std::string& targetName, const std::string& config, bool fast,
- bool verbose,
- std::vector<std::string> const& makeOptions = std::vector<std::string>());
+ void GenerateBuildCommand(std::vector<std::string>& makeCommand,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config, bool fast, bool verbose,
+ std::vector<std::string> const& makeOptions =
+ std::vector<std::string>()) CM_OVERRIDE;
/** Record per-target progress information. */
void RecordTargetProgress(cmMakefileTargetGenerator* tg);
@@ -136,7 +144,7 @@ public:
/** Does the make tool tolerate .DELETE_ON_ERROR? */
virtual bool AllowDeleteOnError() const { return true; }
- virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+ void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE;
std::string IncludeDirective;
bool DefineWindowsNULL;
@@ -163,19 +171,37 @@ protected:
bool NeedRequiresStep(cmGeneratorTarget const*);
// Target name hooks for superclass.
- const char* GetAllTargetName() const { return "all"; }
- const char* GetInstallTargetName() const { return "install"; }
- const char* GetInstallLocalTargetName() const { return "install/local"; }
- const char* GetInstallStripTargetName() const { return "install/strip"; }
- const char* GetPreinstallTargetName() const { return "preinstall"; }
- const char* GetTestTargetName() const { return "test"; }
- const char* GetPackageTargetName() const { return "package"; }
- const char* GetPackageSourceTargetName() const { return "package_source"; }
- const char* GetEditCacheTargetName() const { return "edit_cache"; }
- const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; }
- const char* GetCleanTargetName() const { return "clean"; }
-
- virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
+ const char* GetAllTargetName() const CM_OVERRIDE { return "all"; }
+ const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; }
+ const char* GetInstallLocalTargetName() const CM_OVERRIDE
+ {
+ return "install/local";
+ }
+ const char* GetInstallStripTargetName() const CM_OVERRIDE
+ {
+ return "install/strip";
+ }
+ const char* GetPreinstallTargetName() const CM_OVERRIDE
+ {
+ return "preinstall";
+ }
+ const char* GetTestTargetName() const CM_OVERRIDE { return "test"; }
+ const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; }
+ const char* GetPackageSourceTargetName() const CM_OVERRIDE
+ {
+ return "package_source";
+ }
+ const char* GetEditCacheTargetName() const CM_OVERRIDE
+ {
+ return "edit_cache";
+ }
+ const char* GetRebuildCacheTargetName() const CM_OVERRIDE
+ {
+ return "rebuild_cache";
+ }
+ const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; }
+
+ bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; }
// Some make programs (Borland) do not keep a rule if there are no
// dependencies or commands. This is a problem for creating rules
@@ -214,13 +240,13 @@ protected:
cmGeneratedFileStream* CommandDatabase;
private:
- virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
- virtual std::string GetEditCacheCommand() const;
+ const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; }
+ std::string GetEditCacheCommand() const CM_OVERRIDE;
std::map<cmState::Snapshot, std::set<cmGeneratorTarget const*>,
cmState::Snapshot::StrictWeakOrder>
DirectoryTargetsMap;
- virtual void InitializeProgressMarks();
+ void InitializeProgressMarks() CM_OVERRIDE;
};
#endif
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 90ff98b..df831e5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -42,8 +42,8 @@ class cmGlobalVisualStudio10Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
std::string genName;
const char* p = cmVS10GenName(name, genName);
@@ -65,21 +65,22 @@ public:
return 0;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs10generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2010 project files. "
"Optional [arch] can be \"Win64\" or \"IA64\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs10generatorName);
names.push_back(vs10generatorName + std::string(" IA64"));
names.push_back(vs10generatorName + std::string(" Win64"));
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
@@ -100,6 +101,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
this->SystemIsWindowsPhone = false;
this->SystemIsWindowsStore = false;
this->MSBuildCommandInitialized = false;
+ this->DefaultPlatformToolset = "v100";
this->Version = VS10;
}
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 295b6eb..1478a17 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -36,8 +36,8 @@ class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
std::string genName;
const char* p = cmVS11GenName(name, genName);
@@ -70,14 +70,14 @@ public:
return ret;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs11generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2012 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs11generatorName);
names.push_back(vs11generatorName + std::string(" ARM"));
@@ -91,7 +91,8 @@ public:
}
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 318cb39..3047171 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -36,8 +36,8 @@ class cmGlobalVisualStudio12Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
std::string genName;
const char* p = cmVS12GenName(name, genName);
@@ -59,21 +59,22 @@ public:
return 0;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs12generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2013 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs12generatorName);
names.push_back(vs12generatorName + std::string(" ARM"));
names.push_back(vs12generatorName + std::string(" Win64"));
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index e190e84..254682c 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -36,8 +36,8 @@ class cmGlobalVisualStudio14Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
std::string genName;
const char* p = cmVS14GenName(name, genName);
@@ -59,21 +59,22 @@ public:
return 0;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs14generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2015 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs14generatorName);
names.push_back(vs14generatorName + std::string(" ARM"));
names.push_back(vs14generatorName + std::string(" Win64"));
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index a33bd8b..67ac230 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -122,9 +122,9 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
// does not use the environment it is run in, and this allows
// for running commands and using dll's that the IDE environment
// does not know about.
- const char* extraPath = cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH");
- if (extraPath) {
- mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath,
+ std::string extraPath;
+ if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) {
+ mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(),
"Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
cmState::STATIC);
}
@@ -385,7 +385,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (vcprojName) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
- dir = root->Convert(dir.c_str(), cmOutputConverter::START_OUTPUT);
+ dir = root->ConvertToRelativePath(dir.c_str(),
+ cmOutputConverter::START_OUTPUT);
if (dir == ".") {
dir = ""; // msbuild cannot handle ".\" prefix
}
@@ -674,7 +675,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
target->Target->GetMakefile()->GetDefinition(
"CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD");
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(propertyValue);
if (cmSystemTools::IsOn(
cge->Evaluate(target->GetLocalGenerator(), *i))) {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 2092343..8a33ee0 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -48,6 +48,12 @@ public:
static bool SupportsToolset() { return false; }
/**
+ * Utilized by the generator factory to determine if this generator
+ * supports platforms.
+ */
+ static bool SupportsPlatform() { return false; }
+
+ /**
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
*/
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index dfe196a..2c0168e 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -25,8 +25,8 @@ static const char vs8generatorName[] = "Visual Studio 8 2005";
class cmGlobalVisualStudio8Generator::Factory : public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
if (strncmp(name.c_str(), vs8generatorName,
sizeof(vs8generatorName) - 1) != 0) {
@@ -60,14 +60,14 @@ public:
return ret;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs8generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2005 project files. "
"Optional [arch] can be \"Win64\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs8generatorName);
names.push_back(vs8generatorName + std::string(" Win64"));
@@ -82,7 +82,8 @@ public:
}
}
- virtual bool SupportsToolset() const { return false; }
+ bool SupportsToolset() const CM_OVERRIDE { return false; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index a47f4fc..acc7baa 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -23,8 +23,8 @@ static const char vs9generatorName[] = "Visual Studio 9 2008";
class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE
{
if (strncmp(name.c_str(), vs9generatorName,
sizeof(vs9generatorName) - 1) != 0) {
@@ -62,14 +62,14 @@ public:
return ret;
}
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs9generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 2008 project files. "
"Optional [arch] can be \"Win64\" or \"IA64\".";
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(vs9generatorName);
names.push_back(vs9generatorName + std::string(" Win64"));
@@ -85,7 +85,8 @@ public:
}
}
- virtual bool SupportsToolset() const { return false; }
+ bool SupportsToolset() const CM_OVERRIDE { return false; }
+ bool SupportsPlatform() const CM_OVERRIDE { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 1bec581..7bdd74d 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -827,6 +827,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
cmSystemTools::Error("could not open ", objs_file.c_str());
return;
}
+ std::vector<std::string> objs;
for (std::vector<cmSourceFile const*>::const_iterator it =
objectSources.begin();
it != objectSources.end(); ++it) {
@@ -836,6 +837,12 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
// It must exist because we populated the mapping just above.
assert(!map_it->second.empty());
std::string objFile = obj_dir + map_it->second;
+ objs.push_back(objFile);
+ }
+ gt->UseObjectLibraries(objs, configName);
+ for (std::vector<std::string>::iterator it = objs.begin(); it != objs.end();
+ ++it) {
+ std::string objFile = *it;
// replace $(ConfigurationName) in the object names
cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(),
configName.c_str());
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index fb2cdbd..1d456ff 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -85,7 +85,7 @@ public:
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
- virtual bool IsMultiConfig() { return true; }
+ virtual bool IsMultiConfig() const { return true; }
/** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; }
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index 3954907..bc0d786 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -28,7 +28,7 @@ public:
return new cmGlobalGeneratorSimpleFactory<cmGlobalWatcomWMakeGenerator>();
}
///! Get the name for the generator.
- virtual std::string GetName() const
+ std::string GetName() const CM_OVERRIDE
{
return cmGlobalWatcomWMakeGenerator::GetActualName();
}
@@ -41,11 +41,11 @@ public:
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(std::vector<std::string> const& languages,
- cmMakefile*, bool optional);
+ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
+ bool optional) CM_OVERRIDE;
- virtual bool AllowNotParallel() const { return false; }
- virtual bool AllowDeleteOnError() const { return false; }
+ bool AllowNotParallel() const CM_OVERRIDE { return false; }
+ bool AllowDeleteOnError() const CM_OVERRIDE { return false; }
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6628cfc..b4bc084 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -24,7 +24,7 @@
#include "cmXCodeObject.h"
#include "cmake.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmXMLParser.h"
@@ -108,20 +108,21 @@ public:
class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const;
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE;
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
cmGlobalXCodeGenerator::GetDocumentation(entry);
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(cmGlobalXCodeGenerator::GetActualName());
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return false; }
};
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
@@ -175,7 +176,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist");
}
- cmsys::auto_ptr<cmGlobalXCodeGenerator> gg(
+ CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
new cmGlobalXCodeGenerator(cm, parser.Version));
if (gg->XcodeVersion == 20) {
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
@@ -659,7 +660,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add flags from target and source file properties.
std::string flags;
const char* srcfmt = sf->GetProperty("Fortran_FORMAT");
- switch (this->CurrentLocalGenerator->GetFortranFormat(srcfmt)) {
+ switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
break;
@@ -689,7 +690,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags));
+ settings->AddAttributeIfNotEmpty("COMPILER_FLAGS",
+ this->CreateString(flags));
// Is this a resource file in this target? Add it to the resources group...
//
@@ -698,23 +700,37 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
gtgt->GetTargetSourceFileFlags(sf);
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
+ cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+
// Is this a "private" or "public" framework header file?
// Set the ATTRIBUTES attribute appropriately...
//
if (gtgt->IsFrameworkOnApple()) {
if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) {
- cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Private"));
- settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true;
} else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) {
- cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Public"));
- settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true;
}
}
+ // Add user-specified file attributes.
+ const char* extraFileAttributes = sf->GetProperty("XCODE_FILE_ATTRIBUTES");
+ if (extraFileAttributes) {
+ // Expand the list of attributes.
+ std::vector<std::string> attributes;
+ cmSystemTools::ExpandListArgument(extraFileAttributes, attributes);
+
+ // Store the attributes.
+ for (std::vector<std::string>::const_iterator ai = attributes.begin();
+ ai != attributes.end(); ++ai) {
+ attrs->AddObject(this->CreateString(*ai));
+ }
+ }
+
+ settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
+
// Add the fileRef to the top level Resources group/folder if it is not
// already there.
//
@@ -723,7 +739,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
this->ResourcesGroupChildren->AddObject(fileRef);
}
- buildFile->AddAttribute("settings", settings);
+ buildFile->AddAttributeIfNotEmpty("settings", settings);
return buildFile;
}
@@ -772,6 +788,8 @@ std::string GetSourcecodeValueFromFileExtension(const std::string& _ext,
sourcecode += ".asm";
} else if (ext == "metal") {
sourcecode += ".metal";
+ } else if (ext == "mig") {
+ sourcecode += ".mig";
}
// else
// {
@@ -1544,7 +1562,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
std::string echo_cmd = "echo ";
echo_cmd += (this->CurrentLocalGenerator->EscapeForShell(
comment, ccg.GetCC().GetEscapeAllowMakeVars()));
- makefileStream << "\t" << echo_cmd.c_str() << "\n";
+ makefileStream << "\t" << echo_cmd << "\n";
}
// Add each command line to the set of commands.
@@ -1562,7 +1580,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
}
cmd += cmd2;
ccg.AppendArguments(c, cmd);
- makefileStream << "\t" << cmd.c_str() << "\n";
+ makefileStream << "\t" << cmd << "\n";
}
}
}
@@ -1784,6 +1802,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions += " ";
extraLinkOptions += createFlags;
}
+ const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION");
+ if (ext) {
+ buildSettings->AddAttribute("WRAPPER_EXTENSION",
+ this->CreateString(ext));
+ }
std::string plist = this->ComputeInfoPListLocation(gtgt);
// Xcode will create the final version of Info.plist at build time,
// so let it replace the cfbundle name. This avoids creating
@@ -1821,6 +1844,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string fw_version = gtgt->GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION",
this->CreateString(fw_version));
+ const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION");
+ if (ext) {
+ buildSettings->AddAttribute("WRAPPER_EXTENSION",
+ this->CreateString(ext));
+ }
std::string plist = this->ComputeInfoPListLocation(gtgt);
// Xcode will create the final version of Info.plist at build time,
@@ -1855,6 +1883,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Handle bundles and normal executables separately.
if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) {
+ const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION");
+ if (ext) {
+ buildSettings->AddAttribute("WRAPPER_EXTENSION",
+ this->CreateString(ext));
+ }
std::string plist = this->ComputeInfoPListLocation(gtgt);
// Xcode will create the final version of Info.plist at build time,
// so let it replace the executable name. This avoids creating
@@ -1874,23 +1907,40 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
- std::vector<std::string> includes;
- this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C",
- configName);
std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks");
- for (std::vector<std::string>::iterator i = includes.begin();
- i != includes.end(); ++i) {
- if (this->NameResolvesToFramework(i->c_str())) {
- std::string frameworkDir = *i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
- if (emitted.insert(frameworkDir).second) {
- fdirs.Add(this->XCodeEscapePath(frameworkDir));
+
+ if (this->XcodeVersion < 60) {
+ std::vector<std::string> includes;
+ this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C",
+ configName);
+ for (std::vector<std::string>::iterator i = includes.begin();
+ i != includes.end(); ++i) {
+ if (this->NameResolvesToFramework(i->c_str())) {
+ std::string frameworkDir = *i;
+ frameworkDir += "/../";
+ frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ if (emitted.insert(frameworkDir).second) {
+ fdirs.Add(this->XCodeEscapePath(frameworkDir));
+ }
+ } else {
+ std::string incpath = this->XCodeEscapePath(*i);
+ dirs.Add(incpath);
+ }
+ }
+ } else {
+ for (std::set<std::string>::iterator li = languages.begin();
+ li != languages.end(); ++li) {
+ std::vector<std::string> includes;
+ this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, *li,
+ configName);
+ std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
+ includes, gtgt, *li, true, false, configName);
+
+ std::string& flags = cflags[*li];
+ if (!includeFlags.empty()) {
+ flags += " " + includeFlags;
}
- } else {
- std::string incpath = this->XCodeEscapePath(*i);
- dirs.Add(incpath);
}
}
// Add framework search paths needed for linking.
@@ -1975,13 +2025,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString(flags));
} else if (*li == "C") {
buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
+ } else if (*li == "Swift") {
+ buildSettings->AddAttribute("OTHER_SWIFT_FLAGS",
+ this->CreateString(flags));
}
}
// Add Fortran source format attribute if property is set.
const char* format = 0;
const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
- switch (this->CurrentLocalGenerator->GetFortranFormat(tgtfmt)) {
+ switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
format = "fixed";
break;
@@ -2582,13 +2635,10 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
bool cmGlobalXCodeGenerator::CreateGroups(
- cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
+ std::vector<cmLocalGenerator*>& generators)
{
for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
i != generators.end(); ++i) {
- if (this->IsExcluded(root, *i)) {
- continue;
- }
cmMakefile* mf = (*i)->GetMakefile();
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
@@ -2820,7 +2870,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->MainGroupChildren->AddObject(resourcesGroup);
// now create the cmake groups
- if (!this->CreateGroups(root, generators)) {
+ if (!this->CreateGroups(generators)) {
return false;
}
@@ -2988,10 +3038,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
std::vector<cmXCodeObject*> targets;
for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
i != generators.end(); ++i) {
- if (!this->IsExcluded(root, *i)) {
- if (!this->CreateXCodeTargets(*i, targets)) {
- return false;
- }
+ if (!this->CreateXCodeTargets(*i, targets)) {
+ return false;
}
}
// loop over all targets and add link and depend info
@@ -3437,7 +3485,7 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(
// Return true if the generated build tree may contain multiple builds.
// i.e. "Can I build Debug and Release in the same tree?"
-bool cmGlobalXCodeGenerator::IsMultiConfig()
+bool cmGlobalXCodeGenerator::IsMultiConfig() const
{
// Old Xcode 1.5 is single config:
if (this->XcodeVersion == 15) {
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 2ca4c19..303dfa0 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -79,7 +79,7 @@ public:
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
- virtual bool IsMultiConfig();
+ virtual bool IsMultiConfig() const;
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
void AppendFlag(std::string& flags, std::string const& flag);
@@ -92,8 +92,7 @@ private:
cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, std::string name);
- bool CreateGroups(cmLocalGenerator* root,
- std::vector<cmLocalGenerator*>& generators);
+ bool CreateGroups(std::vector<cmLocalGenerator*>& generators);
std::string XCodeEscapePath(const std::string& p);
std::string RelativeToSource(const char* p);
std::string RelativeToBinary(const char* p);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 20cd171..adb9936 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -64,9 +64,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator ggi(&cm);
- cmsys::auto_ptr<cmMakefile> mf(
- new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
+ CM_AUTO_PTR<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
const char* inFileName = settingsFileName;
@@ -140,7 +139,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
// which other targets depend on it.
void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
{
- if (this->GenerateDependers == false) {
+ if (!this->GenerateDependers) {
return;
}
@@ -149,11 +148,11 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ++ptrIt) {
- if (ptrIt->second == NULL) {
+ if (ptrIt->second == CM_NULLPTR) {
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -184,7 +183,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
// on which targets it depends.
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{
- if (this->GeneratePerTarget == false) {
+ if (!this->GeneratePerTarget) {
return;
}
@@ -193,11 +192,11 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ++ptrIt) {
- if (ptrIt->second == NULL) {
+ if (ptrIt->second == CM_NULLPTR) {
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -239,11 +238,11 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ++ptrIt) {
- if (ptrIt->second == NULL) {
+ if (ptrIt->second == CM_NULLPTR) {
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -278,7 +277,7 @@ void cmGraphVizWriter::WriteConnections(
this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
- if (targetPtrIt->second == NULL) // it's an external library
+ if (targetPtrIt->second == CM_NULLPTR) // it's an external library
{
return;
}
@@ -329,7 +328,7 @@ void cmGraphVizWriter::WriteDependerConnections(
this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
- if (targetPtrIt->second == NULL) // it's an external library
+ if (targetPtrIt->second == CM_NULLPTR) // it's an external library
{
return;
}
@@ -340,11 +339,11 @@ void cmGraphVizWriter::WriteDependerConnections(
for (std::map<std::string, const cmGeneratorTarget*>::const_iterator
dependerIt = this->TargetPtrs.begin();
dependerIt != this->TargetPtrs.end(); ++dependerIt) {
- if (dependerIt->second == NULL) {
+ if (dependerIt->second == CM_NULLPTR) {
continue;
}
- if (this->GenerateForTargetType(dependerIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(dependerIt->second->GetType())) {
continue;
}
@@ -403,7 +402,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName,
void cmGraphVizWriter::CollectTargetsAndLibs()
{
- if (this->HaveTargetsAndLibs == false) {
+ if (!this->HaveTargetsAndLibs) {
this->HaveTargetsAndLibs = true;
int cnt = this->CollectAllTargets();
if (this->GenerateForExternals) {
@@ -427,7 +426,7 @@ int cmGraphVizWriter::CollectAllTargets()
// Skip ignored targets
continue;
}
- // std::cout << "Found target: " << tit->first.c_str() << std::endl;
+ // std::cout << "Found target: " << tit->first << std::endl;
std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[realTargetName] = ostr.str();
@@ -468,8 +467,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
- this->TargetPtrs[libName] = NULL;
- // str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
+ this->TargetPtrs[libName] = CM_NULLPTR;
+ // str << " \"" << ostr << "\" [ label=\"" << libName
// << "\" shape=\"ellipse\"];" << std::endl;
}
}
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index 9609e95..34fd626 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -28,7 +28,7 @@ static bool cm_IsHexChar(char c)
static unsigned int ChompStrlen(const char* line)
{
- if (line == 0) {
+ if (line == CM_NULLPTR) {
return 0;
}
unsigned int length = static_cast<unsigned int>(strlen(line));
@@ -144,7 +144,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
{
char buf[1024];
FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
- if (inFile == 0) {
+ if (inFile == CM_NULLPTR) {
return Binary;
}
@@ -193,11 +193,11 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
// try to open the file
FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
FILE* outFile = cmsys::SystemTools::Fopen(outFileName, "wb");
- if ((inFile == 0) || (outFile == 0)) {
- if (inFile != 0) {
+ if ((inFile == CM_NULLPTR) || (outFile == CM_NULLPTR)) {
+ if (inFile != CM_NULLPTR) {
fclose(inFile);
}
- if (outFile != 0) {
+ if (outFile != CM_NULLPTR) {
fclose(outFile);
}
return false;
@@ -206,7 +206,7 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
// convert them line by line
bool success = false;
char buf[1024];
- while (fgets(buf, 1024, inFile) != 0) {
+ while (fgets(buf, 1024, inFile) != CM_NULLPTR) {
if (type == MotorolaSrec) {
success = ConvertMotorolaSrecLine(buf, outFile);
} else if (type == IntelHex) {
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 45395d1..dd04136 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -46,8 +46,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endif for this if statement, then start executing
if (!this->ScopeDepth) {
// Remove the function blocker for this scope or bail.
- cmsys::auto_ptr<cmFunctionBlocker> fb(
- mf.RemoveFunctionBlocker(this, lff));
+ CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
@@ -185,12 +184,12 @@ bool cmIfCommand::InvokeInitialPass(
conditionEvaluator.IsTrue(expandedArguments, errorString, status);
if (!errorString.empty()) {
- std::string err = cmIfCommandError(expandedArguments);
+ std::string err = "if " + cmIfCommandError(expandedArguments);
err += errorString;
if (status == cmake::FATAL_ERROR) {
- this->SetError(err);
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, err);
cmSystemTools::SetFatalErrorOccured();
- return false;
+ return true;
} else {
this->Makefile->IssueMessage(status, err);
}
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 54200df..f1f979d 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -24,10 +24,10 @@ public:
this->HasRun = false;
this->ScopeDepth = 0;
}
- virtual ~cmIfFunctionBlocker() {}
- virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
- cmExecutionStatus&);
- virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf);
+ ~cmIfFunctionBlocker() CM_OVERRIDE {}
+ bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
+ cmExecutionStatus&) CM_OVERRIDE;
+ bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE;
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
@@ -43,20 +43,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmIfCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmIfCommand; }
/**
* This overrides the default InvokeInitialPass implementation.
* It records the arguments before expansion.
*/
- virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&);
+ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -64,12 +65,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "if"; }
+ std::string GetName() const CM_OVERRIDE { return "if"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index cb9b74d..360ebeb 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -77,7 +77,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
if (gg->IsExportedTargetsFile(fname_abs)) {
- const char* modal = 0;
+ const char* modal = CM_NULLPTR;
std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index e319dbd..365a830 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -26,24 +26,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmIncludeCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmIncludeCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "include"; }
+ std::string GetName() const CM_OVERRIDE { return "include"; }
cmTypeMacro(cmIncludeCommand, cmCommand);
};
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 952294b..25be709 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmIncludeDirectoryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmIncludeDirectoryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "include_directories"; }
+ std::string GetName() const CM_OVERRIDE { return "include_directories"; }
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 999eb9e..8cda7b9 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -27,19 +27,25 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmIncludeExternalMSProjectCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmIncludeExternalMSProjectCommand;
+ }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "include_external_msproject"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "include_external_msproject";
+ }
cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
};
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index 1071a7a..52fdff0 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -26,19 +26,25 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmIncludeRegularExpressionCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmIncludeRegularExpressionCommand;
+ }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "include_regular_expression"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "include_regular_expression";
+ }
cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand);
};
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index e9de8df..4912eac 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -186,7 +186,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
cmCommandArgumentsHelper argHelper;
cmCommandArgumentGroup group;
- cmCAStringVector genericArgVector(&argHelper, 0);
+ cmCAStringVector genericArgVector(&argHelper, CM_NULLPTR);
cmCAStringVector archiveArgVector(&argHelper, "ARCHIVE", &group);
cmCAStringVector libraryArgVector(&argHelper, "LIBRARY", &group);
cmCAStringVector runtimeArgVector(&argHelper, "RUNTIME", &group);
@@ -197,10 +197,10 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
&group);
cmCAStringVector publicHeaderArgVector(&argHelper, "PUBLIC_HEADER", &group);
cmCAStringVector resourceArgVector(&argHelper, "RESOURCE", &group);
- genericArgVector.Follows(0);
+ genericArgVector.Follows(CM_NULLPTR);
group.Follows(&genericArgVector);
- argHelper.Parse(&args, 0);
+ argHelper.Parse(&args, CM_NULLPTR);
// now parse the generic args (i.e. the ones not specialized on LIBRARY/
// ARCHIVE, RUNTIME etc. (see above)
@@ -210,7 +210,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
cmCAString exports(&genericArgs.Parser, "EXPORT",
&genericArgs.ArgumentGroup);
- targetList.Follows(0);
+ targetList.Follows(CM_NULLPTR);
genericArgs.ArgumentGroup.Follows(&targetList);
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
bool success = genericArgs.Finalize();
@@ -373,14 +373,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
ti != targets.end(); ++ti) {
// Handle each target type.
cmTarget& target = *(*ti);
- cmInstallTargetGenerator* archiveGenerator = 0;
- cmInstallTargetGenerator* libraryGenerator = 0;
- cmInstallTargetGenerator* runtimeGenerator = 0;
- cmInstallTargetGenerator* frameworkGenerator = 0;
- cmInstallTargetGenerator* bundleGenerator = 0;
- cmInstallFilesGenerator* privateHeaderGenerator = 0;
- cmInstallFilesGenerator* publicHeaderGenerator = 0;
- cmInstallFilesGenerator* resourceGenerator = 0;
+ cmInstallTargetGenerator* archiveGenerator = CM_NULLPTR;
+ cmInstallTargetGenerator* libraryGenerator = CM_NULLPTR;
+ cmInstallTargetGenerator* runtimeGenerator = CM_NULLPTR;
+ cmInstallTargetGenerator* frameworkGenerator = CM_NULLPTR;
+ cmInstallTargetGenerator* bundleGenerator = CM_NULLPTR;
+ cmInstallFilesGenerator* privateHeaderGenerator = CM_NULLPTR;
+ cmInstallFilesGenerator* publicHeaderGenerator = CM_NULLPTR;
+ cmInstallFilesGenerator* resourceGenerator = CM_NULLPTR;
// Track whether this is a namelink-only rule.
bool namelinkOnly = false;
@@ -407,7 +407,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
runtimeGenerator =
CreateInstallTargetGenerator(target, runtimeArgs, false);
}
- if ((archiveGenerator == 0) && (runtimeGenerator == 0)) {
+ if ((archiveGenerator == CM_NULLPTR) &&
+ (runtimeGenerator == CM_NULLPTR)) {
this->SetError("Library TARGETS given no DESTINATION!");
return false;
}
@@ -621,14 +622,15 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
// Keep track of whether we're installing anything in each category
- installsArchive = installsArchive || archiveGenerator != 0;
- installsLibrary = installsLibrary || libraryGenerator != 0;
- installsRuntime = installsRuntime || runtimeGenerator != 0;
- installsFramework = installsFramework || frameworkGenerator != 0;
- installsBundle = installsBundle || bundleGenerator != 0;
+ installsArchive = installsArchive || archiveGenerator != CM_NULLPTR;
+ installsLibrary = installsLibrary || libraryGenerator != CM_NULLPTR;
+ installsRuntime = installsRuntime || runtimeGenerator != CM_NULLPTR;
+ installsFramework = installsFramework || frameworkGenerator != CM_NULLPTR;
+ installsBundle = installsBundle || bundleGenerator != CM_NULLPTR;
installsPrivateHeader =
- installsPrivateHeader || privateHeaderGenerator != 0;
- installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0;
+ installsPrivateHeader || privateHeaderGenerator != CM_NULLPTR;
+ installsPublicHeader =
+ installsPublicHeader || publicHeaderGenerator != CM_NULLPTR;
installsResource = installsResource || resourceGenerator;
this->Makefile->AddInstallGenerator(archiveGenerator);
@@ -704,7 +706,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
bool programs = (args[0] == "PROGRAMS");
cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
- files.Follows(0);
+ files.Follows(CM_NULLPTR);
ica.ArgumentGroup.Follows(&files);
std::vector<std::string> unknownArgs;
ica.Parse(&args, &unknownArgs);
@@ -744,7 +746,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
for (std::vector<std::string>::const_iterator fileIt = filesVector.begin();
fileIt != filesVector.end(); ++fileIt) {
if (gg->IsExportedTargetsFile(*fileIt)) {
- const char* modal = 0;
+ const char* modal = CM_NULLPTR;
std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
@@ -820,7 +822,7 @@ bool cmInstallCommand::HandleDirectoryMode(
bool exclude_from_all = false;
bool message_never = false;
std::vector<std::string> dirs;
- const char* destination = 0;
+ const char* destination = CM_NULLPTR;
std::string permissions_file;
std::string permissions_dir;
std::vector<std::string> configurations;
@@ -974,7 +976,8 @@ bool cmInstallCommand::HandleDirectoryMode(
} else if (doing == DoingDirs) {
// Convert this directory to a full path.
std::string dir = args[i];
- if (!cmSystemTools::FileIsFullPath(dir.c_str())) {
+ std::string::size_type gpos = cmGeneratorExpression::Find(dir);
+ if (gpos != 0 && !cmSystemTools::FileIsFullPath(dir.c_str())) {
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += args[i];
@@ -1103,7 +1106,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES",
&ica.ArgumentGroup);
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
- exp.Follows(0);
+ exp.Follows(CM_NULLPTR);
ica.ArgumentGroup.Follows(&exp);
std::vector<std::string> unknownArgs;
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 93aca45..3718ad5 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmInstallCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmInstallCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "install"; }
+ std::string GetName() const CM_OVERRIDE { return "install"; }
cmTypeMacro(cmInstallCommand, cmCommand);
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 57e37a3..312c50e 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -17,7 +17,7 @@
const char* cmInstallCommandArguments::PermissionsTable[] = {
"OWNER_READ", "OWNER_WRITE", "OWNER_EXECUTE", "GROUP_READ",
"GROUP_WRITE", "GROUP_EXECUTE", "WORLD_READ", "WORLD_WRITE",
- "WORLD_EXECUTE", "SETUID", "SETGID", 0
+ "WORLD_EXECUTE", "SETUID", "SETGID", CM_NULLPTR
};
const std::string cmInstallCommandArguments::EmptyString;
@@ -35,7 +35,7 @@ cmInstallCommandArguments::cmInstallCommandArguments(
, Optional(&Parser, "OPTIONAL", &ArgumentGroup)
, NamelinkOnly(&Parser, "NAMELINK_ONLY", &ArgumentGroup)
, NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup)
- , GenericArguments(0)
+ , GenericArguments(CM_NULLPTR)
, DefaultComponentName(defaultComponent)
{
}
@@ -45,7 +45,7 @@ const std::string& cmInstallCommandArguments::GetDestination() const
if (!this->DestinationString.empty()) {
return this->DestinationString;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetDestination();
}
return this->EmptyString;
@@ -56,7 +56,7 @@ const std::string& cmInstallCommandArguments::GetComponent() const
if (!this->Component.GetString().empty()) {
return this->Component.GetString();
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetComponent();
}
if (!this->DefaultComponentName.empty()) {
@@ -71,7 +71,7 @@ const std::string& cmInstallCommandArguments::GetRename() const
if (!this->Rename.GetString().empty()) {
return this->Rename.GetString();
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetRename();
}
return this->EmptyString;
@@ -82,7 +82,7 @@ const std::string& cmInstallCommandArguments::GetPermissions() const
if (!this->PermissionsString.empty()) {
return this->PermissionsString;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetPermissions();
}
return this->EmptyString;
@@ -93,7 +93,7 @@ bool cmInstallCommandArguments::GetOptional() const
if (this->Optional.IsEnabled()) {
return true;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetOptional();
}
return false;
@@ -104,7 +104,7 @@ bool cmInstallCommandArguments::GetExcludeFromAll() const
if (this->ExcludeFromAll.IsEnabled()) {
return true;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetExcludeFromAll();
}
return false;
@@ -115,7 +115,7 @@ bool cmInstallCommandArguments::GetNamelinkOnly() const
if (this->NamelinkOnly.IsEnabled()) {
return true;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetNamelinkOnly();
}
return false;
@@ -126,7 +126,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const
if (this->NamelinkSkip.IsEnabled()) {
return true;
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetNamelinkSkip();
}
return false;
@@ -138,7 +138,7 @@ const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations()
if (!this->Configurations.GetVector().empty()) {
return this->Configurations.GetVector();
}
- if (this->GenericArguments != 0) {
+ if (this->GenericArguments != CM_NULLPTR) {
return this->GenericArguments->GetConfigurations();
}
return this->Configurations.GetVector();
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 671ab4c..469b119 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorExpression.h"
#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, const char* dest,
@@ -22,7 +23,7 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
bool optional)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
- , LocalGenerator(0)
+ , LocalGenerator(CM_NULLPTR)
, Directories(dirs)
, FilePermissions(file_permissions)
, DirPermissions(dir_permissions)
@@ -69,10 +70,20 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge;
for (std::vector<std::string>::const_iterator i = this->Directories.begin();
i != this->Directories.end(); ++i) {
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), dirs);
}
+
+ // Make sure all dirs have absolute paths.
+ cmMakefile const& mf = *this->LocalGenerator->GetMakefile();
+ for (std::vector<std::string>::iterator i = dirs.begin(); i != dirs.end();
+ ++i) {
+ if (!cmSystemTools::FileIsFullPath(i->c_str())) {
+ *i = std::string(mf.GetCurrentSourceDirectory()) + "/" + *i;
+ }
+ }
+
this->AddDirectoryInstallRule(os, config, indent, dirs);
}
@@ -81,7 +92,7 @@ void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
std::vector<std::string> const& dirs)
{
// Write code to install the directories.
- const char* no_rename = 0;
+ const char* no_rename = CM_NULLPTR;
this->AddInstallRule(os, this->GetDestination(config),
cmInstallType_DIRECTORY, dirs, this->Optional,
this->FilePermissions.c_str(),
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 10d7c95..93becf4 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -27,17 +27,17 @@ public:
const char* component, MessageLevel message,
bool exclude_from_all, const char* literal_args,
bool optional = false);
- virtual ~cmInstallDirectoryGenerator();
+ ~cmInstallDirectoryGenerator() CM_OVERRIDE;
- void Compute(cmLocalGenerator* lg);
+ void Compute(cmLocalGenerator* lg) CM_OVERRIDE;
std::string GetDestination(std::string const& config) const;
protected:
- virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
- virtual void GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
- Indent const& indent);
+ void GenerateScriptActions(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent const& indent) CM_OVERRIDE;
void AddDirectoryInstallRule(std::ostream& os, const std::string& config,
Indent const& indent,
std::vector<std::string> const& dirs);
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 2fef3a8..72c4d1f 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -37,7 +37,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
, FileName(filename)
, Namespace(name_space)
, ExportOld(exportOld)
- , LocalGenerator(0)
+ , LocalGenerator(CM_NULLPTR)
{
this->EFGen = new cmExportInstallFileGenerator(this);
exportSet->AddInstallation(this);
@@ -63,9 +63,8 @@ void cmInstallExportGenerator::ComputeTempDir()
this->TempDir += "/Export";
if (this->Destination.empty()) {
return;
- } else {
- this->TempDir += "/";
}
+ this->TempDir += "/";
// Enforce a maximum length.
bool useMD5 = false;
@@ -74,9 +73,12 @@ void cmInstallExportGenerator::ComputeTempDir()
#else
std::string::size_type const max_total_len = 1000;
#endif
- if (this->TempDir.size() < max_total_len) {
+ // Will generate files of the form "<temp-dir>/<base>-<config>.<ext>".
+ std::string::size_type const len = this->TempDir.size() + 1 +
+ this->FileName.size() + 1 + this->GetMaxConfigLength();
+ if (len < max_total_len) {
// Keep the total path length below the limit.
- std::string::size_type max_len = max_total_len - this->TempDir.size();
+ std::string::size_type const max_len = max_total_len - len;
if (this->Destination.size() > max_len) {
useMD5 = true;
}
@@ -102,6 +104,26 @@ void cmInstallExportGenerator::ComputeTempDir()
}
}
+size_t cmInstallExportGenerator::GetMaxConfigLength() const
+{
+ // Always use at least 8 for "noconfig".
+ size_t len = 8;
+ if (this->ConfigurationTypes->empty()) {
+ if (this->ConfigurationName.size() > 8) {
+ len = this->ConfigurationName.size();
+ }
+ } else {
+ for (std::vector<std::string>::const_iterator ci =
+ this->ConfigurationTypes->begin();
+ ci != this->ConfigurationTypes->end(); ++ci) {
+ if (ci->size() > len) {
+ len = ci->size();
+ }
+ }
+ }
+ return len;
+}
+
void cmInstallExportGenerator::GenerateScript(std::ostream& os)
{
// Skip empty sets.
@@ -161,8 +183,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
std::string config_test = this->CreateConfigTest(i->first);
os << indent << "if(" << config_test << ")\n";
this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
- false, this->FilePermissions.c_str(), 0, 0, 0,
- indent.Next());
+ false, this->FilePermissions.c_str(), CM_NULLPTR,
+ CM_NULLPTR, CM_NULLPTR, indent.Next());
os << indent << "endif()\n";
files.clear();
}
@@ -201,5 +223,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
std::vector<std::string> files;
files.push_back(this->MainImportFile);
this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
- false, this->FilePermissions.c_str(), 0, 0, 0, indent);
+ false, this->FilePermissions.c_str(), CM_NULLPTR,
+ CM_NULLPTR, CM_NULLPTR, indent);
}
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 256c0c9..22e661b 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -32,11 +32,11 @@ public:
const char* component, MessageLevel message,
bool exclude_from_all, const char* filename,
const char* name_space, bool exportOld);
- ~cmInstallExportGenerator();
+ ~cmInstallExportGenerator() CM_OVERRIDE;
cmExportSet* GetExportSet() { return this->ExportSet; }
- void Compute(cmLocalGenerator* lg);
+ void Compute(cmLocalGenerator* lg) CM_OVERRIDE;
cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; }
@@ -45,12 +45,15 @@ public:
std::string const& GetDestination() const { return this->Destination; }
protected:
- virtual void GenerateScript(std::ostream& os);
- virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
- virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
+ void GenerateScript(std::ostream& os) CM_OVERRIDE;
+ void GenerateScriptConfigs(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
void GenerateImportFile(cmExportSet const* exportSet);
void GenerateImportFile(const char* config, cmExportSet const* exportSet);
void ComputeTempDir();
+ size_t GetMaxConfigLength() const;
cmExportSet* ExportSet;
std::string FilePermissions;
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 0d0388a..cf2c9ff 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmInstallFilesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmInstallFilesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "install_files"; }
+ std::string GetName() const CM_OVERRIDE { return "install_files"; }
/**
* This is called at the end after all the information
@@ -46,8 +46,8 @@ public:
* not implement this method. At this point, reading and
* writing to the cache can be done.
*/
- virtual void FinalPass();
- virtual bool HasFinalPass() const { return !this->IsFilesForm; }
+ void FinalPass() CM_OVERRIDE;
+ bool HasFinalPass() const CM_OVERRIDE { return !this->IsFilesForm; }
cmTypeMacro(cmInstallFilesCommand, cmCommand);
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 8c1b357..93a740c 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -23,7 +23,7 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
const char* rename, bool optional)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
- , LocalGenerator(0)
+ , LocalGenerator(CM_NULLPTR)
, Files(files)
, FilePermissions(file_permissions)
, Rename(rename)
@@ -65,12 +65,12 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
std::vector<std::string> const& files)
{
// Write code to install the files.
- const char* no_dir_permissions = 0;
+ const char* no_dir_permissions = CM_NULLPTR;
this->AddInstallRule(
os, this->GetDestination(config),
(this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files,
this->Optional, this->FilePermissions.c_str(), no_dir_permissions,
- this->Rename.c_str(), 0, indent);
+ this->Rename.c_str(), CM_NULLPTR, indent);
}
void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
@@ -90,7 +90,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge;
for (std::vector<std::string>::const_iterator i = this->Files.begin();
i != this->Files.end(); ++i) {
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), files);
}
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 0e738d3..5cb09f4 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -27,17 +27,17 @@ public:
const char* component, MessageLevel message,
bool exclude_from_all, const char* rename,
bool optional = false);
- virtual ~cmInstallFilesGenerator();
+ ~cmInstallFilesGenerator() CM_OVERRIDE;
- void Compute(cmLocalGenerator* lg);
+ void Compute(cmLocalGenerator* lg) CM_OVERRIDE;
std::string GetDestination(std::string const& config) const;
protected:
- virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
- virtual void GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
- Indent const& indent);
+ void GenerateScriptActions(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent const& indent) CM_OVERRIDE;
void AddFilesInstallRule(std::ostream& os, std::string const& config,
Indent const& indent,
std::vector<std::string> const& files);
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index e271d53..ad9fc28 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -37,15 +37,14 @@ public:
std::vector<std::string> const& configurations,
const char* component, MessageLevel message,
bool exclude_from_all);
- virtual ~cmInstallGenerator();
+ ~cmInstallGenerator() CM_OVERRIDE;
- void AddInstallRule(std::ostream& os, std::string const& dest,
- cmInstallType type,
- std::vector<std::string> const& files,
- bool optional = false, const char* permissions_file = 0,
- const char* permissions_dir = 0, const char* rename = 0,
- const char* literal_args = 0,
- Indent const& indent = Indent());
+ void AddInstallRule(
+ std::ostream& os, std::string const& dest, cmInstallType type,
+ std::vector<std::string> const& files, bool optional = false,
+ const char* permissions_file = CM_NULLPTR,
+ const char* permissions_dir = CM_NULLPTR, const char* rename = CM_NULLPTR,
+ const char* literal_args = CM_NULLPTR, Indent const& indent = Indent());
/** Get the install destination as it should appear in the
installation script. */
@@ -60,7 +59,7 @@ public:
virtual void Compute(cmLocalGenerator*) {}
protected:
- virtual void GenerateScript(std::ostream& os);
+ void GenerateScript(std::ostream& os) CM_OVERRIDE;
std::string CreateComponentTest(const char* component,
bool exclude_from_all);
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index b104c69..b56a9b1 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmInstallProgramsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmInstallProgramsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "install_programs"; }
+ std::string GetName() const CM_OVERRIDE { return "install_programs"; }
/**
* This is called at the end after all the information
@@ -46,9 +46,9 @@ public:
* not implement this method. At this point, reading and
* writing to the cache can be done.
*/
- virtual void FinalPass();
+ void FinalPass() CM_OVERRIDE;
- virtual bool HasFinalPass() const { return true; }
+ bool HasFinalPass() const CM_OVERRIDE { return true; }
cmTypeMacro(cmInstallProgramsCommand, cmCommand);
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 1b0f1d1..76d6b71 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -15,7 +15,7 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
bool code,
const char* component,
bool exclude_from_all)
- : cmInstallGenerator(0, std::vector<std::string>(), component,
+ : cmInstallGenerator(CM_NULLPTR, std::vector<std::string>(), component,
MessageDefault, exclude_from_all)
, Script(script)
, Code(code)
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index ff2f2fa..dc00359 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -22,10 +22,10 @@ class cmInstallScriptGenerator : public cmInstallGenerator
public:
cmInstallScriptGenerator(const char* script, bool code,
const char* component, bool exclude_from_all);
- virtual ~cmInstallScriptGenerator();
+ ~cmInstallScriptGenerator() CM_OVERRIDE;
protected:
- virtual void GenerateScript(std::ostream& os);
+ void GenerateScript(std::ostream& os) CM_OVERRIDE;
std::string Script;
bool Code;
};
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index e68bac2..4b2f40c 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -30,7 +30,7 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
, TargetName(targetName)
- , Target(0)
+ , Target(CM_NULLPTR)
, FilePermissions(file_permissions)
, ImportLibrary(implib)
, Optional(optional)
@@ -142,13 +142,22 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
if (this->Target->IsAppBundleOnApple()) {
cmMakefile const* mf = this->Target->Target->GetMakefile();
+ // Get App Bundle Extension
+ const char* ext = this->Target->GetProperty("BUNDLE_EXTENSION");
+ if (!ext) {
+ ext = "app";
+ }
+
// Install the whole app bundle directory.
type = cmInstallType_DIRECTORY;
literal_args += " USE_SOURCE_PERMISSIONS";
- from1 += ".app";
+ from1 += ".";
+ from1 += ext;
// Tweaks apply to the binary inside the bundle.
- to1 += ".app/";
+ to1 += ".";
+ to1 += ext;
+ to1 += "/";
if (!mf->PlatformIsAppleIos()) {
to1 += "Contents/MacOS/";
}
@@ -294,8 +303,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
&cmInstallTargetGenerator::PreReplacementTweaks);
// Write code to install the target file.
- const char* no_dir_permissions = 0;
- const char* no_rename = 0;
+ const char* no_dir_permissions = CM_NULLPTR;
+ const char* no_rename = CM_NULLPTR;
bool optional = this->Optional || this->ImportLibrary;
this->AddInstallRule(os, this->GetDestination(config), type, filesFrom,
optional, this->FilePermissions.c_str(),
@@ -623,7 +632,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
std::string darwin_major_version_s =
mf->GetSafeDefinition("DARWIN_MAJOR_VERSION");
- std::stringstream ss(darwin_major_version_s);
+ std::istringstream ss(darwin_major_version_s);
int darwin_major_version;
ss >> darwin_major_version;
if (!ss.fail() && darwin_major_version <= 9 &&
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 2fd85b5..b1c28b8 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -27,7 +27,7 @@ public:
std::vector<std::string> const& configurations,
const char* component, MessageLevel message,
bool exclude_from_all, bool optional);
- virtual ~cmInstallTargetGenerator();
+ ~cmInstallTargetGenerator() CM_OVERRIDE;
/** Select the policy for installing shared library linkable name
symlinks. */
@@ -54,7 +54,7 @@ public:
const std::string& config,
NameType nameType = NameNormal);
- void Compute(cmLocalGenerator* lg);
+ void Compute(cmLocalGenerator* lg) CM_OVERRIDE;
cmGeneratorTarget* GetTarget() const { return this->Target; }
@@ -63,10 +63,9 @@ public:
std::string GetDestination(std::string const& config) const;
protected:
- virtual void GenerateScript(std::ostream& os);
- virtual void GenerateScriptForConfig(std::ostream& os,
- const std::string& config,
- Indent const& indent);
+ void GenerateScript(std::ostream& os) CM_OVERRIDE;
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent const& indent) CM_OVERRIDE;
typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&,
Indent const&,
const std::string&,
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index b0d04b0..b7d7f33 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmInstallTargetsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmInstallTargetsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "install_targets"; }
+ std::string GetName() const CM_OVERRIDE { return "install_targets"; }
cmTypeMacro(cmInstallTargetsCommand, cmCommand);
};
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index ed0f74b..bfc5cf1 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -16,7 +16,7 @@
#include "cmSystemTools.h"
cmInstalledFile::cmInstalledFile()
- : NameExpression(0)
+ : NameExpression(CM_NULLPTR)
{
}
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index d000891..00ff611 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -22,7 +22,7 @@
class cmInstalledFile
{
public:
- typedef cmsys::auto_ptr<cmCompiledGeneratorExpression>
+ typedef CM_AUTO_PTR<cmCompiledGeneratorExpression>
CompiledGeneratorExpressionPtrType;
typedef std::vector<cmCompiledGeneratorExpression*> ExpressionVectorType;
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index 7014a69..721d663 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -28,19 +28,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmLinkDirectoriesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmLinkDirectoriesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "link_directories"; }
+ std::string GetName() const CM_OVERRIDE { return "link_directories"; }
cmTypeMacro(cmLinkDirectoriesCommand, cmCommand);
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 0fbe093..8aa3981 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -26,7 +26,7 @@ class cmLinkItem : public std::string
public:
cmLinkItem()
: std_string()
- , Target(0)
+ , Target(CM_NULLPTR)
{
}
cmLinkItem(const std_string& n, cmGeneratorTarget const* t)
@@ -118,7 +118,7 @@ struct cmOptionalLinkInterface : public cmLinkInterface
, AllDone(false)
, Exists(false)
, HadHeadSensitiveCondition(false)
- , ExplicitLibraries(0)
+ , ExplicitLibraries(CM_NULLPTR)
{
}
bool LibrariesDone;
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 6ab50ce..45cc4d7 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmLinkLibrariesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmLinkLibrariesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "link_libraries"; }
+ std::string GetName() const CM_OVERRIDE { return "link_libraries"; }
cmTypeMacro(cmLinkLibrariesCommand, cmCommand);
};
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 1a85396..6b31074 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -56,7 +56,7 @@ public:
public:
iterator()
- : Tree(0)
+ : Tree(CM_NULLPTR)
, Position(0)
{
}
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 56d9694..1c33c96 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -24,24 +24,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmListCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmListCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "list"; }
+ std::string GetName() const CM_OVERRIDE { return "list"; }
cmTypeMacro(cmListCommand, cmCommand);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index f47e9b6..aad538c 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -12,7 +12,7 @@
#include "cmListFileCache.h"
#include "cmListFileLexer.h"
-#include "cmMakefile.h"
+#include "cmMessenger.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
@@ -21,14 +21,18 @@
struct cmListFileParser
{
- cmListFileParser(cmListFile* lf, cmMakefile* mf, const char* filename);
+ cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+ cmMessenger* messenger, const char* filename);
~cmListFileParser();
+ void IssueFileOpenError(std::string const& text) const;
+ void IssueError(std::string const& text) const;
bool ParseFile();
bool ParseFunction(const char* name, long line);
bool AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim);
cmListFile* ListFile;
- cmMakefile* Makefile;
+ cmListFileBacktrace Backtrace;
+ cmMessenger* Messenger;
const char* FileName;
cmListFileLexer* Lexer;
cmListFileFunction Function;
@@ -40,10 +44,12 @@ struct cmListFileParser
} Separation;
};
-cmListFileParser::cmListFileParser(cmListFile* lf, cmMakefile* mf,
+cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+ cmMessenger* messenger,
const char* filename)
: ListFile(lf)
- , Makefile(mf)
+ , Backtrace(lfbt)
+ , Messenger(messenger)
, FileName(filename)
, Lexer(cmListFileLexer_New())
{
@@ -54,23 +60,36 @@ cmListFileParser::~cmListFileParser()
cmListFileLexer_Delete(this->Lexer);
}
+void cmListFileParser::IssueFileOpenError(const std::string& text) const
+{
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, this->Backtrace);
+}
+
+void cmListFileParser::IssueError(const std::string& text) const
+{
+ cmListFileContext lfc;
+ lfc.FilePath = this->FileName;
+ lfc.Line = cmListFileLexer_GetCurrentLine(this->Lexer);
+ cmListFileBacktrace lfbt = this->Backtrace;
+ lfbt = lfbt.Push(lfc);
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, lfbt);
+ cmSystemTools::SetFatalErrorOccured();
+}
+
bool cmListFileParser::ParseFile()
{
// Open the file.
cmListFileLexer_BOM bom;
if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) {
- cmSystemTools::Error("cmListFileCache: error can not open file ",
- this->FileName);
+ this->IssueFileOpenError("cmListFileCache: error can not open file.");
return false;
}
// Verify the Byte-Order-Mark, if any.
if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
- cmListFileLexer_SetFileName(this->Lexer, 0, 0);
- std::ostringstream m;
- m << "File\n " << this->FileName << "\n"
- << "starts with a Byte-Order-Mark that is not UTF-8.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str());
+ cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR);
+ this->IssueFileOpenError(
+ "File starts with a Byte-Order-Mark that is not UTF-8.");
return false;
}
@@ -93,29 +112,26 @@ bool cmListFileParser::ParseFile()
}
} else {
std::ostringstream error;
- error << "Error in cmake code at\n"
- << this->FileName << ":" << token->line << ":\n"
- << "Parse error. Expected a newline, got "
+ error << "Parse error. Expected a newline, got "
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
- cmSystemTools::Error(error.str().c_str());
+ this->IssueError(error.str());
return false;
}
} else {
std::ostringstream error;
- error << "Error in cmake code at\n"
- << this->FileName << ":" << token->line << ":\n"
- << "Parse error. Expected a command name, got "
+ error << "Parse error. Expected a command name, got "
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
- cmSystemTools::Error(error.str().c_str());
+ this->IssueError(error.str());
return false;
}
}
return true;
}
-bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
+bool cmListFile::ParseFile(const char* filename, cmMessenger* messenger,
+ cmListFileBacktrace const& lfbt)
{
if (!cmSystemTools::FileExists(filename) ||
cmSystemTools::FileIsDirectory(filename)) {
@@ -125,87 +141,11 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
bool parseError = false;
{
- cmListFileParser parser(this, mf, filename);
+ cmListFileParser parser(this, lfbt, messenger, filename);
parseError = !parser.ParseFile();
}
- // do we need a cmake_policy(VERSION call?
- if (topLevel) {
- bool hasVersion = false;
- // search for the right policy command
- for (std::vector<cmListFileFunction>::iterator i = this->Functions.begin();
- i != this->Functions.end(); ++i) {
- if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") {
- hasVersion = true;
- break;
- }
- }
- // if no policy command is found this is an error if they use any
- // non advanced functions or a lot of functions
- if (!hasVersion) {
- bool isProblem = true;
- if (this->Functions.size() < 30) {
- // the list of simple commands DO NOT ADD TO THIS LIST!!!!!
- // these commands must have backwards compatibility forever and
- // and that is a lot longer than your tiny mind can comprehend mortal
- std::set<std::string> allowedCommands;
- allowedCommands.insert("project");
- allowedCommands.insert("set");
- allowedCommands.insert("if");
- allowedCommands.insert("endif");
- allowedCommands.insert("else");
- allowedCommands.insert("elseif");
- allowedCommands.insert("add_executable");
- allowedCommands.insert("add_library");
- allowedCommands.insert("target_link_libraries");
- allowedCommands.insert("option");
- allowedCommands.insert("message");
- isProblem = false;
- for (std::vector<cmListFileFunction>::iterator i =
- this->Functions.begin();
- i != this->Functions.end(); ++i) {
- std::string name = cmSystemTools::LowerCase(i->Name);
- if (allowedCommands.find(name) == allowedCommands.end()) {
- isProblem = true;
- break;
- }
- }
- }
-
- if (isProblem) {
- // Tell the top level cmMakefile to diagnose
- // this violation of CMP0000.
- mf->SetCheckCMP0000(true);
-
- // Implicitly set the version for the user.
- mf->SetPolicyVersion("2.4");
- }
- }
- }
-
- if (topLevel) {
- bool hasProject = false;
- // search for a project command
- for (std::vector<cmListFileFunction>::iterator i = this->Functions.begin();
- i != this->Functions.end(); ++i) {
- if (cmSystemTools::LowerCase(i->Name) == "project") {
- hasProject = true;
- break;
- }
- }
- // if no project command is found, add one
- if (!hasProject) {
- cmListFileFunction project;
- project.Name = "PROJECT";
- cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0);
- project.Arguments.push_back(prj);
- this->Functions.insert(this->Functions.begin(), project);
- }
- }
- if (parseError) {
- return false;
- }
- return true;
+ return !parseError;
}
bool cmListFileParser::ParseFunction(const char* name, long line)
@@ -223,22 +163,18 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
if (!token) {
std::ostringstream error;
/* clang-format off */
- error << "Error in cmake code at\n" << this->FileName << ":"
- << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
+ error << "Unexpected end of file.\n"
<< "Parse error. Function missing opening \"(\".";
/* clang-format on */
- cmSystemTools::Error(error.str().c_str());
+ this->IssueError(error.str());
return false;
}
if (token->type != cmListFileLexer_Token_ParenLeft) {
std::ostringstream error;
- error << "Error in cmake code at\n"
- << this->FileName << ":"
- << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
- << "Parse error. Expected \"(\", got "
+ error << "Parse error. Expected \"(\", got "
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
- cmSystemTools::Error(error.str().c_str());
+ this->IssueError(error.str());
return false;
}
@@ -290,25 +226,24 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
} else {
// Error.
std::ostringstream error;
- error << "Error in cmake code at\n"
- << this->FileName << ":"
- << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
- << "Parse error. Function missing ending \")\". "
+ error << "Parse error. Function missing ending \")\". "
<< "Instead found "
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
- cmSystemTools::Error(error.str().c_str());
+ this->IssueError(error.str());
return false;
}
}
std::ostringstream error;
- error << "Error in cmake code at\n"
- << this->FileName << ":" << lastLine << ":\n"
- << "Parse error. Function missing ending \")\". "
+ cmListFileContext lfc;
+ lfc.FilePath = this->FileName;
+ lfc.Line = lastLine;
+ cmListFileBacktrace lfbt = this->Backtrace;
+ lfbt = lfbt.Push(lfc);
+ error << "Parse error. Function missing ending \")\". "
<< "End of file reached.";
- cmSystemTools::Error(error.str().c_str());
-
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, error.str(), lfbt);
return false;
}
@@ -323,19 +258,22 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
bool isError = (this->Separation == SeparationError ||
delim == cmListFileArgument::Bracket);
std::ostringstream m;
- /* clang-format off */
- m << "Syntax " << (isError? "Error":"Warning") << " in cmake code at\n"
- << " " << this->FileName << ":" << token->line << ":"
- << token->column << "\n"
+ cmListFileContext lfc;
+ lfc.FilePath = this->FileName;
+ lfc.Line = token->line;
+ cmListFileBacktrace lfbt = this->Backtrace;
+ lfbt = lfbt.Push(lfc);
+
+ m << "Syntax " << (isError ? "Error" : "Warning") << " in cmake code at "
+ << "column " << token->column << "\n"
<< "Argument not separated from preceding token by whitespace.";
/* clang-format on */
if (isError) {
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str());
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, m.str(), lfbt);
return false;
- } else {
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str());
- return true;
}
+ this->Messenger->IssueMessage(cmake::AUTHOR_WARNING, m.str(), lfbt);
+ return true;
}
struct cmListFileBacktrace::Entry : public cmListFileContext
@@ -387,13 +325,13 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur)
cmListFileBacktrace::cmListFileBacktrace()
: Bottom()
- , Cur(0)
+ , Cur(CM_NULLPTR)
{
}
cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot)
: Bottom(snapshot.GetCallStackBottom())
- , Cur(0)
+ , Cur(CM_NULLPTR)
{
}
@@ -450,10 +388,9 @@ cmListFileContext const& cmListFileBacktrace::Top() const
{
if (this->Cur) {
return *this->Cur;
- } else {
- static cmListFileContext const empty;
- return empty;
}
+ static cmListFileContext const empty;
+ return empty;
}
void cmListFileBacktrace::PrintTitle(std::ostream& out) const
@@ -464,7 +401,8 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const
cmOutputConverter converter(this->Bottom);
cmListFileContext lfc = *this->Cur;
if (!this->Bottom.GetState()->GetIsInTryCompile()) {
- lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath =
+ converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
}
out << (lfc.Line ? " at " : " in ") << lfc;
}
@@ -489,7 +427,8 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
}
cmListFileContext lfc = *i;
if (!this->Bottom.GetState()->GetIsInTryCompile()) {
- lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath =
+ converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
}
out << " " << lfc << "\n";
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index d72c360..cd44536 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -23,7 +23,7 @@
* cmake list files.
*/
-class cmMakefile;
+class cmMessenger;
struct cmCommandContext
{
@@ -158,7 +158,8 @@ private:
struct cmListFile
{
- bool ParseFile(const char* path, bool topLevel, cmMakefile* mf);
+ bool ParseFile(const char* path, cmMessenger* messenger,
+ cmListFileBacktrace const& lfbt);
std::vector<cmListFileFunction> Functions;
};
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 67d93ac..0755809 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmLoadCacheCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmLoadCacheCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "load_cache"; }
+ std::string GetName() const CM_OVERRIDE { return "load_cache"; }
cmTypeMacro(cmLoadCacheCommand, cmCommand);
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 081c22e..ddf6ce6 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -37,12 +37,12 @@ public:
}
///! clean up any memory allocated by the plugin
- ~cmLoadedCommand();
+ ~cmLoadedCommand() CM_OVERRIDE;
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmLoadedCommand* newC = new cmLoadedCommand;
// we must copy when we clone
@@ -54,8 +54,8 @@ public:
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called at the end after all the information
@@ -63,8 +63,8 @@ public:
* not implement this method. At this point, reading and
* writing to the cache can be done.
*/
- virtual void FinalPass();
- virtual bool HasFinalPass() const
+ void FinalPass() CM_OVERRIDE;
+ bool HasFinalPass() const CM_OVERRIDE
{
return this->info.FinalPass ? true : false;
}
@@ -72,7 +72,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return info.Name; }
+ std::string GetName() const CM_OVERRIDE { return info.Name; }
static const char* LastName;
static void TrapsForSignals(int sig)
@@ -94,11 +94,11 @@ public:
#endif
signal(SIGILL, TrapsForSignalsCFunction);
} else {
- signal(SIGSEGV, 0);
+ signal(SIGSEGV, CM_NULLPTR);
#ifdef SIGBUS
- signal(SIGBUS, 0);
+ signal(SIGBUS, CM_NULLPTR);
#endif
- signal(SIGILL, 0);
+ signal(SIGILL, CM_NULLPTR);
}
}
@@ -112,7 +112,7 @@ extern "C" void TrapsForSignalsCFunction(int sig)
cmLoadedCommand::TrapsForSignals(sig);
}
-const char* cmLoadedCommand::LastName = 0;
+const char* cmLoadedCommand::LastName = CM_NULLPTR;
bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -128,7 +128,7 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
// create argc and argv and then invoke the command
int argc = static_cast<int>(args.size());
- char** argv = 0;
+ char** argv = CM_NULLPTR;
if (argc) {
argv = (char**)malloc(argc * sizeof(char*));
}
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index e00a01e..6552845 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -17,10 +17,10 @@
class cmLoadCommandCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmLoadCommandCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "load_command"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmLoadCommandCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "load_command"; }
cmTypeMacro(cmLoadCommandCommand, cmCommand);
};
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 3ebd128..1383421 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -13,9 +13,10 @@
#include "cmMakefile.h"
-cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf)
+cmLocalCommonGenerator::cmLocalCommonGenerator(
+ cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd)
: cmLocalGenerator(gg, mf)
+ , WorkingDirectory(wd)
{
}
@@ -34,3 +35,49 @@ void cmLocalCommonGenerator::SetConfigName()
this->ConfigName = "";
}
}
+
+std::string cmLocalCommonGenerator::GetTargetFortranFlags(
+ cmGeneratorTarget const* target, std::string const& config)
+{
+ std::string flags;
+
+ // Enable module output if necessary.
+ if (const char* modout_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
+ this->AppendFlags(flags, modout_flag);
+ }
+
+ // Add a module output directory flag if necessary.
+ std::string mod_dir = target->GetFortranModuleDirectory();
+ if (!mod_dir.empty()) {
+ mod_dir =
+ this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
+ } else {
+ mod_dir =
+ this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
+ }
+ if (!mod_dir.empty()) {
+ const char* moddir_flag =
+ this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
+ std::string modflag = moddir_flag;
+ modflag += mod_dir;
+ this->AppendFlags(flags, modflag);
+ }
+
+ // If there is a separate module path flag then duplicate the
+ // include path with it. This compiler does not search the include
+ // path for modules.
+ if (const char* modpath_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
+ std::vector<std::string> includes;
+ this->GetIncludeDirectories(includes, target, "C", config);
+ for (std::vector<std::string>::const_iterator idi = includes.begin();
+ idi != includes.end(); ++idi) {
+ std::string flg = modpath_flag;
+ flg += this->ConvertToOutputFormat(*idi, cmOutputConverter::SHELL);
+ this->AppendFlags(flags, flg);
+ }
+ }
+
+ return flags;
+}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index d282054..0a8753d 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,12 +22,23 @@ class cmCommonTargetGenerator;
class cmLocalCommonGenerator : public cmLocalGenerator
{
public:
- cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
- ~cmLocalCommonGenerator();
+ cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf,
+ cmOutputConverter::RelativeRoot wd);
+ ~cmLocalCommonGenerator() CM_OVERRIDE;
std::string const& GetConfigName() { return this->ConfigName; }
+ cmOutputConverter::RelativeRoot GetWorkingDirectory() const
+ {
+ return this->WorkingDirectory;
+ }
+
+ std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+ std::string const& config) CM_OVERRIDE;
+
protected:
+ cmOutputConverter::RelativeRoot WorkingDirectory;
+
void SetConfigName();
std::string ConfigName;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e91eb46..de9e1e5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -45,6 +45,7 @@
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
: cmOutputConverter(makefile->GetStateSnapshot())
, StateSnapshot(makefile->GetStateSnapshot())
+ , DirectoryBacktrace(makefile->GetBacktrace())
{
this->GlobalGenerator = gg;
@@ -68,7 +69,7 @@ cmLocalGenerator::~cmLocalGenerator()
void cmLocalGenerator::IssueMessage(cmake::MessageType t,
std::string const& text) const
{
- this->Makefile->IssueMessage(t, text);
+ this->GetCMakeInstance()->IssueMessage(t, text, this->DirectoryBacktrace);
}
void cmLocalGenerator::ComputeObjectMaxPath()
@@ -175,7 +176,7 @@ void cmLocalGenerator::GenerateTestFiles()
// TODO: Use add_subdirectory instead?
fout << "subdirs(";
std::string outP = children[i].GetDirectory().GetCurrentBinary();
- fout << this->Convert(outP, START_OUTPUT);
+ fout << this->ConvertToRelativePath(outP, START_OUTPUT);
fout << ")" << std::endl;
}
}
@@ -271,7 +272,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Choose a default install configuration.
std::string default_config = config;
const char* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
- "DEBUG", 0 };
+ "DEBUG", CM_NULLPTR };
for (const char** c = default_order; *c && default_config.empty(); ++c) {
for (std::vector<std::string>::iterator i = configurationTypes.begin();
i != configurationTypes.end(); ++i) {
@@ -444,7 +445,7 @@ cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
if (ti != this->GeneratorTargets.end()) {
return *ti;
}
- return 0;
+ return CM_NULLPTR;
}
void cmLocalGenerator::ComputeTargetManifest()
@@ -507,7 +508,7 @@ static const char* ruleReplaceVars[] = {
"CMAKE_RANLIB",
"CMAKE_LINKER",
"CMAKE_CL_SHOWINCLUDES_PREFIX",
- 0
+ CM_NULLPTR
};
std::string cmLocalGenerator::ExpandRuleVariable(
@@ -625,16 +626,14 @@ std::string cmLocalGenerator::ExpandRuleVariable(
if (variable == "TARGET_VERSION_MAJOR") {
if (replaceValues.TargetVersionMajor) {
return replaceValues.TargetVersionMajor;
- } else {
- return "0";
}
+ return "0";
}
if (variable == "TARGET_VERSION_MINOR") {
if (replaceValues.TargetVersionMinor) {
return replaceValues.TargetVersionMinor;
- } else {
- return "0";
}
+ return "0";
}
if (replaceValues.Target) {
if (variable == "TARGET_BASE") {
@@ -643,9 +642,8 @@ std::string cmLocalGenerator::ExpandRuleVariable(
std::string::size_type pos = targetBase.rfind('.');
if (pos != targetBase.npos) {
return targetBase.substr(0, pos);
- } else {
- return targetBase;
}
+ return targetBase;
}
}
}
@@ -690,7 +688,9 @@ std::string cmLocalGenerator::ExpandRuleVariable(
}
}
if (variable == "CMAKE_COMMAND") {
- return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL);
+ return this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
+ SHELL);
}
std::vector<std::string> enabledLanguages =
this->GetState()->GetEnabledLanguages();
@@ -703,13 +703,13 @@ std::string cmLocalGenerator::ExpandRuleVariable(
std::string actualReplace = ruleReplaceVars[pos];
// If this is the compiler then look for the extra variable
// _COMPILER_ARG1 which must be the first argument to the compiler
- const char* compilerArg1 = 0;
- const char* compilerTarget = 0;
- const char* compilerOptionTarget = 0;
- const char* compilerExternalToolchain = 0;
- const char* compilerOptionExternalToolchain = 0;
- const char* compilerSysroot = 0;
- const char* compilerOptionSysroot = 0;
+ const char* compilerArg1 = CM_NULLPTR;
+ const char* compilerTarget = CM_NULLPTR;
+ const char* compilerOptionTarget = CM_NULLPTR;
+ const char* compilerExternalToolchain = CM_NULLPTR;
+ const char* compilerOptionExternalToolchain = CM_NULLPTR;
+ const char* compilerSysroot = CM_NULLPTR;
+ const char* compilerOptionSysroot = CM_NULLPTR;
if (actualReplace == "CMAKE_${LANG}_COMPILER") {
std::string arg1 = actualReplace + "_ARG1";
cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
@@ -812,9 +812,8 @@ const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
{
if (target) {
return target->GetProperty(prop);
- } else {
- return this->Makefile->GetProperty(prop);
}
+ return this->Makefile->GetProperty(prop);
}
void cmLocalGenerator::InsertRuleLauncher(std::string& s,
@@ -831,8 +830,8 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s,
std::string cmLocalGenerator::ConvertToIncludeReference(
std::string const& path, OutputFormat format, bool forceFullPaths)
{
- return this->ConvertToOutputForExisting(
- path, forceFullPaths ? FULL : START_OUTPUT, format);
+ static_cast<void>(forceFullPaths);
+ return this->ConvertToOutputForExisting(path, format);
}
std::string cmLocalGenerator::GetIncludeFlags(
@@ -871,7 +870,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
// normal flag is repeated for each directory.
std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
sysFlagVar += lang;
- const char* sysIncludeFlag = 0;
+ const char* sysIncludeFlag = CM_NULLPTR;
if (repeatFlag) {
sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar);
}
@@ -943,7 +942,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
cmGeneratorTarget const* target,
const std::string& config,
- const std::string& lang)
+ const std::string& lang) const
{
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines, config, lang);
@@ -1152,13 +1151,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
}
void cmLocalGenerator::GetTargetFlags(
- std::string& linkLibs, std::string& flags, std::string& linkFlags,
- std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target,
- bool useWatcomQuote)
+ const std::string& config, std::string& linkLibs, std::string& flags,
+ std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
+ cmGeneratorTarget* target, bool useWatcomQuote)
{
- std::string buildType =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- buildType = cmSystemTools::UpperCase(buildType);
+ const std::string buildType = cmSystemTools::UpperCase(config);
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
@@ -1188,7 +1185,8 @@ void cmLocalGenerator::GetTargetFlags(
if (sf->GetExtension() == "def") {
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- linkFlags += this->Convert(sf->GetFullPath(), FULL, SHELL);
+ linkFlags += this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL);
linkFlags += " ";
}
}
@@ -1273,6 +1271,112 @@ void cmLocalGenerator::GetTargetFlags(
}
}
+void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
+ std::string const& config,
+ std::string const& lang,
+ std::string& flags)
+{
+ cmMakefile* mf = this->GetMakefile();
+
+ // Add language-specific flags.
+ this->AddLanguageFlags(flags, lang, config);
+
+ if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
+ this->AppendFeatureOptions(flags, lang, "IPO");
+ }
+
+ this->AddArchitectureFlags(flags, target, lang, config);
+
+ if (lang == "Fortran") {
+ this->AppendFlags(flags, this->GetTargetFortranFlags(target, config));
+ }
+
+ this->AddCMP0018Flags(flags, target, lang, config);
+ this->AddVisibilityPresetFlags(flags, target, lang);
+ this->AppendFlags(flags, mf->GetDefineFlags());
+ this->AppendFlags(flags, this->GetFrameworkFlags(lang, config, target));
+ this->AddCompileOptions(flags, target, lang, config);
+}
+
+static std::string GetFrameworkFlags(const std::string& lang,
+ const std::string& config,
+ cmGeneratorTarget* target)
+{
+ cmLocalGenerator* lg = target->GetLocalGenerator();
+ cmMakefile* mf = lg->GetMakefile();
+
+ if (!mf->IsOn("APPLE")) {
+ return std::string();
+ }
+
+ std::string fwSearchFlagVar = "CMAKE_" + lang + "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag = mf->GetDefinition(fwSearchFlagVar);
+ if (!(fwSearchFlag && *fwSearchFlag)) {
+ return std::string();
+ }
+
+ 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;
+
+ lg->GetIncludeDirectories(includes, target, "C", config);
+ // check all include directories for frameworks as this
+ // will already have added a -F for the framework
+ for (std::vector<std::string>::iterator i = includes.begin();
+ i != includes.end(); ++i) {
+ if (lg->GetGlobalGenerator()->NameResolvesToFramework(*i)) {
+ std::string frameworkDir = *i;
+ frameworkDir += "/../";
+ frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ emitted.insert(frameworkDir);
+ }
+ }
+
+ std::string flags;
+ if (cmComputeLinkInformation* cli = target->GetLinkInformation(config)) {
+ std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
+ for (std::vector<std::string>::const_iterator i = frameworks.begin();
+ i != frameworks.end(); ++i) {
+ if (emitted.insert(*i).second) {
+ flags += fwSearchFlag;
+ flags += lg->ConvertToOutputFormat(*i, cmOutputConverter::SHELL);
+ flags += " ";
+ }
+ }
+ }
+ return flags;
+}
+
+std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
+ std::string const& config,
+ cmGeneratorTarget* target)
+{
+ return ::GetFrameworkFlags(l, config, target);
+}
+
+void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
+ std::string const& config,
+ std::string const& lang,
+ std::set<std::string>& defines) const
+{
+ // Add the export symbol definition for shared library objects.
+ if (const char* exportMacro = target->GetExportMacro()) {
+ this->AppendDefines(defines, exportMacro);
+ }
+
+ // Add preprocessor definitions for this target and configuration.
+ this->AddCompileDefinitions(defines, target, config, lang.c_str());
+}
+
+std::string cmLocalGenerator::GetTargetFortranFlags(
+ cmGeneratorTarget const* /*unused*/, std::string const& /*unused*/)
+{
+ // Implemented by specific generators that override this.
+ return std::string();
+}
+
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
OutputFormat format)
{
@@ -1292,7 +1396,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
sp += lib.substr(pos);
// Convert to an output path.
- return this->Convert(sp.c_str(), NONE, format);
+ return this->ConvertToOutputFormat(sp.c_str(), format);
}
}
}
@@ -1350,7 +1454,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n"
"For compatibility with older versions of CMake, "
"additional flags may be added to export symbols on all "
- "executables regardless of thier ENABLE_EXPORTS property.";
+ "executables regardless of their ENABLE_EXPORTS property.";
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
@@ -1388,7 +1492,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
fdi != fwDirs.end(); ++fdi) {
frameworkPath += fwSearchFlag;
- frameworkPath += this->Convert(*fdi, NONE, shellFormat);
+ frameworkPath += this->ConvertToOutputFormat(*fdi, shellFormat);
frameworkPath += " ";
}
}
@@ -1398,7 +1502,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
libDir != libDirs.end(); ++libDir) {
std::string libpath =
- this->ConvertToOutputForExisting(*libDir, START_OUTPUT, shellFormat);
+ this->ConvertToOutputForExisting(*libDir, shellFormat);
linkPath += " " + libPathFlag;
linkPath += libpath;
linkPath += libPathTerminator;
@@ -1434,7 +1538,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
ri != runtimeDirs.end(); ++ri) {
rpath += cli.GetRuntimeFlag();
- rpath += this->Convert(*ri, NONE, shellFormat);
+ rpath += this->ConvertToOutputFormat(*ri, shellFormat);
rpath += " ";
}
fout << rpath;
@@ -1475,16 +1579,12 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
const std::string& config)
{
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
- if (!this->Makefile->IsOn("APPLE")) {
- return;
- }
-
- if (this->EmitUniversalBinaryFlags) {
+ if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) {
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
if (sysroot && sysroot[0] == '/' && !sysroot[1]) {
- sysroot = 0;
+ sysroot = CM_NULLPTR;
}
std::string sysrootFlagVar =
std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
@@ -1508,7 +1608,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
flags += " ";
flags += sysrootFlag;
flags += " ";
- flags += this->Convert(sysroot, NONE, SHELL);
+ flags += this->ConvertToOutputFormat(sysroot, SHELL);
}
if (deploymentTargetFlag && *deploymentTargetFlag && deploymentTarget &&
@@ -1824,7 +1924,7 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
}
std::string warnCMP0063;
- std::string* pWarnCMP0063 = 0;
+ std::string* pWarnCMP0063 = CM_NULLPTR;
if (target->GetType() != cmState::SHARED_LIBRARY &&
target->GetType() != cmState::MODULE_LIBRARY &&
!target->IsExecutableWithExports()) {
@@ -1935,7 +2035,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
std::string const& lang,
int targetType)
{
- const char* picFlags = 0;
+ const char* picFlags = CM_NULLPTR;
if (targetType == cmState::EXECUTABLE) {
std::string flagsVar = "CMAKE_";
@@ -1999,7 +2099,7 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
}
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
- const char* defines_list)
+ const char* defines_list) const
{
// Short-circuit if there are no definitions.
if (!defines_list) {
@@ -2013,7 +2113,8 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
}
void cmLocalGenerator::AppendDefines(
- std::set<std::string>& defines, const std::vector<std::string>& defines_vec)
+ std::set<std::string>& defines,
+ const std::vector<std::string>& defines_vec) const
{
for (std::vector<std::string>::const_iterator di = defines_vec.begin();
di != defines_vec.end(); ++di) {
@@ -2115,7 +2216,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
}
snp = snp.GetBuildsystemDirectoryParent();
}
- return 0;
+ return CM_NULLPTR;
}
std::string cmLocalGenerator::GetProjectName() const
@@ -2139,7 +2240,8 @@ std::string cmLocalGenerator::ConstructComment(
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
o != ccg.GetOutputs().end(); ++o) {
comment += sep;
- comment += this->Convert(*o, cmOutputConverter::START_OUTPUT);
+ comment +=
+ this->ConvertToRelativePath(*o, cmOutputConverter::START_OUTPUT);
sep = ", ";
}
return comment;
@@ -2178,7 +2280,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Include the user-specified pre-install script for this target.
if (const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT")) {
- cmInstallScriptGenerator g(preinstall, false, 0, false);
+ cmInstallScriptGenerator g(preinstall, false, CM_NULLPTR, false);
g.Generate(os, config, configurationTypes);
}
@@ -2231,7 +2333,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Include the user-specified post-install script for this target.
if (const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT")) {
- cmInstallScriptGenerator g(postinstall, false, 0, false);
+ cmInstallScriptGenerator g(postinstall, false, CM_NULLPTR, false);
g.Generate(os, config, configurationTypes);
}
}
@@ -2263,10 +2365,9 @@ static bool cmLocalGeneratorShortenObjectName(std::string& objName,
// The object name is now short enough.
return true;
- } else {
- // The object name could not be shortened enough.
- return false;
}
+ // The object name could not be shortened enough.
+ return false;
}
bool cmLocalGeneratorCheckObjectName(std::string& objName,
@@ -2280,15 +2381,13 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
if (objName.size() > max_obj_len) {
// The current object file name is too long. Try to shorten it.
return cmLocalGeneratorShortenObjectName(objName, max_obj_len);
- } else {
- // The object file name is short enough.
- return true;
}
- } else {
- // The build directory in which the object will be stored is
- // already too deep.
- return false;
+ // The object file name is short enough.
+ return true;
}
+ // The build directory in which the object will be stored is
+ // already too deep.
+ return false;
}
#endif
@@ -2376,7 +2475,8 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
}
void cmLocalGenerator::ComputeObjectFilenames(
- std::map<cmSourceFile const*, std::string>&, cmGeneratorTarget const*)
+ std::map<cmSourceFile const*, std::string>& /*unused*/,
+ cmGeneratorTarget const* /*unused*/)
{
}
@@ -2409,13 +2509,14 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
const char* fullPath = source.GetFullPath().c_str();
// Try referencing the source relative to the source tree.
- std::string relFromSource = this->Convert(fullPath, START);
+ std::string relFromSource = this->ConvertToRelativePath(fullPath, START);
assert(!relFromSource.empty());
bool relSource = !cmSystemTools::FileIsFullPath(relFromSource.c_str());
bool subSource = relSource && relFromSource[0] != '.';
// Try referencing the source relative to the binary tree.
- std::string relFromBinary = this->Convert(fullPath, START_OUTPUT);
+ std::string relFromBinary =
+ this->ConvertToRelativePath(fullPath, START_OUTPUT);
assert(!relFromBinary.empty());
bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary.c_str());
bool subBinary = relBinary && relFromBinary[0] != '.';
@@ -2511,7 +2612,7 @@ const char* cmLocalGenerator::GetCurrentSourceDirectory() const
}
std::string cmLocalGenerator::GetTargetDirectory(
- const cmGeneratorTarget*) const
+ const cmGeneratorTarget* /*unused*/) const
{
cmSystemTools::Error("GetTargetDirectory"
" called on cmLocalGenerator");
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 5c603a6..fa4bb30 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -138,13 +138,15 @@ public:
* Encode a list of preprocessor definitions for the compiler
* command line.
*/
- void AppendDefines(std::set<std::string>& defines, const char* defines_list);
- void AppendDefines(std::set<std::string>& defines, std::string defines_list)
+ void AppendDefines(std::set<std::string>& defines,
+ const char* defines_list) const;
+ void AppendDefines(std::set<std::string>& defines,
+ std::string defines_list) const
{
this->AppendDefines(defines, defines_list.c_str());
}
void AppendDefines(std::set<std::string>& defines,
- const std::vector<std::string>& defines_vec);
+ const std::vector<std::string>& defines_vec) const;
/**
* Join a set of defines into a definesString with a space separator.
@@ -200,7 +202,7 @@ public:
void AddCompileDefinitions(std::set<std::string>& defines,
cmGeneratorTarget const* target,
const std::string& config,
- const std::string& lang);
+ const std::string& lang) const;
std::string GetProjectName() const;
@@ -298,9 +300,9 @@ public:
std::string ConstructComment(cmCustomCommandGenerator const& ccg,
const char* default_comment = "");
// Compute object file names.
- std::string GetObjectFileNameWithoutTarget(const cmSourceFile& source,
- std::string const& dir_max,
- bool* hasSourceExtension = 0);
+ std::string GetObjectFileNameWithoutTarget(
+ const cmSourceFile& source, std::string const& dir_max,
+ bool* hasSourceExtension = CM_NULLPTR);
/** Fill out the static linker flags for the given target. */
void GetStaticLibraryFlags(std::string& flags, std::string const& config,
@@ -308,14 +310,26 @@ public:
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
- void GetTargetFlags(std::string& linkLibs, std::string& flags,
- std::string& linkFlags, std::string& frameworkPath,
- std::string& linkPath, cmGeneratorTarget* target,
- bool useWatcomQuote);
+ void GetTargetFlags(const std::string& config, std::string& linkLibs,
+ std::string& flags, std::string& linkFlags,
+ std::string& frameworkPath, std::string& linkPath,
+ cmGeneratorTarget* target, bool useWatcomQuote);
+ void GetTargetDefines(cmGeneratorTarget const* target,
+ std::string const& config, std::string const& lang,
+ std::set<std::string>& defines) const;
+ void GetTargetCompileFlags(cmGeneratorTarget* target,
+ std::string const& config,
+ std::string const& lang, std::string& flags);
+
+ std::string GetFrameworkFlags(std::string const& l,
+ std::string const& config,
+ cmGeneratorTarget* target);
+ virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+ std::string const& config);
virtual void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
- cmGeneratorTarget const* gt = 0);
+ cmGeneratorTarget const* gt = CM_NULLPTR);
bool IsWindowsShell() const;
bool IsWatcomWMake() const;
@@ -364,6 +378,7 @@ protected:
cmMakefile* Makefile;
cmState::Snapshot StateSnapshot;
+ cmListFileBacktrace DirectoryBacktrace;
cmGlobalGenerator* GlobalGenerator;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 6c231c3..d15ee22 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -25,7 +25,7 @@
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf)
+ : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
@@ -41,7 +41,7 @@ void cmLocalNinjaGenerator::Generate()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath = this->Convert(
+ this->HomeRelativeOutputPath = this->ConvertToRelativePath(
this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
@@ -81,8 +81,9 @@ void cmLocalNinjaGenerator::Generate()
tg->Generate();
// Add the target to "all" if required.
if (!this->GetGlobalNinjaGenerator()->IsExcluded(
- this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t))
+ this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) {
this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t);
+ }
delete tg;
}
}
@@ -131,9 +132,11 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
std::string const& path, cmOutputConverter::OutputFormat format,
bool forceFullPaths)
{
- return this->Convert(path, forceFullPaths ? cmOutputConverter::FULL
- : cmOutputConverter::HOME_OUTPUT,
- format);
+ if (forceFullPaths) {
+ return this->ConvertToOutputFormat(cmSystemTools::CollapseFullPath(path),
+ format);
+ }
+ return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format);
}
// Private methods.
@@ -257,8 +260,9 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
os << "# Write statements declared in CMakeLists.txt:" << std::endl
<< "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE")
<< std::endl;
- if (this->IsRootMakefile())
+ if (this->IsRootMakefile()) {
os << "# Which is the root file." << std::endl;
+ }
cmGlobalNinjaGenerator::WriteDivider(os);
os << std::endl;
}
@@ -282,9 +286,10 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(
for (std::vector<std::string>::const_iterator i = deps.begin();
i != deps.end(); ++i) {
std::string dep;
- if (this->GetRealDependency(*i, this->GetConfigName(), dep))
+ if (this->GetRealDependency(*i, this->GetConfigName(), dep)) {
ninjaDeps.push_back(
this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(dep));
+ }
}
}
@@ -294,12 +299,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
// If we have no commands but we need to build a command anyway, use ":".
// This happens when building a POST_BUILD value for link targets that
// don't use POST_BUILD.
- if (cmdLines.empty())
+ if (cmdLines.empty()) {
#ifdef _WIN32
return "cd .";
#else
return ":";
#endif
+ }
std::ostringstream cmd;
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
@@ -332,8 +338,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
{
if (ccg.GetNumberOfCommands() > 0) {
std::string wd = ccg.GetWorkingDirectory();
- if (wd.empty())
+ if (wd.empty()) {
wd = this->GetCurrentBinaryDirectory();
+ }
std::ostringstream cdCmd;
#ifdef _WIN32
@@ -361,8 +368,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps)
{
- if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc))
+ if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) {
return;
+ }
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this);
@@ -391,8 +399,9 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->AppendCustomCommandDeps(ccg, ninjaDeps);
for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end();
- ++i)
+ ++i) {
this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i);
+ }
std::vector<std::string> cmdLines;
this->AppendCustomCommandLines(ccg, cmdLines);
@@ -405,7 +414,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
} else {
this->GetGlobalNinjaGenerator()->WriteCustomCommandBuild(
this->BuildCommandLine(cmdLines), this->ConstructComment(ccg),
- "Custom command for " + ninjaOutputs[0], cc->GetUsesTerminal(),
+ "Custom command for " + ninjaOutputs[0], cc->GetDepfile(),
+ cc->GetUsesTerminal(),
/*restat*/ !symbolic || !byproducts.empty(), ninjaOutputs, ninjaDeps,
orderOnlyDeps);
}
@@ -443,13 +453,14 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
assert(j != i->second.end());
std::vector<std::string> ccTargetDeps;
- this->AppendTargetDepends(*j, ccTargetDeps);
+ this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j,
+ ccTargetDeps);
std::sort(ccTargetDeps.begin(), ccTargetDeps.end());
++j;
for (; j != i->second.end(); ++j) {
std::vector<std::string> jDeps, depsIntersection;
- this->AppendTargetDepends(*j, jDeps);
+ this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j, jDeps);
std::sort(jDeps.begin(), jDeps.end());
std::set_intersection(ccTargetDeps.begin(), ccTargetDeps.end(),
jDeps.begin(), jDeps.end(),
@@ -478,12 +489,13 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
- cmOutputConverter::RelativeRoot relative_root =
- ccg.GetWorkingDirectory().empty() ? cmOutputConverter::START_OUTPUT
- : cmOutputConverter::NONE;
-
- output =
- this->Convert(outputs[0], relative_root, cmOutputConverter::SHELL);
+ if (ccg.GetWorkingDirectory().empty()) {
+ output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+ } else {
+ output =
+ this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL);
+ }
}
vars.Output = output.c_str();
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 9899360..6e61087 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -34,12 +34,12 @@ class cmLocalNinjaGenerator : public cmLocalCommonGenerator
public:
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
- virtual ~cmLocalNinjaGenerator();
+ ~cmLocalNinjaGenerator() CM_OVERRIDE;
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
- virtual std::string GetTargetDirectory(
- cmGeneratorTarget const* target) const;
+ std::string GetTargetDirectory(cmGeneratorTarget const* target) const
+ CM_OVERRIDE;
const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const;
cmGlobalNinjaGenerator* GetGlobalNinjaGenerator();
@@ -72,19 +72,19 @@ public:
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
cmNinjaDeps& ninjaDeps);
- virtual std::string ConvertToLinkReference(
- std::string const& lib,
- cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
+ std::string ConvertToLinkReference(std::string const& lib,
+ cmOutputConverter::OutputFormat format =
+ cmOutputConverter::SHELL) CM_OVERRIDE;
- virtual void ComputeObjectFilenames(
+ void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
- cmGeneratorTarget const* gt = 0);
+ cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
protected:
- virtual std::string ConvertToIncludeReference(
+ std::string ConvertToIncludeReference(
std::string const& path,
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
- bool forceFullPaths = false);
+ bool forceFullPaths = false) CM_OVERRIDE;
private:
cmGeneratedFileStream& GetBuildFileStream() const;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f60a595..3c4841e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -30,8 +30,8 @@
#include "cmDependsJava.h"
#endif
+#include <cm_auto_ptr.hxx>
#include <cmsys/Terminal.h>
-#include <cmsys/auto_ptr.hxx>
#include <algorithm>
#include <queue>
@@ -84,7 +84,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
cmGlobalGenerator* gg, cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf)
+ : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
@@ -121,7 +121,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
continue;
}
- cmsys::auto_ptr<cmMakefileTargetGenerator> tg(
+ CM_AUTO_PTR<cmMakefileTargetGenerator> tg(
cmMakefileTargetGenerator::New(*t));
if (tg.get()) {
tg->WriteRuleFiles();
@@ -140,7 +140,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath = this->Convert(
+ this->HomeRelativeOutputPath = this->ConvertToRelativePath(
this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
@@ -340,8 +340,8 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
std::vector<std::string> depends;
depends.push_back(output);
std::vector<std::string> no_commands;
- this->WriteMakeRule(ruleFileStream, 0, outNoExt, depends, no_commands,
- true, true);
+ this->WriteMakeRule(ruleFileStream, CM_NULLPTR, outNoExt, depends,
+ no_commands, true, true);
inHelp = false;
}
@@ -358,7 +358,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
}
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
// Write the rule to the makefile.
std::vector<std::string> no_depends;
@@ -398,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefile2.c_str(), localName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
localName, depends, commands, true);
@@ -423,7 +423,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName, depends, commands, true);
@@ -439,7 +439,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.",
localName, depends, commands, true);
@@ -592,8 +592,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
}
}
-std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand(
- std::string const& cmd, cmOutputConverter::RelativeRoot root)
+std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
+ std::string const& cmd)
{
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos) {
@@ -602,11 +602,10 @@ std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand(
// lines with shell redirection operators.
std::string scmd;
if (cmSystemTools::GetShortPath(cmd, scmd)) {
- return this->Convert(scmd, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ return this->ConvertToOutputFormat(scmd, cmOutputConverter::SHELL);
}
}
- return this->Convert(cmd, root, cmOutputConverter::SHELL);
+ return std::string();
}
void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
@@ -638,19 +637,25 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
#endif
}
+ std::string cmakeShellCommand =
+ this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand());
+ if (cmakeShellCommand.empty()) {
+ cmakeShellCommand = this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
+ cmOutputConverter::SHELL);
+ }
+
/* clang-format off */
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(),
- cmOutputConverter::FULL)
+ << cmakeShellCommand
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
- << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(),
- cmOutputConverter::FULL)
+ << cmakeShellCommand
<< " -E remove -f\n"
<< "\n";
makefileStream
@@ -660,16 +665,16 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
makefileStream
<< "# The top-level source directory on which CMake was run.\n"
<< "CMAKE_SOURCE_DIR = "
- << this->Convert(this->GetSourceDirectory(),
- cmOutputConverter::FULL,
+ << this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(this->GetSourceDirectory()),
cmOutputConverter::SHELL)
<< "\n"
<< "\n";
makefileStream
<< "# The top-level build directory on which CMake was run.\n"
<< "CMAKE_BINARY_DIR = "
- << this->Convert(this->GetBinaryDirectory(),
- cmOutputConverter::FULL,
+ << this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(this->GetBinaryDirectory()),
cmOutputConverter::SHELL)
<< "\n"
<< "\n";
@@ -703,8 +708,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
// Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make.
std::vector<std::string> depends;
depends.push_back(".hpux_make_needs_suffix_list");
- this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands,
- false);
+ this->WriteMakeRule(makefileStream, CM_NULLPTR, ".SUFFIXES", depends,
+ no_commands, false);
if (this->IsWatcomWMake()) {
// Switch on WMake feature, if an error or interrupt occurs during
// makefile processing, the current target being made may be deleted
@@ -784,8 +789,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ runRule +=
+ this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
runRule += " 0";
std::vector<std::string> no_depends;
@@ -793,7 +798,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
commands.push_back(runRule);
if (!this->IsRootMakefile()) {
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
}
this->WriteMakeRule(
makefileStream, "Special rule to run CMake to check the build system "
@@ -829,8 +834,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(
{
std::string dir = this->HomeRelativeOutputPath;
dir += this->GetTargetDirectory(target);
- return this->Convert(dir, cmOutputConverter::NONE,
- cmOutputConverter::UNCHANGED);
+ return dir;
}
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
@@ -900,19 +904,19 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend(
void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
std::vector<std::string>& commands, const std::vector<cmCustomCommand>& ccs,
- cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative)
+ cmGeneratorTarget* target, std::string const& relative)
{
for (std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i) {
cmCustomCommandGenerator ccg(*i, this->ConfigName, this);
- this->AppendCustomCommand(commands, ccg, target, true, relative);
+ this->AppendCustomCommand(commands, ccg, target, relative, true);
}
}
void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
- cmGeneratorTarget* target, bool echo_comment,
- cmOutputConverter::RelativeRoot relative, std::ostream* content)
+ cmGeneratorTarget* target, std::string const& relative, bool echo_comment,
+ std::ostream* content)
{
// Optionally create a command to display the custom command's
// comment text. This is used for pre-build, pre-link, and
@@ -962,7 +966,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != cmd.npos;
if (workingDir.empty()) {
- cmd = this->Convert(cmd, cmOutputConverter::START_OUTPUT);
+ cmd =
+ this->ConvertToRelativePath(cmd, cmOutputConverter::START_OUTPUT);
}
bool has_slash = cmd.find('/') != cmd.npos;
if (had_slash && !has_slash) {
@@ -971,10 +976,43 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// without the current directory being in the search path.
cmd = "./" + cmd;
}
- std::string launcher = this->MakeLauncher(
- ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT
- : cmOutputConverter::NONE);
- cmd = launcher + this->ConvertShellCommand(cmd, cmOutputConverter::NONE);
+
+ std::string launcher;
+ // Short-circuit if there is no launcher.
+ const char* prop = "RULE_LAUNCH_CUSTOM";
+ const char* val = this->GetRuleLauncher(target, prop);
+ if (val && *val) {
+ // Expand rules in the empty string. It may insert the launcher and
+ // perform replacements.
+ RuleVariables vars;
+ vars.RuleLauncher = prop;
+ vars.CMTarget = target;
+ std::string output;
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
+ if (!outputs.empty()) {
+ if (workingDir.empty()) {
+ output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+
+ } else {
+ output = this->ConvertToOutputFormat(outputs[0],
+ cmOutputConverter::SHELL);
+ }
+ }
+ vars.Output = output.c_str();
+
+ this->ExpandRuleVariables(launcher, vars);
+ if (!launcher.empty()) {
+ launcher += " ";
+ }
+ }
+
+ std::string shellCommand = this->MaybeConvertWatcomShellCommand(cmd);
+ if (shellCommand.empty()) {
+ shellCommand =
+ this->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL);
+ }
+ cmd = launcher + shellCommand;
ccg.AppendArguments(c, cmd);
if (content) {
@@ -1017,37 +1055,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
commands.insert(commands.end(), commands1.begin(), commands1.end());
}
-std::string cmLocalUnixMakefileGenerator3::MakeLauncher(
- cmCustomCommandGenerator const& ccg, cmGeneratorTarget* target,
- cmOutputConverter::RelativeRoot relative)
-{
- // Short-circuit if there is no launcher.
- const char* prop = "RULE_LAUNCH_CUSTOM";
- const char* val = this->GetRuleLauncher(target, prop);
- if (!(val && *val)) {
- return "";
- }
-
- // Expand rules in the empty string. It may insert the launcher and
- // perform replacements.
- RuleVariables vars;
- vars.RuleLauncher = prop;
- vars.CMTarget = target;
- std::string output;
- const std::vector<std::string>& outputs = ccg.GetOutputs();
- if (!outputs.empty()) {
- output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL);
- }
- vars.Output = output.c_str();
-
- std::string launcher;
- this->ExpandRuleVariables(launcher, vars);
- if (!launcher.empty()) {
- launcher += " ";
- }
- return launcher;
-}
-
void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::vector<std::string>& commands, const std::vector<std::string>& files,
cmGeneratorTarget* target, const char* filename)
@@ -1061,8 +1068,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
cleanfile += filename;
}
cleanfile += ".cmake";
- std::string cleanfilePath =
- this->Convert(cleanfile, cmOutputConverter::FULL);
+ std::string cleanfilePath = cmSystemTools::CollapseFullPath(cleanfile);
cmsys::ofstream fout(cleanfilePath.c_str());
if (!fout) {
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
@@ -1071,8 +1077,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
fout << "file(REMOVE_RECURSE\n";
for (std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
- std::string fc = this->Convert(*f, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ std::string fc =
+ this->ConvertToRelativePath(*f, cmOutputConverter::START_OUTPUT);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
@@ -1148,8 +1154,9 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
cmd += color_name;
if (progress) {
cmd += "--progress-dir=";
- cmd += this->Convert(progress->Dir, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ cmd += this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progress->Dir),
+ cmOutputConverter::SHELL);
cmd += " ";
cmd += "--progress-num=";
cmd += progress->Arg;
@@ -1164,7 +1171,7 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
line = "";
// Progress appears only on first line.
- progress = 0;
+ progress = CM_NULLPTR;
// Terminate on end-of-string.
if (*c == '\0') {
@@ -1322,7 +1329,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
// not be considered.
std::map<std::string, cmDepends::DependencyVector> validDependencies;
bool needRescanDependencies = false;
- if (needRescanDirInfo == false) {
+ if (!needRescanDirInfo) {
cmDependsC checker;
checker.SetVerbose(verbose);
checker.SetFileComparison(ftc);
@@ -1433,7 +1440,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
std::string lang = *li;
// Create the scanner for this language
- cmDepends* scanner = 0;
+ cmDepends* scanner = CM_NULLPTR;
if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM") {
// TODO: Handle RC (resource files) dependencies correctly.
scanner = new cmDependsC(this, targetDir, lang, &validDeps);
@@ -1558,9 +1565,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
this->AppendCustomDepends(depends, gt->GetPreBuildCommands());
this->AppendCustomDepends(depends, gt->GetPostBuildCommands());
this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt,
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), gt,
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
std::string targetName = gt->GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName,
depends, commands, true);
@@ -1597,15 +1604,16 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
- progCmd << this->Convert(progressDir, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ progCmd << this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory();
progressFile += "/progress.marks";
std::string progressFileNameFull = this->ConvertToFullPath(progressFile);
progCmd << " "
- << this->Convert(progressFileNameFull, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ << this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progressFileNameFull),
+ cmOutputConverter::SHELL);
commands.push_back(progCmd.str());
}
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -1613,12 +1621,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << this->Convert(progressDir, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ progCmd << this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL);
progCmd << " 0";
commands.push_back(progCmd.str());
}
@@ -1633,7 +1641,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
depends, commands, true);
commands.clear();
@@ -1659,7 +1667,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
"preinstall", depends, commands, true);
depends.clear();
@@ -1674,12 +1682,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ runRule +=
+ this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
runRule += " 1";
commands.push_back(runRule);
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmOutputConverter::START_OUTPUT);
+ this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
commands, true);
}
@@ -1846,7 +1854,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) {
cmakefileStream << " \""
- << this->Convert(*i, cmOutputConverter::HOME_OUTPUT)
+ << this->ConvertToRelativePath(
+ *i, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n";
@@ -1888,8 +1897,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
// Call make on the given file.
std::string cmd;
cmd += "$(MAKE) -f ";
- cmd +=
- this->Convert(makefile, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ cmd += this->ConvertToOutputFormat(makefile, cmOutputConverter::SHELL);
cmd += " ";
cmGlobalUnixMakefileGenerator3* gg =
@@ -1911,7 +1919,8 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
// Add the target.
if (!tgt.empty()) {
// The make target is always relative to the top of the build tree.
- std::string tgt2 = this->Convert(tgt, cmOutputConverter::HOME_OUTPUT);
+ std::string tgt2 =
+ this->ConvertToRelativePath(tgt, cmOutputConverter::HOME_OUTPUT);
// The target may have been written with windows paths.
cmSystemTools::ConvertToOutputSlashes(tgt2);
@@ -2046,12 +2055,10 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
std::vector<std::string>& commands, const char* tgtDir,
- cmOutputConverter::RelativeRoot relRetDir)
+ std::string const& relDir)
{
- const char* retDir = this->GetRelativeRootPath(relRetDir);
-
// do we need to cd?
- if (!strcmp(tgtDir, retDir)) {
+ if (tgtDir == relDir) {
return;
}
@@ -2068,19 +2075,18 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
// back because the shell keeps the working directory between
// commands.
std::string cmd = cd_cmd;
- cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir);
+ cmd += this->ConvertToOutputForExisting(tgtDir);
commands.insert(commands.begin(), cmd);
// Change back to the starting directory.
cmd = cd_cmd;
- cmd += this->ConvertToOutputForExisting(relRetDir, tgtDir);
+ cmd += this->ConvertToOutputForExisting(relDir);
commands.push_back(cmd);
} else {
// On UNIX we must construct a single shell command to change
// directory and build because make resets the directory between
// each command.
- std::string outputForExisting =
- this->ConvertToOutputForExisting(tgtDir, relRetDir);
+ std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir);
std::string prefix = cd_cmd + outputForExisting + " && ";
std::transform(commands.begin(), commands.end(), commands.begin(),
std::bind1st(std::plus<std::string>(), prefix));
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index a65a1a1..3e90055 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -33,14 +33,14 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
- virtual ~cmLocalUnixMakefileGenerator3();
+ ~cmLocalUnixMakefileGenerator3() CM_OVERRIDE;
- virtual void ComputeHomeRelativeOutputPath();
+ void ComputeHomeRelativeOutputPath() CM_OVERRIDE;
/**
* Generate the makefile for this directory.
*/
- virtual void Generate();
+ void Generate() CM_OVERRIDE;
// this returns the relative path between the HomeOutputDirectory and this
// local generators StartOutputDirectory
@@ -90,8 +90,9 @@ public:
const std::string& tgt);
// append flags to a string
- virtual void AppendFlags(std::string& flags, const std::string& newFlags);
- virtual void AppendFlags(std::string& flags, const char* newFlags);
+ void AppendFlags(std::string& flags,
+ const std::string& newFlags) CM_OVERRIDE;
+ void AppendFlags(std::string& flags, const char* newFlags) CM_OVERRIDE;
// append an echo command
enum EchoColor
@@ -109,18 +110,18 @@ public:
std::string Arg;
};
void AppendEcho(std::vector<std::string>& commands, std::string const& text,
- EchoColor color = EchoNormal, EchoProgress const* = 0);
+ EchoColor color = EchoNormal,
+ EchoProgress const* = CM_NULLPTR);
/** Get whether the makefile is to have color. */
bool GetColorMakefile() const { return this->ColorMakefile; }
- virtual std::string GetTargetDirectory(
- cmGeneratorTarget const* target) const;
+ std::string GetTargetDirectory(cmGeneratorTarget const* target) const
+ CM_OVERRIDE;
// create a command that cds to the start dir then runs the commands
void CreateCDCommand(std::vector<std::string>& commands,
- const char* targetDir,
- cmOutputConverter::RelativeRoot returnDir);
+ const char* targetDir, std::string const& relDir);
static std::string ConvertToQuotedOutputPath(const char* p,
bool useWatcomQuote);
@@ -130,11 +131,11 @@ public:
/** Called from command-line hook to bring dependencies up to date
for a target. */
- virtual bool UpdateDependencies(const char* tgtInfo, bool verbose,
- bool color);
+ bool UpdateDependencies(const char* tgtInfo, bool verbose,
+ bool color) CM_OVERRIDE;
/** Called from command-line hook to clear dependencies. */
- virtual void ClearDependencies(cmMakefile* mf, bool verbose);
+ void ClearDependencies(cmMakefile* mf, bool verbose) CM_OVERRIDE;
/** write some extra rules such as make test etc */
void WriteSpecialTargetsTop(std::ostream& makefileStream);
@@ -227,18 +228,20 @@ protected:
const std::vector<cmCustomCommand>& ccs);
void AppendCustomDepend(std::vector<std::string>& depends,
cmCustomCommandGenerator const& cc);
- void AppendCustomCommands(
- std::vector<std::string>& commands,
- const std::vector<cmCustomCommand>& ccs, cmGeneratorTarget* target,
- cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT);
- void AppendCustomCommand(
- std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
- cmGeneratorTarget* target, bool echo_comment = false,
- cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT,
- std::ostream* content = 0);
+ void AppendCustomCommands(std::vector<std::string>& commands,
+ const std::vector<cmCustomCommand>& ccs,
+ cmGeneratorTarget* target,
+ std::string const& relative);
+ void AppendCustomCommand(std::vector<std::string>& commands,
+ cmCustomCommandGenerator const& ccg,
+ cmGeneratorTarget* target,
+ std::string const& relative,
+ bool echo_comment = false,
+ std::ostream* content = CM_NULLPTR);
void AppendCleanCommand(std::vector<std::string>& commands,
const std::vector<std::string>& files,
- cmGeneratorTarget* target, const char* filename = 0);
+ cmGeneratorTarget* target,
+ const char* filename = CM_NULLPTR);
// Helper methods for dependeny updates.
bool ScanDependencies(
@@ -247,15 +250,11 @@ protected:
void CheckMultipleOutputs(bool verbose);
private:
- std::string ConvertShellCommand(std::string const& cmd,
- cmOutputConverter::RelativeRoot root);
- std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
- cmGeneratorTarget* target,
- cmOutputConverter::RelativeRoot relative);
+ std::string MaybeConvertWatcomShellCommand(std::string const& cmd);
- virtual void ComputeObjectFilenames(
+ void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
- cmGeneratorTarget const* gt = 0);
+ cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
friend class cmMakefileTargetGenerator;
friend class cmMakefileExecutableTargetGenerator;
@@ -272,7 +271,7 @@ private:
cmGeneratorTarget* Target;
std::string Language;
LocalObjectEntry()
- : Target(0)
+ : Target(CM_NULLPTR)
, Language()
{
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 6e7d7d2..70fe819 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -269,8 +269,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
args += this->GetBinaryDirectory();
commandLine.push_back(args);
commandLine.push_back("--check-stamp-file");
- std::string stampFilename = this->Convert(
- stampName.c_str(), cmOutputConverter::FULL, cmOutputConverter::SHELL);
+ std::string stampFilename = this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(stampName), cmOutputConverter::SHELL);
commandLine.push_back(stampFilename.c_str());
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
@@ -278,8 +278,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
cmCustomCommandLines commandLines;
commandLines.push_back(commandLine);
const char* no_working_directory = 0;
- std::string fullpathStampName = this->Convert(
- stampName.c_str(), cmOutputConverter::FULL, cmOutputConverter::UNCHANGED);
+ std::string fullpathStampName =
+ cmSystemTools::CollapseFullPath(stampName.c_str());
this->Makefile->AddCustomCommandToOutput(
fullpathStampName.c_str(), listFiles, makefileIn.c_str(), commandLines,
comment.c_str(), no_working_directory, true);
@@ -683,7 +683,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
if (this->FortranProject) {
- switch (this->GetFortranFormat(target->GetProperty("Fortran_FORMAT"))) {
+ switch (cmOutputConverter::GetFortranFormat(
+ target->GetProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
flags += " -fixed";
break;
@@ -787,8 +788,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir;
if (target_mod_dir) {
- modDir = this->Convert(target_mod_dir, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ modDir = this->ConvertToRelativePath(target_mod_dir,
+ cmOutputConverter::START_OUTPUT);
} else {
modDir = ".";
}
@@ -1012,7 +1013,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
- if (target->GetType() == cmState::SHARED_LIBRARY &&
+ if ((target->GetType() == cmState::SHARED_LIBRARY ||
+ target->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def");
@@ -1298,9 +1300,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
- std::string rel =
- lg->Convert(l->Value.c_str(), cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ std::string rel = lg->ConvertToRelativePath(
+ l->Value.c_str(), cmOutputConverter::START_OUTPUT);
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -1320,8 +1321,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
const char* sep = isep ? isep : "";
for (std::vector<std::string>::const_iterator oi = objs.begin();
oi != objs.end(); ++oi) {
- std::string rel = lg->Convert(oi->c_str(), cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ std::string rel =
+ lg->ConvertToRelativePath(oi->c_str(), cmOutputConverter::START_OUTPUT);
fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
sep = " ";
}
@@ -1344,9 +1345,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// Switch to a relative path specification if it is shorter.
if (cmSystemTools::FileIsFullPath(dir.c_str())) {
- std::string rel =
- this->Convert(dir.c_str(), cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ std::string rel = this->ConvertToRelativePath(
+ dir.c_str(), cmOutputConverter::START_OUTPUT);
if (rel.size() < dir.size()) {
dir = rel;
}
@@ -1474,7 +1474,8 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
needfc = true;
}
if (lg->FortranProject) {
- switch (lg->GetFortranFormat(sf.GetProperty("Fortran_FORMAT"))) {
+ switch (cmOutputConverter::GetFortranFormat(
+ sf.GetProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
fc.CompileFlags = "-fixed " + fc.CompileFlags;
needfc = true;
@@ -1686,12 +1687,12 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
ppLang);
}
if (!fc.AdditionalDeps.empty()) {
- fout << "\t\t\t\t\tAdditionalDependencies=\""
- << fc.AdditionalDeps.c_str() << "\"\n";
+ fout << "\t\t\t\t\tAdditionalDependencies=\"" << fc.AdditionalDeps
+ << "\"\n";
}
if (!fc.ObjectName.empty()) {
- fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/"
- << fc.ObjectName.c_str() << "\"\n";
+ fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" << fc.ObjectName
+ << "\"\n";
}
fout << "\t\t\t\t\t/>\n"
<< "\t\t\t\t</FileConfiguration>\n";
@@ -1834,7 +1835,8 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
tool = this->FortranProject ? "VFPreLinkEventTool" : "VCPreLinkEventTool";
event.Start(tool);
bool addedPrelink = false;
- if (target->GetType() == cmState::SHARED_LIBRARY &&
+ if ((target->GetType() == cmState::SHARED_LIBRARY ||
+ target->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
addedPrelink = true;
@@ -1848,7 +1850,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
if (!addedPrelink) {
event.Write(target->GetPreLinkCommands());
}
- cmsys::auto_ptr<cmCustomCommand> pcc(
+ CM_AUTO_PTR<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject));
if (pcc.get()) {
event.Write(*pcc);
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 85ab615..b492962 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -74,12 +74,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
}
}
-cmsys::auto_ptr<cmCustomCommand>
+CM_AUTO_PTR<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
const std::string& config,
bool isFortran)
{
- cmsys::auto_ptr<cmCustomCommand> pcc;
+ CM_AUTO_PTR<cmCustomCommand> pcc;
// If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory.
@@ -127,7 +127,6 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
{
bool useLocal = this->CustomCommandUseLocal();
std::string workingDirectory = ccg.GetWorkingDirectory();
- RelativeRoot relativeRoot = workingDirectory.empty() ? START_OUTPUT : NONE;
// Avoid leading or trailing newlines.
std::string newline = "";
@@ -156,7 +155,8 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
script += newline;
newline = newline_text;
script += "cd ";
- script += this->Convert(workingDirectory, FULL, SHELL);
+ script += this->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(workingDirectory), SHELL);
script += check_error;
// Change the working drive.
@@ -203,7 +203,11 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
}
}
- script += this->Convert(cmd.c_str(), relativeRoot, SHELL);
+ if (workingDirectory.empty()) {
+ script += this->Convert(cmd.c_str(), START_OUTPUT, SHELL);
+ } else {
+ script += this->ConvertToOutputFormat(cmd.c_str(), SHELL);
+ }
ccg.AppendArguments(c, script);
// After each custom command, check for an error result.
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index c24d813..87acda2 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -16,7 +16,7 @@
#include "cmGlobalVisualStudioGenerator.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
class cmSourceFile;
class cmSourceGroup;
@@ -59,8 +59,9 @@ protected:
virtual bool CustomCommandUseLocal() const { return false; }
/** Construct a custom command to make exe import lib dir. */
- cmsys::auto_ptr<cmCustomCommand> MaybeCreateImplibDir(
- cmGeneratorTarget* target, const std::string& config, bool isFortran);
+ CM_AUTO_PTR<cmCustomCommand> MaybeCreateImplibDir(cmGeneratorTarget* target,
+ const std::string& config,
+ bool isFortran);
};
#endif
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index e69c32e..f922c03 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -22,7 +22,7 @@ class cmLocaleRAII
public:
cmLocaleRAII()
- : OldLocale(setlocale(LC_CTYPE, 0))
+ : OldLocale(setlocale(LC_CTYPE, CM_NULLPTR))
{
setlocale(LC_CTYPE, "");
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 2caa401..9d312ee 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -21,7 +21,7 @@ public:
cmMacroHelperCommand() {}
///! clean up any memory allocated by the macro
- ~cmMacroHelperCommand() {}
+ ~cmMacroHelperCommand() CM_OVERRIDE {}
/**
* This is used to avoid including this command
@@ -29,12 +29,12 @@ public:
* cmMacroHelperCommand and cmFunctionHelperCommand
* which cannot provide appropriate documentation.
*/
- virtual bool ShouldAppearInDocumentation() const { return false; }
+ bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; }
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ cmCommand* Clone() CM_OVERRIDE
{
cmMacroHelperCommand* newC = new cmMacroHelperCommand;
// we must copy when we clone
@@ -48,16 +48,17 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&);
+ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus&) CM_OVERRIDE;
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -65,7 +66,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return this->Args[0]; }
+ std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
cmTypeMacro(cmMacroHelperCommand, cmCommand);
@@ -158,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass(
}
cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(newLFF, status) ||
- status.GetNestedError()) {
+ (cmSystemTools::GetErrorOccuredFlag() &&
+ !cmSystemTools::GetFatalErrorOccured())) {
// The error message should have already included the call stack
// so we do not need to report an error here.
macroScope.Quiet();
- inStatus.SetNestedError(true);
return false;
}
if (status.GetReturnInvoked()) {
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 11d2e1c..541b54f 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -20,10 +20,10 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker
{
public:
cmMacroFunctionBlocker() { this->Depth = 0; }
- virtual ~cmMacroFunctionBlocker() {}
- virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
- cmExecutionStatus&);
- virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf);
+ ~cmMacroFunctionBlocker() CM_OVERRIDE {}
+ bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
+ cmExecutionStatus&) CM_OVERRIDE;
+ bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE;
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -37,24 +37,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmMacroCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmMacroCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "macro"; }
+ std::string GetName() const CM_OVERRIDE { return "macro"; }
cmTypeMacro(cmMacroCommand, cmCommand);
};
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 1a86398..de4ab8b 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -29,24 +29,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmMakeDirectoryCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmMakeDirectoryCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "make_directory"; }
+ std::string GetName() const CM_OVERRIDE { return "make_directory"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmMakeDirectoryCommand, cmCommand);
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e684689..d1fddca 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -11,37 +11,45 @@
============================================================================*/
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
#include "cmCommand.h"
#include "cmCommandArgumentParserHelper.h"
-#include "cmCommands.h"
+#include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
+#include "cmExpandedCommandArgument.h"
+#include "cmFileLockPool.h"
#include "cmFunctionBlocker.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmGlobalGenerator.h"
+#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
-#include "cmOutputConverter.h"
+#include "cmMessenger.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmTest.h"
+#include "cmTestGenerator.h"
#include "cmVersion.h"
+#include "cmake.h"
+
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmVariableWatch.h"
#endif
-#include "cmAlgorithms.h"
-#include "cmInstallGenerator.h"
-#include "cmTestGenerator.h"
-#include "cmake.h"
-#include <stdlib.h> // required for atoi
+#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/auto_ptr.hxx>
+#include <algorithm>
#include <assert.h>
-#include <ctype.h> // for isspace
-#include <list>
+#include <ctype.h>
+#include <sstream>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
// default is not to be building executables
cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
@@ -105,16 +113,10 @@ cmMakefile::~cmMakefile()
cmDeleteAll(this->EvaluationFiles);
}
-void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text,
- bool force) const
+void cmMakefile::IssueMessage(cmake::MessageType t,
+ std::string const& text) const
{
- // Collect context information.
- if (!this->ExecutionStatusStack.empty()) {
- if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) {
- this->ExecutionStatusStack.back()->SetNestedError(true);
- }
- }
- this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace(), force);
+ this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
}
cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
@@ -175,8 +177,29 @@ cmListFileContext cmMakefile::GetExecutionContext() const
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
+ // Check if current file in the list of requested to trace...
+ std::vector<std::string> const& trace_only_this_files =
+ this->GetCMakeInstance()->GetTraceSources();
+ std::string const& full_path = this->GetExecutionFilePath();
+ std::string const& only_filename = cmSystemTools::GetFilenameName(full_path);
+ bool trace = trace_only_this_files.empty();
+ if (!trace) {
+ for (std::vector<std::string>::const_iterator i =
+ trace_only_this_files.begin();
+ !trace && i != trace_only_this_files.end(); ++i) {
+ std::string::size_type const pos = full_path.rfind(*i);
+ trace = (pos != std::string::npos) &&
+ ((pos + i->size()) == full_path.size()) &&
+ (only_filename == cmSystemTools::GetFilenameName(*i));
+ }
+ // Do nothing if current file wasn't requested for trace...
+ if (!trace) {
+ return;
+ }
+ }
+
std::ostringstream msg;
- msg << this->GetExecutionFilePath() << "(" << lff.Line << "): ";
+ msg << full_path << "(" << lff.Line << "): ";
msg << lff.Name << "(";
bool expand = this->GetCMakeInstance()->GetTraceExpand();
std::string temp;
@@ -240,7 +263,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Lookup the command prototype.
if (cmCommand* proto = this->GetState()->GetCommand(name)) {
// Clone the prototype.
- cmsys::auto_ptr<cmCommand> pcmd(proto->Clone());
+ CM_AUTO_PTR<cmCommand> pcmd(proto->Clone());
pcmd->SetMakefile(this);
// Decide whether to invoke the command.
@@ -253,10 +276,19 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
if (this->GetCMakeInstance()->GetTrace()) {
this->PrintCommandTrace(lff);
}
- // Try invoking the command.
- if (!pcmd->InvokeInitialPass(lff.Arguments, status) ||
- status.GetNestedError()) {
- if (!status.GetNestedError()) {
+
+ bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() &&
+ !cmSystemTools::GetFatalErrorOccured();
+ cmSystemTools::ResetErrorOccuredFlag();
+
+ bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status);
+ bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() &&
+ !cmSystemTools::GetFatalErrorOccured();
+ if (hadPreviousNonFatalError) {
+ cmSystemTools::SetErrorOccured();
+ }
+ if (!invokeSucceeded || hadNestedError) {
+ if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) {
// The command invocation requested that we report an error.
this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError());
}
@@ -426,7 +458,8 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
IncludeScope incScope(this, filenametoread, noPolicyScope);
cmListFile listFile;
- if (!listFile.ParseFile(filenametoread.c_str(), false, this)) {
+ if (!listFile.ParseFile(filenametoread.c_str(), this->GetMessenger(),
+ this->Backtrace)) {
return false;
}
@@ -475,7 +508,8 @@ bool cmMakefile::ReadListFile(const char* filename)
ListFileScope scope(this, filenametoread);
cmListFile listFile;
- if (!listFile.ParseFile(filenametoread.c_str(), false, this)) {
+ if (!listFile.ParseFile(filenametoread.c_str(), this->GetMessenger(),
+ this->Backtrace)) {
return false;
}
@@ -546,7 +580,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
case cmPolicies::WARN:
// Warn because the user did not provide a mimimum required
// version.
- this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
+ this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
+ msg.str(), this->Backtrace);
case cmPolicies::OLD:
// OLD behavior is to use policy version 2.4 set in
// cmListFileCache.
@@ -555,7 +590,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// NEW behavior is to issue an error.
- this->IssueMessage(cmake::FATAL_ERROR, msg.str());
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str(),
+ this->Backtrace);
cmSystemTools::SetFatalErrorOccured();
return;
}
@@ -564,9 +600,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
void cmMakefile::AddEvaluationFile(
const std::string& inputFile,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
- bool inputIsContent)
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent)
{
this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile(
inputFile, outputName, condition, inputIsContent));
@@ -651,12 +686,13 @@ void cmMakefile::ConfigureFinalPass()
const char* oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (oldValue &&
cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) {
- this->IssueMessage(
+ this->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR,
"You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less "
"than 2.4. This version of CMake only supports backwards compatibility "
"with CMake 2.4 or later. For compatibility with older versions please "
- "use any CMake 2.8.x release or lower.");
+ "use any CMake 2.8.x release or lower.",
+ this->Backtrace);
}
}
@@ -665,7 +701,7 @@ void cmMakefile::AddCustomCommandToTarget(
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
const char* comment, const char* workingDir, bool escapeOldStyle,
- bool uses_terminal)
+ bool uses_terminal, const std::string& depfile)
{
// Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target);
@@ -737,6 +773,7 @@ void cmMakefile::AddCustomCommandToTarget(
cc.SetEscapeOldStyle(escapeOldStyle);
cc.SetEscapeAllowMakeVars(true);
cc.SetUsesTerminal(uses_terminal);
+ cc.SetDepfile(depfile);
switch (type) {
case cmTarget::PRE_BUILD:
ti->second.AddPreBuildCommand(cc);
@@ -756,12 +793,12 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
const std::vector<std::string>& depends, const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace, bool escapeOldStyle,
- bool uses_terminal)
+ bool uses_terminal, const std::string& depfile)
{
// Make sure there is at least one output.
if (outputs.empty()) {
cmSystemTools::Error("Attempt to add a custom rule with no output!");
- return 0;
+ return CM_NULLPTR;
}
// Validate custom commands. TODO: More strict?
@@ -772,12 +809,12 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
std::ostringstream e;
e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
- return 0;
+ return CM_NULLPTR;
}
}
// Choose a source file on which to store the custom command.
- cmSourceFile* file = 0;
+ cmSourceFile* file = CM_NULLPTR;
if (!commandLines.empty() && !main_dependency.empty()) {
// The main dependency was specified. Use it unless a different
// custom command already used it.
@@ -788,11 +825,10 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
// The existing custom command is identical. Silently ignore
// the duplicate.
return file;
- } else {
- // The existing custom command is different. We need to
- // generate a rule file for this new command.
- file = 0;
}
+ // The existing custom command is different. We need to
+ // generate a rule file for this new command.
+ file = CM_NULLPTR;
} else if (!file) {
file = this->CreateSource(main_dependency);
}
@@ -851,6 +887,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
cc->SetEscapeOldStyle(escapeOldStyle);
cc->SetEscapeAllowMakeVars(true);
cc->SetUsesTerminal(uses_terminal);
+ cc->SetDepfile(depfile);
file->SetCustomCommand(cc);
this->UpdateOutputToSourceMap(outputs, file);
}
@@ -888,14 +925,14 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
const std::string& output, const std::vector<std::string>& depends,
const std::string& main_dependency, const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir, bool replace,
- bool escapeOldStyle, bool uses_terminal)
+ bool escapeOldStyle, bool uses_terminal, const std::string& depfile)
{
std::vector<std::string> outputs;
outputs.push_back(output);
std::vector<std::string> no_byproducts;
return this->AddCustomCommandToOutput(
outputs, no_byproducts, depends, main_dependency, commandLines, comment,
- workingDir, replace, escapeOldStyle, uses_terminal);
+ workingDir, replace, escapeOldStyle, uses_terminal, depfile);
}
void cmMakefile::AddCustomCommandOldStyle(
@@ -912,7 +949,7 @@ void cmMakefile::AddCustomCommandOldStyle(
std::vector<std::string> no_byproducts;
this->AddCustomCommandToTarget(target, no_byproducts, depends,
commandLines, cmTarget::POST_BUILD, comment,
- 0);
+ CM_NULLPTR);
return;
}
@@ -930,14 +967,14 @@ void cmMakefile::AddCustomCommandOldStyle(
if (sourceFiles.find(source)) {
// The source looks like a real file. Use it as the main dependency.
sf = this->AddCustomCommandToOutput(output, depends, source,
- commandLines, comment, 0);
+ commandLines, comment, CM_NULLPTR);
} else {
// The source may not be a real file. Do not use a main dependency.
std::string no_main_dependency = "";
std::vector<std::string> depends2 = depends;
depends2.push_back(source);
sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
- commandLines, comment, 0);
+ commandLines, comment, CM_NULLPTR);
}
// If the rule was added to the source (and not a .rule file),
@@ -1420,10 +1457,82 @@ void cmMakefile::Configure()
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
cmListFile listFile;
- if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(),
- this)) {
+ if (!listFile.ParseFile(currentStart.c_str(), this->GetMessenger(),
+ this->Backtrace)) {
return;
}
+ if (this->IsRootMakefile()) {
+ bool hasVersion = false;
+ // search for the right policy command
+ for (std::vector<cmListFileFunction>::iterator i =
+ listFile.Functions.begin();
+ i != listFile.Functions.end(); ++i) {
+ if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") {
+ hasVersion = true;
+ break;
+ }
+ }
+ // if no policy command is found this is an error if they use any
+ // non advanced functions or a lot of functions
+ if (!hasVersion) {
+ bool isProblem = true;
+ if (listFile.Functions.size() < 30) {
+ // the list of simple commands DO NOT ADD TO THIS LIST!!!!!
+ // these commands must have backwards compatibility forever and
+ // and that is a lot longer than your tiny mind can comprehend mortal
+ std::set<std::string> allowedCommands;
+ allowedCommands.insert("project");
+ allowedCommands.insert("set");
+ allowedCommands.insert("if");
+ allowedCommands.insert("endif");
+ allowedCommands.insert("else");
+ allowedCommands.insert("elseif");
+ allowedCommands.insert("add_executable");
+ allowedCommands.insert("add_library");
+ allowedCommands.insert("target_link_libraries");
+ allowedCommands.insert("option");
+ allowedCommands.insert("message");
+ isProblem = false;
+ for (std::vector<cmListFileFunction>::iterator i =
+ listFile.Functions.begin();
+ i != listFile.Functions.end(); ++i) {
+ std::string name = cmSystemTools::LowerCase(i->Name);
+ if (allowedCommands.find(name) == allowedCommands.end()) {
+ isProblem = true;
+ break;
+ }
+ }
+ }
+
+ if (isProblem) {
+ // Tell the top level cmMakefile to diagnose
+ // this violation of CMP0000.
+ this->SetCheckCMP0000(true);
+
+ // Implicitly set the version for the user.
+ this->SetPolicyVersion("2.4");
+ }
+ }
+ bool hasProject = false;
+ // search for a project command
+ for (std::vector<cmListFileFunction>::iterator i =
+ listFile.Functions.begin();
+ i != listFile.Functions.end(); ++i) {
+ if (cmSystemTools::LowerCase(i->Name) == "project") {
+ hasProject = true;
+ break;
+ }
+ }
+ // if no project command is found, add one
+ if (!hasProject) {
+ cmListFileFunction project;
+ project.Name = "PROJECT";
+ cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0);
+ project.Arguments.push_back(prj);
+ listFile.Functions.insert(listFile.Functions.begin(), project);
+ }
+ }
+
this->ReadListFile(listFile, currentStart);
if (cmSystemTools::GetFatalErrorOccured()) {
scope.Quiet();
@@ -1720,8 +1829,8 @@ void cmMakefile::RemoveDefinition(const std::string& name)
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
- vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS, 0,
- this);
+ vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS,
+ CM_NULLPTR, this);
}
#endif
}
@@ -1854,7 +1963,7 @@ cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput(
}
// otherwise return NULL
- return 0;
+ return CM_NULLPTR;
}
cmSourceFile* cmMakefile::GetSourceFileWithOutput(
@@ -1870,14 +1979,14 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
if (o != this->OutputToSource.end()) {
return (*o).second;
}
- return 0;
+ return CM_NULLPTR;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmSourceGroup* cmMakefile::GetSourceGroup(
const std::vector<std::string>& name) const
{
- cmSourceGroup* sg = 0;
+ cmSourceGroup* sg = CM_NULLPTR;
// first look for source group starting with the same as the one we want
for (std::vector<cmSourceGroup>::const_iterator sgIt =
@@ -1890,11 +1999,11 @@ cmSourceGroup* cmMakefile::GetSourceGroup(
}
}
- if (sg != 0) {
+ if (sg != CM_NULLPTR) {
// iterate through its children to find match source group
for (unsigned int i = 1; i < name.size(); ++i) {
sg = sg->LookupChild(name[i].c_str());
- if (sg == 0) {
+ if (sg == CM_NULLPTR) {
break;
}
}
@@ -1912,14 +2021,14 @@ void cmMakefile::AddSourceGroup(const std::string& name, const char* regex)
void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
const char* regex)
{
- cmSourceGroup* sg = 0;
+ cmSourceGroup* sg = CM_NULLPTR;
std::vector<std::string> currentName;
int i = 0;
const int lastElement = static_cast<int>(name.size() - 1);
for (i = lastElement; i >= 0; --i) {
currentName.assign(name.begin(), name.begin() + i + 1);
sg = this->GetSourceGroup(currentName);
- if (sg != 0) {
+ if (sg != CM_NULLPTR) {
break;
}
}
@@ -1933,7 +2042,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
sg->SetGroupRegex(regex);
}
return;
- } else if (i == -1) {
+ }
+ if (i == -1) {
// group does not exist nor belong to any existing group
// add its first component
this->SourceGroups.push_back(cmSourceGroup(name[0].c_str(), regex));
@@ -1946,7 +2056,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
}
// build the whole source group path
for (++i; i <= lastElement; ++i) {
- sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
+ sg->AddChild(
+ cmSourceGroup(name[i].c_str(), CM_NULLPTR, sg->GetFullName()));
sg = sg->LookupChild(name[i].c_str());
}
@@ -2048,7 +2159,8 @@ void cmMakefile::ExpandVariablesCMP0019()
<< "The following variable evaluations were encountered:\n"
<< w.str();
/* clang-format on */
- this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
+ this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, m.str(),
+ this->Backtrace);
}
}
@@ -2076,6 +2188,14 @@ bool cmMakefile::IsSet(const std::string& name) const
return true;
}
+bool cmMakefile::PlatformIs32Bit() const
+{
+ if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
+ return atoi(sizeof_dptr) == 4;
+ }
+ return false;
+}
+
bool cmMakefile::PlatformIs64Bit() const
{
if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
@@ -2124,20 +2244,11 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const
// If we are doing an in-source build, then the test will always fail
if (cmSystemTools::SameFile(this->GetHomeDirectory(),
this->GetHomeOutputDirectory())) {
- if (this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD")) {
- return false;
- }
- return true;
+ return !this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD");
}
- // Check if this is a subdirectory of the source tree but not a
- // subdirectory of the build tree
- if (cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) &&
- !cmSystemTools::IsSubDirectory(fileName,
- this->GetHomeOutputDirectory())) {
- return false;
- }
- return true;
+ return !cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) ||
+ cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory());
}
const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
@@ -2166,7 +2277,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
}
}
#endif
- return def ? true : false;
+ return def != CM_NULLPTR;
}
const char* cmMakefile::GetDefinition(const std::string& name) const
@@ -2473,8 +2584,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
openstack.pop_back();
result.append(last, in - last);
std::string const& lookup = result.substr(var.loc);
- const char* value = NULL;
+ const char* value = CM_NULLPTR;
std::string varresult;
+ std::string svalue;
static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE";
switch (var.domain) {
case NORMAL:
@@ -2487,7 +2599,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
}
break;
case ENVIRONMENT:
- value = cmSystemTools::GetEnv(lookup.c_str());
+ if (cmSystemTools::GetEnv(lookup, svalue)) {
+ value = svalue.c_str();
+ }
break;
case CACHE:
value = state->GetCacheEntryValue(lookup);
@@ -2526,7 +2640,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
if (!atOnly) {
t_lookup lookup;
const char* next = in + 1;
- const char* start = NULL;
+ const char* start = CM_NULLPTR;
char nextc = *next;
if (nextc == '{') {
// Looking for a variable.
@@ -2717,13 +2831,12 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
cmSystemTools::ExpandListArgument(configTypes, configs);
}
return "";
- } else {
- const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
- if (singleConfig && !buildType.empty()) {
- configs.push_back(buildType);
- }
- return buildType;
}
+ const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ if (singleConfig && !buildType.empty()) {
+ configs.push_back(buildType);
+ }
+ return buildType;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2792,7 +2905,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
FunctionBlockersType::size_type barrier =
this->FunctionBlockerBarriers.back();
while (this->FunctionBlockers.size() > barrier) {
- cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back());
+ CM_AUTO_PTR<cmFunctionBlocker> fb(this->FunctionBlockers.back());
this->FunctionBlockers.pop_back();
if (reportError) {
// Report the context in which the unclosed block was opened.
@@ -2929,7 +3042,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
this->FunctionBlockers.push_back(fb);
}
-cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
+CM_AUTO_PTR<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff)
{
// Find the function blocker stack barrier for the current scope.
@@ -2962,11 +3075,11 @@ cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
}
cmFunctionBlocker* b = *pos;
this->FunctionBlockers.erase(pos);
- return cmsys::auto_ptr<cmFunctionBlocker>(b);
+ return CM_AUTO_PTR<cmFunctionBlocker>(b);
}
}
- return cmsys::auto_ptr<cmFunctionBlocker>();
+ return CM_AUTO_PTR<cmFunctionBlocker>();
}
const char* cmMakefile::GetHomeDirectory() const
@@ -3010,7 +3123,7 @@ cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const
return sf;
}
}
- return 0;
+ return CM_NULLPTR;
}
cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName,
@@ -3029,9 +3142,8 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName,
{
if (cmSourceFile* esf = this->GetSource(sourceName)) {
return esf;
- } else {
- return this->CreateSource(sourceName, generated);
}
+ return this->CreateSource(sourceName, generated);
}
void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
@@ -3168,6 +3280,11 @@ cmake* cmMakefile::GetCMakeInstance() const
return this->GlobalGenerator->GetCMakeInstance();
}
+cmMessenger* cmMakefile::GetMessenger() const
+{
+ return this->GetCMakeInstance()->GetMessenger();
+}
+
cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
{
return this->GlobalGenerator;
@@ -3180,7 +3297,7 @@ cmVariableWatch* cmMakefile::GetVariableWatch() const
this->GetCMakeInstance()->GetVariableWatch()) {
return this->GetCMakeInstance()->GetVariableWatch();
}
- return 0;
+ return CM_NULLPTR;
}
#endif
@@ -3341,8 +3458,8 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
}
// Perform variable replacements.
- this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, 0, -1,
- true, true);
+ this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, CM_NULLPTR,
+ -1, true, true);
}
int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
@@ -3384,7 +3501,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
} else {
std::string newLineCharacters;
- std::ios_base::openmode omode = std::ios_base::out | std::ios_base::trunc;
+ std::ios::openmode omode = std::ios::out | std::ios::trunc;
if (newLine.IsValid()) {
newLineCharacters = newLine.GetCharacters();
omode |= std::ios::binary;
@@ -3425,7 +3542,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
while (cmSystemTools::GetLineFromStream(fin, inLine)) {
outLine = "";
this->ConfigureString(inLine, outLine, atOnly, escapeQuotes);
- fout << outLine.c_str() << newLineCharacters;
+ fout << outLine << newLineCharacters;
}
// close the files before attempting to copy
fin.close();
@@ -3481,7 +3598,7 @@ cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
if (i != this->Targets.end()) {
return &i->second;
}
- return 0;
+ return CM_NULLPTR;
}
cmTest* cmMakefile::CreateTest(const std::string& testName)
@@ -3503,7 +3620,7 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const
if (mi != this->Tests.end()) {
return mi->second;
}
- return 0;
+ return CM_NULLPTR;
}
void cmMakefile::AddCMakeDependFilesFromUser()
@@ -3594,7 +3711,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
cmState::TargetType type, bool global)
{
// Create the target.
- cmsys::auto_ptr<cmTarget> target(new cmTarget);
+ CM_AUTO_PTR<cmTarget> target(new cmTarget);
target->SetType(type, name);
target->MarkAsImported(global);
target->SetMakefile(this);
@@ -3629,8 +3746,9 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
bool cmMakefile::IsAlias(const std::string& name) const
{
- if (this->AliasTargets.find(name) != this->AliasTargets.end())
+ if (this->AliasTargets.find(name) != this->AliasTargets.end()) {
return true;
+ }
return this->GetGlobalGenerator()->IsAlias(name);
}
@@ -3655,69 +3773,67 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
<< "\" because an imported target with the same name already exists.";
msg = e.str();
return false;
- } else {
- // target names must be globally unique
- switch (this->GetPolicyStatus(cmPolicies::CMP0002)) {
- case cmPolicies::WARN:
- this->IssueMessage(
- cmake::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0002));
- case cmPolicies::OLD:
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->IssueMessage(
- cmake::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002));
- return true;
- case cmPolicies::NEW:
- break;
- }
-
- // The conflict is with a non-imported target.
- // Allow this if the user has requested support.
- cmake* cm = this->GetCMakeInstance();
- if (isCustom && existing->GetType() == cmState::UTILITY &&
- this != existing->GetMakefile() &&
- cm->GetState()->GetGlobalPropertyAsBool(
- "ALLOW_DUPLICATE_CUSTOM_TARGETS")) {
+ }
+ // target names must be globally unique
+ switch (this->GetPolicyStatus(cmPolicies::CMP0002)) {
+ case cmPolicies::WARN:
+ this->IssueMessage(cmake::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0002));
+ case cmPolicies::OLD:
return true;
- }
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ this->IssueMessage(
+ cmake::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002));
+ return true;
+ case cmPolicies::NEW:
+ break;
+ }
- // Produce an error that tells the user how to work around the
- // problem.
- std::ostringstream e;
- e << "cannot create target \"" << name
- << "\" because another target with the same name already exists. "
- << "The existing target is ";
- switch (existing->GetType()) {
- case cmState::EXECUTABLE:
- e << "an executable ";
- break;
- case cmState::STATIC_LIBRARY:
- e << "a static library ";
- break;
- case cmState::SHARED_LIBRARY:
- e << "a shared library ";
- break;
- case cmState::MODULE_LIBRARY:
- e << "a module library ";
- break;
- case cmState::UTILITY:
- e << "a custom target ";
- break;
- case cmState::INTERFACE_LIBRARY:
- e << "an interface library ";
- break;
- default:
- break;
- }
- e << "created in source directory \""
- << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". "
- << "See documentation for policy CMP0002 for more details.";
- msg = e.str();
- return false;
+ // The conflict is with a non-imported target.
+ // Allow this if the user has requested support.
+ cmake* cm = this->GetCMakeInstance();
+ if (isCustom && existing->GetType() == cmState::UTILITY &&
+ this != existing->GetMakefile() &&
+ cm->GetState()->GetGlobalPropertyAsBool(
+ "ALLOW_DUPLICATE_CUSTOM_TARGETS")) {
+ return true;
}
+
+ // Produce an error that tells the user how to work around the
+ // problem.
+ std::ostringstream e;
+ e << "cannot create target \"" << name
+ << "\" because another target with the same name already exists. "
+ << "The existing target is ";
+ switch (existing->GetType()) {
+ case cmState::EXECUTABLE:
+ e << "an executable ";
+ break;
+ case cmState::STATIC_LIBRARY:
+ e << "a static library ";
+ break;
+ case cmState::SHARED_LIBRARY:
+ e << "a shared library ";
+ break;
+ case cmState::MODULE_LIBRARY:
+ e << "a module library ";
+ break;
+ case cmState::UTILITY:
+ e << "a custom target ";
+ break;
+ case cmState::INTERFACE_LIBRARY:
+ e << "an interface library ";
+ break;
+ default:
+ break;
+ }
+ e << "created in source directory \""
+ << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". "
+ << "See documentation for policy CMP0002 for more details.";
+ msg = e.str();
+ return false;
}
return true;
}
@@ -3963,10 +4079,10 @@ bool cmMakefile::IgnoreErrorsCMP0061() const
}
#define FEATURE_STRING(F) , #F
-static const char* const C_FEATURES[] = { 0 FOR_EACH_C_FEATURE(
+static const char* const C_FEATURES[] = { CM_NULLPTR FOR_EACH_C_FEATURE(
FEATURE_STRING) };
-static const char* const CXX_FEATURES[] = { 0 FOR_EACH_CXX_FEATURE(
+static const char* const CXX_FEATURES[] = { CM_NULLPTR FOR_EACH_CXX_FEATURE(
FEATURE_STRING) };
#undef FEATURE_STRING
@@ -4002,14 +4118,20 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
<< this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
<< "\"\nversion "
<< this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (error) {
+ *error = e.str();
+ } else {
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
+ }
return false;
}
target->AppendProperty("COMPILE_FEATURES", feature.c_str());
- return lang == "C" ? this->AddRequiredTargetCFeature(target, feature)
- : this->AddRequiredTargetCxxFeature(target, feature);
+ return lang == "C"
+ ? this->AddRequiredTargetCFeature(target, feature, error)
+ : this->AddRequiredTargetCxxFeature(target, feature, error);
}
bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
@@ -4045,7 +4167,8 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
if (error) {
*error = e.str();
} else {
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
}
return false;
}
@@ -4070,9 +4193,10 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
if (error) {
*error = e.str();
} else {
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
}
- return 0;
+ return CM_NULLPTR;
}
return featuresKnown;
}
@@ -4137,15 +4261,15 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target,
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS), cmStrCmp("11"))) {
return false;
- } else if (needC99 && existingCStandard &&
- existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
- cmArrayEnd(C_STANDARDS),
- cmStrCmp("99"))) {
+ }
+ if (needC99 && existingCStandard &&
+ existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
+ cmArrayEnd(C_STANDARDS), cmStrCmp("99"))) {
return false;
- } else if (needC90 && existingCStandard &&
- existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
- cmArrayEnd(C_STANDARDS),
- cmStrCmp("90"))) {
+ }
+ if (needC90 && existingCStandard &&
+ existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
+ cmArrayEnd(C_STANDARDS), cmStrCmp("90"))) {
return false;
}
return true;
@@ -4223,10 +4347,11 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("11"))) {
return false;
- } else if (needCxx98 &&
- existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
- cmArrayEnd(CXX_STANDARDS),
- cmStrCmp("98"))) {
+ }
+ if (needCxx98 &&
+ existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
+ cmArrayEnd(CXX_STANDARDS),
+ cmStrCmp("98"))) {
return false;
}
return true;
@@ -4257,7 +4382,8 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
}
bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
- const std::string& feature) const
+ const std::string& feature,
+ std::string* error) const
{
bool needCxx98 = false;
bool needCxx11 = false;
@@ -4273,7 +4399,12 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\".";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (error) {
+ *error = e.str();
+ } else {
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
+ }
return false;
}
}
@@ -4338,7 +4469,8 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
}
bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
- const std::string& feature) const
+ const std::string& feature,
+ std::string* error) const
{
bool needC90 = false;
bool needC99 = false;
@@ -4353,7 +4485,12 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\".";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (error) {
+ *error = e.str();
+ } else {
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
+ }
return false;
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c665b1f..4d137db 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -12,46 +12,52 @@
#ifndef cmMakefile_h
#define cmMakefile_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h>
#include "cmAlgorithms.h"
-#include "cmExecutionStatus.h"
-#include "cmExpandedCommandArgument.h"
#include "cmListFileCache.h"
#include "cmNewLineStyle.h"
+#include "cmPolicies.h"
#include "cmState.h"
-#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetLinkLibraryType.h"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h"
#endif
+#include <cm_auto_ptr.hxx>
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/auto_ptr.hxx>
+
+#include <map>
+#include <set>
+#include <stack>
+#include <string>
+#include <vector>
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map>
#else
#include <cmsys/hash_map.hxx>
#endif
#endif
-#include <stack>
-
-class cmFunctionBlocker;
class cmCommand;
+class cmCompiledGeneratorExpression;
+class cmCustomCommandLines;
+class cmExecutionStatus;
+class cmExpandedCommandArgument;
+class cmExportBuildFileGenerator;
+class cmFunctionBlocker;
+class cmGeneratorExpressionEvaluationFile;
+class cmGlobalGenerator;
class cmInstallGenerator;
class cmSourceFile;
class cmTest;
class cmTestGenerator;
class cmVariableWatch;
-class cmake;
-class cmMakefileCall;
-class cmCMakePolicyCommand;
-class cmGeneratorExpressionEvaluationFile;
-class cmExportBuildFileGenerator;
/** \class cmMakefile
* \brief Process the input CMakeLists.txt file.
@@ -97,7 +103,7 @@ public:
* Remove the function blocker whose scope ends with the given command.
* This returns ownership of the function blocker object.
*/
- cmsys::auto_ptr<cmFunctionBlocker> RemoveFunctionBlocker(
+ CM_AUTO_PTR<cmFunctionBlocker> RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff);
/**
@@ -129,14 +135,12 @@ public:
void FinalPass();
/** Add a custom command to the build. */
- void AddCustomCommandToTarget(const std::string& target,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- cmTarget::CustomCommandType type,
- const char* comment, const char* workingDir,
- bool escapeOldStyle = true,
- bool uses_terminal = false);
+ void AddCustomCommandToTarget(
+ const std::string& target, const std::vector<std::string>& byproducts,
+ const std::vector<std::string>& depends,
+ const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
+ const char* comment, const char* workingDir, bool escapeOldStyle = true,
+ bool uses_terminal = false, const std::string& depfile = "");
cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,
@@ -144,13 +148,13 @@ public:
const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace = false, bool escapeOldStyle = true,
- bool uses_terminal = false);
+ bool uses_terminal = false, const std::string& depfile = "");
cmSourceFile* AddCustomCommandToOutput(
const std::string& output, const std::vector<std::string>& depends,
const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace = false, bool escapeOldStyle = true,
- bool uses_terminal = false);
+ bool uses_terminal = false, const std::string& depfile = "");
void AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
@@ -182,24 +186,23 @@ public:
* Add a utility to the build. A utiltity target is a command that
* is run every time the target is built.
*/
- cmTarget* AddUtilityCommand(const std::string& utilityName,
- bool excludeFromAll,
- const std::vector<std::string>& depends,
- const char* workingDirectory,
- const char* command, const char* arg1 = 0,
- const char* arg2 = 0, const char* arg3 = 0,
- const char* arg4 = 0);
+ cmTarget* AddUtilityCommand(
+ const std::string& utilityName, bool excludeFromAll,
+ const std::vector<std::string>& depends, const char* workingDirectory,
+ const char* command, const char* arg1 = CM_NULLPTR,
+ const char* arg2 = CM_NULLPTR, const char* arg3 = CM_NULLPTR,
+ const char* arg4 = CM_NULLPTR);
cmTarget* AddUtilityCommand(
const std::string& utilityName, bool excludeFromAll,
const char* workingDirectory, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
- const char* comment = 0, bool uses_terminal = false);
+ const char* comment = CM_NULLPTR, bool uses_terminal = false);
cmTarget* AddUtilityCommand(
const std::string& utilityName, bool excludeFromAll,
const char* workingDirectory, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
- const char* comment = 0, bool uses_terminal = false);
+ const char* comment = CM_NULLPTR, bool uses_terminal = false);
/**
* Add a link library to the build.
@@ -274,14 +277,14 @@ public:
/**
* Add a root source group for consideration when adding a new source.
*/
- void AddSourceGroup(const std::string& name, const char* regex = 0);
+ void AddSourceGroup(const std::string& name, const char* regex = CM_NULLPTR);
/**
* Add a source group for consideration when adding a new source.
* name is tokenized.
*/
void AddSourceGroup(const std::vector<std::string>& name,
- const char* regex = 0);
+ const char* regex = CM_NULLPTR);
#endif
@@ -437,6 +440,9 @@ public:
bool IsOn(const std::string& name) const;
bool IsSet(const std::string& name) const;
+ /** Return whether the target platform is 32-bit. */
+ bool PlatformIs32Bit() const;
+
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
@@ -516,8 +522,8 @@ public:
const char* ExpandVariablesInString(std::string& source) const;
const char* ExpandVariablesInString(std::string& source, bool escapeQuotes,
bool noEscapes, bool atOnly = false,
- const char* filename = 0, long line = -1,
- bool removeEmpty = false,
+ const char* filename = CM_NULLPTR,
+ long line = -1, bool removeEmpty = false,
bool replaceAt = false) const;
/**
@@ -589,16 +595,17 @@ public:
*/
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs,
- const char* filename = 0) const;
+ const char* filename = CM_NULLPTR) const;
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
std::vector<cmExpandedCommandArgument>& outArgs,
- const char* filename = 0) const;
+ const char* filename = CM_NULLPTR) const;
/**
* Get the instance
*/
cmake* GetCMakeInstance() const;
+ cmMessenger* GetMessenger() const;
cmGlobalGenerator* GetGlobalGenerator() const;
/**
@@ -643,8 +650,9 @@ public:
void AddInstallGenerator(cmInstallGenerator* g)
{
- if (g)
+ if (g) {
this->InstallGenerators.push_back(g);
+ }
}
std::vector<cmInstallGenerator*>& GetInstallGenerators()
{
@@ -653,8 +661,9 @@ public:
void AddTestGenerator(cmTestGenerator* g)
{
- if (g)
+ if (g) {
this->TestGenerators.push_back(g);
+ }
}
const std::vector<cmTestGenerator*>& GetTestGenerators() const
{
@@ -715,8 +724,7 @@ public:
cmMakefile* Makefile;
};
- void IssueMessage(cmake::MessageType t, std::string const& text,
- bool force = false) const;
+ void IssueMessage(cmake::MessageType t, std::string const& text) const;
/** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
@@ -739,7 +747,7 @@ public:
bool PolicyOptionalWarningEnabled(std::string const& var);
bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
- std::string* error = 0) const;
+ std::string* error = CM_NULLPTR) const;
bool CompileFeatureKnown(cmTarget const* target, const std::string& feature,
std::string& lang, std::string* error) const;
@@ -768,11 +776,10 @@ public:
void EnforceDirectoryLevelRules() const;
- void AddEvaluationFile(
- const std::string& inputFile,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName,
- cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
- bool inputIsContent);
+ void AddEvaluationFile(const std::string& inputFile,
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent);
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators()
@@ -792,7 +799,7 @@ protected:
// libraries, classes, and executables
mutable cmTargets Targets;
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string, cmTarget*> TargetMap;
#else
typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
@@ -911,7 +918,7 @@ private:
// A map for fast output to input look up.
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string, cmSourceFile*> OutputToSourceMap;
#else
typedef cmsys::hash_map<std::string, cmSourceFile*> OutputToSourceMap;
@@ -928,11 +935,12 @@ private:
std::vector<cmSourceFile*> QtUiFilesWithOptions;
- bool AddRequiredTargetCFeature(cmTarget* target,
- const std::string& feature) const;
+ bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
+ std::string* error = CM_NULLPTR) const;
bool AddRequiredTargetCxxFeature(cmTarget* target,
- const std::string& feature) const;
+ const std::string& feature,
+ std::string* error = CM_NULLPTR) const;
void CheckNeededCLanguage(const std::string& feature, bool& needC90,
bool& needC99, bool& needC11) const;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 9d42257..66e1ca2 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -12,12 +12,20 @@
#include "cmMakefileExecutableTargetGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
+#include "cmOSXBundleGenerator.h"
+#include "cmOutputConverter.h"
+#include "cmSystemTools.h"
#include "cmake.h"
+#include <sstream>
+#include <string>
+#include <vector>
+
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
cmGeneratorTarget* target)
: cmMakefileTargetGenerator(target)
@@ -127,8 +135,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
std::string targetFullPathImport = outpathImp + targetNameImport;
- std::string targetOutPathPDB = this->Convert(
- targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
+ targetFullPathPDB, cmOutputConverter::SHELL);
// Convert to the output path to use in constructing commands.
std::string targetOutPath = this->Convert(
targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
@@ -187,6 +195,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition(export_flag_var));
}
+ if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) {
+ this->LocalGenerator->AppendFlags(linkFlags, " -Wl,--no-as-needed");
+ }
// Add language feature flags.
this->AddFeatureFlags(flags, linkLanguage);
@@ -207,49 +218,43 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
- exeCleanFiles.push_back(this->Convert(targetFullPath,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPath, cmOutputConverter::START_OUTPUT));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
- exeCleanFiles.push_back(this->Convert((targetFullPath + ".manifest").c_str(),
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ (targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT));
#endif
if (targetNameReal != targetName) {
- exeCleanFiles.push_back(this->Convert(targetFullPathReal,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathReal, cmOutputConverter::START_OUTPUT));
}
if (!targetNameImport.empty()) {
- exeCleanFiles.push_back(this->Convert(targetFullPathImport,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathImport, cmOutputConverter::START_OUTPUT));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- exeCleanFiles.push_back(this->Convert(implib,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ implib, cmOutputConverter::START_OUTPUT));
}
}
// List the PDB for cleaning only when the whole target is
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
- this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathPDB, cmOutputConverter::START_OUTPUT));
// Add the pre-build and pre-link rules building but not when relinking.
if (!relink) {
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPreBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPreLinkCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
}
// Determine whether a link script will be used.
@@ -274,27 +279,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
}
- // Select whether to use a response file for objects.
- bool useResponseFileForObjects = false;
- {
- std::string responseVar = "CMAKE_";
- responseVar += linkLanguage;
- responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
- if (this->Makefile->IsOn(responseVar)) {
- useResponseFileForObjects = true;
- }
- }
-
- // Select whether to use a response file for libraries.
- bool useResponseFileForLibs = false;
- {
- std::string responseVar = "CMAKE_";
- responseVar += linkLanguage;
- responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES";
- if (this->Makefile->IsOn(responseVar)) {
- useResponseFileForLibs = true;
- }
- }
+ bool useResponseFileForObjects =
+ this->CheckUseResponseFileForObjects(linkLanguage);
+ bool const useResponseFileForLibs =
+ this->CheckUseResponseFileForLibraries(linkLanguage);
// Expand the rule variables.
{
@@ -315,6 +303,12 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects,
buildObjs, depends, useWatcomQuote);
+ // maybe create .def file from list of objects
+ if (this->GeneratorTarget->IsExecutableWithExports() &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
+ this->GenDefFile(real_link_commands, linkFlags);
+ }
+
std::string manifests = this->GetManifests();
cmLocalGenerator::RuleVariables vars;
@@ -356,6 +350,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.LinkFlags = linkFlags.c_str();
vars.Manifests = manifests.c_str();
+ if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) {
+ std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmakeCommand += " -E __run_iwyu --lwyu=";
+ cmakeCommand += targetOutPathReal;
+ real_link_commands.push_back(cmakeCommand);
+ }
+
// Expand placeholders in the commands.
this->LocalGenerator->TargetImplib = targetOutPathImport;
for (std::vector<std::string>::iterator i = real_link_commands.begin();
@@ -380,7 +382,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
@@ -393,7 +395,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
commands1.push_back(symlink);
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
@@ -402,12 +404,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if (!relink) {
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPostBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
}
// Write the build rule.
- this->LocalGenerator->WriteMakeRule(
- *this->BuildFileStream, 0, targetFullPathReal, depends, commands, false);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ targetFullPathReal, depends, commands,
+ false);
// The symlink name for the target should depend on the real target
// so if the target version changes it rebuilds and recreates the
@@ -416,8 +419,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
depends.clear();
commands.clear();
depends.push_back(targetFullPathReal);
- this->LocalGenerator->WriteMakeRule(
- *this->BuildFileStream, 0, targetFullPath, depends, commands, false);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ targetFullPath, depends, commands,
+ false);
}
// Write the main driver rule to build everything in this target.
diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h
index 64cb17f..1e6047e 100644
--- a/Source/cmMakefileExecutableTargetGenerator.h
+++ b/Source/cmMakefileExecutableTargetGenerator.h
@@ -12,17 +12,21 @@
#ifndef cmMakefileExecutableTargetGenerator_h
#define cmMakefileExecutableTargetGenerator_h
+#include <cmConfigure.h>
+
#include "cmMakefileTargetGenerator.h"
+class cmGeneratorTarget;
+
class cmMakefileExecutableTargetGenerator : public cmMakefileTargetGenerator
{
public:
cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target);
- virtual ~cmMakefileExecutableTargetGenerator();
+ ~cmMakefileExecutableTargetGenerator() CM_OVERRIDE;
/* the main entry point for this class. Writes the Makefiles associated
with this target */
- virtual void WriteRuleFiles();
+ void WriteRuleFiles() CM_OVERRIDE;
protected:
virtual void WriteExecutableRule(bool relink);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 8f7dd7e..c31c469 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -11,14 +11,21 @@
============================================================================*/
#include "cmMakefileLibraryTargetGenerator.h"
-#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
+#include "cmOSXBundleGenerator.h"
+#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmake.h"
+#include <sstream>
+#include <vector>
+
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
cmGeneratorTarget* target)
: cmMakefileTargetGenerator(target)
@@ -105,13 +112,13 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
// Add post-build rules.
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPostBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
// Depend on the object files.
this->AppendObjectDepends(depends);
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
this->GeneratorTarget->GetName(),
depends, commands, true);
@@ -163,6 +170,9 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
this->AddModuleDefinitionFlag(extraFlags);
+ if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) {
+ this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
+ }
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
@@ -300,8 +310,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Construct the output path version of the names for use in command
// arguments.
- std::string targetOutPathPDB = this->Convert(
- targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
+ targetFullPathPDB, cmOutputConverter::SHELL);
std::string targetOutPath = this->Convert(
targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
std::string targetOutPathSO =
@@ -329,8 +339,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
buildEcho += " shared library ";
break;
case cmState::MODULE_LIBRARY:
- if (this->GeneratorTarget->IsCFBundleOnApple())
+ if (this->GeneratorTarget->IsCFBundleOnApple()) {
buildEcho += " CFBundle";
+ }
buildEcho += " shared module ";
break;
default:
@@ -342,7 +353,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
- const char* forbiddenFlagVar = 0;
+ const char* forbiddenFlagVar = CM_NULLPTR;
switch (this->GeneratorTarget->GetType()) {
case cmState::SHARED_LIBRARY:
forbiddenFlagVar = "_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS";
@@ -356,46 +367,40 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Clean files associated with this library.
std::vector<std::string> libCleanFiles;
- libCleanFiles.push_back(this->Convert(targetFullPath,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPath, cmOutputConverter::START_OUTPUT));
if (targetNameReal != targetName) {
- libCleanFiles.push_back(this->Convert(targetFullPathReal,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathReal, cmOutputConverter::START_OUTPUT));
}
if (targetNameSO != targetName && targetNameSO != targetNameReal) {
- libCleanFiles.push_back(this->Convert(targetFullPathSO,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathSO, cmOutputConverter::START_OUTPUT));
}
if (!targetNameImport.empty()) {
- libCleanFiles.push_back(this->Convert(targetFullPathImport,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathImport, cmOutputConverter::START_OUTPUT));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- libCleanFiles.push_back(this->Convert(implib,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ implib, cmOutputConverter::START_OUTPUT));
}
}
// List the PDB for cleaning only when the whole target is
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
- this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
- cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ targetFullPathPDB, cmOutputConverter::START_OUTPUT));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
- libCleanFiles.push_back(this->Convert(
- (targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED));
+ libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ (targetFullPath + ".manifest").c_str(),
+ cmOutputConverter::START_OUTPUT));
}
#endif
@@ -407,7 +412,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->GeneratorTarget, "target");
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
@@ -416,36 +421,19 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
if (!relink) {
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPreBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPreLinkCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
}
// Determine whether a link script will be used.
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
- // Select whether to use a response file for objects.
- bool useResponseFileForObjects = false;
- {
- std::string responseVar = "CMAKE_";
- responseVar += linkLanguage;
- responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
- if (this->Makefile->IsOn(responseVar)) {
- useResponseFileForObjects = true;
- }
- }
-
- // Select whether to use a response file for libraries.
- bool useResponseFileForLibs = false;
- {
- std::string responseVar = "CMAKE_";
- responseVar += linkLanguage;
- responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES";
- if (this->Makefile->IsOn(responseVar)) {
- useResponseFileForLibs = true;
- }
- }
+ bool useResponseFileForObjects =
+ this->CheckUseResponseFileForObjects(linkLanguage);
+ bool const useResponseFileForLibs =
+ this->CheckUseResponseFileForLibraries(linkLanguage);
// For static libraries there might be archiving rules.
bool haveStaticLibraryRule = false;
@@ -454,8 +442,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
- haveStaticLibraryRule =
- this->Makefile->GetDefinition(linkRuleVar) ? true : false;
+ haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar);
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
@@ -518,48 +505,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// maybe create .def file from list of objects
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
- if (this->GeneratorTarget->GetPropertyAsBool(
- "WINDOWS_EXPORT_ALL_SYMBOLS")) {
- std::string name_of_def_file =
- this->GeneratorTarget->GetSupportDirectory();
- name_of_def_file +=
- std::string("/") + this->GeneratorTarget->GetName();
- name_of_def_file += ".def";
- std::string cmd = cmSystemTools::GetCMakeCommand();
- cmd = this->Convert(cmd, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
- cmd += " -E __create_def ";
- cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
- cmd += " ";
- std::string objlist_file = name_of_def_file;
- objlist_file += ".objs";
- cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
- real_link_commands.push_back(cmd);
- // create a list of obj files for the -E __create_def to read
- cmGeneratedFileStream fout(objlist_file.c_str());
- for (std::vector<std::string>::const_iterator i =
- this->Objects.begin();
- i != this->Objects.end(); ++i) {
- if (cmHasLiteralSuffix(*i, ".obj")) {
- fout << *i << "\n";
- }
- }
- for (std::vector<std::string>::const_iterator i =
- this->ExternalObjects.begin();
- i != this->ExternalObjects.end(); ++i) {
- fout << *i << "\n";
- }
- // now add the def file link flag
- linkFlags += " ";
- linkFlags +=
- this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- linkFlags +=
- this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
- linkFlags += " ";
- }
+ this->GenDefFile(real_link_commands, linkFlags);
}
std::string manifests = this->GetManifests();
@@ -620,8 +566,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.TargetInstallNameDir = "";
} else {
// Convert to a path for the native build tool.
- install_name_dir = this->LocalGenerator->Convert(
- install_name_dir, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ install_name_dir = this->LocalGenerator->ConvertToOutputFormat(
+ install_name_dir, cmOutputConverter::SHELL);
vars.TargetInstallNameDir = install_name_dir.c_str();
}
}
@@ -677,12 +623,23 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
i != archiveFinishCommands.end(); ++i) {
std::string cmd = *i;
this->LocalGenerator->ExpandRuleVariables(cmd, vars);
- real_link_commands.push_back(cmd);
+ // If there is no ranlib the command will be ":". Skip it.
+ if (!cmd.empty() && cmd[0] != ':') {
+ real_link_commands.push_back(cmd);
+ }
}
} else {
// Get the set of commands.
std::string linkRule = this->GetLinkRule(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+ if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE") &&
+ (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY)) {
+ std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmakeCommand += " -E __run_iwyu --lwyu=";
+ cmakeCommand += targetOutPathReal;
+ real_link_commands.push_back(cmakeCommand);
+ }
// Expand placeholders.
for (std::vector<std::string>::iterator i = real_link_commands.begin();
@@ -708,7 +665,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
@@ -725,15 +682,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
commands1.push_back(symlink);
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
+
// Add the post-build rules when building but not when relinking.
if (!relink) {
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPostBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
}
// Compute the list of outputs.
@@ -746,8 +704,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
// Write the build rule.
- this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands,
- false);
+ this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, outputs, depends,
+ commands, false);
// Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(targetFullPath, relink);
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index f72dbd7..ec2f6bb 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -12,17 +12,23 @@
#ifndef cmMakefileLibraryTargetGenerator_h
#define cmMakefileLibraryTargetGenerator_h
+#include <cmConfigure.h>
+
#include "cmMakefileTargetGenerator.h"
+#include <string>
+
+class cmGeneratorTarget;
+
class cmMakefileLibraryTargetGenerator : public cmMakefileTargetGenerator
{
public:
cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target);
- virtual ~cmMakefileLibraryTargetGenerator();
+ ~cmMakefileLibraryTargetGenerator() CM_OVERRIDE;
/* the main entry point for this class. Writes the Makefiles associated
with this target */
- virtual void WriteRuleFiles();
+ void WriteRuleFiles() CM_OVERRIDE;
protected:
void WriteObjectLibraryRules();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 93f9e49..165f96c 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -13,32 +13,43 @@
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
+#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
-#include "cmState.h"
-#include "cmake.h"
-
#include "cmMakefileExecutableTargetGenerator.h"
#include "cmMakefileLibraryTargetGenerator.h"
#include "cmMakefileUtilityTargetGenerator.h"
+#include "cmOutputConverter.h"
+#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
+#include <algorithm>
#include <ctype.h>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
+#ifndef _WIN32
+#include <unistd.h>
+#endif
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
- : cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target)
- , OSXBundleGenerator(0)
- , MacOSXContentGenerator(0)
+ : cmCommonTargetGenerator(target)
+ , OSXBundleGenerator(CM_NULLPTR)
+ , MacOSXContentGenerator(CM_NULLPTR)
{
- this->BuildFileStream = 0;
- this->InfoFileStream = 0;
- this->FlagFileStream = 0;
+ this->BuildFileStream = CM_NULLPTR;
+ this->InfoFileStream = CM_NULLPTR;
+ this->FlagFileStream = CM_NULLPTR;
this->CustomCommandDriver = OnBuild;
this->LocalGenerator =
static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator());
@@ -61,7 +72,7 @@ cmMakefileTargetGenerator::~cmMakefileTargetGenerator()
cmMakefileTargetGenerator* cmMakefileTargetGenerator::New(
cmGeneratorTarget* tgt)
{
- cmMakefileTargetGenerator* result = 0;
+ cmMakefileTargetGenerator* result = CM_NULLPTR;
switch (tgt->GetType()) {
case cmState::EXECUTABLE:
@@ -134,12 +145,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
if (const char* additional_clean_files =
this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(additional_clean_files);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget,
- 0, 0),
+ CM_NULLPTR, CM_NULLPTR),
this->CleanFiles);
}
@@ -161,8 +172,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
const std::vector<std::string>& outputs = ccg.GetOutputs();
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
- this->CleanFiles.push_back(this->Convert(
- *o, cmOutputConverter::START_OUTPUT, cmOutputConverter::UNCHANGED));
+ this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ *o, cmOutputConverter::START_OUTPUT));
}
}
}
@@ -301,8 +312,10 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
output += "/";
output += cmSystemTools::GetFilenameName(input);
this->Generator->CleanFiles.push_back(
- this->Generator->Convert(output, cmOutputConverter::START_OUTPUT));
- output = this->Generator->Convert(output, cmOutputConverter::HOME_OUTPUT);
+ this->Generator->LocalGenerator->ConvertToRelativePath(
+ output, cmOutputConverter::START_OUTPUT));
+ output = this->Generator->LocalGenerator->ConvertToRelativePath(
+ output, cmOutputConverter::HOME_OUTPUT);
// Create a rule to copy the content into the bundle.
std::vector<std::string> depends;
@@ -313,14 +326,15 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
this->Generator->LocalGenerator->AppendEcho(
commands, copyEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string copyCommand = "$(CMAKE_COMMAND) -E copy ";
- copyCommand += this->Generator->Convert(input, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ copyCommand += this->Generator->LocalGenerator->ConvertToOutputFormat(
+ input, cmOutputConverter::SHELL);
copyCommand += " ";
- copyCommand += this->Generator->Convert(output, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ copyCommand += this->Generator->LocalGenerator->ConvertToOutputFormat(
+ output, cmOutputConverter::SHELL);
commands.push_back(copyCommand);
this->Generator->LocalGenerator->WriteMakeRule(
- *this->Generator->BuildFileStream, 0, output, depends, commands, false);
+ *this->Generator->BuildFileStream, CM_NULLPTR, output, depends, commands,
+ false);
this->Generator->ExtraFiles.insert(output);
}
@@ -381,9 +395,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string objFullPath = this->LocalGenerator->GetCurrentBinaryDirectory();
objFullPath += "/";
objFullPath += obj;
- objFullPath = this->Convert(objFullPath, cmOutputConverter::FULL);
+ objFullPath = cmSystemTools::CollapseFullPath(objFullPath);
std::string srcFullPath =
- this->Convert(source.GetFullPath(), cmOutputConverter::FULL);
+ cmSystemTools::CollapseFullPath(source.GetFullPath());
this->LocalGenerator->AddImplicitDepends(
this->GeneratorTarget, lang, objFullPath.c_str(), srcFullPath.c_str());
}
@@ -452,8 +466,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
// Get the output paths for source and object files.
- std::string sourceFile = this->Convert(
- source.GetFullPath(), cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ std::string sourceFile = this->LocalGenerator->ConvertToOutputFormat(
+ source.GetFullPath(), cmOutputConverter::SHELL);
// Construct the build message.
std::vector<std::string> no_commands;
@@ -504,8 +518,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
targetOutPathReal =
this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
cmOutputConverter::SHELL);
- targetOutPathPDB = this->Convert(
- targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
+ targetFullPathPDB, cmOutputConverter::SHELL);
targetOutPathCompilePDB =
this->Convert(targetFullPathCompilePDB, cmOutputConverter::START_OUTPUT,
cmOutputConverter::SHELL);
@@ -527,7 +541,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
vars.Source = sourceFile.c_str();
std::string shellObj =
- this->Convert(obj, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ this->LocalGenerator->ConvertToOutputFormat(obj, cmOutputConverter::SHELL);
vars.Object = shellObj.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
@@ -572,9 +586,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
lang_can_export_cmds && compileCommands.size() == 1) {
std::string compileCommand = compileCommands[0];
this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
- std::string workingDirectory = this->LocalGenerator->Convert(
- this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::FULL);
+ std::string workingDirectory = cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetCurrentBinaryDirectory());
compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
this->GetFlags(lang));
std::string langDefines = std::string("$(") + lang + "_DEFINES)";
@@ -637,7 +650,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Change the command working directory to the local build tree.
this->LocalGenerator->CreateCDCommand(
compileCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), compileCommands.begin(),
compileCommands.end());
}
@@ -652,7 +665,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
// Write the rule.
- this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands);
+ this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, outputs, depends,
+ commands);
bool do_preprocess_rules = lang_has_preprocessor &&
this->LocalGenerator->GetCreatePreprocessedSourceRules();
@@ -686,8 +700,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> preprocessCommands;
cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands);
- std::string shellObjI = this->Convert(objI, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ std::string shellObjI = this->LocalGenerator->ConvertToOutputFormat(
+ objI, cmOutputConverter::SHELL);
vars.PreprocessedSource = shellObjI.c_str();
// Expand placeholders in the commands.
@@ -699,7 +713,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
preprocessCommands,
this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), preprocessCommands.begin(),
preprocessCommands.end());
} else {
@@ -708,7 +722,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
commands.push_back(cmd);
}
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
relativeObjI, force_depends,
commands, false);
}
@@ -733,8 +747,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> assemblyCommands;
cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands);
- std::string shellObjS = this->Convert(objS, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ std::string shellObjS = this->LocalGenerator->ConvertToOutputFormat(
+ objS, cmOutputConverter::SHELL);
vars.AssemblySource = shellObjS.c_str();
// Expand placeholders in the commands.
@@ -745,7 +759,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
assemblyCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), assemblyCommands.begin(),
assemblyCommands.end());
} else {
@@ -754,7 +768,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
commands.push_back(cmd);
}
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
relativeObjS, force_depends,
commands, false);
}
@@ -766,8 +780,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
objectRequires += ".requires";
std::vector<std::string> p_depends;
// always provide an empty requires target
- this->LocalGenerator->WriteMakeRule(
- *this->BuildFileStream, 0, objectRequires, p_depends, no_commands, true);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ objectRequires, p_depends, no_commands,
+ true);
// write a build rule to recursively build what this obj provides
std::string objectProvides = relativeObj;
@@ -783,13 +798,14 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
p_depends.clear();
p_depends.push_back(objectRequires);
- this->LocalGenerator->WriteMakeRule(
- *this->BuildFileStream, 0, objectProvides, p_depends, r_commands, true);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ objectProvides, p_depends, r_commands,
+ true);
// write the provides.build rule dependency on the obj file
p_depends.clear();
p_depends.push_back(relativeObj);
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, temp,
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, temp,
p_depends, no_commands, false);
}
@@ -815,8 +831,8 @@ void cmMakefileTargetGenerator::WriteTargetRequiresRules()
}
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, depTarget,
- depends, no_commands, true);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ depTarget, depends, no_commands, true);
}
void cmMakefileTargetGenerator::WriteTargetCleanRules()
@@ -834,11 +850,11 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
this->GeneratorTarget);
this->LocalGenerator->CreateCDCommand(
commands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory());
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, cleanTarget,
- depends, commands, true);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ cleanTarget, depends, commands, true);
}
bool cmMakefileTargetGenerator::WriteMakeRule(
@@ -848,7 +864,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
const std::vector<std::string>& commands, bool in_help)
{
bool symbolic = false;
- if (outputs.size() == 0) {
+ if (outputs.empty()) {
return symbolic;
}
@@ -892,7 +908,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
if (!o_symbolic) {
output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out);
}
- this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends,
+ this->LocalGenerator->WriteMakeRule(os, CM_NULLPTR, *o, output_depends,
output_commands, o_symbolic, in_help);
if (!o_symbolic) {
@@ -962,7 +978,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "\n"
<< "# Fortran module output directory.\n"
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
- << this->GetFortranModuleDirectory() << "\")\n";
+ << this->GeneratorTarget->GetFortranModuleDirectory() << "\")\n";
/* clang-format on */
// and now write the rule to use it
@@ -984,9 +1000,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// paths. Make sure PWD is set to the original name of the home
// output directory to help cmSystemTools to create the same
// translation table for the dependency scanning process.
- depCmd << "cd " << (this->LocalGenerator->Convert(
- this->LocalGenerator->GetBinaryDirectory(),
- cmOutputConverter::FULL, cmOutputConverter::SHELL))
+ depCmd << "cd " << (this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetBinaryDirectory()),
+ cmOutputConverter::SHELL))
<< " && ";
#endif
// Generate a call this signature:
@@ -1000,20 +1017,29 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// the state of our local generator sufficiently for its needs.
depCmd << "$(CMAKE_COMMAND) -E cmake_depends \""
<< this->GlobalGenerator->GetName() << "\" "
- << this->Convert(this->LocalGenerator->GetSourceDirectory(),
- cmOutputConverter::FULL, cmOutputConverter::SHELL)
+ << this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetSourceDirectory()),
+ cmOutputConverter::SHELL)
<< " "
- << this->Convert(this->LocalGenerator->GetCurrentSourceDirectory(),
- cmOutputConverter::FULL, cmOutputConverter::SHELL)
+ << this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetCurrentSourceDirectory()),
+ cmOutputConverter::SHELL)
<< " "
- << this->Convert(this->LocalGenerator->GetBinaryDirectory(),
- cmOutputConverter::FULL, cmOutputConverter::SHELL)
+ << this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetBinaryDirectory()),
+ cmOutputConverter::SHELL)
<< " "
- << this->Convert(this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmOutputConverter::FULL, cmOutputConverter::SHELL)
+ << this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(
+ this->LocalGenerator->GetCurrentBinaryDirectory()),
+ cmOutputConverter::SHELL)
<< " "
- << this->Convert(this->InfoFileNameFull, cmOutputConverter::FULL,
- cmOutputConverter::SHELL);
+ << this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(this->InfoFileNameFull),
+ cmOutputConverter::SHELL);
if (this->LocalGenerator->GetColorMakefile()) {
depCmd << " --color=$(COLOR)";
}
@@ -1025,8 +1051,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
}
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, depTarget,
- depends, commands, true);
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ depTarget, depends, commands, true);
}
void cmMakefileTargetGenerator::DriveCustomCommands(
@@ -1079,8 +1105,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
// Now append the actual user-specified commands.
std::ostringstream content;
this->LocalGenerator->AppendCustomCommand(
- commands, ccg, this->GeneratorTarget, false,
- cmOutputConverter::HOME_OUTPUT, &content);
+ commands, ccg, this->GeneratorTarget,
+ this->LocalGenerator->GetBinaryDirectory(), false, &content);
// Collect the dependencies.
std::vector<std::string> depends;
@@ -1088,8 +1114,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
// Write the rule.
const std::vector<std::string>& outputs = ccg.GetOutputs();
- bool symbolic =
- this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands);
+ bool symbolic = this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ outputs, depends, commands);
// If the rule has changed make sure the output is rebuilt.
if (!symbolic) {
@@ -1100,10 +1126,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
for (cmCustomCommand::ImplicitDependsList::const_iterator idi =
ccg.GetCC().GetImplicitDepends().begin();
idi != ccg.GetCC().GetImplicitDepends().end(); ++idi) {
- std::string objFullPath =
- this->Convert(outputs[0], cmOutputConverter::FULL);
- std::string srcFullPath =
- this->Convert(idi->second, cmOutputConverter::FULL);
+ std::string objFullPath = cmSystemTools::CollapseFullPath(outputs[0]);
+ std::string srcFullPath = cmSystemTools::CollapseFullPath(idi->second);
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi->first,
objFullPath.c_str(),
srcFullPath.c_str());
@@ -1159,7 +1183,8 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->Convert(*i, cmOutputConverter::START_OUTPUT);
+ object = this->LocalGenerator->ConvertToRelativePath(
+ *i, cmOutputConverter::START_OUTPUT);
*this->BuildFileStream << " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition(
"CMAKE_OBJECT_NAME");
@@ -1246,15 +1271,14 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
- buildTargetRuleName =
- this->Convert(buildTargetRuleName, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
+ buildTargetRuleName, cmOutputConverter::HOME_OUTPUT);
// Build the list of target outputs to drive.
std::vector<std::string> depends;
depends.push_back(main_output);
- const char* comment = 0;
+ const char* comment = CM_NULLPTR;
if (relink) {
// Setup the comment for the preinstall driver.
comment = "Rule to relink during preinstall.";
@@ -1443,6 +1467,73 @@ void cmMakefileTargetGenerator::CreateLinkScript(
makefile_depends.push_back(linkScriptName);
}
+static size_t calculateCommandLineLengthLimit()
+{
+#if defined(_SC_ARG_MAX)
+ return ((size_t)sysconf(_SC_ARG_MAX)) - 1000;
+#else
+ return 0;
+#endif
+}
+
+bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
+ std::string const& l) const
+{
+ // Check for an explicit setting one way or the other.
+ std::string const responseVar =
+ "CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS";
+ if (const char* val = this->Makefile->GetDefinition(responseVar)) {
+ if (*val) {
+ return cmSystemTools::IsOn(val);
+ }
+ }
+
+ // Check for a system limit.
+ if (size_t const limit = calculateCommandLineLengthLimit()) {
+ // Compute the total length of our list of object files with room
+ // for argument separation and quoting. This does not convert paths
+ // relative to START_OUTPUT like the final list will be, so the actual
+ // list will likely be much shorter than this. However, in the worst
+ // case all objects will remain as absolute paths.
+ size_t length = 0;
+ for (std::vector<std::string>::const_iterator i = this->Objects.begin();
+ i != this->Objects.end(); ++i) {
+ length += i->size() + 3;
+ }
+ for (std::vector<std::string>::const_iterator i =
+ this->ExternalObjects.begin();
+ i != this->ExternalObjects.end(); ++i) {
+ length += i->size() + 3;
+ }
+
+ // We need to guarantee room for both objects and libraries, so
+ // if the objects take up more than half then use a response file
+ // for them.
+ if (length > (limit / 2)) {
+ return true;
+ }
+ }
+
+ // We do not need a response file for objects.
+ return false;
+}
+
+bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
+ std::string const& l) const
+{
+ // Check for an explicit setting one way or the other.
+ std::string const responseVar =
+ "CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
+ if (const char* val = this->Makefile->GetDefinition(responseVar)) {
+ if (*val) {
+ return cmSystemTools::IsOn(val);
+ }
+ }
+
+ // We do not need a response file for libraries.
+ return false;
+}
+
std::string cmMakefileTargetGenerator::CreateResponseFile(
const char* name, std::string const& options,
std::vector<std::string>& makefile_depends)
@@ -1494,8 +1585,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
// Reference the response file.
linkLibs = responseFlag;
- linkLibs += this->Convert(link_rsp, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ linkLibs += this->LocalGenerator->ConvertToOutputFormat(
+ link_rsp, cmOutputConverter::SHELL);
}
}
@@ -1543,8 +1634,8 @@ void cmMakefileTargetGenerator::CreateObjectLists(
// Reference the response file.
buildObjs += responseFlag;
- buildObjs += this->Convert(objects_rsp, cmOutputConverter::NONE,
- cmOutputConverter::SHELL);
+ buildObjs += this->LocalGenerator->ConvertToOutputFormat(
+ objects_rsp, cmOutputConverter::SHELL);
}
} else if (useLinkScript) {
if (!useArchiveRules) {
@@ -1591,3 +1682,46 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
this->LocalGenerator->AppendFlags(flags, includeFlags);
}
}
+
+void cmMakefileTargetGenerator::GenDefFile(
+ std::vector<std::string>& real_link_commands, std::string& linkFlags)
+{
+ if (this->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
+ std::string name_of_def_file =
+ this->GeneratorTarget->GetSupportDirectory();
+ name_of_def_file += std::string("/") + this->GeneratorTarget->GetName();
+ name_of_def_file += ".def";
+ std::string cmd = cmSystemTools::GetCMakeCommand();
+ cmd = this->LocalGenerator->ConvertToOutputFormat(
+ cmd, cmOutputConverter::SHELL);
+ cmd += " -E __create_def ";
+ cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+ cmd += " ";
+ std::string objlist_file = name_of_def_file;
+ objlist_file += ".objs";
+ cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+ real_link_commands.insert(real_link_commands.begin(), cmd);
+ // create a list of obj files for the -E __create_def to read
+ cmGeneratedFileStream fout(objlist_file.c_str());
+ for (std::vector<std::string>::const_iterator i = this->Objects.begin();
+ i != this->Objects.end(); ++i) {
+ if (cmHasLiteralSuffix(*i, ".obj")) {
+ fout << *i << "\n";
+ }
+ }
+ for (std::vector<std::string>::const_iterator i =
+ this->ExternalObjects.begin();
+ i != this->ExternalObjects.end(); ++i) {
+ fout << *i << "\n";
+ }
+ // now add the def file link flag
+ linkFlags += " ";
+ linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
+ linkFlags +=
+ this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+ linkFlags += " ";
+ }
+}
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index c513026..e4f7a36 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -12,18 +12,22 @@
#ifndef cmMakefileTargetGenerator_h
#define cmMakefileTargetGenerator_h
-#include "cmCommonTargetGenerator.h"
+#include <cmConfigure.h>
+#include "cmCommonTargetGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmOSXBundleGenerator.h"
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
class cmCustomCommandGenerator;
-class cmDepends;
-class cmGeneratorTarget;
class cmGeneratedFileStream;
+class cmGeneratorTarget;
class cmGlobalUnixMakefileGenerator3;
-class cmLocalUnixMakefileGenerator3;
-class cmMakefile;
class cmSourceFile;
/** \class cmMakefileTargetGenerator
@@ -35,7 +39,7 @@ class cmMakefileTargetGenerator : public cmCommonTargetGenerator
public:
// constructor to set the ivars
cmMakefileTargetGenerator(cmGeneratorTarget* target);
- virtual ~cmMakefileTargetGenerator();
+ ~cmMakefileTargetGenerator() CM_OVERRIDE;
// construct using this factory call
static cmMakefileTargetGenerator* New(cmGeneratorTarget* tgt);
@@ -83,7 +87,8 @@ protected:
{
}
- void operator()(cmSourceFile const& source, const char* pkgloc);
+ void operator()(cmSourceFile const& source,
+ const char* pkgloc) CM_OVERRIDE;
private:
cmMakefileTargetGenerator* Generator;
@@ -150,6 +155,9 @@ protected:
std::string CreateResponseFile(const char* name, std::string const& options,
std::vector<std::string>& makefile_depends);
+ bool CheckUseResponseFileForObjects(std::string const& l) const;
+ bool CheckUseResponseFileForLibraries(std::string const& l) const;
+
/** Create list of flags for link libraries. */
void CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile,
std::vector<std::string>& makefile_depends,
@@ -161,7 +169,12 @@ protected:
std::vector<std::string>& makefile_depends,
bool useWatcomQuote);
- void AddIncludeFlags(std::string& flags, const std::string& lang);
+ /** Add commands for generate def files */
+ void GenDefFile(std::vector<std::string>& real_link_commands,
+ std::string& linkFlags);
+
+ void AddIncludeFlags(std::string& flags,
+ const std::string& lang) CM_OVERRIDE;
virtual void CloseFileStreams();
void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 6e44e8f..b709545 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -12,10 +12,16 @@
#include "cmMakefileUtilityTargetGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
+#include "cmOSXBundleGenerator.h"
+#include "cmOutputConverter.h"
+
+#include <ostream>
+#include <string>
+#include <vector>
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
cmGeneratorTarget* target)
@@ -69,14 +75,14 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPreBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
// Depend on all custom command outputs for sources
this->DriveCustomCommands(depends);
this->LocalGenerator->AppendCustomCommands(
commands, this->GeneratorTarget->GetPostBuildCommands(),
- this->GeneratorTarget);
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
// Add dependencies on targets that must be built first.
this->AppendTargetDepends(depends);
@@ -95,7 +101,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
}
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
this->GeneratorTarget->GetName(),
depends, commands, true);
diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h
index dbb312c..daf4bac 100644
--- a/Source/cmMakefileUtilityTargetGenerator.h
+++ b/Source/cmMakefileUtilityTargetGenerator.h
@@ -12,17 +12,21 @@
#ifndef cmMakefileUtilityTargetGenerator_h
#define cmMakefileUtilityTargetGenerator_h
+#include <cmConfigure.h>
+
#include "cmMakefileTargetGenerator.h"
+class cmGeneratorTarget;
+
class cmMakefileUtilityTargetGenerator : public cmMakefileTargetGenerator
{
public:
cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target);
- virtual ~cmMakefileUtilityTargetGenerator();
+ ~cmMakefileUtilityTargetGenerator() CM_OVERRIDE;
/* the main entry point for this class. Writes the Makefiles associated
with this target */
- virtual void WriteRuleFiles();
+ void WriteRuleFiles() CM_OVERRIDE;
protected:
};
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 07f1fa8..2fb6a75 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -35,7 +35,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
cmState* state = this->Makefile->GetState();
if (!state->GetCacheEntryValue(variable)) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
- variable, 0, 0, cmState::UNINITIALIZED);
+ variable, CM_NULLPTR, CM_NULLPTR, cmState::UNINITIALIZED);
overwrite = true;
}
if (!state->GetCacheEntryValue(variable)) {
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index add43c9..bb1b83c 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmMarkAsAdvancedCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmMarkAsAdvancedCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "mark_as_advanced"; }
+ std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; }
/**
* This determines if the command is invoked when in script mode.
@@ -45,7 +45,7 @@ public:
* make many of the modules usable in cmake/ctest scripts, (among them
* FindUnixMake.cmake used by the CTEST_BUILD command.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand);
};
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 3ac6f41..b99e790 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -21,24 +21,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmMathCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmMathCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "math"; }
+ std::string GetName() const CM_OVERRIDE { return "math"; }
cmTypeMacro(cmMathCommand, cmCommand);
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index f4458a7..c48910e 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmMessageCommand.h"
+#include "cmMessenger.h"
+
// cmLibraryCommand
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -24,7 +26,6 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
cmake::MessageType type = cmake::MESSAGE;
bool status = false;
bool fatal = false;
- cmake* cm = this->Makefile->GetCMakeInstance();
if (*i == "SEND_ERROR") {
type = cmake::FATAL_ERROR;
++i;
@@ -36,10 +37,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
type = cmake::WARNING;
++i;
} else if (*i == "AUTHOR_WARNING") {
- if (cm->GetDevWarningsAsErrors(this->Makefile)) {
+ if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
+ !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
fatal = true;
type = cmake::AUTHOR_ERROR;
- } else if (!cm->GetSuppressDevWarnings(this->Makefile)) {
+ } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
type = cmake::AUTHOR_WARNING;
} else {
return true;
@@ -49,10 +51,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
status = true;
++i;
} else if (*i == "DEPRECATION") {
- if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) {
+ if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
fatal = true;
type = cmake::DEPRECATION_ERROR;
- } else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) {
+ } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
+ this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
type = cmake::DEPRECATION_WARNING;
} else {
return true;
@@ -63,8 +66,9 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
if (type != cmake::MESSAGE) {
- // we've overriden the message type, above, so force IssueMessage to use it
- this->Makefile->IssueMessage(type, message, true);
+ // we've overriden the message type, above, so display it directly
+ cmMessenger* m = this->Makefile->GetMessenger();
+ m->DisplayMessage(type, message, this->Makefile->GetBacktrace());
} else {
if (status) {
this->Makefile->DisplayStatus(message.c_str(), -1);
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index afc5509..61767a1 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -24,24 +24,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmMessageCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmMessageCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "message"; }
+ std::string GetName() const CM_OVERRIDE { return "message"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmMessageCommand, cmCommand);
};
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
new file mode 100644
index 0000000..43fa150
--- /dev/null
+++ b/Source/cmMessenger.cxx
@@ -0,0 +1,209 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmMessenger.h"
+#include "cmDocumentationFormatter.h"
+#include "cmMessenger.h"
+#include "cmOutputConverter.h"
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include <cmsys/SystemInformation.hxx>
+#endif
+
+cmake::MessageType cmMessenger::ConvertMessageType(cmake::MessageType t) const
+{
+ bool warningsAsErrors;
+
+ if (t == cmake::AUTHOR_WARNING || t == cmake::AUTHOR_ERROR) {
+ warningsAsErrors = this->GetDevWarningsAsErrors();
+ if (warningsAsErrors && t == cmake::AUTHOR_WARNING) {
+ t = cmake::AUTHOR_ERROR;
+ } else if (!warningsAsErrors && t == cmake::AUTHOR_ERROR) {
+ t = cmake::AUTHOR_WARNING;
+ }
+ } else if (t == cmake::DEPRECATION_WARNING ||
+ t == cmake::DEPRECATION_ERROR) {
+ warningsAsErrors = this->GetDeprecatedWarningsAsErrors();
+ if (warningsAsErrors && t == cmake::DEPRECATION_WARNING) {
+ t = cmake::DEPRECATION_ERROR;
+ } else if (!warningsAsErrors && t == cmake::DEPRECATION_ERROR) {
+ t = cmake::DEPRECATION_WARNING;
+ }
+ }
+
+ return t;
+}
+
+bool cmMessenger::IsMessageTypeVisible(cmake::MessageType t) const
+{
+ bool isVisible = true;
+
+ if (t == cmake::DEPRECATION_ERROR) {
+ if (!this->GetDeprecatedWarningsAsErrors()) {
+ isVisible = false;
+ }
+ } else if (t == cmake::DEPRECATION_WARNING) {
+ if (this->GetSuppressDeprecatedWarnings()) {
+ isVisible = false;
+ }
+ } else if (t == cmake::AUTHOR_ERROR) {
+ if (!this->GetDevWarningsAsErrors()) {
+ isVisible = false;
+ }
+ } else if (t == cmake::AUTHOR_WARNING) {
+ if (this->GetSuppressDevWarnings()) {
+ isVisible = false;
+ }
+ }
+
+ return isVisible;
+}
+
+static bool printMessagePreamble(cmake::MessageType t, std::ostream& msg)
+{
+ // Construct the message header.
+ if (t == cmake::FATAL_ERROR) {
+ msg << "CMake Error";
+ } else if (t == cmake::INTERNAL_ERROR) {
+ msg << "CMake Internal Error (please report a bug)";
+ } else if (t == cmake::LOG) {
+ msg << "CMake Debug Log";
+ } else if (t == cmake::DEPRECATION_ERROR) {
+ msg << "CMake Deprecation Error";
+ } else if (t == cmake::DEPRECATION_WARNING) {
+ msg << "CMake Deprecation Warning";
+ } else if (t == cmake::AUTHOR_WARNING) {
+ msg << "CMake Warning (dev)";
+ } else if (t == cmake::AUTHOR_ERROR) {
+ msg << "CMake Error (dev)";
+ } else {
+ msg << "CMake Warning";
+ }
+ return true;
+}
+
+void printMessageText(std::ostream& msg, std::string const& text)
+{
+ msg << ":\n";
+ cmDocumentationFormatter formatter;
+ formatter.SetIndent(" ");
+ formatter.PrintFormatted(msg, text.c_str());
+}
+
+void displayMessage(cmake::MessageType t, std::ostringstream& msg)
+{
+ // Add a note about warning suppression.
+ if (t == cmake::AUTHOR_WARNING) {
+ msg << "This warning is for project developers. Use -Wno-dev to suppress "
+ "it.";
+ } else if (t == cmake::AUTHOR_ERROR) {
+ msg << "This error is for project developers. Use -Wno-error=dev to "
+ "suppress "
+ "it.";
+ }
+
+ // Add a terminating blank line.
+ msg << "\n";
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ // Add a C++ stack trace to internal errors.
+ if (t == cmake::INTERNAL_ERROR) {
+ std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0);
+ if (!stack.empty()) {
+ if (cmHasLiteralPrefix(stack, "WARNING:")) {
+ stack = "Note:" + stack.substr(8);
+ }
+ msg << stack << "\n";
+ }
+ }
+#endif
+
+ // Output the message.
+ if (t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR ||
+ t == cmake::DEPRECATION_ERROR || t == cmake::AUTHOR_ERROR) {
+ cmSystemTools::SetErrorOccured();
+ cmSystemTools::Message(msg.str().c_str(), "Error");
+ } else {
+ cmSystemTools::Message(msg.str().c_str(), "Warning");
+ }
+}
+
+cmMessenger::cmMessenger(cmState* state)
+ : State(state)
+{
+}
+
+void cmMessenger::IssueMessage(cmake::MessageType t, const std::string& text,
+ const cmListFileBacktrace& backtrace) const
+{
+ bool force = false;
+ if (!force) {
+ // override the message type, if needed, for warnings and errors
+ cmake::MessageType override = this->ConvertMessageType(t);
+ if (override != t) {
+ t = override;
+ force = true;
+ }
+ }
+
+ if (!force && !this->IsMessageTypeVisible(t)) {
+ return;
+ }
+ this->DisplayMessage(t, text, backtrace);
+}
+
+void cmMessenger::DisplayMessage(cmake::MessageType t, const std::string& text,
+ const cmListFileBacktrace& backtrace) const
+{
+ std::ostringstream msg;
+ if (!printMessagePreamble(t, msg)) {
+ return;
+ }
+
+ // Add the immediate context.
+ backtrace.PrintTitle(msg);
+
+ printMessageText(msg, text);
+
+ // Add the rest of the context.
+ backtrace.PrintCallStack(msg);
+
+ displayMessage(t, msg);
+}
+
+bool cmMessenger::GetSuppressDevWarnings() const
+{
+ const char* cacheEntryValue =
+ this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+ return cmSystemTools::IsOn(cacheEntryValue);
+}
+
+bool cmMessenger::GetSuppressDeprecatedWarnings() const
+{
+ const char* cacheEntryValue =
+ this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
+ return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
+}
+
+bool cmMessenger::GetDevWarningsAsErrors() const
+{
+ const char* cacheEntryValue =
+ this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
+ return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
+}
+
+bool cmMessenger::GetDeprecatedWarningsAsErrors() const
+{
+ const char* cacheEntryValue =
+ this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
+ return cmSystemTools::IsOn(cacheEntryValue);
+}
diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h
new file mode 100644
index 0000000..f15bf13
--- /dev/null
+++ b/Source/cmMessenger.h
@@ -0,0 +1,44 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmMessenger_h
+#define cmMessenger_h
+
+#include "cmListFileCache.h"
+#include "cmState.h"
+#include "cmake.h"
+
+class cmMessenger
+{
+public:
+ cmMessenger(cmState* state);
+
+ void IssueMessage(
+ cmake::MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
+
+ void DisplayMessage(cmake::MessageType t, std::string const& text,
+ cmListFileBacktrace const& backtrace) const;
+
+ bool GetSuppressDevWarnings() const;
+ bool GetSuppressDeprecatedWarnings() const;
+ bool GetDevWarningsAsErrors() const;
+ bool GetDeprecatedWarningsAsErrors() const;
+
+private:
+ bool IsMessageTypeVisible(cmake::MessageType t) const;
+ cmake::MessageType ConvertMessageType(cmake::MessageType t) const;
+
+ cmState* State;
+};
+
+#endif
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index c03f60d..e9d017e 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmNewLineStyle.h"
+#include <stddef.h>
+
cmNewLineStyle::cmNewLineStyle()
: NewLineStyle(Invalid)
{
@@ -34,19 +36,18 @@ bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
if (eol == "LF" || eol == "UNIX") {
NewLineStyle = LF;
return true;
- } else if (eol == "CRLF" || eol == "WIN32" || eol == "DOS") {
+ }
+ if (eol == "CRLF" || eol == "WIN32" || eol == "DOS") {
NewLineStyle = CRLF;
return true;
- } else {
- errorString = "NEWLINE_STYLE sets an unknown style, only LF, "
- "CRLF, UNIX, DOS, and WIN32 are supported";
- return false;
}
- } else {
- errorString = "NEWLINE_STYLE must set a style: "
- "LF, CRLF, UNIX, DOS, or WIN32";
+ errorString = "NEWLINE_STYLE sets an unknown style, only LF, "
+ "CRLF, UNIX, DOS, and WIN32 are supported";
return false;
}
+ errorString = "NEWLINE_STYLE must set a style: "
+ "LF, CRLF, UNIX, DOS, or WIN32";
+ return false;
}
}
return true;
diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h
index 800f131..427348a 100644
--- a/Source/cmNewLineStyle.h
+++ b/Source/cmNewLineStyle.h
@@ -12,7 +12,10 @@
#ifndef cmNewLineStyle_h
#define cmNewLineStyle_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
class cmNewLineStyle
{
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 3e91545..335b552 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -13,18 +13,30 @@
#include "cmNinjaNormalTargetGenerator.h"
#include "cmAlgorithms.h"
+#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
+#include "cmNinjaTypes.h"
#include "cmOSXBundleGenerator.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
#include <algorithm>
#include <assert.h>
+#include <iterator>
#include <limits>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stddef.h>
#ifndef _WIN32
#include <unistd.h>
@@ -41,15 +53,16 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
, TargetLinkLanguage("")
{
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
- if (target->GetType() == cmState::EXECUTABLE)
+ if (target->GetType() == cmState::EXECUTABLE) {
this->GetGeneratorTarget()->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, GetLocalGenerator()->GetConfigName());
- else
+ } else {
this->GetGeneratorTarget()->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB,
GetLocalGenerator()->GetConfigName());
+ }
if (target->GetType() != cmState::OBJECT_LIBRARY) {
// on Windows the output dir is already needed at compile time
@@ -125,14 +138,15 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
case cmState::SHARED_LIBRARY:
return "shared library";
case cmState::MODULE_LIBRARY:
- if (this->GetGeneratorTarget()->IsCFBundleOnApple())
+ if (this->GetGeneratorTarget()->IsCFBundleOnApple()) {
return "CFBundle shared module";
- else
+ } else {
return "shared module";
+ }
case cmState::EXECUTABLE:
return "executable";
default:
- return 0;
+ return CM_NULLPTR;
}
}
@@ -144,6 +158,14 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule() const
this->GetGeneratorTarget()->GetName());
}
+struct cmNinjaRemoveNoOpCommands
+{
+ bool operator()(std::string const& cmd)
+ {
+ return cmd.empty() || cmd[0] == ':';
+ }
+};
+
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
{
cmState::TargetType targetType = this->GetGeneratorTarget()->GetType();
@@ -231,6 +253,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
i != linkCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
}
+ {
+ // If there is no ranlib the command will be ":". Skip it.
+ std::vector<std::string>::iterator newEnd = std::remove_if(
+ linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands());
+ linkCmds.erase(newEnd, linkCmds.end());
+ }
+
linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
linkCmds.push_back("$POST_BUILD");
std::string linkCmd =
@@ -256,7 +285,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
- if (targetType == cmState::EXECUTABLE)
+ if (targetType == cmState::EXECUTABLE) {
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_EXECUTABLE",
cmakeCommand + " -E cmake_symlink_executable"
@@ -269,7 +298,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
/*rspcontent*/ "",
/*restat*/ "",
/*generator*/ false);
- else
+ } else {
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_LIBRARY",
cmakeCommand + " -E cmake_symlink_library"
@@ -282,6 +311,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
/*rspcontent*/ "",
/*restat*/ "",
/*generator*/ false);
+ }
}
}
@@ -295,6 +325,22 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
const char* linkCmd = mf->GetDefinition(linkCmdVar);
if (linkCmd) {
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
+ if (this->GetGeneratorTarget()->GetProperty("LINK_WHAT_YOU_USE")) {
+ std::string cmakeCommand =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmakeCommand += " -E __run_iwyu --lwyu=";
+ cmGeneratorTarget& gt = *this->GetGeneratorTarget();
+ const std::string cfgName = this->GetConfigName();
+ std::string targetOutput = ConvertToNinjaPath(gt.GetFullPath(cfgName));
+ std::string targetOutputReal =
+ this->ConvertToNinjaPath(gt.GetFullPath(cfgName,
+ /*implib=*/false,
+ /*realpath=*/true));
+ cmakeCommand += targetOutputReal;
+ cmakeCommand += " || true";
+ linkCmds.push_back(cmakeCommand);
+ }
return linkCmds;
}
}
@@ -340,7 +386,7 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
#ifdef _WIN32
8000,
#endif
-#if defined(__APPLE__) || defined(__HAIKU__) || defined(__linux)
+#if defined(_SC_ARG_MAX)
// for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
((int)sysconf(_SC_ARG_MAX)) - 1000,
#endif
@@ -354,7 +400,7 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
size_t const arrSz = cmArraySize(limits);
int const sz = *std::min_element(limits, limits + arrSz);
if (sz == std::numeric_limits<int>::max()) {
- return -1;
+ return 0;
}
return sz - linkRuleLength;
@@ -434,11 +480,12 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
- localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"],
- vars["LINK_FLAGS"], frameworkPath, linkPath,
- &genTarget, useWatcomQuote);
+ localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
+ vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
+ linkPath, &genTarget, useWatcomQuote);
if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
- gt.GetType() == cmState::SHARED_LIBRARY) {
+ (gt.GetType() == cmState::SHARED_LIBRARY ||
+ gt.IsExecutableWithExports())) {
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
std::string name_of_def_file = gt.GetSupportDirectory();
name_of_def_file += "/" + gt.GetName();
@@ -467,6 +514,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["MANIFESTS"] = this->GetManifests();
vars["LINK_PATH"] = frameworkPath + linkPath;
+ std::string lwyuFlags;
+ if (genTarget.GetProperty("LINK_WHAT_YOU_USE")) {
+ lwyuFlags = " -Wl,--no-as-needed";
+ }
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
@@ -474,16 +525,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (targetType == cmState::EXECUTABLE) {
std::string t = vars["FLAGS"];
localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
+ t += lwyuFlags;
vars["FLAGS"] = t;
} else {
std::string t = vars["ARCH_FLAGS"];
localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t = "";
+ t += lwyuFlags;
localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
-
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;
@@ -491,8 +543,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
if (!install_dir.empty()) {
- vars["INSTALLNAME_DIR"] = localGen.Convert(
- install_dir, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+ vars["INSTALLNAME_DIR"] = localGen.ConvertToOutputFormat(
+ install_dir, cmOutputConverter::SHELL);
}
}
}
@@ -560,7 +612,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
// maybe create .def file from list of objects
- if (gt.GetType() == cmState::SHARED_LIBRARY &&
+ if ((gt.GetType() == cmState::SHARED_LIBRARY ||
+ gt.IsExecutableWithExports()) &&
this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
std::string cmakeCommand =
@@ -607,7 +660,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["POST_BUILD"] = ":";
symlinkVars["POST_BUILD"] = postBuildCmdLine;
}
-
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
int commandLineLengthLimit = -1;
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 300618c..1f670bf 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -13,23 +13,22 @@
#ifndef cmNinjaNormalTargetGenerator_h
#define cmNinjaNormalTargetGenerator_h
-#include "cmNinjaTargetGenerator.h"
+#include <cmConfigure.h>
-#include "cmNinjaTypes.h"
+#include "cmNinjaTargetGenerator.h"
-#include <set>
+#include <string>
+#include <vector>
-class cmSourceFile;
-class cmOSXBundleGenerator;
class cmGeneratorTarget;
class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator
{
public:
cmNinjaNormalTargetGenerator(cmGeneratorTarget* target);
- ~cmNinjaNormalTargetGenerator();
+ ~cmNinjaNormalTargetGenerator() CM_OVERRIDE;
- void Generate();
+ void Generate() CM_OVERRIDE;
private:
std::string LanguageLinkerRule() const;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1aa2ddb..6ac59d5 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -18,14 +18,22 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
#include "cmNinjaNormalTargetGenerator.h"
#include "cmNinjaUtilityTargetGenerator.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
+#include "cmState.h"
#include "cmSystemTools.h"
+#include "cmake.h"
#include <algorithm>
+#include <iterator>
+#include <map>
+#include <sstream>
+#include <string.h>
cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
{
@@ -38,28 +46,18 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
return new cmNinjaNormalTargetGenerator(target);
case cmState::UTILITY:
+ case cmState::GLOBAL_TARGET:
return new cmNinjaUtilityTargetGenerator(target);
- ;
-
- case cmState::GLOBAL_TARGET: {
- // We only want to process global targets that live in the home
- // (i.e. top-level) directory. CMake creates copies of these targets
- // in every directory, which we don't need.
- if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(),
- target->GetLocalGenerator()->GetSourceDirectory()) == 0)
- return new cmNinjaUtilityTargetGenerator(target);
- // else fallthrough
- }
default:
- return 0;
+ return CM_NULLPTR;
}
}
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
- : cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target)
- , MacOSXContentGenerator(0)
- , OSXBundleGenerator(0)
+ : cmCommonTargetGenerator(target)
+ , MacOSXContentGenerator(CM_NULLPTR)
+ , OSXBundleGenerator(CM_NULLPTR)
, MacContentFolders()
, LocalGenerator(
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
@@ -130,11 +128,11 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, language,
- language == "RC" ? true : false, // full include paths for RC
- // needed by cmcldeps
+ language == "RC", // full include paths for RC needed by cmcldeps
false, this->GetConfigName());
- if (this->GetGlobalGenerator()->IsGCCOnWindows())
+ if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
+ }
this->LocalGenerator->AppendFlags(languageFlags, includeFlags);
}
@@ -171,13 +169,15 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
{
// Static libraries never depend on other targets for linking.
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY)
+ this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) {
return cmNinjaDeps();
+ }
cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
- if (!cli)
+ if (!cli) {
return cmNinjaDeps();
+ }
const std::vector<std::string>& deps = cli->GetDepends();
cmNinjaDeps result(deps.size());
@@ -219,8 +219,9 @@ std::string cmNinjaTargetGenerator::GetObjectFilePath(
cmSourceFile const* source) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
std::string const& objectName = this->GeneratorTarget->GetObjectName(source);
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
@@ -238,8 +239,9 @@ std::string cmNinjaTargetGenerator::GetTargetFilePath(
const std::string& name) const
{
std::string path = this->GetTargetOutputDir();
- if (path.empty() || path == ".")
+ if (path.empty() || path == ".") {
return name;
+ }
path += "/";
path += name;
return path;
@@ -300,7 +302,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->GetGeneratorTarget();
vars.Language = lang.c_str();
- vars.Source = "$in";
+ vars.Source = "$IN_ABS";
vars.Object = "$out";
vars.Defines = "$DEFINES";
vars.Includes = "$INCLUDES";
@@ -316,7 +318,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string rspcontent;
std::string responseFlag;
- if (this->ForceResponseFile()) {
+ if (lang != "RC" && this->ForceResponseFile()) {
rspfile = "$RSP_FILE";
responseFlag = "@" + rspfile;
rspcontent = " $DEFINES $INCLUDES $FLAGS";
@@ -421,8 +423,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
for (std::vector<std::string>::iterator i = compileCmds.begin();
- i != compileCmds.end(); ++i)
+ i != compileCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
+ }
std::string cmdLine =
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
@@ -481,6 +484,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
orderOnlyDeps);
+ // Add order-only dependencies on other files associated with the target.
+ orderOnlyDeps.insert(orderOnlyDeps.end(), this->ExtraFiles.begin(),
+ this->ExtraFiles.end());
+
// Add order-only dependencies on custom command outputs.
for (std::vector<cmCustomCommand const*>::const_iterator cci =
this->CustomCommands.begin();
@@ -519,8 +526,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSourceFile const* source, bool writeOrderDependsTargetForTarget)
{
std::string const language = source->GetLanguage();
- std::string const sourceFileName =
- language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
+ std::string const sourceFileName = this->GetSourceFilePath(source);
std::string const objectDir =
this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
std::string const objectFileName =
@@ -529,6 +535,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetFilenamePath(objectFileName);
cmNinjaVars vars;
+ vars["IN_ABS"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ source->GetFullPath(), cmOutputConverter::SHELL);
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->GetIncludes(language);
@@ -593,7 +601,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->SetMsvcTargetPdbVariable(vars);
- int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
+ bool const isRC = (language == "RC");
+ int const commandLineLengthLimit =
+ ((!isRC && this->ForceResponseFile())) ? -1 : 0;
std::string const rspfile = objectFileName + ".rsp";
this->GetGlobalGenerator()->WriteBuild(
@@ -654,8 +664,9 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
for (std::vector<std::string>::iterator i = compileCmds.begin();
- i != compileCmds.end(); ++i)
+ i != compileCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars);
+ }
std::string cmdLine =
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
@@ -710,8 +721,8 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input,
output);
- // Add as a dependency of all target so that it gets called.
- this->Generator->GetGlobalGenerator()->AddDependencyToAll(output);
+ // Add as a dependency to the target so that it gets called.
+ this->Generator->ExtraFiles.push_back(output);
}
void cmNinjaTargetGenerator::addPoolNinjaVariable(
@@ -728,5 +739,5 @@ bool cmNinjaTargetGenerator::ForceResponseFile()
{
static std::string const forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
return (this->GetMakefile()->IsDefinitionSet(forceRspFile) ||
- cmSystemTools::GetEnv(forceRspFile) != 0);
+ cmSystemTools::HasEnv(forceRspFile));
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 414aa09..2b26788 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -13,19 +13,23 @@
#ifndef cmNinjaTargetGenerator_h
#define cmNinjaTargetGenerator_h
-#include "cmCommonTargetGenerator.h"
+#include <cmConfigure.h>
+#include "cmCommonTargetGenerator.h"
#include "cmGlobalNinjaGenerator.h"
-#include "cmLocalNinjaGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOSXBundleGenerator.h"
-class cmTarget;
+#include <set>
+#include <string>
+#include <vector>
+
+class cmCustomCommand;
class cmGeneratedFileStream;
class cmGeneratorTarget;
+class cmLocalNinjaGenerator;
class cmMakefile;
class cmSourceFile;
-class cmCustomCommand;
class cmNinjaTargetGenerator : public cmCommonTargetGenerator
{
@@ -37,7 +41,7 @@ public:
cmNinjaTargetGenerator(cmGeneratorTarget* target);
/// Destructor.
- virtual ~cmNinjaTargetGenerator();
+ ~cmNinjaTargetGenerator() CM_OVERRIDE;
virtual void Generate() = 0;
@@ -79,7 +83,8 @@ protected:
std::string ComputeFlagsForObject(cmSourceFile const* source,
const std::string& language);
- void AddIncludeFlags(std::string& flags, std::string const& lang);
+ void AddIncludeFlags(std::string& flags,
+ std::string const& lang) CM_OVERRIDE;
std::string ComputeDefines(cmSourceFile const* source,
const std::string& language);
@@ -134,7 +139,8 @@ protected:
{
}
- void operator()(cmSourceFile const& source, const char* pkgloc);
+ void operator()(cmSourceFile const& source,
+ const char* pkgloc) CM_OVERRIDE;
private:
cmNinjaTargetGenerator* Generator;
@@ -156,6 +162,7 @@ private:
/// List of object files for this target.
cmNinjaDeps Objects;
std::vector<cmCustomCommand const*> CustomCommands;
+ cmNinjaDeps ExtraFiles;
};
#endif // ! cmNinjaTargetGenerator_h
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index f7a7f38..0664104 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -15,9 +15,21 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
+#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
+#include "cmNinjaTypes.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <algorithm>
+#include <iterator>
+#include <string>
+#include <vector>
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
cmGeneratorTarget* target)
@@ -31,10 +43,12 @@ cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator()
void cmNinjaUtilityTargetGenerator::Generate()
{
- std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash();
+ std::string utilCommandName =
+ this->GetLocalGenerator()->GetCurrentBinaryDirectory();
+ utilCommandName += cmake::GetCMakeFilesDirectory();
+ utilCommandName += "/";
utilCommandName += this->GetTargetName() + ".util";
- utilCommandName =
- this->GetGlobalGenerator()->NinjaOutputPath(utilCommandName);
+ utilCommandName = this->ConvertToNinjaPath(utilCommandName);
std::vector<std::string> commands;
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
@@ -57,8 +71,9 @@ void cmNinjaUtilityTargetGenerator::Generate()
std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
std::transform(ccByproducts.begin(), ccByproducts.end(),
std::back_inserter(util_outputs), MapToNinjaPath());
- if (ci->GetUsesTerminal())
+ if (ci->GetUsesTerminal()) {
uses_terminal = true;
+ }
}
}
@@ -99,10 +114,11 @@ void cmNinjaUtilityTargetGenerator::Generate()
const char* echoStr =
this->GetGeneratorTarget()->GetProperty("EchoString");
std::string desc;
- if (echoStr)
+ if (echoStr) {
desc = echoStr;
- else
+ } else {
desc = "Running utility command for " + this->GetTargetName();
+ }
// TODO: fix problematic global targets. For now, search and replace the
// makefile vars.
@@ -122,8 +138,9 @@ void cmNinjaUtilityTargetGenerator::Generate()
.c_str());
cmSystemTools::ReplaceString(command, "$(ARGS)", "");
- if (command.find('$') != std::string::npos)
+ if (command.find('$') != std::string::npos) {
return;
+ }
for (cmNinjaDeps::const_iterator oi = util_outputs.begin(),
oe = util_outputs.end();
@@ -133,7 +150,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
this->GetGlobalGenerator()->WriteCustomCommandBuild(
command, desc, "Utility command for " + this->GetTargetName(),
- uses_terminal,
+ /*depfile*/ "", uses_terminal,
/*restat*/ true, util_outputs, deps);
this->GetGlobalGenerator()->WritePhonyBuild(
@@ -141,6 +158,11 @@ void cmNinjaUtilityTargetGenerator::Generate()
cmNinjaDeps(1, utilCommandName));
}
- this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
- this->GetGeneratorTarget());
+ // Add an alias for the logical target name regardless of what directory
+ // contains it. Skip this for GLOBAL_TARGET because they are meant to
+ // be per-directory and have one at the top-level anyway.
+ if (this->GetGeneratorTarget()->GetType() != cmState::GLOBAL_TARGET) {
+ this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
+ this->GetGeneratorTarget());
+ }
}
diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h
index fec2946..78015aa 100644
--- a/Source/cmNinjaUtilityTargetGenerator.h
+++ b/Source/cmNinjaUtilityTargetGenerator.h
@@ -13,19 +13,19 @@
#ifndef cmNinjaUtilityTargetGenerator_h
#define cmNinjaUtilityTargetGenerator_h
-#include "cmNinjaTargetGenerator.h"
+#include <cmConfigure.h>
-#include "cmNinjaTypes.h"
+#include "cmNinjaTargetGenerator.h"
-class cmSourceFile;
+class cmGeneratorTarget;
class cmNinjaUtilityTargetGenerator : public cmNinjaTargetGenerator
{
public:
cmNinjaUtilityTargetGenerator(cmGeneratorTarget* target);
- ~cmNinjaUtilityTargetGenerator();
+ ~cmNinjaUtilityTargetGenerator() CM_OVERRIDE;
- void Generate();
+ void Generate() CM_OVERRIDE;
};
#endif // ! cmNinjaUtilityTargetGenerator_h
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index f62ba40..dbfe6eb 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -23,10 +23,11 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target,
, Makefile(target->Target->GetMakefile())
, LocalGenerator(target->GetLocalGenerator())
, ConfigName(configName)
- , MacContentFolders(0)
+ , MacContentFolders(CM_NULLPTR)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
}
bool cmOSXBundleGenerator::MustSkip()
@@ -37,8 +38,9 @@ bool cmOSXBundleGenerator::MustSkip()
void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
std::string& outpath)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
// Compute bundle directory names.
std::string out = outpath;
@@ -64,8 +66,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
const std::string& outpath)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
assert(this->MacContentFolders);
@@ -92,8 +95,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
plist.c_str());
// Generate Versions directory only for MacOSX frameworks
- if (this->Makefile->PlatformIsAppleIos())
+ if (this->Makefile->PlatformIsAppleIos()) {
return;
+ }
// TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
// drive rules to create these files at build time.
@@ -162,8 +166,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
const std::string& root)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
// Compute bundle directory names.
std::string out = root;
@@ -186,8 +191,9 @@ void cmOSXBundleGenerator::GenerateMacOSXContentStatements(
std::vector<cmSourceFile const*> const& sources,
MacOSXContentGeneratorType* generator)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
for (std::vector<cmSourceFile const*>::const_iterator si = sources.begin();
si != sources.end(); ++si) {
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 491f45e..6e6b076 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmOptionCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmOptionCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "option"; }
+ std::string GetName() const CM_OVERRIDE { return "option"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmOptionCommand, cmCommand);
};
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 00606c7..20f2246 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -157,7 +157,7 @@ public:
}
}
- virtual void Report(std::ostream& e)
+ void Report(std::ostream& e) CM_OVERRIDE
{
e << "runtime library [";
if (this->SOName.empty()) {
@@ -168,7 +168,7 @@ public:
e << "]";
}
- virtual bool FindConflict(std::string const& dir);
+ bool FindConflict(std::string const& dir) CM_OVERRIDE;
private:
// The soname of the shared library if it is known.
@@ -212,12 +212,12 @@ public:
{
}
- virtual void Report(std::ostream& e)
+ void Report(std::ostream& e) CM_OVERRIDE
{
e << "link library [" << this->FileName << "]";
}
- virtual bool FindConflict(std::string const& dir);
+ bool FindConflict(std::string const& dir) CM_OVERRIDE;
};
bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index fc1a388..38e197c 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -30,7 +30,8 @@ public:
cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
const char* purpose);
~cmOrderDirectories();
- void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
+ void AddRuntimeLibrary(std::string const& fullPath,
+ const char* soname = CM_NULLPTR);
void AddLinkLibrary(std::string const& fullPath);
void AddUserDirectories(std::vector<std::string> const& extra);
void AddLanguageDirectories(std::vector<std::string> const& dirs);
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 8e80bd0..630da42 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -15,6 +15,7 @@
#include "cmake.h"
#include <assert.h>
+#include <sstream>
#include <ctype.h> /* isalpha */
#include <string.h> /* strlen */
@@ -26,14 +27,14 @@ cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
assert(this->StateSnapshot.IsValid());
}
-std::string cmOutputConverter::ConvertToOutputForExistingCommon(
- const std::string& remote, std::string const& result,
- OutputFormat format) const
+std::string cmOutputConverter::ConvertToOutputForExisting(
+ const std::string& remote, OutputFormat format) const
{
// If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a
// space.
- if (this->GetState()->UseWindowsShell() && result.find(' ') != result.npos &&
+ if (this->GetState()->UseWindowsShell() &&
+ remote.find(' ') != std::string::npos &&
cmSystemTools::FileExists(remote.c_str())) {
std::string tmp;
if (cmSystemTools::GetShortPath(remote, tmp)) {
@@ -41,82 +42,44 @@ std::string cmOutputConverter::ConvertToOutputForExistingCommon(
}
}
- // Otherwise, leave it unchanged.
- return result;
-}
-
-std::string cmOutputConverter::ConvertToOutputForExisting(
- const std::string& remote, RelativeRoot local, OutputFormat format) const
-{
- static_cast<void>(local);
-
- // Perform standard conversion.
- std::string result = this->ConvertToOutputFormat(remote, format);
-
- // Consider short-path.
- return this->ConvertToOutputForExistingCommon(remote, result, format);
+ // Otherwise, perform standard conversion.
+ return this->ConvertToOutputFormat(remote, format);
}
-std::string cmOutputConverter::ConvertToOutputForExisting(
- RelativeRoot remote, const std::string& local, OutputFormat format) const
-{
- // Perform standard conversion.
- std::string result = this->Convert(remote, local, format, true);
-
- // Consider short-path.
- const char* remotePath = this->GetRelativeRootPath(remote);
- return this->ConvertToOutputForExistingCommon(remotePath, result, format);
-}
-
-const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const
-{
- switch (relroot) {
- case HOME:
- return this->GetState()->GetSourceDirectory();
- case START:
- return this->StateSnapshot.GetDirectory().GetCurrentSource();
- case HOME_OUTPUT:
- return this->GetState()->GetBinaryDirectory();
- case START_OUTPUT:
- return this->StateSnapshot.GetDirectory().GetCurrentBinary();
- default:
- break;
- }
- return 0;
-}
-
-std::string cmOutputConverter::Convert(const std::string& source,
- RelativeRoot relative,
- OutputFormat output) const
+std::string cmOutputConverter::ConvertToRelativePath(
+ const std::string& source, RelativeRoot relative) const
{
- // Convert the path to a relative path.
- std::string result = source;
+ std::string result;
switch (relative) {
case HOME:
result = this->ConvertToRelativePath(
- this->GetState()->GetSourceDirectoryComponents(), result);
+ this->GetState()->GetSourceDirectoryComponents(), source);
break;
case START:
result = this->ConvertToRelativePath(
this->StateSnapshot.GetDirectory().GetCurrentSourceComponents(),
- result);
+ source);
break;
case HOME_OUTPUT:
result = this->ConvertToRelativePath(
- this->GetState()->GetBinaryDirectoryComponents(), result);
+ this->GetState()->GetBinaryDirectoryComponents(), source);
break;
case START_OUTPUT:
result = this->ConvertToRelativePath(
this->StateSnapshot.GetDirectory().GetCurrentBinaryComponents(),
- result);
- break;
- case FULL:
- result = cmSystemTools::CollapseFullPath(result);
- break;
- case NONE:
+ source);
break;
}
+ return result;
+}
+
+std::string cmOutputConverter::Convert(const std::string& source,
+ RelativeRoot relative,
+ OutputFormat output) const
+{
+ // Convert the path to a relative path.
+ std::string result = this->ConvertToRelativePath(source, relative);
return this->ConvertToOutputFormat(result, output);
}
@@ -155,26 +118,6 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
return result;
}
-std::string cmOutputConverter::Convert(RelativeRoot remote,
- const std::string& local,
- OutputFormat output,
- bool optional) const
-{
- const char* remotePath = this->GetRelativeRootPath(remote);
-
- // The relative root must have a path (i.e. not FULL or NONE)
- assert(remotePath != 0);
-
- if (!local.empty() && !optional) {
- std::vector<std::string> components;
- cmSystemTools::SplitPath(local, components);
- std::string result = this->ConvertToRelativePath(components, remotePath);
- return this->ConvertToOutputFormat(result, output);
- }
-
- return this->ConvertToOutputFormat(remotePath, output);
-}
-
static bool cmOutputConverterNotAbove(const char* a, const char* b)
{
return (cmSystemTools::ComparePath(a, b) ||
@@ -328,19 +271,9 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str,
flags |= Shell_Flag_NMake;
}
- // Compute the buffer size needed.
- int size = (this->GetState()->UseWindowsShell()
- ? Shell_GetArgumentSizeForWindows(str.c_str(), flags)
- : Shell_GetArgumentSizeForUnix(str.c_str(), flags));
-
- // Compute the shell argument itself.
- std::vector<char> arg(size);
- if (this->GetState()->UseWindowsShell()) {
- Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
- } else {
- Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags);
- }
- return std::string(&arg[0]);
+ return this->GetState()->UseWindowsShell()
+ ? Shell_GetArgumentForWindows(str.c_str(), flags)
+ : Shell_GetArgumentForUnix(str.c_str(), flags);
}
std::string cmOutputConverter::EscapeForCMake(const std::string& str)
@@ -369,18 +302,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str)
std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg,
int shell_flags)
{
- char local_buffer[1024];
- char* buffer = local_buffer;
- int size = Shell_GetArgumentSizeForWindows(arg, shell_flags);
- if (size > 1024) {
- buffer = new char[size];
- }
- Shell_GetArgumentForWindows(arg, buffer, shell_flags);
- std::string result(buffer);
- if (buffer != local_buffer) {
- delete[] buffer;
- }
- return result;
+ return Shell_GetArgumentForWindows(arg, shell_flags);
}
cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
@@ -586,12 +508,10 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
return 0;
}
-int cmOutputConverter::Shell__GetArgumentSize(const char* in, int isUnix,
- int flags)
+std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
+ int flags)
{
- /* Start with the length of the original argument, plus one for
- either a terminating null or a separating space. */
- int size = (int)strlen(in) + 1;
+ std::ostringstream out;
/* String iterator. */
const char* c;
@@ -599,116 +519,17 @@ int cmOutputConverter::Shell__GetArgumentSize(const char* in, int isUnix,
/* Keep track of how many backslashes have been encountered in a row. */
int windows_backslashes = 0;
- /* Scan the string for characters that require escaping or quoting. */
- for (c = in; *c; ++c) {
- /* Look for $(MAKEVAR) syntax if requested. */
- if (flags & Shell_Flag_AllowMakeVariables) {
- /* Skip over the make variable references if any are present. */
- c = Shell__SkipMakeVariables(c);
-
- /* Stop if we have reached the end of the string. */
- if (!*c) {
- break;
- }
- }
-
- /* Check whether this character needs escaping for the shell. */
- if (isUnix) {
- /* On Unix a few special characters need escaping even inside a
- quoted argument. */
- if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') {
- /* This character needs a backslash to escape it. */
- ++size;
- }
- } else if (flags & Shell_Flag_EchoWindows) {
- /* On Windows the built-in command shell echo never needs escaping. */
- } else {
- /* On Windows only backslashes and double-quotes need escaping. */
- if (*c == '\\') {
- /* Found a backslash. It may need to be escaped later. */
- ++windows_backslashes;
- } else if (*c == '"') {
- /* Found a double-quote. We need to escape it and all
- immediately preceding backslashes. */
- size += windows_backslashes + 1;
- windows_backslashes = 0;
- } else {
- /* Found another character. This eliminates the possibility
- that any immediately preceding backslashes will be
- escaped. */
- windows_backslashes = 0;
- }
- }
-
- /* Check whether this character needs escaping for a make tool. */
- if (*c == '$') {
- if (flags & Shell_Flag_Make) {
- /* In Makefiles a dollar is written $$ so we need one extra
- character. */
- ++size;
- } else if (flags & Shell_Flag_VSIDE) {
- /* In a VS IDE a dollar is written "$" so we need two extra
- characters. */
- size += 2;
- }
- } else if (*c == '#') {
- if ((flags & Shell_Flag_Make) && (flags & Shell_Flag_WatcomWMake)) {
- /* In Watcom WMake makefiles a pound is written $# so we need
- one extra character. */
- ++size;
- }
- } else if (*c == '%') {
- if ((flags & Shell_Flag_VSIDE) ||
- ((flags & Shell_Flag_Make) &&
- ((flags & Shell_Flag_MinGWMake) || (flags & Shell_Flag_NMake)))) {
- /* In the VS IDE, NMake, or MinGW make a percent is written %%
- so we need one extra characters. */
- size += 1;
- }
- } else if (*c == ';') {
- if (flags & Shell_Flag_VSIDE) {
- /* In a VS IDE a semicolon is written ";" so we need two extra
- characters. */
- size += 2;
- }
- }
- }
-
- /* Check whether the argument needs surrounding quotes. */
- if (Shell__ArgumentNeedsQuotes(in, isUnix, flags)) {
- /* Surrounding quotes are needed. Allocate space for them. */
- if ((flags & Shell_Flag_WatcomQuote) && (isUnix)) {
- size += 2;
- }
- size += 2;
-
- /* We must escape all ending backslashes when quoting on windows. */
- size += windows_backslashes;
- }
-
- return size;
-}
-
-char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
- int isUnix, int flags)
-{
- /* String iterator. */
- const char* c;
-
- /* Keep track of how many backslashes have been encountered in a row. */
- int windows_backslashes = 0;
-
/* Whether the argument must be quoted. */
int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags);
if (needQuotes) {
/* Add the opening quote for this argument. */
if (flags & Shell_Flag_WatcomQuote) {
if (isUnix) {
- *out++ = '"';
+ out << '"';
}
- *out++ = '\'';
+ out << '\'';
} else {
- *out++ = '"';
+ out << '"';
}
}
@@ -720,7 +541,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
if (skip != c) {
/* Copy to the end of the make variable references. */
while (c != skip) {
- *out++ = *c++;
+ out << *c++;
}
/* The make variable reference eliminates any escaping needed
@@ -740,7 +561,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
quoted argument. */
if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') {
/* This character needs a backslash to escape it. */
- *out++ = '\\';
+ out << '\\';
}
} else if (flags & Shell_Flag_EchoWindows) {
/* On Windows the built-in command shell echo never needs escaping. */
@@ -754,11 +575,11 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
backslashes. */
while (windows_backslashes > 0) {
--windows_backslashes;
- *out++ = '\\';
+ out << '\\';
}
/* Add the backslash to escape the double-quote. */
- *out++ = '\\';
+ out << '\\';
} else {
/* We encountered a normal character. This eliminates any
escaping needed for preceding backslashes. */
@@ -771,8 +592,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
if (flags & Shell_Flag_Make) {
/* In Makefiles a dollar is written $$. The make tool will
replace it with just $ before passing it to the shell. */
- *out++ = '$';
- *out++ = '$';
+ out << "$$";
} else if (flags & Shell_Flag_VSIDE) {
/* In a VS IDE a dollar is written "$". If this is written in
an un-quoted argument it starts a quoted segment, inserts
@@ -780,34 +600,30 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
argument it ends quoting, inserts the $ and restarts
quoting. Either way the $ is isolated from surrounding
text to avoid looking like a variable reference. */
- *out++ = '"';
- *out++ = '$';
- *out++ = '"';
+ out << "\"$\"";
} else {
/* Otherwise a dollar is written just $. */
- *out++ = '$';
+ out << '$';
}
} else if (*c == '#') {
if ((flags & Shell_Flag_Make) && (flags & Shell_Flag_WatcomWMake)) {
/* In Watcom WMake makefiles a pound is written $#. The make
tool will replace it with just # before passing it to the
shell. */
- *out++ = '$';
- *out++ = '#';
+ out << "$#";
} else {
/* Otherwise a pound is written just #. */
- *out++ = '#';
+ out << '#';
}
} else if (*c == '%') {
if ((flags & Shell_Flag_VSIDE) ||
((flags & Shell_Flag_Make) &&
((flags & Shell_Flag_MinGWMake) || (flags & Shell_Flag_NMake)))) {
/* In the VS IDE, NMake, or MinGW make a percent is written %%. */
- *out++ = '%';
- *out++ = '%';
+ out << "%%";
} else {
/* Otherwise a percent is written just %. */
- *out++ = '%';
+ out << '%';
}
} else if (*c == ';') {
if (flags & Shell_Flag_VSIDE) {
@@ -816,16 +632,14 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
inserts the ; and ends the segment. If it is written in a
quoted argument it ends quoting, inserts the ; and restarts
quoting. Either way the ; is isolated. */
- *out++ = '"';
- *out++ = ';';
- *out++ = '"';
+ out << "\";\"";
} else {
/* Otherwise a semicolon is written just ;. */
- *out++ = ';';
+ out << ';';
}
} else {
/* Store this character. */
- *out++ = *c;
+ out << *c;
}
}
@@ -833,45 +647,31 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
/* Add enough backslashes to escape any trailing ones. */
while (windows_backslashes > 0) {
--windows_backslashes;
- *out++ = '\\';
+ out << '\\';
}
/* Add the closing quote for this argument. */
if (flags & Shell_Flag_WatcomQuote) {
- *out++ = '\'';
+ out << '\'';
if (isUnix) {
- *out++ = '"';
+ out << '"';
}
} else {
- *out++ = '"';
+ out << '"';
}
}
- /* Store a terminating null without incrementing. */
- *out = 0;
-
- return out;
-}
-
-char* cmOutputConverter::Shell_GetArgumentForWindows(const char* in, char* out,
- int flags)
-{
- return Shell__GetArgument(in, out, 0, flags);
-}
-
-char* cmOutputConverter::Shell_GetArgumentForUnix(const char* in, char* out,
- int flags)
-{
- return Shell__GetArgument(in, out, 1, flags);
+ return out.str();
}
-int cmOutputConverter::Shell_GetArgumentSizeForWindows(const char* in,
- int flags)
+std::string cmOutputConverter::Shell_GetArgumentForWindows(const char* in,
+ int flags)
{
- return Shell__GetArgumentSize(in, 0, flags);
+ return Shell__GetArgument(in, 0, flags);
}
-int cmOutputConverter::Shell_GetArgumentSizeForUnix(const char* in, int flags)
+std::string cmOutputConverter::Shell_GetArgumentForUnix(const char* in,
+ int flags)
{
- return Shell__GetArgumentSize(in, 1, flags);
+ return Shell__GetArgument(in, 1, flags);
}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 75d6326..9af9659 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -38,8 +38,6 @@ public:
*/
enum RelativeRoot
{
- NONE,
- FULL,
HOME,
START,
HOME_OUTPUT,
@@ -47,7 +45,6 @@ public:
};
enum OutputFormat
{
- UNCHANGED,
MAKERULE,
SHELL,
WATCOMQUOTE,
@@ -56,27 +53,14 @@ public:
std::string ConvertToOutputFormat(const std::string& source,
OutputFormat output) const;
std::string Convert(const std::string& remote, RelativeRoot local,
- OutputFormat output = UNCHANGED) const;
- std::string Convert(RelativeRoot remote, const std::string& local,
- OutputFormat output = UNCHANGED,
- bool optional = false) const;
+ OutputFormat output) const;
+ std::string ConvertToRelativePath(const std::string& remote,
+ RelativeRoot local) const;
std::string ConvertDirectorySeparatorsForShell(
const std::string& source) const;
- /**
- * Get path for the specified relative root.
- */
- const char* GetRelativeRootPath(RelativeRoot relroot) const;
-
///! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const std::string& remote,
- RelativeRoot local = START_OUTPUT,
- OutputFormat format = SHELL) const;
-
- /** For existing path identified by RelativeRoot convert to output
- path and short path if spaces. */
- std::string ConvertToOutputForExisting(RelativeRoot remote,
- const std::string& local = "",
OutputFormat format = SHELL) const;
void SetLinkScriptShell(bool linkScriptShell);
@@ -126,17 +110,8 @@ public:
* modify the generated quoting and escape sequences to work under
* alternative environments.
*/
- static char* Shell_GetArgumentForWindows(const char* in, char* out,
- int flags);
- static char* Shell_GetArgumentForUnix(const char* in, char* out, int flags);
-
- /**
- * Compute the size of the buffer required to store the output from
- * Shell_GetArgumentForWindows or Shell_GetArgumentForUnix. The flags
- * passed must be identical between the two calls.
- */
- static int Shell_GetArgumentSizeForWindows(const char* in, int flags);
- static int Shell_GetArgumentSizeForUnix(const char* in, int flags);
+ static std::string Shell_GetArgumentForWindows(const char* in, int flags);
+ static std::string Shell_GetArgumentForUnix(const char* in, int flags);
std::string EscapeForShell(const std::string& str, bool makeVars = false,
bool forEcho = false,
@@ -171,10 +146,6 @@ public:
private:
cmState* GetState() const;
- std::string ConvertToOutputForExistingCommon(const std::string& remote,
- std::string const& result,
- OutputFormat format) const;
-
static int Shell__CharIsWhitespace(char c);
static int Shell__CharNeedsQuotesOnUnix(char c);
static int Shell__CharNeedsQuotesOnWindows(char c);
@@ -182,9 +153,7 @@ private:
static int Shell__CharIsMakeVariableName(char c);
static const char* Shell__SkipMakeVariables(const char* c);
static int Shell__ArgumentNeedsQuotes(const char* in, int isUnix, int flags);
- static int Shell__GetArgumentSize(const char* in, int isUnix, int flags);
- static char* Shell__GetArgument(const char* in, char* out, int isUnix,
- int flags);
+ static std::string Shell__GetArgument(const char* in, int isUnix, int flags);
private:
cmState::Snapshot StateSnapshot;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 29f1acc..ef636e7 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -28,7 +28,7 @@ public:
*/
cmDependInformation()
: DependDone(false)
- , SourceFile(0)
+ , SourceFile(CM_NULLPTR)
{
}
@@ -154,7 +154,7 @@ public:
*/
const cmDependInformation* FindDependencies(const char* file)
{
- cmDependInformation* info = this->GetDependInformation(file, 0);
+ cmDependInformation* info = this->GetDependInformation(file, CM_NULLPTR);
this->GenerateDependInformation(info);
return info;
}
@@ -203,7 +203,7 @@ protected:
message += includeFile;
message += " for file ";
message += info->FullPath.c_str();
- cmSystemTools::Error(message.c_str(), 0);
+ cmSystemTools::Error(message.c_str(), CM_NULLPTR);
}
continue;
}
@@ -329,7 +329,7 @@ protected:
// See if the cmSourceFile for it has any files specified as
// dependency hints.
- if (info->SourceFile != 0) {
+ if (info->SourceFile != CM_NULLPTR) {
// Get the cmSourceFile corresponding to this.
const cmSourceFile& cFile = *(info->SourceFile);
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index 7a6f5a6..8838d09 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -20,10 +20,10 @@ class cmOutputRequiredFilesCommand : public cmCommand
{
public:
cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "output_required_files"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "output_required_files"; }
void ListDependencies(cmDependInformation const* info, FILE* fout,
std::set<cmDependInformation const*>* visited);
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index 46d9daa..fcd9992 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -24,24 +24,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmParseArgumentsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmParseArgumentsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "cmake_parse_arguments"; }
+ std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
cmTypeMacro(cmParseArgumentsCommand, cmCommand);
};
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 85f0fa3..7688c59 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -2,14 +2,18 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
-#include "cmVersionMacros.h"
#include "cmake.h"
+
#include <assert.h>
+#include <cmConfigure.h>
#include <ctype.h>
-#include <map>
-#include <queue>
-#include <set>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+#include <vector>
static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
{
@@ -57,9 +61,9 @@ static const char* idToString(cmPolicies::PolicyID id)
CM_FOR_EACH_POLICY_ID(POLICY_CASE)
#undef POLICY_CASE
case cmPolicies::CMPCOUNT:
- return 0;
+ return CM_NULLPTR;
}
- return 0;
+ return CM_NULLPTR;
}
static const char* idToVersion(cmPolicies::PolicyID id)
@@ -71,9 +75,9 @@ static const char* idToVersion(cmPolicies::PolicyID id)
CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE)
#undef POLICY_CASE
case cmPolicies::CMPCOUNT:
- return 0;
+ return CM_NULLPTR;
}
- return 0;
+ return CM_NULLPTR;
}
static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
@@ -102,9 +106,9 @@ const char* idToShortDescription(cmPolicies::PolicyID id)
CM_FOR_EACH_POLICY_ID_DOC(POLICY_CASE)
#undef POLICY_CASE
case cmPolicies::CMPCOUNT:
- return 0;
+ return CM_NULLPTR;
}
- return 0;
+ return CM_NULLPTR;
}
static void DiagnoseAncientPolicies(
@@ -293,7 +297,8 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
}
///! Get the default status for a policy
-cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus(cmPolicies::PolicyID)
+cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus(
+ cmPolicies::PolicyID /*unused*/)
{
return cmPolicies::WARN;
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ff49e31..149bb46 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -12,12 +12,12 @@
#ifndef cmPolicies_h
#define cmPolicies_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <bitset>
+#include <string>
class cmMakefile;
-class cmPolicy;
#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
SELECT(POLICY, CMP0000, \
@@ -203,7 +203,10 @@ class cmPolicy;
SELECT(POLICY, CMP0065, \
"Do not add flags to export symbols from executables without " \
"the ENABLE_EXPORTS target property.", \
- 3, 4, 0, cmPolicies::WARN)
+ 3, 4, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0066, \
+ "Honor per-config flags in try_compile() source-file signature.", 3, \
+ 7, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index 446752e..4a0d459 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -12,32 +12,33 @@
#include "cmProcessTools.h"
#include <cmsys/Process.h>
+#include <ostream>
void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
OutputParser* err)
{
cmsysProcess_Execute(cp);
- char* data = 0;
+ char* data = CM_NULLPTR;
int length = 0;
int p;
while ((out || err) &&
- (p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+ (p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
if (out && p == cmsysProcess_Pipe_STDOUT) {
if (!out->Process(data, length)) {
- out = 0;
+ out = CM_NULLPTR;
}
} else if (err && p == cmsysProcess_Pipe_STDERR) {
if (!err->Process(data, length)) {
- err = 0;
+ err = CM_NULLPTR;
}
}
}
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
}
cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR)
- : Log(0)
- , Prefix(0)
+ : Log(CM_NULLPTR)
+ , Prefix(CM_NULLPTR)
, Separator(sep)
, LineEnd('\0')
, IgnoreCR(ignoreCR)
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index a48e52b..3d2a224 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -12,7 +12,11 @@
#ifndef cmProcessTools_h
#define cmProcessTools_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string.h>
+#include <string>
/** \class cmProcessTools
* \brief Helper classes for process output parsing
@@ -62,7 +66,7 @@ public:
char Separator;
char LineEnd;
bool IgnoreCR;
- virtual bool ProcessChunk(const char* data, int length);
+ bool ProcessChunk(const char* data, int length) CM_OVERRIDE;
/** Implement in a subclass to process one line of input. It
should return true only if it is interested in more data. */
@@ -73,18 +77,18 @@ public:
class OutputLogger : public LineParser
{
public:
- OutputLogger(std::ostream& log, const char* prefix = 0)
+ OutputLogger(std::ostream& log, const char* prefix = CM_NULLPTR)
{
this->SetLog(&log, prefix);
}
private:
- virtual bool ProcessLine() { return true; }
+ bool ProcessLine() CM_OVERRIDE { return true; }
};
/** Run a process and send output to given parsers. */
static void RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
- OutputParser* err = 0);
+ OutputParser* err = CM_NULLPTR);
};
#endif
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index a4e6367..3318df1 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -28,19 +28,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmProjectCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmProjectCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "project"; }
+ std::string GetName() const CM_OVERRIDE { return "project"; }
cmTypeMacro(cmProjectCommand, cmCommand);
};
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 4910616..75b44cb 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmProperty.h"
-#include "cmSystemTools.h"
+#include <cmConfigure.h>
void cmProperty::Set(const char* value)
{
@@ -33,5 +33,5 @@ const char* cmProperty::GetValue() const
if (this->ValueHasBeenSet) {
return this->Value.c_str();
}
- return 0;
+ return CM_NULLPTR;
}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 1736136..2091360 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -12,7 +12,9 @@
#ifndef cmProperty_h
#define cmProperty_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
class cmProperty
{
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index 546146b..003898a 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -11,8 +11,6 @@
============================================================================*/
#include "cmPropertyDefinition.h"
-#include "cmSystemTools.h"
-
void cmPropertyDefinition::DefineProperty(const std::string& name,
cmProperty::ScopeType scope,
const char* shortDescription,
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index 5733917..5804df9 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -12,8 +12,12 @@
#ifndef cmPropertyDefinition_h
#define cmPropertyDefinition_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include "cmProperty.h"
+#include <string>
+
/** \class cmPropertyDefinition
* \brief Property meta-information
*
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index ebc2caa..0015337 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -11,8 +11,7 @@
============================================================================*/
#include "cmPropertyDefinitionMap.h"
-#include "cmDocumentationSection.h"
-#include "cmSystemTools.h"
+#include <utility>
void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
cmProperty::ScopeType scope,
@@ -31,12 +30,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
{
- cmPropertyDefinitionMap::const_iterator it = this->find(name);
- if (it == this->end()) {
- return false;
- }
-
- return true;
+ return this->find(name) != this->end();
}
bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h
index fbc9a18..a4e4600 100644
--- a/Source/cmPropertyDefinitionMap.h
+++ b/Source/cmPropertyDefinitionMap.h
@@ -12,9 +12,13 @@
#ifndef cmPropertyDefinitionMap_h
#define cmPropertyDefinitionMap_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include "cmProperty.h"
#include "cmPropertyDefinition.h"
-class cmDocumentationSection;
+#include <map>
+#include <string>
class cmPropertyDefinitionMap
: public std::map<std::string, cmPropertyDefinition>
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 74e04da..5a6ba2a 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -11,11 +11,10 @@
============================================================================*/
#include "cmPropertyMap.h"
-#include "cmState.h"
-#include "cmSystemTools.h"
-#include "cmake.h"
-
+#include <algorithm>
#include <assert.h>
+#include <cmConfigure.h>
+#include <utility>
cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
{
@@ -29,6 +28,17 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
return prop;
}
+std::vector<std::string> cmPropertyMap::GetPropertyList() const
+{
+ std::vector<std::string> keyList;
+ for (cmPropertyMap::const_iterator i = this->begin(), e = this->end();
+ i != e; ++i) {
+ keyList.push_back(i->first);
+ }
+ std::sort(keyList.begin(), keyList.end());
+ return keyList;
+}
+
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
{
if (!value) {
@@ -58,7 +68,7 @@ const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
cmPropertyMap::const_iterator it = this->find(name);
if (it == this->end()) {
- return 0;
+ return CM_NULLPTR;
}
return it->second.GetValue();
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 4e98750..151255e 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -12,13 +12,21 @@
#ifndef cmPropertyMap_h
#define cmPropertyMap_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include "cmProperty.h"
+#include <map>
+#include <string>
+#include <vector>
+
class cmPropertyMap : public std::map<std::string, cmProperty>
{
public:
cmProperty* GetOrCreateProperty(const std::string& name);
+ std::vector<std::string> GetPropertyList() const;
+
void SetProperty(const std::string& name, const char* value);
void AppendProperty(const std::string& name, const char* value,
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index f63672b..ef8255a 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -80,7 +80,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
depends.push_back(hname);
std::string no_main_dependency = "";
- const char* no_working_dir = 0;
+ const char* no_working_dir = CM_NULLPTR;
this->Makefile->AddCustomCommandToOutput(
newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
no_working_dir);
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 2014828..78d5510 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -30,19 +30,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmQTWrapCPPCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapCPPCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "qt_wrap_cpp"; }
+ std::string GetName() const CM_OVERRIDE { return "qt_wrap_cpp"; }
};
#endif
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 4c1da36..a948dd6 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -111,8 +111,8 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> depends;
depends.push_back(uiName);
std::string no_main_dependency = "";
- const char* no_comment = 0;
- const char* no_working_dir = 0;
+ const char* no_comment = CM_NULLPTR;
+ const char* no_working_dir = CM_NULLPTR;
this->Makefile->AddCustomCommandToOutput(
hName, depends, no_main_dependency, hCommandLines, no_comment,
no_working_dir);
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 48cfc77..a34a7bf 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -28,19 +28,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmQTWrapUICommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapUICommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "qt_wrap_ui"; }
+ std::string GetName() const CM_OVERRIDE { return "qt_wrap_ui"; }
};
#endif
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index dd19760..f1da4d5 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -13,6 +13,7 @@
#include "cmQtAutoGeneratorInitializer.h"
+#include "cmFilePathUuid.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
@@ -53,51 +54,6 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
return targetDir;
}
-static std::string GetSourceRelativePath(cmGeneratorTarget const* target,
- const std::string& fileName)
-{
- std::string pathRel;
- // Test if the file is child to any of the known directories
- {
- const std::string fileNameReal = cmsys::SystemTools::GetRealPath(fileName);
- std::string parentDirectory;
- bool match(false);
- {
- std::string testDirs[4];
- {
- cmMakefile* makefile = target->Target->GetMakefile();
- testDirs[0] = makefile->GetCurrentSourceDirectory();
- testDirs[1] = makefile->GetCurrentBinaryDirectory();
- testDirs[2] = makefile->GetHomeDirectory();
- testDirs[3] = makefile->GetHomeOutputDirectory();
- }
- for (int ii = 0; ii != sizeof(testDirs) / sizeof(std::string); ++ii) {
- const ::std::string testDir =
- cmsys::SystemTools::GetRealPath(testDirs[ii]);
- if (!testDir.empty() &&
- cmsys::SystemTools::IsSubDirectory(fileNameReal, testDir)) {
- parentDirectory = testDir;
- match = true;
- break;
- }
- }
- }
- // Use root as fallback parent directory
- if (!match) {
- cmsys::SystemTools::SplitPathRootComponent(fileNameReal,
- &parentDirectory);
- }
- pathRel = cmsys::SystemTools::RelativePath(
- parentDirectory, cmsys::SystemTools::GetParentDirectory(fileNameReal));
- }
- // Sanitize relative path
- if (!pathRel.empty()) {
- pathRel += '/';
- cmSystemTools::ReplaceString(pathRel, "..", "__");
- }
- return pathRel;
-}
-
static void SetupSourceFiles(cmGeneratorTarget const* target,
std::vector<std::string>& skipMoc,
std::vector<std::string>& mocSources,
@@ -111,6 +67,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
std::vector<std::string> newRccFiles;
+ cmFilePathUuid fpathUuid(makefile);
for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end(); ++fileIt) {
cmSourceFile* sf = *fileIt;
@@ -129,15 +86,11 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
if (ext == "qrc" &&
!cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
- std::string rcc_output_dir = GetAutogenTargetBuildDir(target);
- rcc_output_dir += GetSourceRelativePath(target, absFile);
- cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
-
- std::string basename =
- cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
+ std::string rcc_output_file = GetAutogenTargetBuildDir(target);
+ // Create output directory
+ cmSystemTools::MakeDirectory(rcc_output_file.c_str());
+ rcc_output_file += fpathUuid.get(absFile, "qrc_", ".cpp");
- std::string rcc_output_file = rcc_output_dir;
- rcc_output_file += "qrc_" + basename + ".cpp";
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
rcc_output_file.c_str(), false);
makefile->GetOrCreateSource(rcc_output_file, true);
@@ -173,7 +126,7 @@ static void GetCompileDefinitionsAndDirectories(
std::vector<std::string> includeDirs;
cmLocalGenerator* localGen = target->GetLocalGenerator();
// Get the include dirs for this target, without stripping the implicit
- // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
+ // include dirs off, see https://gitlab.kitware.com/cmake/cmake/issues/13667
localGen->GetIncludeDirectories(includeDirs, target, "CXX", config, false);
incs = cmJoin(includeDirs, ";");
@@ -195,7 +148,7 @@ static void SetupAutoMocTarget(
cmMakefile* makefile = target->Target->GetMakefile();
const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
- std::string _moc_options = (tmp != 0 ? tmp : "");
+ std::string _moc_options = (tmp != CM_NULLPTR ? tmp : "");
makefile->AddDefinition(
"_moc_options", cmOutputConverter::EscapeForCMake(_moc_options).c_str());
makefile->AddDefinition(
@@ -394,7 +347,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
return std::string();
}
return qt5Rcc->ImportedGetLocation("");
- } else if (strcmp(qtVersion, "4") == 0) {
+ }
+ if (strcmp(qtVersion, "4") == 0) {
cmGeneratorTarget* qt4Rcc = lg->FindGeneratorTargetToUse("Qt4::rcc");
if (!qt4Rcc) {
cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str());
@@ -464,7 +418,7 @@ static std::string cmQtAutoGeneratorsStripCR(std::string const& line)
static std::string ReadAll(const std::string& filename)
{
cmsys::ifstream file(filename.c_str());
- std::stringstream stream;
+ std::ostringstream stream;
stream << file.rdbuf();
file.close();
return stream.str();
@@ -484,8 +438,9 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
std::string rccStdOut;
std::string rccStdErr;
int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
- command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE);
+ bool result =
+ cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
+ CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
if (result && retVal == 0 &&
rccStdOut.find("--list") != std::string::npos) {
hasDashDashList = true;
@@ -505,10 +460,11 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
std::string rccStdOut;
std::string rccStdErr;
int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
- command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE);
+ bool result =
+ cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
+ CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
if (!result || retVal) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
<< " failed:\n"
<< rccStdOut << "\n"
@@ -538,7 +494,7 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
std::string::size_type pos = eline.find(searchString);
if (pos == std::string::npos) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: Rcc lists unparsable output " << eline
<< std::endl;
std::cerr << err.str();
@@ -793,6 +749,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
) {
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
+ cmFilePathUuid fpathUuid(makefile);
for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end(); ++fileIt) {
cmSourceFile* sf = *fileIt;
@@ -803,19 +760,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
if (target->GetPropertyAsBool("AUTORCC")) {
if (ext == "qrc" &&
!cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
-
{
- std::string rcc_output_dir = GetAutogenTargetBuildDir(target);
- rcc_output_dir += GetSourceRelativePath(target, absFile);
- cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
-
- std::string basename =
- cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
- std::string rcc_output_file = rcc_output_dir;
- rcc_output_file += "qrc_" + basename + ".cpp";
+ std::string rcc_output_file = GetAutogenTargetBuildDir(target);
+ // Create output directory
+ cmSystemTools::MakeDirectory(rcc_output_file.c_str());
+ rcc_output_file += fpathUuid.get(absFile, "qrc_", ".cpp");
rcc_output.push_back(rcc_output_file);
}
-
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
if (qtMajorVersion == "5") {
ListQt5RccInputs(sf, target, depends);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index ac64397..a261962 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -14,6 +14,7 @@
#include "cmQtAutoGenerators.h"
#include "cmAlgorithms.h"
+#include "cmFilePathUuid.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
@@ -34,8 +35,8 @@
static bool requiresMocing(const std::string& text, std::string& macroName)
{
// this simple check is much much faster than the regexp
- if (strstr(text.c_str(), "Q_OBJECT") == NULL &&
- strstr(text.c_str(), "Q_GADGET") == NULL) {
+ if (strstr(text.c_str(), "Q_OBJECT") == CM_NULLPTR &&
+ strstr(text.c_str(), "Q_GADGET") == CM_NULLPTR) {
return false;
}
@@ -87,8 +88,25 @@ static std::string extractSubDir(const std::string& absPath,
return subDir;
}
+static bool FileNameIsUnique(const std::string& filePath,
+ const std::map<std::string, std::string>& fileMap)
+{
+ size_t count(0);
+ const std::string fileName = cmsys::SystemTools::GetFilenameName(filePath);
+ for (std::map<std::string, std::string>::const_iterator si = fileMap.begin();
+ si != fileMap.end(); ++si) {
+ if (cmsys::SystemTools::GetFilenameName(si->first) == fileName) {
+ ++count;
+ if (count > 1) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
cmQtAutoGenerators::cmQtAutoGenerators()
- : Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
+ : Verbose(cmsys::SystemTools::HasEnv("VERBOSE"))
, ColorOutput(true)
, RunMocFailed(false)
, RunUicFailed(false)
@@ -155,7 +173,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
snapshot.GetDirectory().SetCurrentSource(targetDirectory);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, snapshot));
gg.SetCurrentMakefile(mf.get());
this->ReadAutogenInfoFile(mf.get(), targetDirectory, config);
@@ -363,6 +381,7 @@ void cmQtAutoGenerators::Init()
this->OutMocCppFilenameRel = this->TargetName;
this->OutMocCppFilenameRel += ".cpp";
+
this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
std::vector<std::string> cdefList;
@@ -432,7 +451,7 @@ void cmQtAutoGenerators::Init()
static std::string ReadAll(const std::string& filename)
{
cmsys::ifstream file(filename.c_str());
- std::stringstream stream;
+ std::ostringstream stream;
stream << file.rdbuf();
file.close();
return stream.str();
@@ -477,7 +496,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
skipUic ? skippedUis : includedUis;
const std::string& absFilename = *it;
if (this->Verbose) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: Checking " << absFilename << std::endl;
this->LogInfo(err.str());
}
@@ -499,7 +518,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
uicSkipped.end()) {
const std::string& absFilename = *it;
if (this->Verbose) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: Checking " << absFilename << std::endl;
this->LogInfo(err.str());
}
@@ -527,19 +546,19 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
}
if (this->RunMocFailed) {
- std::stringstream err;
+ std::ostringstream err;
err << "moc failed..." << std::endl;
this->LogError(err.str());
return false;
}
if (this->RunUicFailed) {
- std::stringstream err;
+ std::ostringstream err;
err << "uic failed..." << std::endl;
this->LogError(err.str());
return false;
}
if (this->RunRccFailed) {
- std::stringstream err;
+ std::ostringstream err;
err << "rcc failed..." << std::endl;
this->LogError(err.str());
return false;
@@ -560,7 +579,7 @@ void cmQtAutoGenerators::ParseCppFile(
const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl;
this->LogError(err.str());
@@ -588,7 +607,7 @@ void cmQtAutoGenerators::ParseCppFile(
// first a simple string check for "moc" is *much* faster than the regexp,
// and if the string search already fails, we don't have to try the
// expensive regexp
- if ((strstr(contentsString.c_str(), "moc") != NULL) &&
+ if ((strstr(contentsString.c_str(), "moc") != CM_NULLPTR) &&
(mocIncludeRegExp.find(contentsString))) {
// for every moc include in the file
do {
@@ -620,7 +639,7 @@ void cmQtAutoGenerators::ParseCppFile(
ownMocHeaderFile = headerToMoc;
}
} else {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file "
<< "includes the moc file \"" << currentMoc << "\", "
<< "but could not find header \"" << basename << '{'
@@ -636,15 +655,15 @@ void cmQtAutoGenerators::ParseCppFile(
}
} else {
std::string fileToMoc = absFilename;
- if ((basename != scannedFileBasename) || (requiresMoc == false)) {
+ if (!requiresMoc || basename != scannedFileBasename) {
std::string mocSubDir = extractSubDir(absPath, currentMoc);
std::string headerToMoc =
findMatchingHeader(absPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty()) {
// this is for KDE4 compatibility:
fileToMoc = headerToMoc;
- if ((requiresMoc == false) && (basename == scannedFileBasename)) {
- std::stringstream err;
+ if (!requiresMoc && basename == scannedFileBasename) {
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename
<< ": The file "
"includes the moc file \""
@@ -656,7 +675,7 @@ void cmQtAutoGenerators::ParseCppFile(
<< std::endl;
this->LogError(err.str());
} else {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename
<< ": The file "
"includes the moc file \""
@@ -670,7 +689,7 @@ void cmQtAutoGenerators::ParseCppFile(
this->LogError(err.str());
}
} else {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename
<< ": The file "
"includes the moc file \""
@@ -696,10 +715,10 @@ void cmQtAutoGenerators::ParseCppFile(
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (requiresMoc == true)) {
- if (mocUnderscoreIncluded == true) {
+ if (!dotMocIncluded && requiresMoc) {
+ if (mocUnderscoreIncluded) {
// this is for KDE4 compatibility:
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not "
"include "
@@ -717,7 +736,7 @@ void cmQtAutoGenerators::ParseCppFile(
includedMocs.erase(ownMocHeaderFile);
} else {
// otherwise always error out since it will not compile:
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not "
"include "
@@ -742,7 +761,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl;
this->LogError(err.str());
@@ -765,7 +784,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
// first a simple string check for "moc" is *much* faster than the regexp,
// and if the string search already fails, we don't have to try the
// expensive regexp
- if ((strstr(contentsString.c_str(), "moc") != NULL) &&
+ if ((strstr(contentsString.c_str(), "moc") != CM_NULLPTR) &&
(mocIncludeRegExp.find(contentsString))) {
// for every moc include in the file
do {
@@ -791,7 +810,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
if (!headerToMoc.empty()) {
includedMocs[headerToMoc] = currentMoc;
} else {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << " The file "
<< "includes the moc file \"" << currentMoc << "\", "
<< "but could not find header \"" << basename << '{'
@@ -807,7 +826,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
}
} else {
if (basename != scannedFileBasename) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename
<< ": The file "
"includes the moc file \""
@@ -833,10 +852,9 @@ void cmQtAutoGenerators::StrictParseCppFile(
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
std::string macroName;
- if ((dotMocIncluded == false) &&
- (requiresMocing(contentsString, macroName))) {
+ if (!dotMocIncluded && requiresMocing(contentsString, macroName)) {
// otherwise always error out since it will not compile:
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not include "
<< "\"" << scannedFileBasename << ".moc\" !\n"
@@ -855,7 +873,7 @@ void cmQtAutoGenerators::ParseForUic(
}
const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl;
this->LogError(err.str());
@@ -880,7 +898,7 @@ void cmQtAutoGenerators::ParseForUic(
const std::string realName = cmsys::SystemTools::GetRealPath(absFilename);
matchOffset = 0;
- if ((strstr(contentsString.c_str(), "ui_") != NULL) &&
+ if ((strstr(contentsString.c_str(), "ui_") != CM_NULLPTR) &&
(uiIncludeRegExp.find(contentsString))) {
do {
const std::string currentUi = uiIncludeRegExp.match(1);
@@ -935,6 +953,8 @@ void cmQtAutoGenerators::ParseHeaders(
std::map<std::string, std::string>& notIncludedMocs,
std::map<std::string, std::vector<std::string> >& includedUis)
{
+ cmFilePathUuid fpathUuid(this->Srcdir, this->Builddir,
+ this->ProjectSourceDir, this->ProjectBinaryDir);
for (std::set<std::string>::const_iterator hIt = absHeaders.begin();
hIt != absHeaders.end(); ++hIt) {
const std::string& headerName = *hIt;
@@ -943,19 +963,15 @@ void cmQtAutoGenerators::ParseHeaders(
if (!this->MocExecutable.empty() &&
includedMocs.find(headerName) == includedMocs.end()) {
if (this->Verbose) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: Checking " << headerName << std::endl;
this->LogInfo(err.str());
}
std::string macroName;
if (requiresMocing(contents, macroName)) {
- const std::string parentDir =
- this->TargetBuildSubDir + this->SourceRelativePath(headerName);
- const std::string basename =
- cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName);
- const std::string currentMoc = parentDir + "moc_" + basename + ".cpp";
- notIncludedMocs[headerName] = currentMoc;
+ notIncludedMocs[headerName] =
+ this->TargetBuildSubDir + fpathUuid.get(headerName, "moc_", ".cpp");
}
}
this->ParseForUic(headerName, contents, includedUis);
@@ -973,7 +989,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
std::map<std::string, std::string> mergedMocs(includedMocs);
mergedMocs.insert(notIncludedMocs.begin(), notIncludedMocs.end());
if (this->NameCollisionTest(mergedMocs, collisions)) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: "
"The same moc file will be generated "
"from different sources."
@@ -1014,7 +1030,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
// compose _automoc.cpp content
std::string automocSource;
{
- std::stringstream outStream;
+ std::ostringstream outStream;
outStream << "/* This file is autogenerated, do not edit*/\n";
if (notIncludedMocs.empty()) {
outStream << "enum some_compilers { need_more_than_nothing };\n";
@@ -1036,7 +1052,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
if (oldContents == automocSource) {
// nothing changed: don't touch the _automoc.cpp file
if (this->Verbose) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date"
<< std::endl;
this->LogInfo(err.str());
@@ -1107,7 +1123,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n"
<< output << std::endl;
this->LogError(err.str());
@@ -1148,7 +1164,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
{
std::multimap<std::string, std::string> collisions;
if (this->NameCollisionTest(testMap, collisions)) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: The same ui_NAME.h file will be generated "
"from different sources."
<< std::endl
@@ -1186,7 +1202,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
cmsys::SystemTools::MakeDirectory(this->Builddir.c_str());
}
- const ::std::string uiBuildFile = this->Builddir + uiOutputFile;
+ const std::string uiBuildFile = this->Builddir + uiOutputFile;
int sourceNewerThanUi = 0;
bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uiBuildFile,
@@ -1224,7 +1240,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOUIC: error: process for " << uiOutputFile
<< " needed by\n \"" << realName << "\"\nfailed:\n"
<< output << std::endl;
@@ -1258,17 +1274,18 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
{
// generate single map with input / output names
std::map<std::string, std::string> qrcGenMap;
- for (std::vector<std::string>::const_iterator si = this->RccSources.begin();
- si != this->RccSources.end(); ++si) {
- const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
- if (ext == ".qrc") {
- std::string basename =
- cmsys::SystemTools::GetFilenameWithoutLastExtension(*si);
- std::string qrcOutputFile = this->TargetBuildSubDir +
- this->SourceRelativePath(*si) + "qrc_" + basename + ".cpp";
- // std::string qrcOutputFile = "CMakeFiles/" + this->OriginTargetName
- // + ".dir/qrc_" + basename + ".cpp";
- qrcGenMap[*si] = qrcOutputFile;
+ {
+ cmFilePathUuid fpathUuid(this->Srcdir, this->Builddir,
+ this->ProjectSourceDir, this->ProjectBinaryDir);
+ for (std::vector<std::string>::const_iterator si =
+ this->RccSources.begin();
+ si != this->RccSources.end(); ++si) {
+ const std::string ext =
+ cmsys::SystemTools::GetFilenameLastExtension(*si);
+ if (ext == ".qrc") {
+ qrcGenMap[*si] =
+ (this->TargetBuildSubDir + fpathUuid.get(*si, "qrc_", ".cpp"));
+ }
}
}
@@ -1276,7 +1293,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
{
std::multimap<std::string, std::string> collisions;
if (this->NameCollisionTest(qrcGenMap, collisions)) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTOGEN: error: The same qrc_NAME.cpp file"
" will be generated from different sources."
<< std::endl
@@ -1290,7 +1307,8 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
for (std::map<std::string, std::string>::const_iterator si =
qrcGenMap.begin();
si != qrcGenMap.end(); ++si) {
- if (!this->GenerateQrc(si->first, si->second)) {
+ bool unique = FileNameIsUnique(si->first, qrcGenMap);
+ if (!this->GenerateQrc(si->first, si->second, unique)) {
if (this->RunRccFailed) {
return false;
}
@@ -1300,13 +1318,24 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
}
bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
- const std::string& qrcOutputFile)
+ const std::string& qrcOutputFile,
+ bool unique_n)
{
- std::string relName = this->SourceRelativePath(qrcInputFile);
- std::replace(relName.begin(), relName.end(), '/', '_');
- relName += cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
-
- const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile;
+ std::string symbolName;
+ if (unique_n) {
+ symbolName =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
+ } else {
+ symbolName =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcOutputFile);
+ // Remove "qrc_" at string begin
+ symbolName.erase(0, 4);
+ }
+ // Replace '-' with '_'. The former is valid for
+ // file names but not for symbol names.
+ std::replace(symbolName.begin(), symbolName.end(), '-', '_');
+
+ const std::string qrcBuildFile = this->Builddir + qrcOutputFile;
int sourceNewerThanQrc = 0;
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(
@@ -1332,7 +1361,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
}
command.push_back("-name");
- command.push_back(relName);
+ command.push_back(symbolName);
command.push_back("-o");
command.push_back(qrcBuildFile);
command.push_back(qrcInputFile);
@@ -1345,7 +1374,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) {
- std::stringstream err;
+ std::ostringstream err;
err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n"
<< output << std::endl;
this->LogError(err.str());
@@ -1357,49 +1386,6 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
return true;
}
-std::string cmQtAutoGenerators::SourceRelativePath(const std::string& filename)
-{
- std::string pathRel;
-
- // Test if the file is child to any of the known directories
- {
- std::string fileNameReal = cmsys::SystemTools::GetRealPath(filename);
- std::string parentDirectory;
- bool match(false);
- {
- const ::std::string* testDirs[4];
- testDirs[0] = &(this->Srcdir);
- testDirs[1] = &(this->Builddir);
- testDirs[2] = &(this->ProjectSourceDir);
- testDirs[3] = &(this->ProjectBinaryDir);
- for (int ii = 0; ii != sizeof(testDirs) / sizeof(const ::std::string*);
- ++ii) {
- const ::std::string testDir =
- cmsys::SystemTools::GetRealPath(*(testDirs[ii]));
- if (cmsys::SystemTools::IsSubDirectory(fileNameReal, testDir)) {
- parentDirectory = testDir;
- match = true;
- break;
- }
- }
- }
- // Use root as fallback parent directory
- if (!match) {
- cmsys::SystemTools::SplitPathRootComponent(fileNameReal,
- &parentDirectory);
- }
- pathRel = cmsys::SystemTools::RelativePath(
- parentDirectory, cmsys::SystemTools::GetParentDirectory(fileNameReal));
- }
-
- // Sanitize relative path
- if (!pathRel.empty()) {
- pathRel += '/';
- cmSystemTools::ReplaceString(pathRel, "..", "__");
- }
- return pathRel;
-}
-
/**
* @brief Collects name collisions as output/input pairs
* @return True if there were collisions
@@ -1436,7 +1422,7 @@ void cmQtAutoGenerators::NameCollisionLog(
{
typedef std::multimap<std::string, std::string>::const_iterator Iter;
- std::stringstream err;
+ std::ostringstream err;
// Add message
err << message;
// Append collision list
@@ -1458,7 +1444,7 @@ void cmQtAutoGenerators::LogError(const std::string& message)
void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
{
- std::stringstream sbuf;
+ std::ostringstream sbuf;
for (std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end(); ++cmdIt) {
if (cmdIt != command.begin()) {
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 5e7fab5..fab2d19 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -51,7 +51,8 @@ private:
const std::string& uiOutputFile);
bool GenerateQrcFiles();
bool GenerateQrc(const std::string& qrcInputFile,
- const std::string& qrcOutputFile);
+ const std::string& qrcOutputFile, bool unique_n);
+
void ParseCppFile(
const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
@@ -83,8 +84,6 @@ private:
void Init();
- std::string SourceRelativePath(const std::string& filename);
-
bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
std::multimap<std::string, std::string>& collisions);
void NameCollisionLog(
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index c226a54..1deff36 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmRemoveCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmRemoveCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "remove"; }
+ std::string GetName() const CM_OVERRIDE { return "remove"; }
cmTypeMacro(cmRemoveCommand, cmCommand);
};
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index b440307..7fb2e5f 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmRemoveDefinitionsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmRemoveDefinitionsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "remove_definitions"; }
+ std::string GetName() const CM_OVERRIDE { return "remove_definitions"; }
cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand);
};
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index 44cd4c8..ddf3613 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmReturnCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmReturnCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "return"; }
+ std::string GetName() const CM_OVERRIDE { return "return"; }
cmTypeMacro(cmReturnCommand, cmCommand);
};
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 5fed107..a000258 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -19,7 +19,7 @@ cmScriptGenerator::cmScriptGenerator(
: RuntimeConfigVariable(config_var)
, Configurations(configurations)
, ConfigurationName("")
- , ConfigurationTypes(0)
+ , ConfigurationTypes(CM_NULLPTR)
, ActionsPerConfig(false)
{
}
@@ -36,7 +36,7 @@ void cmScriptGenerator::Generate(
this->ConfigurationTypes = &configurationTypes;
this->GenerateScript(os);
this->ConfigurationName = "";
- this->ConfigurationTypes = 0;
+ this->ConfigurationTypes = CM_NULLPTR;
}
static void cmScriptGeneratorEncodeConfig(const std::string& config,
@@ -117,9 +117,9 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os,
}
}
-void cmScriptGenerator::GenerateScriptForConfig(std::ostream&,
- const std::string&,
- Indent const&)
+void cmScriptGenerator::GenerateScriptForConfig(std::ostream& /*unused*/,
+ const std::string& /*unused*/,
+ Indent const& /*unused*/)
{
// No actions for this generator.
}
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index a0cce12..ca3a57f 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -45,7 +45,7 @@ void cmSearchPath::AddPath(const std::string& path)
void cmSearchPath::AddUserPath(const std::string& path)
{
- assert(this->FC != NULL);
+ assert(this->FC != CM_NULLPTR);
std::vector<std::string> outPaths;
@@ -80,7 +80,7 @@ void cmSearchPath::AddUserPath(const std::string& path)
void cmSearchPath::AddCMakePath(const std::string& variable)
{
- assert(this->FC != NULL);
+ assert(this->FC != CM_NULLPTR);
// Get a path from a CMake variable.
if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
@@ -107,7 +107,7 @@ void cmSearchPath::AddEnvPath(const std::string& variable)
void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
{
- assert(this->FC != NULL);
+ assert(this->FC != CM_NULLPTR);
// Get a path from a CMake variable.
if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
@@ -172,7 +172,7 @@ void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes)
void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
const char* base)
{
- assert(this->FC != NULL);
+ assert(this->FC != CM_NULLPTR);
// default for programs
std::string subdir = "bin";
@@ -213,7 +213,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
void cmSearchPath::AddPathInternal(const std::string& path, const char* base)
{
- assert(this->FC != NULL);
+ assert(this->FC != CM_NULLPTR);
std::string collapsed = cmSystemTools::CollapseFullPath(path, base);
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 835196f..65f703f 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -28,7 +28,7 @@ public:
// cmSearchPath must be initialized from a valid pointer. The only reason
// for the default is to allow it to be easily used in stl containers.
// Attempting to initialize with a NULL value will fail an assertion
- cmSearchPath(cmFindCommon* findCmd = 0);
+ cmSearchPath(cmFindCommon* findCmd = CM_NULLPTR);
~cmSearchPath();
const std::vector<std::string>& GetPaths() const { return this->Paths; }
@@ -47,8 +47,8 @@ public:
protected:
void AddPrefixPaths(const std::vector<std::string>& paths,
- const char* base = 0);
- void AddPathInternal(const std::string& path, const char* base = 0);
+ const char* base = CM_NULLPTR);
+ void AddPathInternal(const std::string& path, const char* base = CM_NULLPTR);
cmFindCommon* FC;
std::vector<std::string> Paths;
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 47246c9..3c9e7d7 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmSeparateArgumentsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSeparateArgumentsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "separate_arguments"; }
+ std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
cmTypeMacro(cmSeparateArgumentsCommand, cmCommand);
};
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5f4cfee..8fb6aa0 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -31,13 +31,14 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
putEnvArg += "=";
// what is the current value if any
- const char* currValue = getenv(varName);
+ std::string currValue;
+ const bool currValueSet = cmSystemTools::GetEnv(varName, currValue);
delete[] varName;
// will it be set to something, then set it
if (args.size() > 1 && !args[1].empty()) {
// but only if it is different from current value
- if (!currValue || strcmp(currValue, args[1].c_str())) {
+ if (!currValueSet || currValue != args[1]) {
putEnvArg += args[1];
cmSystemTools::PutEnv(putEnvArg);
}
@@ -45,7 +46,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
}
// if it will be cleared, then clear it if it isn't already clear
- if (currValue) {
+ if (currValueSet) {
cmSystemTools::PutEnv(putEnvArg);
}
return true;
@@ -59,7 +60,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
// SET (VAR PARENT_SCOPE) // Removes the definition of VAR
// in the parent scope.
else if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") {
- this->Makefile->RaiseScope(variable, 0);
+ this->Makefile->RaiseScope(variable, CM_NULLPTR);
return true;
}
@@ -73,7 +74,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
bool force = false; // optional
bool parentScope = false;
cmState::CacheEntryType type = cmState::STRING; // required if cache
- const char* docstring = 0; // required if cache
+ const char* docstring = CM_NULLPTR; // required if cache
unsigned int ignoreLastArgs = 0;
// look for PARENT_SCOPE argument
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 65af8ac..b51eed0 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmSetCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSetCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set"; }
+ std::string GetName() const CM_OVERRIDE { return "set"; }
cmTypeMacro(cmSetCommand, cmCommand);
};
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index a393eee..ef476ec 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -17,24 +17,30 @@
class cmSetDirectoryPropertiesCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmSetDirectoryPropertiesCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmSetDirectoryPropertiesCommand;
+ }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_directory_properties"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "set_directory_properties";
+ }
/**
* Static entry point for use by other commands
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 73f7437..8fe8ade 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -139,7 +139,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
- value = 0;
+ value = CM_NULLPTR;
}
if (this->AppendMode) {
cm->AppendProperty(name, value ? value : "", this->AppendAsString);
@@ -189,7 +189,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
- value = 0;
+ value = CM_NULLPTR;
}
if (this->AppendMode) {
mf->AppendProperty(name, value ? value : "", this->AppendAsString);
@@ -230,7 +230,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
- value = 0;
+ value = CM_NULLPTR;
}
if (this->AppendMode) {
target->AppendProperty(name, value, this->AppendAsString);
@@ -269,7 +269,7 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
- value = 0;
+ value = CM_NULLPTR;
}
if (this->AppendMode) {
@@ -317,7 +317,7 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
- value = 0;
+ value = CM_NULLPTR;
}
if (this->AppendMode) {
test->AppendProperty(name, value, this->AppendAsString);
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index a85d652..e78b04c 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -19,24 +19,24 @@ class cmSetPropertyCommand : public cmCommand
public:
cmSetPropertyCommand();
- virtual cmCommand* Clone() { return new cmSetPropertyCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSetPropertyCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_property"; }
+ std::string GetName() const CM_OVERRIDE { return "set_property"; }
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
cmTypeMacro(cmSetPropertyCommand, cmCommand);
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 20e6b93..f6b4de0 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -17,19 +17,25 @@
class cmSetSourceFilesPropertiesCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmSetSourceFilesPropertiesCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmSetSourceFilesPropertiesCommand;
+ }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_source_files_properties"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "set_source_files_properties";
+ }
cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand);
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 122c15e..1ed8d90 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -17,19 +17,19 @@
class cmSetTargetPropertiesCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmSetTargetPropertiesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSetTargetPropertiesCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_target_properties"; }
+ std::string GetName() const CM_OVERRIDE { return "set_target_properties"; }
/**
* Used by this command and cmSetPropertiesCommand
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index e469b2a..712ab36 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -17,19 +17,19 @@
class cmSetTestsPropertiesCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmSetTestsPropertiesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSetTestsPropertiesCommand; }
/**
* This is called when the command is first encountered in
* the input file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "set_tests_properties"; }
+ std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 702af4d..5c14991 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -55,7 +55,8 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args,
// try to find the hostname for this computer
if (!cmSystemTools::IsOff(hostname_cmd.c_str())) {
std::string host;
- cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, 0, 0, 0,
+ cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, CM_NULLPTR,
+ CM_NULLPTR, CM_NULLPTR,
cmSystemTools::OUTPUT_NONE);
// got the hostname
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index a4812f7..7a9ca9d 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmSiteNameCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSiteNameCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "site_name"; }
+ std::string GetName() const CM_OVERRIDE { return "site_name"; }
cmTypeMacro(cmSiteNameCommand, cmCommand);
};
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5b0acee..5869a01 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -19,7 +19,7 @@
cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
: Location(mf, name)
{
- this->CustomCommand = 0;
+ this->CustomCommand = CM_NULLPTR;
this->FindFullPathFailed = false;
this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(
this->Location.GetName()));
@@ -27,7 +27,7 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
cmSourceFile::~cmSourceFile()
{
- this->SetCustomCommand(0);
+ this->SetCustomCommand(CM_NULLPTR);
}
std::string const& cmSourceFile::GetExtension() const
@@ -135,7 +135,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
// The file is not generated. It must exist on disk.
cmMakefile const* mf = this->Location.GetMakefile();
- const char* tryDirs[3] = { 0, 0, 0 };
+ const char* tryDirs[3] = { CM_NULLPTR, CM_NULLPTR, CM_NULLPTR };
if (this->Location.DirectoryIsAmbiguous()) {
tryDirs[0] = mf->GetCurrentSourceDirectory();
tryDirs[1] = mf->GetCurrentBinaryDirectory();
@@ -294,10 +294,9 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
// Check for computed properties.
if (prop == "LOCATION") {
if (this->FullPath.empty()) {
- return 0;
- } else {
- return this->FullPath.c_str();
+ return CM_NULLPTR;
}
+ return this->FullPath.c_str();
}
const char* retVal = this->Properties.GetPropertyValue(prop);
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index b1623bd..a3808f7 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -62,7 +62,7 @@ public:
* horrible interface, but is necessary for backwards
* compatibility).
*/
- std::string const& GetFullPath(std::string* error = 0);
+ std::string const& GetFullPath(std::string* error = CM_NULLPTR);
std::string const& GetFullPath() const;
/**
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 3219f36..099a6f0 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -19,7 +19,7 @@
#include "assert.h"
cmSourceFileLocation::cmSourceFileLocation()
- : Makefile(0)
+ : Makefile(CM_NULLPTR)
, AmbiguousDirectory(true)
, AmbiguousExtension(true)
{
@@ -177,10 +177,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
}
std::vector<std::string> hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
- if (std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) {
- return true;
- }
- return false;
+ return std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end();
}
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index 394b33a..d9529a2 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -86,11 +86,7 @@ bool cmSourceGroup::MatchesRegex(const char* name)
bool cmSourceGroup::MatchesFiles(const char* name)
{
- std::set<std::string>::const_iterator i = this->GroupFiles.find(name);
- if (i != this->GroupFiles.end()) {
- return true;
- }
- return false;
+ return this->GroupFiles.find(name) != this->GroupFiles.end();
}
void cmSourceGroup::AssignSource(const cmSourceFile* sf)
@@ -127,7 +123,7 @@ cmSourceGroup* cmSourceGroup::LookupChild(const char* name) const
}
// if no child with this name was found return NULL
- return NULL;
+ return CM_NULLPTR;
}
cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const char* name)
@@ -147,7 +143,7 @@ cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const char* name)
return result;
}
}
- return 0;
+ return CM_NULLPTR;
}
cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const char* name)
@@ -168,7 +164,7 @@ cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const char* name)
return this;
}
- return 0;
+ return CM_NULLPTR;
}
std::vector<cmSourceGroup> const& cmSourceGroup::GetGroupChildren() const
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 8603e95..1f5232e 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -34,7 +34,7 @@ class cmSourceGroup
{
public:
cmSourceGroup(const char* name, const char* regex,
- const char* parentName = 0);
+ const char* parentName = CM_NULLPTR);
cmSourceGroup(cmSourceGroup const& r);
~cmSourceGroup();
cmSourceGroup& operator=(cmSourceGroup const&);
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 252819c..6db14c0 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -28,7 +28,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> folders =
cmSystemTools::tokenize(args[0], delimiter);
- cmSourceGroup* sg = 0;
+ cmSourceGroup* sg = CM_NULLPTR;
sg = this->Makefile->GetSourceGroup(folders);
if (!sg) {
this->Makefile->AddSourceGroup(folders);
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 0458656..81dfad6 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -26,19 +26,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmSourceGroupCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSourceGroupCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "source_group"; }
+ std::string GetName() const CM_OVERRIDE { return "source_group"; }
cmTypeMacro(cmSourceGroupCommand, cmCommand);
};
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 6669e5c..606978e 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -18,18 +18,6 @@
#include <cmConfigure.h>
-#include <cmsys/Configure.hxx>
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4786)
-#pragma warning(disable : 4503)
-#endif
-
-#ifdef __ICL
-#pragma warning(disable : 985)
-#pragma warning(disable : 1572) /* floating-point equality test */
-#endif
-
// Provide fixed-size integer types.
#include <cm_kwiml.h>
@@ -67,73 +55,9 @@ typedef unsigned short mode_t;
/* Poison this operator to avoid common mistakes. */
extern void operator<<(std::ostream&, const std::ostringstream&);
-/** Standard documentation entry for cmDocumentation's formatting. */
-struct cmDocumentationEntry
-{
- std::string Name;
- std::string Brief;
- cmDocumentationEntry() {}
- cmDocumentationEntry(const char* doc[2])
- {
- if (doc[0])
- this->Name = doc[0];
- if (doc[1])
- this->Brief = doc[1];
- }
- cmDocumentationEntry(const char* n, const char* b)
- {
- if (n)
- this->Name = n;
- if (b)
- this->Brief = b;
- }
-};
-
-/** Data structure to represent a single command line. */
-class cmCustomCommandLine : public std::vector<std::string>
-{
-public:
- typedef std::vector<std::string> Superclass;
- typedef Superclass::iterator iterator;
- typedef Superclass::const_iterator const_iterator;
-};
-
-/** Data structure to represent a list of command lines. */
-class cmCustomCommandLines : public std::vector<cmCustomCommandLine>
-{
-public:
- typedef std::vector<cmCustomCommandLine> Superclass;
- typedef Superclass::iterator iterator;
- typedef Superclass::const_iterator const_iterator;
-};
-
-// All subclasses of cmCommand or cmCTestGenericHandler should
-// invoke this macro.
-#define cmTypeMacro(thisClass, superclass) \
- virtual const char* GetNameOfClass() { return #thisClass; } \
- typedef superclass Superclass; \
- static bool IsTypeOf(const char* type) \
- { \
- if (!strcmp(#thisClass, type)) { \
- return true; \
- } \
- return Superclass::IsTypeOf(type); \
- } \
- virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \
- static thisClass* SafeDownCast(cmObject* c) \
- { \
- if (c && c->IsA(#thisClass)) { \
- return static_cast<thisClass*>(c); \
- } \
- return 0; \
- } \
- class cmTypeMacro_UseTrailingSemicolon
-
-enum cmTargetLinkLibraryType
-{
- GENERAL_LibraryType,
- DEBUG_LibraryType,
- OPTIMIZED_LibraryType
-};
+#include "cmCustomCommandLines.h"
+#include "cmDocumentationEntry.h"
+#include "cmTargetLinkLibraryType.h"
+#include "cmTypeMacro.h"
#endif
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 04f07ce..073c239 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -15,10 +15,19 @@
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmDefinitions.h"
+#include "cmListFileCache.h"
+#include "cmSystemTools.h"
+#include "cmTypeMacro.h"
#include "cmVersion.h"
#include "cmake.h"
+#include <algorithm>
#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <iterator>
+#include <stdio.h>
+#include <string.h>
+#include <utility>
struct cmState::SnapshotDataType
{
@@ -135,12 +144,12 @@ const char* cmState::GetTargetTypeName(cmState::TargetType targetType)
return "UNKNOWN_LIBRARY";
}
assert(0 && "Unexpected target type");
- return 0;
+ return CM_NULLPTR;
}
const char* cmCacheEntryTypes[] = { "BOOL", "PATH", "FILEPATH",
"STRING", "INTERNAL", "STATIC",
- "UNINITIALIZED", 0 };
+ "UNINITIALIZED", CM_NULLPTR };
const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
{
@@ -204,7 +213,7 @@ const char* cmState::GetCacheEntryValue(std::string const& key) const
{
cmCacheManager::CacheEntry* e = this->CacheManager->GetCacheEntry(key);
if (!e) {
- return 0;
+ return CM_NULLPTR;
}
return e->Value.c_str();
}
@@ -246,13 +255,21 @@ void cmState::SetCacheEntryBoolProperty(std::string const& key,
it.SetProperty(propertyName, value);
}
+std::vector<std::string> cmState::GetCacheEntryPropertyList(
+ const std::string& key)
+{
+ cmCacheManager::CacheIterator it =
+ this->CacheManager->GetCacheIterator(key.c_str());
+ return it.GetPropertyList();
+}
+
const char* cmState::GetCacheEntryProperty(std::string const& key,
std::string const& propertyName)
{
cmCacheManager::CacheIterator it =
this->CacheManager->GetCacheIterator(key.c_str());
if (!it.PropertyExists(propertyName)) {
- return 0;
+ return CM_NULLPTR;
}
return it.GetProperty(propertyName);
}
@@ -288,7 +305,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
std::string const& propertyName)
{
this->CacheManager->GetCacheIterator(key.c_str())
- .SetProperty(propertyName, (void*)0);
+ .SetProperty(propertyName, (void*)CM_NULLPTR);
}
cmState::Snapshot cmState::Reset()
@@ -366,7 +383,7 @@ cmPropertyDefinition const* cmState::GetPropertyDefinition(
this->PropertyDefinitions.find(scope)->second;
return &defs.find(name)->second;
}
- return 0;
+ return CM_NULLPTR;
}
bool cmState::IsPropertyDefined(const std::string& name,
@@ -483,7 +500,7 @@ void cmState::RemoveUnscriptableCommands()
cmCommand* cmState::GetCommand(std::string const& name) const
{
- cmCommand* command = 0;
+ cmCommand* command = CM_NULLPTR;
std::string sName = cmSystemTools::LowerCase(name);
std::map<std::string, cmCommand*>::const_iterator pos =
this->Commands.find(sName);
@@ -1189,7 +1206,7 @@ void cmState::Snapshot::SetDefinition(std::string const& name,
void cmState::Snapshot::RemoveDefinition(std::string const& name)
{
- this->Position->Vars->Set(name, 0);
+ this->Position->Vars->Set(name, CM_NULLPTR);
}
std::vector<std::string> cmState::Snapshot::UnusedKeys() const
@@ -1278,8 +1295,9 @@ void cmState::Snapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_UNIX", "1");
#endif
#if defined(__CYGWIN__)
- if (cmSystemTools::IsOn(
- cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32"))) {
+ std::string legacy;
+ if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) &&
+ cmSystemTools::IsOn(legacy.c_str())) {
this->SetDefinition("WIN32", "1");
this->SetDefinition("CMAKE_HOST_WIN32", "1");
}
@@ -1684,7 +1702,8 @@ const char* cmState::Directory::GetProperty(const std::string& prop,
return parent.GetDirectory().GetCurrentSource();
}
return "";
- } else if (prop == "LISTFILE_STACK") {
+ }
+ if (prop == "LISTFILE_STACK") {
std::vector<std::string> listFiles;
cmState::Snapshot snp = this->Snapshot_;
while (snp.IsValid()) {
@@ -1694,10 +1713,12 @@ const char* cmState::Directory::GetProperty(const std::string& prop,
std::reverse(listFiles.begin(), listFiles.end());
output = cmJoin(listFiles, ";");
return output.c_str();
- } else if (prop == "CACHE_VARIABLES") {
+ }
+ if (prop == "CACHE_VARIABLES") {
output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
return output.c_str();
- } else if (prop == "VARIABLES") {
+ }
+ if (prop == "VARIABLES") {
std::vector<std::string> res = this->Snapshot_.ClosureKeys();
std::vector<std::string> cacheKeys =
this->Snapshot_.State->GetCacheEntryKeys();
@@ -1705,13 +1726,16 @@ const char* cmState::Directory::GetProperty(const std::string& prop,
std::sort(res.begin(), res.end());
output = cmJoin(res, ";");
return output.c_str();
- } else if (prop == "INCLUDE_DIRECTORIES") {
+ }
+ if (prop == "INCLUDE_DIRECTORIES") {
output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
return output.c_str();
- } else if (prop == "COMPILE_OPTIONS") {
+ }
+ if (prop == "COMPILE_OPTIONS") {
output = cmJoin(this->GetCompileOptionsEntries(), ";");
return output.c_str();
- } else if (prop == "COMPILE_DEFINITIONS") {
+ }
+ if (prop == "COMPILE_DEFINITIONS") {
output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
return output.c_str();
}
diff --git a/Source/cmState.h b/Source/cmState.h
index 18c45b8..9ab4213 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -12,19 +12,25 @@
#ifndef cmState_h
#define cmState_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmAlgorithms.h"
+#include "cmDefinitions.h"
#include "cmLinkedTree.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
-class cmake;
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmCacheManager;
class cmCommand;
-class cmDefinitions;
class cmListFileBacktrace;
-class cmCacheManager;
+class cmPropertyDefinition;
class cmState
{
@@ -55,7 +61,7 @@ public:
class Snapshot
{
public:
- Snapshot(cmState* state = 0);
+ Snapshot(cmState* state = CM_NULLPTR);
Snapshot(cmState* state, PositionType position);
const char* GetDefinition(std::string const& name) const;
@@ -247,6 +253,7 @@ public:
std::string const& value);
void SetCacheEntryBoolProperty(std::string const& key,
std::string const& propertyName, bool value);
+ std::vector<std::string> GetCacheEntryPropertyList(std::string const& key);
const char* GetCacheEntryProperty(std::string const& key,
std::string const& propertyName);
bool GetCacheEntryPropertyAsBool(std::string const& key,
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index a348aef..3c913ee 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -89,7 +89,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
return false;
}
- cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash.get()) {
std::string out = hash->HashString(args[2]);
this->Makefile->AddDefinition(args[1], out.c_str());
@@ -485,7 +485,8 @@ bool cmStringCommand::HandleCompareCommand(
}
std::string mode = args[1];
if ((mode == "EQUAL") || (mode == "NOTEQUAL") || (mode == "LESS") ||
- (mode == "GREATER")) {
+ (mode == "LESS_EQUAL") || (mode == "GREATER") ||
+ (mode == "GREATER_EQUAL")) {
if (args.size() < 5) {
std::string e = "sub-command COMPARE, mode ";
e += mode;
@@ -500,8 +501,12 @@ bool cmStringCommand::HandleCompareCommand(
bool result;
if (mode == "LESS") {
result = (left < right);
+ } else if (mode == "LESS_EQUAL") {
+ result = (left <= right);
} else if (mode == "GREATER") {
result = (left > right);
+ } else if (mode == "GREATER_EQUAL") {
+ result = (left >= right);
} else if (mode == "EQUAL") {
result = (left == right);
} else // if(mode == "NOTEQUAL")
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 23d482c..23dc9db 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -29,24 +29,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmStringCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmStringCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "string"; }
+ std::string GetName() const CM_OVERRIDE { return "string"; }
cmTypeMacro(cmStringCommand, cmCommand);
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 9da91c4..08eb9a0 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmSubdirCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSubdirCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "subdirs"; }
+ std::string GetName() const CM_OVERRIDE { return "subdirs"; }
cmTypeMacro(cmSubdirCommand, cmCommand);
};
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index a15ee3e..41b27c8 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -17,10 +17,10 @@
class cmSubdirDependsCommand : public cmCommand
{
public:
- virtual cmCommand* Clone() { return new cmSubdirDependsCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "subdir_depends"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmSubdirDependsCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "subdir_depends"; }
cmTypeMacro(cmSubdirDependsCommand, cmCommand);
};
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7dece47..21a50cb 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -191,7 +191,8 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64 view)
}
}
#else
-void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64)
+void cmSystemTools::ExpandRegistryValues(std::string& source,
+ KeyWOW64 /*unused*/)
{
cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]");
while (regEntry.find(source)) {
@@ -228,14 +229,16 @@ std::string cmSystemTools::HelpFileName(std::string name)
std::string cmSystemTools::TrimWhitespace(const std::string& s)
{
std::string::const_iterator start = s.begin();
- while (start != s.end() && cm_isspace(*start))
+ while (start != s.end() && cm_isspace(*start)) {
++start;
- if (start == s.end())
+ }
+ if (start == s.end()) {
return "";
-
+ }
std::string::const_iterator stop = s.end() - 1;
- while (cm_isspace(*stop))
+ while (cm_isspace(*stop)) {
--stop;
+ }
return std::string(start, stop + 1);
}
@@ -330,9 +333,8 @@ void cmSystemTools::Message(const char* m1, const char* title)
(*s_MessageCallback)(m1, title, s_DisableMessages,
s_MessageCallbackClientData);
return;
- } else {
- std::cerr << m1 << std::endl << std::flush;
}
+ std::cerr << m1 << std::endl << std::flush;
}
void cmSystemTools::ReportLastSystemError(const char* msg)
@@ -581,7 +583,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
a != command.end(); ++a) {
argv.push_back(a->c_str());
}
- argv.push_back(0);
+ argv.push_back(CM_NULLPTR);
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
@@ -593,12 +595,12 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
if (outputflag == OUTPUT_PASSTHROUGH) {
cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
- captureStdOut = 0;
- captureStdErr = 0;
+ captureStdOut = CM_NULLPTR;
+ captureStdErr = CM_NULLPTR;
} else if (outputflag == OUTPUT_MERGE ||
(captureStdErr && captureStdErr == captureStdOut)) {
cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1);
- captureStdErr = 0;
+ captureStdErr = CM_NULLPTR;
}
assert(!captureStdErr || captureStdErr != captureStdOut);
@@ -612,7 +614,8 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
int pipe;
if (outputflag != OUTPUT_PASSTHROUGH &&
(captureStdOut || captureStdErr || outputflag != OUTPUT_NONE)) {
- while ((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) {
+ while ((pipe = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) >
+ 0) {
// Translate NULL characters in the output into valid text.
// Visual Studio 7 puts these characters in the output of its
// build process.
@@ -640,7 +643,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
}
}
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
if (captureStdOut) {
captureStdOut->assign(tempStdOut.begin(), tempStdOut.end());
}
@@ -702,7 +705,7 @@ bool cmSystemTools::RunSingleCommand(const char* command,
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
- if (args.size() < 1) {
+ if (args.empty()) {
return false;
}
return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr,
@@ -1430,7 +1433,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
- if ((p == NULL) || (*p == '\0')) {
+ if ((p == CM_NULLPTR) || (*p == '\0')) {
sprintf(tmp, "%lu ", (unsigned long)archive_entry_uid(entry));
p = tmp;
}
@@ -1441,7 +1444,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
fprintf(out, "%-*s ", (int)u_width, p);
/* Use gname if it's present, else gid. */
p = archive_entry_gname(entry);
- if (p != NULL && p[0] != '\0') {
+ if (p != CM_NULLPTR && p[0] != '\0') {
fprintf(out, "%s", p);
w = strlen(p);
} else {
@@ -1684,7 +1687,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
if (pipe == cmsysProcess_Pipe_Timeout) {
// Timeout has been exceeded.
return pipe;
- } else if (pipe == cmsysProcess_Pipe_STDOUT) {
+ }
+ if (pipe == cmsysProcess_Pipe_STDOUT) {
// Append to the stdout buffer.
std::vector<char>::size_type size = out.size();
out.insert(out.end(), data, data + length);
@@ -1700,13 +1704,13 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
line.append(&out[0], outiter - out.begin());
out.erase(out.begin(), out.end());
return cmsysProcess_Pipe_STDOUT;
- } else if (!err.empty()) {
+ }
+ if (!err.empty()) {
line.append(&err[0], erriter - err.begin());
err.erase(err.begin(), err.end());
return cmsysProcess_Pipe_STDERR;
- } else {
- return cmsysProcess_Pipe_None;
}
+ return cmsysProcess_Pipe_None;
}
}
}
@@ -1873,7 +1877,7 @@ unsigned int cmSystemTools::RandomSeed()
// Try using a real random source.
cmsys::ifstream fin;
- fin.rdbuf()->pubsetbuf(0, 0); // Unbuffered read.
+ fin.rdbuf()->pubsetbuf(CM_NULLPTR, 0); // Unbuffered read.
fin.open("/dev/urandom");
if (fin.good() && fin.read(seed.bytes, sizeof(seed)) &&
fin.gcount() == sizeof(seed)) {
@@ -1882,7 +1886,7 @@ unsigned int cmSystemTools::RandomSeed()
// Fall back to the time and pid.
struct timeval t;
- gettimeofday(&t, 0);
+ gettimeofday(&t, CM_NULLPTR);
unsigned int pid = static_cast<unsigned int>(getpid());
unsigned int tv_sec = static_cast<unsigned int>(t.tv_sec);
unsigned int tv_usec = static_cast<unsigned int>(t.tv_usec);
@@ -1930,11 +1934,11 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
}
if (cmSystemTools::GetFilenameName(exe_dir) == "MacOS") {
// The executable is inside an application bundle.
- // Look for ../bin (install tree) and then fall back to
+ // Look for ..<CMAKE_BIN_DIR> (install tree) and then fall back to
// ../../../bin (build tree).
exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
- if (cmSystemTools::FileExists((exe_dir + "/bin/cmake").c_str())) {
- exe_dir += "/bin";
+ if (cmSystemTools::FileExists(exe_dir + CMAKE_BIN_DIR "/cmake")) {
+ exe_dir += CMAKE_BIN_DIR;
} else {
exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
exe_dir = cmSystemTools::GetFilenamePath(exe_dir);
@@ -1985,13 +1989,20 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
}
#ifdef CMAKE_BUILD_WITH_CMAKE
- // Install tree has "<prefix>/bin/cmake" and "<prefix><CMAKE_DATA_DIR>".
- std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
- cmSystemToolsCMakeRoot = dir + CMAKE_DATA_DIR;
- if (!cmSystemTools::FileExists(
+ // Install tree has
+ // - "<prefix><CMAKE_BIN_DIR>/cmake"
+ // - "<prefix><CMAKE_DATA_DIR>"
+ if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) {
+ std::string const prefix =
+ exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR));
+ cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR;
+ }
+ if (cmSystemToolsCMakeRoot.empty() ||
+ !cmSystemTools::FileExists(
(cmSystemToolsCMakeRoot + "/Modules/CMake.cmake").c_str())) {
// Build tree has "<build>/bin[/<config>]/cmake" and
// "<build>/CMakeFiles/CMakeSourceDir.txt".
+ std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
cmsys::ifstream fin(src_dir_txt.c_str());
std::string src_dir;
@@ -2059,9 +2070,9 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
// However, we can test for some situations when the answer is most
// likely no.
int assumeTTY = cmsysTerminal_Color_AssumeTTY;
- if (cmSystemTools::GetEnv("DART_TEST_FROM_DART") ||
- cmSystemTools::GetEnv("DASHBOARD_TEST_FROM_CTEST") ||
- cmSystemTools::GetEnv("CTEST_INTERACTIVE_DEBUG_MODE")) {
+ if (cmSystemTools::HasEnv("DART_TEST_FROM_DART") ||
+ cmSystemTools::HasEnv("DASHBOARD_TEST_FROM_CTEST") ||
+ cmSystemTools::HasEnv("CTEST_INTERACTIVE_DEBUG_MODE")) {
// Avoid printing color escapes during dashboard builds.
assumeTTY = 0;
}
@@ -2108,11 +2119,8 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
// If the symlink points at an extended version of the same name
// assume it is the soname.
std::string name = cmSystemTools::GetFilenameName(fullPath);
- if (soname.length() > name.length() &&
- soname.substr(0, name.length()) == name) {
- return true;
- }
- return false;
+ return soname.length() > name.length() &&
+ soname.compare(0, name.length(), name) == 0;
}
bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
@@ -2193,8 +2201,8 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// Get the RPATH and RUNPATH entries from it.
int se_count = 0;
- cmELF::StringEntry const* se[2] = { 0, 0 };
- const char* se_name[2] = { 0, 0 };
+ cmELF::StringEntry const* se[2] = { CM_NULLPTR, CM_NULLPTR };
+ const char* se_name[2] = { CM_NULLPTR, CM_NULLPTR };
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
se[se_count] = se_rpath;
se_name[se_count] = "RPATH";
@@ -2210,13 +2218,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// The new rpath is empty and there is no rpath anyway so it is
// okay.
return true;
- } else {
- if (emsg) {
- *emsg = "No valid ELF RPATH or RUNPATH entry exists in the file; ";
- *emsg += elf.GetErrorMessage();
- }
- return false;
}
+ if (emsg) {
+ *emsg = "No valid ELF RPATH or RUNPATH entry exists in the file; ";
+ *emsg += elf.GetErrorMessage();
+ }
+ return false;
}
for (int i = 0; i < se_count; ++i) {
@@ -2373,10 +2380,11 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
if (lhs < rhs) {
// lhs < rhs, so true if operation is LESS
- return op == cmSystemTools::OP_LESS;
- } else if (lhs > rhs) {
+ return (op & cmSystemTools::OP_LESS) != 0;
+ }
+ if (lhs > rhs) {
// lhs > rhs, so true if operation is GREATER
- return op == cmSystemTools::OP_GREATER;
+ return (op & cmSystemTools::OP_GREATER) != 0;
}
if (*endr == '.') {
@@ -2388,7 +2396,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
}
}
// lhs == rhs, so true if operation is EQUAL
- return op == cmSystemTools::OP_EQUAL;
+ return (op & cmSystemTools::OP_EQUAL) != 0;
}
bool cmSystemTools::VersionCompareEqual(std::string const& lhs,
@@ -2405,6 +2413,13 @@ bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
rhs.c_str());
}
+bool cmSystemTools::VersionCompareGreaterEq(std::string const& lhs,
+ std::string const& rhs)
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
+ lhs.c_str(), rhs.c_str());
+}
+
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
bool* removed)
{
@@ -2424,7 +2439,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
// Get the RPATH and RUNPATH entries from it and sort them by index
// in the dynamic section header.
int se_count = 0;
- cmELF::StringEntry const* se[2] = { 0, 0 };
+ cmELF::StringEntry const* se[2] = { CM_NULLPTR, CM_NULLPTR };
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
se[se_count++] = se_rpath;
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index df2c1f7..3c1a9f4 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -12,10 +12,13 @@
#ifndef cmSystemTools_h
#define cmSystemTools_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <cmsys/Process.h>
#include <cmsys/SystemTools.hxx>
+#include <stddef.h>
+#include <string>
+#include <vector>
class cmSystemToolsFileTime;
@@ -64,33 +67,35 @@ public:
* title as a const char*, and a reference to bool that when
* set to false, will disable furthur messages (cancel).
*/
- static void SetMessageCallback(MessageCallback f, void* clientData = 0);
+ static void SetMessageCallback(MessageCallback f,
+ void* clientData = CM_NULLPTR);
/**
* Display an error message.
*/
- static void Error(const char* m, const char* m2 = 0, const char* m3 = 0,
- const char* m4 = 0);
+ static void Error(const char* m, const char* m2 = CM_NULLPTR,
+ const char* m3 = CM_NULLPTR, const char* m4 = CM_NULLPTR);
/**
* Display a message.
*/
- static void Message(const char* m, const char* title = 0);
+ static void Message(const char* m, const char* title = CM_NULLPTR);
typedef void (*OutputCallback)(const char*, size_t length, void*);
///! Send a string to stdout
static void Stdout(const char* s);
static void Stdout(const char* s, size_t length);
- static void SetStdoutCallback(OutputCallback, void* clientData = 0);
+ static void SetStdoutCallback(OutputCallback, void* clientData = CM_NULLPTR);
///! Send a string to stderr
static void Stderr(const char* s);
static void Stderr(const char* s, size_t length);
- static void SetStderrCallback(OutputCallback, void* clientData = 0);
+ static void SetStderrCallback(OutputCallback, void* clientData = CM_NULLPTR);
typedef bool (*InterruptCallback)(void*);
- static void SetInterruptCallback(InterruptCallback f, void* clientData = 0);
+ static void SetInterruptCallback(InterruptCallback f,
+ void* clientData = CM_NULLPTR);
static bool GetInterruptFlag();
///! Return true if there was an error at any point.
@@ -220,9 +225,10 @@ public:
OUTPUT_PASSTHROUGH
};
static bool RunSingleCommand(const char* command,
- std::string* captureStdOut = 0,
- std::string* captureStdErr = 0, int* retVal = 0,
- const char* dir = 0,
+ std::string* captureStdOut = CM_NULLPTR,
+ std::string* captureStdErr = CM_NULLPTR,
+ int* retVal = CM_NULLPTR,
+ const char* dir = CM_NULLPTR,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
/**
@@ -231,9 +237,10 @@ public:
* be in comand[1]...command[command.size()]
*/
static bool RunSingleCommand(std::vector<std::string> const& command,
- std::string* captureStdOut = 0,
- std::string* captureStdErr = 0, int* retVal = 0,
- const char* dir = 0,
+ std::string* captureStdOut = CM_NULLPTR,
+ std::string* captureStdErr = CM_NULLPTR,
+ int* retVal = CM_NULLPTR,
+ const char* dir = CM_NULLPTR,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
@@ -280,9 +287,11 @@ public:
enum CompareOp
{
- OP_LESS,
- OP_GREATER,
- OP_EQUAL
+ OP_EQUAL = 1,
+ OP_LESS = 2,
+ OP_GREATER = 4,
+ OP_LESS_EQUAL = OP_LESS | OP_EQUAL,
+ OP_GREATER_EQUAL = OP_GREATER | OP_EQUAL
};
/**
@@ -293,6 +302,8 @@ public:
std::string const& rhs);
static bool VersionCompareGreater(std::string const& lhs,
std::string const& rhs);
+ static bool VersionCompareGreaterEq(std::string const& lhs,
+ std::string const& rhs);
/**
* Determine the file type based on the extension
@@ -435,12 +446,14 @@ public:
/** Try to set the RPATH in an ELF binary. */
static bool ChangeRPath(std::string const& file, std::string const& oldRPath,
- std::string const& newRPath, std::string* emsg = 0,
- bool* changed = 0);
+ std::string const& newRPath,
+ std::string* emsg = CM_NULLPTR,
+ bool* changed = CM_NULLPTR);
/** Try to remove the RPATH from an ELF binary. */
- static bool RemoveRPath(std::string const& file, std::string* emsg = 0,
- bool* removed = 0);
+ static bool RemoveRPath(std::string const& file,
+ std::string* emsg = CM_NULLPTR,
+ bool* removed = CM_NULLPTR);
/** Check whether the RPATH in an ELF binary contains the path
given. */
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5e0d2b7..d5274cd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -12,22 +12,30 @@
#include "cmTarget.h"
#include "cmAlgorithms.h"
-#include "cmComputeLinkInformation.h"
#include "cmGeneratorExpression.h"
-#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
+#include "cmSystemTools.h"
#include "cmake.h"
+
+#include <algorithm>
#include <assert.h>
#include <cmsys/RegularExpression.hxx>
-#include <errno.h>
#include <map>
#include <set>
-#include <stdlib.h> // required for atof
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include <sstream>
+#include <string.h>
+
+#if defined(CMake_HAVE_CXX_UNORDERED_SET)
+#include <unordered_set>
+#define UNORDERED_SET std::unordered_set
+#elif defined(CMAKE_BUILD_WITH_CMAKE)
#include <cmsys/hash_set.hxx>
#define UNORDERED_SET cmsys::hash_set
#else
@@ -53,7 +61,7 @@ public:
cmTarget::cmTarget()
{
- this->Makefile = 0;
+ this->Makefile = CM_NULLPTR;
this->HaveInstallRule = false;
this->DLLPlatform = false;
this->IsAndroid = false;
@@ -93,63 +101,64 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Setup default property values.
if (this->GetType() != cmState::INTERFACE_LIBRARY &&
this->GetType() != cmState::UTILITY) {
- this->SetPropertyDefault("ANDROID_API", 0);
- this->SetPropertyDefault("ANDROID_API_MIN", 0);
- this->SetPropertyDefault("ANDROID_ARCH", 0);
- this->SetPropertyDefault("ANDROID_STL_TYPE", 0);
- this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", 0);
- this->SetPropertyDefault("ANDROID_PROCESS_MAX", 0);
- this->SetPropertyDefault("ANDROID_PROGUARD", 0);
- this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", 0);
- this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", 0);
- this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", 0);
- this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", 0);
- this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", 0);
- this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", 0);
- this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", 0);
- this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", 0);
- this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", 0);
- this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
+ this->SetPropertyDefault("ANDROID_API", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_API_MIN", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_ARCH", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_STL_TYPE", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_PROCESS_MAX", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_PROGUARD", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", CM_NULLPTR);
+ this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", CM_NULLPTR);
+ this->SetPropertyDefault("INSTALL_NAME_DIR", CM_NULLPTR);
this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF");
this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF");
- this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
- this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
- this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
- this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0);
- this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", 0);
- this->SetPropertyDefault("Fortran_FORMAT", 0);
- this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
- this->SetPropertyDefault("GNUtoMS", 0);
- this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
- this->SetPropertyDefault("IOS_INSTALL_COMBINED", 0);
- this->SetPropertyDefault("AUTOMOC", 0);
- this->SetPropertyDefault("AUTOUIC", 0);
- this->SetPropertyDefault("AUTORCC", 0);
- this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
- this->SetPropertyDefault("AUTOUIC_OPTIONS", 0);
- this->SetPropertyDefault("AUTORCC_OPTIONS", 0);
- this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0);
- this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
- this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
- this->SetPropertyDefault("MACOSX_BUNDLE", 0);
- this->SetPropertyDefault("MACOSX_RPATH", 0);
- this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
- this->SetPropertyDefault("C_CLANG_TIDY", 0);
- this->SetPropertyDefault("C_COMPILER_LAUNCHER", 0);
- this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", 0);
- this->SetPropertyDefault("C_STANDARD", 0);
- this->SetPropertyDefault("C_STANDARD_REQUIRED", 0);
- this->SetPropertyDefault("C_EXTENSIONS", 0);
- this->SetPropertyDefault("CXX_CLANG_TIDY", 0);
- this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", 0);
- this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", 0);
- this->SetPropertyDefault("CXX_STANDARD", 0);
- this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0);
- this->SetPropertyDefault("CXX_EXTENSIONS", 0);
- this->SetPropertyDefault("LINK_SEARCH_START_STATIC", 0);
- this->SetPropertyDefault("LINK_SEARCH_END_STATIC", 0);
+ this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("Fortran_FORMAT", CM_NULLPTR);
+ this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", CM_NULLPTR);
+ this->SetPropertyDefault("GNUtoMS", CM_NULLPTR);
+ this->SetPropertyDefault("OSX_ARCHITECTURES", CM_NULLPTR);
+ this->SetPropertyDefault("IOS_INSTALL_COMBINED", CM_NULLPTR);
+ this->SetPropertyDefault("AUTOMOC", CM_NULLPTR);
+ this->SetPropertyDefault("AUTOUIC", CM_NULLPTR);
+ this->SetPropertyDefault("AUTORCC", CM_NULLPTR);
+ this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", CM_NULLPTR);
+ this->SetPropertyDefault("AUTOUIC_OPTIONS", CM_NULLPTR);
+ this->SetPropertyDefault("AUTORCC_OPTIONS", CM_NULLPTR);
+ this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", CM_NULLPTR);
+ this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", CM_NULLPTR);
+ this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR);
+ this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR);
+ this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR);
+ this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR);
+ this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR);
+ this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR);
+ this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR);
+ this->SetPropertyDefault("LINK_WHAT_YOU_USE", CM_NULLPTR);
+ this->SetPropertyDefault("C_STANDARD", CM_NULLPTR);
+ this->SetPropertyDefault("C_STANDARD_REQUIRED", CM_NULLPTR);
+ this->SetPropertyDefault("C_EXTENSIONS", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_CLANG_TIDY", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_STANDARD", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_STANDARD_REQUIRED", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_EXTENSIONS", CM_NULLPTR);
+ this->SetPropertyDefault("LINK_SEARCH_START_STATIC", CM_NULLPTR);
+ this->SetPropertyDefault("LINK_SEARCH_END_STATIC", CM_NULLPTR);
}
// Collect the set of configuration types.
@@ -166,7 +175,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
"PDB_OUTPUT_DIRECTORY_",
"COMPILE_PDB_OUTPUT_DIRECTORY_",
"MAP_IMPORTED_CONFIG_",
- 0
+ CM_NULLPTR
};
for (std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci) {
@@ -178,7 +187,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
}
std::string property = *p;
property += configUpper;
- this->SetPropertyDefault(property, 0);
+ this->SetPropertyDefault(property, CM_NULLPTR);
}
// Initialize per-configuration name postfix property from the
@@ -190,7 +199,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->TargetTypeValue != cmState::INTERFACE_LIBRARY) {
std::string property = cmSystemTools::UpperCase(*ci);
property += "_POSTFIX";
- this->SetPropertyDefault(property, 0);
+ this->SetPropertyDefault(property, CM_NULLPTR);
}
}
}
@@ -234,27 +243,28 @@ void cmTarget::SetMakefile(cmMakefile* mf)
if (this->GetType() != cmState::INTERFACE_LIBRARY &&
this->GetType() != cmState::UTILITY) {
- this->SetPropertyDefault("C_VISIBILITY_PRESET", 0);
- this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0);
- this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0);
+ this->SetPropertyDefault("C_VISIBILITY_PRESET", CM_NULLPTR);
+ this->SetPropertyDefault("CXX_VISIBILITY_PRESET", CM_NULLPTR);
+ this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", CM_NULLPTR);
}
if (this->TargetTypeValue == cmState::EXECUTABLE) {
- this->SetPropertyDefault("ANDROID_GUI", 0);
- this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0);
- this->SetPropertyDefault("ENABLE_EXPORTS", 0);
+ this->SetPropertyDefault("ANDROID_GUI", CM_NULLPTR);
+ this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", CM_NULLPTR);
+ this->SetPropertyDefault("ENABLE_EXPORTS", CM_NULLPTR);
}
if (this->TargetTypeValue == cmState::SHARED_LIBRARY ||
this->TargetTypeValue == cmState::MODULE_LIBRARY) {
this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
}
- if (this->TargetTypeValue == cmState::SHARED_LIBRARY) {
- this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", 0);
+ if (this->TargetTypeValue == cmState::SHARED_LIBRARY ||
+ this->TargetTypeValue == cmState::EXECUTABLE) {
+ this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", CM_NULLPTR);
}
if (this->GetType() != cmState::INTERFACE_LIBRARY &&
this->GetType() != cmState::UTILITY) {
- this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
+ this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", CM_NULLPTR);
}
// Record current policies for later use.
@@ -269,8 +279,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
if (this->GetType() != cmState::INTERFACE_LIBRARY &&
this->GetType() != cmState::UTILITY) {
- this->SetPropertyDefault("JOB_POOL_COMPILE", 0);
- this->SetPropertyDefault("JOB_POOL_LINK", 0);
+ this->SetPropertyDefault("JOB_POOL_COMPILE", CM_NULLPTR);
+ this->SetPropertyDefault("JOB_POOL_LINK", CM_NULLPTR);
}
}
@@ -287,8 +297,9 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
{
std::map<std::string, cmListFileBacktrace>::const_iterator i =
this->UtilityBacktraces.find(u);
- if (i == this->UtilityBacktraces.end())
- return 0;
+ if (i == this->UtilityBacktraces.end()) {
+ return CM_NULLPTR;
+ }
return &i->second;
}
@@ -403,7 +414,7 @@ cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
{
std::string src = this->ProcessSourceItemCMP0049(s);
if (!s.empty() && src.empty()) {
- return 0;
+ return CM_NULLPTR;
}
return this->AddSource(src);
}
@@ -474,7 +485,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
this->Internal->SourceBacktraces.push_back(lfbt);
}
if (cmGeneratorExpression::Find(src) != std::string::npos) {
- return 0;
+ return CM_NULLPTR;
}
return this->Makefile->GetOrCreateSource(src);
}
@@ -580,8 +591,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
return ret;
}
-void cmTarget::GetTllSignatureTraces(std::ostringstream& s,
- TLLSignature sig) const
+void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const
{
const char* sigString =
(sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain");
@@ -592,7 +602,8 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream& s,
it != this->TLLCommands.end(); ++it) {
if (it->first == sig) {
cmListFileContext lfc = it->second;
- lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath =
+ converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
s << " * " << lfc << std::endl;
}
}
@@ -764,12 +775,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
<< prop << "\" is not allowed.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "NAME") {
+ }
+ if (prop == "NAME") {
std::ostringstream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "INCLUDE_DIRECTORIES") {
+ }
+ if (prop == "INCLUDE_DIRECTORIES") {
this->Internal->IncludeDirectoriesEntries.clear();
this->Internal->IncludeDirectoriesBacktraces.clear();
if (value) {
@@ -846,12 +859,14 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
<< prop << "\" is not allowed.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "NAME") {
+ }
+ if (prop == "NAME") {
std::ostringstream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "INCLUDE_DIRECTORIES") {
+ }
+ if (prop == "INCLUDE_DIRECTORIES") {
if (value && *value) {
this->Internal->IncludeDirectoriesEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -1059,7 +1074,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
return true;
}
std::ostringstream e;
- const char* modal = 0;
+ const char* modal = CM_NULLPTR;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch (context->GetPolicyStatus(cmPolicies::CMP0026)) {
case cmPolicies::WARN:
@@ -1101,7 +1116,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
"The property \""
<< prop << "\" is not allowed.";
context->IssueMessage(cmake::FATAL_ERROR, e.str());
- return 0;
+ return CM_NULLPTR;
}
// Watch for special "computed" properties that are dependent on
@@ -1114,7 +1129,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
static const std::string propLOCATION = "LOCATION";
if (prop == propLOCATION) {
if (!this->HandleLocationPropertyPolicy(context)) {
- return 0;
+ return CM_NULLPTR;
}
// Set the LOCATION property of the target.
@@ -1131,7 +1146,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
// target because the configuration type may not be known at
// CMake time.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild());
}
@@ -1141,7 +1158,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
// Support "LOCATION_<CONFIG>".
else if (cmHasLiteralPrefix(prop, "LOCATION_")) {
if (!this->HandleLocationPropertyPolicy(context)) {
- return 0;
+ return CM_NULLPTR;
}
const char* configName = prop.c_str() + 9;
@@ -1150,7 +1167,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
prop, this->ImportedGetFullPath(configName, false).c_str());
} else {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
@@ -1161,14 +1180,16 @@ const char* cmTarget::GetProperty(const std::string& prop,
std::string configName(prop.c_str(), prop.size() - 9);
if (configName != "IMPORTED") {
if (!this->HandleLocationPropertyPolicy(context)) {
- return 0;
+ return CM_NULLPTR;
}
if (this->IsImported()) {
this->Properties.SetProperty(
prop, this->ImportedGetFullPath(configName, false).c_str());
} else {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
@@ -1206,7 +1227,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
if (specialProps.count(prop)) {
if (prop == propLINK_LIBRARIES) {
if (this->Internal->LinkImplementationPropertyEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
static std::string output;
@@ -1214,51 +1235,60 @@ const char* cmTarget::GetProperty(const std::string& prop,
return output.c_str();
}
// the type property returns what type the target is
- else if (prop == propTYPE) {
+ if (prop == propTYPE) {
return cmState::GetTargetTypeName(this->GetType());
- } else if (prop == propINCLUDE_DIRECTORIES) {
+ }
+ if (prop == propINCLUDE_DIRECTORIES) {
if (this->Internal->IncludeDirectoriesEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
static std::string output;
output = cmJoin(this->Internal->IncludeDirectoriesEntries, ";");
return output.c_str();
- } else if (prop == propCOMPILE_FEATURES) {
+ }
+ if (prop == propCOMPILE_FEATURES) {
if (this->Internal->CompileFeaturesEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
static std::string output;
output = cmJoin(this->Internal->CompileFeaturesEntries, ";");
return output.c_str();
- } else if (prop == propCOMPILE_OPTIONS) {
+ }
+ if (prop == propCOMPILE_OPTIONS) {
if (this->Internal->CompileOptionsEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
static std::string output;
output = cmJoin(this->Internal->CompileOptionsEntries, ";");
return output.c_str();
- } else if (prop == propCOMPILE_DEFINITIONS) {
+ }
+ if (prop == propCOMPILE_DEFINITIONS) {
if (this->Internal->CompileDefinitionsEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
static std::string output;
output = cmJoin(this->Internal->CompileDefinitionsEntries, ";");
return output.c_str();
- } else if (prop == propIMPORTED) {
+ }
+ if (prop == propIMPORTED) {
return this->IsImported() ? "TRUE" : "FALSE";
- } else if (prop == propNAME) {
+ }
+ if (prop == propNAME) {
return this->GetName().c_str();
- } else if (prop == propBINARY_DIR) {
+ }
+ if (prop == propBINARY_DIR) {
return this->GetMakefile()->GetCurrentBinaryDirectory();
- } else if (prop == propSOURCE_DIR) {
+ }
+ if (prop == propSOURCE_DIR) {
return this->GetMakefile()->GetCurrentSourceDirectory();
- } else if (prop == propSOURCES) {
+ }
+ if (prop == propSOURCES) {
if (this->Internal->SourceEntries.empty()) {
- return 0;
+ return CM_NULLPTR;
}
std::ostringstream ss;
@@ -1423,8 +1453,8 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config,
std::string result;
- const char* loc = 0;
- const char* imp = 0;
+ const char* loc = CM_NULLPTR;
+ const char* imp = CM_NULLPTR;
std::string suffix;
if (this->GetType() != cmState::INTERFACE_LIBRARY &&
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 71ba0cd..fc30166 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -12,32 +12,35 @@
#ifndef cmTarget_h
#define cmTarget_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
#include "cmPropertyMap.h"
+#include "cmState.h"
+#include "cmTargetLinkLibraryType.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
-#include <cmsys/auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map>
#else
#include <cmsys/hash_map.hxx>
#endif
#endif
-class cmake;
class cmMakefile;
class cmSourceFile;
-class cmGlobalGenerator;
-class cmListFileBacktrace;
-class cmTarget;
-class cmGeneratorTarget;
-class cmTargetTraceDependencies;
-
class cmTargetInternals;
+
class cmTargetInternalPointer
{
public:
@@ -156,7 +159,7 @@ public:
};
bool PushTLLCommandTrace(TLLSignature signature,
cmListFileContext const& lfc);
- void GetTllSignatureTraces(std::ostringstream& s, TLLSignature sig) const;
+ void GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const;
void MergeLinkLibraries(cmMakefile& mf, const std::string& selfname,
const LinkLibraryVectorType& libs);
@@ -195,7 +198,7 @@ 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 std::string& u, cmMakefile* makefile = 0);
+ void AddUtility(const std::string& u, cmMakefile* makefile = CM_NULLPTR);
///! Get the utilities used by this target
std::set<std::string> const& GetUtilities() const { return this->Utilities; }
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
@@ -331,7 +334,7 @@ private:
};
#ifdef CMAKE_BUILD_WITH_CMAKE
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
typedef std::unordered_map<std::string, cmTarget> cmTargets;
#else
typedef cmsys::hash_map<std::string, cmTarget> cmTargets;
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 29d86c5..1689a75 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -21,30 +21,36 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTargetCompileDefinitionsCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmTargetCompileDefinitionsCommand;
+ }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "target_compile_definitions"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "target_compile_definitions";
+ }
cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase);
private:
- virtual void HandleImportedTarget(const std::string& tgt);
- virtual void HandleMissingTarget(const std::string& name);
+ void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
+ void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
- virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
- virtual std::string Join(const std::vector<std::string>& content);
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
+ std::string Join(const std::vector<std::string>& content) CM_OVERRIDE;
};
#endif
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 3d883e9..4fae84a 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -16,23 +16,23 @@
class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
{
- virtual cmCommand* Clone() { return new cmTargetCompileFeaturesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileFeaturesCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
- virtual std::string GetName() const { return "target_compile_features"; }
+ std::string GetName() const CM_OVERRIDE { return "target_compile_features"; }
cmTypeMacro(cmTargetCompileFeaturesCommand, cmTargetPropCommandBase);
private:
- virtual void HandleImportedTarget(const std::string& tgt);
- virtual void HandleMissingTarget(const std::string& name);
+ void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
+ void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
- virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
- virtual std::string Join(const std::vector<std::string>& content);
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
+ std::string Join(const std::vector<std::string>& content) CM_OVERRIDE;
};
#endif
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 231448b..7239629 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -21,30 +21,30 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTargetCompileOptionsCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileOptionsCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "target_compile_options"; }
+ std::string GetName() const CM_OVERRIDE { return "target_compile_options"; }
cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase);
private:
- virtual void HandleImportedTarget(const std::string& tgt);
- virtual void HandleMissingTarget(const std::string& name);
+ void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
+ void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
- virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
- virtual std::string Join(const std::vector<std::string>& content);
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
+ std::string Join(const std::vector<std::string>& content) CM_OVERRIDE;
};
#endif
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 4c907bd..ba5d980 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -21,34 +21,40 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTargetIncludeDirectoriesCommand; }
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmTargetIncludeDirectoriesCommand;
+ }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "target_include_directories"; }
+ std::string GetName() const CM_OVERRIDE
+ {
+ return "target_include_directories";
+ }
cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase);
private:
- virtual void HandleImportedTarget(const std::string& tgt);
- virtual void HandleMissingTarget(const std::string& name);
+ void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
+ void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
- virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
- virtual void HandleInterfaceContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
+ void HandleInterfaceContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
- virtual std::string Join(const std::vector<std::string>& content);
+ std::string Join(const std::vector<std::string>& content) CM_OVERRIDE;
};
#endif
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 774577a..1c4a9ce 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -91,7 +91,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
if (this->Target->GetType() == cmState::UTILITY) {
std::ostringstream e;
- const char* modal = 0;
+ const char* modal = CM_NULLPTR;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) {
case cmPolicies::WARN:
@@ -307,7 +307,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
if (!this->Target->PushTLLCommandTrace(
sig, this->Makefile->GetExecutionContext())) {
std::ostringstream e;
- const char* modal = 0;
+ const char* modal = CM_NULLPTR;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) {
case cmPolicies::WARN:
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 016993d..4f58639 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -27,19 +27,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTargetLinkLibrariesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTargetLinkLibrariesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "target_link_libraries"; }
+ std::string GetName() const CM_OVERRIDE { return "target_link_libraries"; }
cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
diff --git a/Source/cmTargetLinkLibraryType.h b/Source/cmTargetLinkLibraryType.h
new file mode 100644
index 0000000..71ac9e7
--- /dev/null
+++ b/Source/cmTargetLinkLibraryType.h
@@ -0,0 +1,22 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmTargetLinkLibraryType_h
+#define cmTargetLinkLibraryType_h
+
+enum cmTargetLinkLibraryType
+{
+ GENERAL_LibraryType,
+ DEBUG_LibraryType,
+ OPTIMIZED_LibraryType
+};
+
+#endif
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 304e176..9073204 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -21,31 +21,31 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTargetSourcesCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTargetSourcesCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "target_sources"; }
+ std::string GetName() const CM_OVERRIDE { return "target_sources"; }
cmTypeMacro(cmTargetSourcesCommand, cmTargetPropCommandBase);
private:
- virtual void HandleImportedTarget(const std::string& tgt);
- virtual void HandleMissingTarget(const std::string& name);
+ void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
+ void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
- virtual bool HandleDirectContent(cmTarget* tgt,
- const std::vector<std::string>& content,
- bool prepend, bool system);
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) CM_OVERRIDE;
- virtual std::string Join(const std::vector<std::string>& content);
+ std::string Join(const std::vector<std::string>& content) CM_OVERRIDE;
};
#endif
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 0658e95..790a3f8 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -11,10 +11,10 @@
============================================================================*/
#include "cmTest.h"
-#include "cmSystemTools.h"
-
#include "cmMakefile.h"
-#include "cmake.h"
+#include "cmProperty.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
cmTest::cmTest(cmMakefile* mf)
: Backtrace(mf->GetBacktrace())
diff --git a/Source/cmTest.h b/Source/cmTest.h
index db68008..ce3867c 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -12,11 +12,14 @@
#ifndef cmTest_h
#define cmTest_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmCustomCommand.h"
#include "cmListFileCache.h"
#include "cmPropertyMap.h"
+
+#include <string>
+#include <vector>
+
class cmMakefile;
/** \class cmTest
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index e599825..cfc174e 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -12,11 +12,19 @@
#include "cmTestGenerator.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
+#include "cmPropertyMap.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmTest.h"
+#include <map>
+#include <ostream>
+#include <utility>
+
cmTestGenerator::cmTestGenerator(
cmTest* test, std::vector<std::string> const& configurations)
: cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations)
@@ -24,7 +32,7 @@ cmTestGenerator::cmTestGenerator(
{
this->ActionsPerConfig = !test->GetOldStyle();
this->TestGenerated = false;
- this->LG = 0;
+ this->LG = CM_NULLPTR;
}
cmTestGenerator::~cmTestGenerator()
@@ -83,7 +91,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Prepend with the emulator when cross compiling if required.
const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
- if (emulator != 0) {
+ if (emulator != CM_NULLPTR) {
std::vector<std::string> emulatorWithArgs;
cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
std::string emulatorExe(emulatorWithArgs[0]);
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index f946a1c..44574e7 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -12,10 +12,16 @@
#ifndef cmTestGenerator_h
#define cmTestGenerator_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include "cmScriptGenerator.h"
-class cmTest;
+#include <iosfwd>
+#include <string>
+#include <vector>
+
class cmLocalGenerator;
+class cmTest;
/** \class cmTestGenerator
* \brief Support class for generating install scripts.
@@ -27,18 +33,20 @@ public:
cmTestGenerator(cmTest* test,
std::vector<std::string> const& configurations =
std::vector<std::string>());
- virtual ~cmTestGenerator();
+ ~cmTestGenerator() CM_OVERRIDE;
void Compute(cmLocalGenerator* lg);
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 std::string& config,
- Indent const& indent);
- virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent);
- virtual bool NeedsScriptNoConfig() const;
+ void GenerateScriptConfigs(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptNoConfig(std::ostream& os,
+ Indent const& indent) CM_OVERRIDE;
+ bool NeedsScriptNoConfig() const CM_OVERRIDE;
void GenerateOldStyle(std::ostream& os, Indent const& indent);
cmLocalGenerator* LG;
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index c624d0f..61b74db 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -22,7 +22,7 @@
std::string cmTimestamp::CurrentTime(const std::string& formatString,
bool utcFlag)
{
- time_t currentTimeT = time(0);
+ time_t currentTimeT = time(CM_NULLPTR);
if (currentTimeT == time_t(-1)) {
return std::string();
}
@@ -56,14 +56,14 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
struct tm timeStruct;
memset(&timeStruct, 0, sizeof(timeStruct));
- struct tm* ptr = (struct tm*)0;
+ struct tm* ptr = (struct tm*)CM_NULLPTR;
if (utcFlag) {
ptr = gmtime(&timeT);
} else {
ptr = localtime(&timeT);
}
- if (ptr == 0) {
+ if (ptr == CM_NULLPTR) {
return std::string();
}
@@ -93,10 +93,9 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
#else
// From Linux timegm() manpage.
- std::string tz_old = "TZ=";
- if (const char* tz = cmSystemTools::GetEnv("TZ")) {
- tz_old += tz;
- }
+ std::string tz_old = "";
+ cmSystemTools::GetEnv("TZ", tz_old);
+ tz_old = "TZ=" + tz_old;
// The standard says that "TZ=" or "TZ=[UNRECOGNIZED_TZ]" means UTC.
// It seems that "TZ=" does NOT work, at least under Windows
@@ -152,7 +151,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
return std::string();
}
- std::stringstream ss;
+ std::ostringstream ss;
ss << static_cast<long int>(difftime(timeT, unixEpoch));
return ss.str();
}
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index e50d54c..abfe335 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTryCompileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTryCompileCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "try_compile"; }
+ std::string GetName() const CM_OVERRIDE { return "try_compile"; }
cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
};
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 19837a7..7b19048 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -124,8 +124,9 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
std::string runOutputContents;
if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") &&
!this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) {
- this->DoNotRunExecutable(runArgs, argv[3],
- captureRunOutput ? &runOutputContents : 0);
+ this->DoNotRunExecutable(runArgs, argv[3], captureRunOutput
+ ? &runOutputContents
+ : CM_NULLPTR);
} else {
this->RunExecutable(runArgs, &runOutputContents);
}
@@ -186,9 +187,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
finalCommand += runArgs;
}
int timeout = 0;
- bool worked =
- cmSystemTools::RunSingleCommand(finalCommand.c_str(), out, out, &retVal, 0,
- cmSystemTools::OUTPUT_NONE, timeout);
+ bool worked = cmSystemTools::RunSingleCommand(
+ finalCommand.c_str(), out, out, &retVal, CM_NULLPTR,
+ cmSystemTools::OUTPUT_NONE, timeout);
// set the run var
char retChar[1000];
if (worked) {
@@ -230,7 +231,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
this->RunResultVariable + "__TRYRUN_OUTPUT";
bool error = false;
- if (this->Makefile->GetDefinition(this->RunResultVariable) == 0) {
+ if (this->Makefile->GetDefinition(this->RunResultVariable) == CM_NULLPTR) {
// if the variables doesn't exist, create it with a helpful error text
// and mark it as advanced
std::string comment;
@@ -252,8 +253,8 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
}
// is the output from the executable used ?
- if (out != 0) {
- if (this->Makefile->GetDefinition(internalRunOutputName) == 0) {
+ if (out != CM_NULLPTR) {
+ if (this->Makefile->GetDefinition(internalRunOutputName) == CM_NULLPTR) {
// if the variables doesn't exist, create it with a helpful error text
// and mark it as advanced
std::string comment;
@@ -301,7 +302,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment += " to\n"
" the exit code (in many cases 0 for success), otherwise "
"enter \"FAILED_TO_RUN\".\n";
- if (out != 0) {
+ if (out != CM_NULLPTR) {
comment += internalRunOutputName;
comment +=
"\n contains the text the executable "
@@ -332,7 +333,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
<< this->Makefile->GetDefinition(this->RunResultVariable)
<< "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n";
- if (out != 0) {
+ if (out != CM_NULLPTR) {
file << "set( " << internalRunOutputName << " \n \""
<< this->Makefile->GetDefinition(internalRunOutputName)
<< "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n";
@@ -345,7 +346,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"please set the following cache variables "
"appropriately:\n";
errorMessage += " " + this->RunResultVariable + " (advanced)\n";
- if (out != 0) {
+ if (out != CM_NULLPTR) {
errorMessage += " " + internalRunOutputName + " (advanced)\n";
}
errorMessage += detailsString;
@@ -353,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
return;
}
- if (out != 0) {
+ if (out != CM_NULLPTR) {
(*out) = this->Makefile->GetDefinition(internalRunOutputName);
}
}
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index 26c0777..b8eb1de 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -25,19 +25,19 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmTryRunCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmTryRunCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "try_run"; }
+ std::string GetName() const CM_OVERRIDE { return "try_run"; }
cmTypeMacro(cmTryRunCommand, cmCoreTryCompile);
diff --git a/Source/cmTypeMacro.h b/Source/cmTypeMacro.h
new file mode 100644
index 0000000..147eba8
--- /dev/null
+++ b/Source/cmTypeMacro.h
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmTypeMacro_h
+#define cmTypeMacro_h
+
+// All subclasses of cmCommand or cmCTestGenericHandler should
+// invoke this macro.
+#define cmTypeMacro(thisClass, superclass) \
+ const char* GetNameOfClass() CM_OVERRIDE { return #thisClass; } \
+ typedef superclass Superclass; \
+ static bool IsTypeOf(const char* type) \
+ { \
+ if (!strcmp(#thisClass, type)) { \
+ return true; \
+ } \
+ return Superclass::IsTypeOf(type); \
+ } \
+ bool IsA(const char* type) CM_OVERRIDE \
+ { \
+ return thisClass::IsTypeOf(type); \
+ } \
+ static thisClass* SafeDownCast(cmObject* c) \
+ { \
+ if (c && c->IsA(#thisClass)) { \
+ return static_cast<thisClass*>(c); \
+ } \
+ return 0; \
+ } \
+ class cmTypeMacro_UseTrailingSemicolon
+
+#endif
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index c04c44a..05ba65a 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -47,7 +47,7 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
}
// unset(VAR PARENT_SCOPE)
else if ((args.size() == 2) && (args[1] == "PARENT_SCOPE")) {
- this->Makefile->RaiseScope(variable, 0);
+ this->Makefile->RaiseScope(variable, CM_NULLPTR);
return true;
}
// ERROR: second argument isn't CACHE or PARENT_SCOPE
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index faa8f9b..6429c10 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -25,24 +25,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmUnsetCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmUnsetCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "unset"; }
+ std::string GetName() const CM_OVERRIDE { return "unset"; }
cmTypeMacro(cmUnsetCommand, cmCommand);
};
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index 5a97a61..5a44035 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -18,11 +18,11 @@ class cmUseMangledMesaCommand : public cmCommand
{
public:
cmTypeMacro(cmUseMangledMesaCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "use_mangled_mesa"; }
- virtual bool IsScriptable() const { return true; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
protected:
void CopyAndFullPathMesaHeader(const char* source, const char* outdir);
};
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index f7d766e..c50cbfb 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -38,7 +38,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
bool haveCacheValue = false;
if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
- haveCacheValue = (cacheValue != 0);
+ haveCacheValue = (cacheValue != CM_NULLPTR);
if (!haveCacheValue) {
std::string msg = "UTILITY_SOURCE is used in cross compiling mode for ";
msg += cacheEntry;
@@ -50,7 +50,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
} else {
cmState* state = this->Makefile->GetState();
haveCacheValue =
- (cacheValue && (strstr(cacheValue, "(IntDir)") == 0 ||
+ (cacheValue && (strstr(cacheValue, "(IntDir)") == CM_NULLPTR ||
(intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
(state->GetCacheMajorVersion() != 0 &&
state->GetCacheMinorVersion() != 0));
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index a709de1..2eb961f 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -18,10 +18,10 @@ class cmUtilitySourceCommand : public cmCommand
{
public:
cmTypeMacro(cmUtilitySourceCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmUtilitySourceCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "utility_source"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "utility_source"; }
};
#endif
diff --git a/Source/cmUtils.hxx b/Source/cmUtils.hxx
new file mode 100644
index 0000000..b7a79cc
--- /dev/null
+++ b/Source/cmUtils.hxx
@@ -0,0 +1,26 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2016 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmUtils_hxx
+#define cmUtils_hxx
+
+#include <cmsys/SystemTools.hxx>
+
+// Use the make system's VERBOSE environment variable to enable
+// verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
+// (which is set by the Eclipse and KDevelop generators).
+inline bool isCMakeVerbose()
+{
+ return (cmSystemTools::HasEnv("VERBOSE") &&
+ !cmSystemTools::HasEnv("CMAKE_NO_VERBOSE"));
+}
+
+#endif
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 6d09bdf..b072964 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -11,10 +11,10 @@
============================================================================*/
#include "cmUuid.h"
-#include <string.h>
-
#include "cm_sha2.h"
+
#include <cmsys/MD5.h>
+#include <string.h>
cmUuid::cmUuid()
{
@@ -180,13 +180,14 @@ bool cmUuid::IntFromHexDigit(char input, char& output) const
if (input >= '0' && input <= '9') {
output = char(input - '0');
return true;
- } else if (input >= 'a' && input <= 'f') {
+ }
+ if (input >= 'a' && input <= 'f') {
output = char(input - 'a' + 0xA);
return true;
- } else if (input >= 'A' && input <= 'F') {
+ }
+ if (input >= 'A' && input <= 'F') {
output = char(input - 'A' + 0xA);
return true;
- } else {
- return false;
}
+ return false;
}
diff --git a/Source/cmUuid.h b/Source/cmUuid.h
index 2bd7ec5..f01230c 100644
--- a/Source/cmUuid.h
+++ b/Source/cmUuid.h
@@ -12,7 +12,10 @@
#ifndef cmUuid_h
#define cmUuid_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
/** \class cmUuid
* \brief Utility class to generate UUIDs as defined by RFC4122
diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h
index 4243f30..5812e79 100644
--- a/Source/cmVS14CLFlagTable.h
+++ b/Source/cmVS14CLFlagTable.h
@@ -16,7 +16,6 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = {
{ "Optimization", "", "Custom", "Custom", 0 },
{ "Optimization", "Od", "Disabled", "Disabled", 0 },
- { "Optimization", "Os", "Minimize Size", "MinSize", 0 },
{ "Optimization", "O1", "Minimize Size", "MinSpace", 0 },
{ "Optimization", "O2", "Maximize Speed", "MaxSpeed", 0 },
{ "Optimization", "Ox", "Full Optimization", "Full", 0 },
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index b83f615..c4b0817 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -18,10 +18,10 @@ class cmVariableRequiresCommand : public cmCommand
{
public:
cmTypeMacro(cmVariableRequiresCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmVariableRequiresCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
- virtual std::string GetName() const { return "variable_requires"; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; }
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+ std::string GetName() const CM_OVERRIDE { return "variable_requires"; }
};
#endif
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 11eaa93..ce700db 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -13,7 +13,9 @@
#include "cmAlgorithms.h"
-#include <cmsys/auto_ptr.hxx>
+#include <algorithm>
+#include <cm_auto_ptr.hxx>
+#include <utility>
static const char* const cmVariableWatchAccessStrings[] = {
"READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
@@ -48,7 +50,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
void* client_data /*=0*/,
DeleteData delete_data /*=0*/)
{
- cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
+ CM_AUTO_PTR<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
p->Method = method;
p->ClientData = client_data;
p->DeleteDataCall = delete_data;
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index be8f72f..88b3d1c 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -12,7 +12,11 @@
#ifndef cmVariableWatch_h
#define cmVariableWatch_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
+#include <vector>
class cmMakefile;
@@ -36,9 +40,10 @@ public:
* Add watch to the variable
*/
bool AddWatch(const std::string& variable, WatchMethod method,
- void* client_data = 0, DeleteData delete_data = 0);
+ void* client_data = CM_NULLPTR,
+ DeleteData delete_data = CM_NULLPTR);
void RemoveWatch(const std::string& variable, WatchMethod method,
- void* client_data = 0);
+ void* client_data = CM_NULLPTR);
/**
* This method is called when variable is accessed
@@ -71,9 +76,9 @@ protected:
void* ClientData;
DeleteData DeleteDataCall;
Pair()
- : Method(0)
- , ClientData(0)
- , DeleteDataCall(0)
+ : Method(CM_NULLPTR)
+ , ClientData(CM_NULLPTR)
+ , DeleteDataCall(CM_NULLPTR)
{
}
~Pair()
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index aad53cb..1d402af 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -24,34 +24,34 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmVariableWatchCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmVariableWatchCommand; }
//! Default constructor
cmVariableWatchCommand();
//! Destructor.
- ~cmVariableWatchCommand();
+ ~cmVariableWatchCommand() CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/** This command does not really have a final pass but it needs to
stay alive since it owns variable watch callback information. */
- virtual bool HasFinalPass() const { return true; }
+ bool HasFinalPass() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "variable_watch"; }
+ std::string GetName() const CM_OVERRIDE { return "variable_watch"; }
cmTypeMacro(cmVariableWatchCommand, cmCommand);
diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx
index 4c2e4ce..88cae0b 100644
--- a/Source/cmVersion.cxx
+++ b/Source/cmVersion.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmVersion.h"
-#include "cmVersionMacros.h"
+#include "cmVersionConfig.h"
unsigned int cmVersion::GetMajorVersion()
{
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index 46fd5a6..20e4c8c 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -12,7 +12,7 @@
#ifndef cmVersion_h
#define cmVersion_h
-#include "cmStandardIncludes.h"
+#include <cm_kwiml.h>
/** \class cmVersion
* \brief Helper class for providing CMake and CTest version information.
diff --git a/Source/cmVersionConfig.h.in b/Source/cmVersionConfig.h.in
index 16aeabe..92abfbe 100644
--- a/Source/cmVersionConfig.h.in
+++ b/Source/cmVersionConfig.h.in
@@ -12,4 +12,6 @@
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@
#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@
+#define CMake_VERSION_SUFFIX "@CMake_VERSION_SUFFIX@"
+#define CMake_VERSION_IS_DIRTY @CMake_VERSION_IS_DIRTY@
#define CMake_VERSION "@CMake_VERSION@"
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7e17818..8ff7366 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -42,7 +42,7 @@
#include "cmVisualStudioGeneratorOptions.h"
#include "windows.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
static std::string const kWINDOWS_7_1_SDK = "Windows7.1SDK";
@@ -185,13 +185,12 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName();
this->NsightTegra = gg->IsNsightTegra();
- for (int i =
- sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u",
- &this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
- &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
- i < 4; ++i) {
+ for (int i = 0; i < 4; ++i) {
this->NsightTegraVersion[i] = 0;
}
+ sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u",
+ &this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
+ &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
this->MSTools = !this->NsightTegra;
this->TargetCompileAsWinRT = false;
this->BuildFileStream = 0;
@@ -533,7 +532,9 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
this->Configurations.begin();
i != this->Configurations.end(); ++i) {
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
- if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE")) {
+ if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") ||
+ // Handle variant of VS_GLOBAL_<variable> for RootNamespace.
+ this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) {
(*this->BuildFileStream) << "$(RootNamespace).";
}
(*this->BuildFileStream) << "%(Filename)";
@@ -1189,6 +1190,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
tool = "PRIResource";
} else if (ext == "xml") {
tool = "XML";
+ } else if (ext == "natvis") {
+ tool = "Natvis";
}
if (this->NsightTegra) {
@@ -1205,6 +1208,11 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
}
}
+ const char* toolOverride = sf->GetProperty("VS_TOOL_OVERRIDE");
+ if (toolOverride && *toolOverride) {
+ tool = toolOverride;
+ }
+
std::string deployContent;
std::string deployLocation;
if (this->GlobalGenerator->TargetsWindowsPhone() ||
@@ -1226,8 +1234,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
if (!deployContent.empty()) {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(deployContent);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis
if (!deployLocation.empty()) {
this->WriteString("<Link>", 3);
@@ -1681,7 +1688,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// copied from cmLocalVisualStudio7Generator.cxx 805
// TODO: Integrate code below with cmLocalVisualStudio7Generator.
- cmsys::auto_ptr<Options> pOptions(new Options(
+ CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::Compiler, this->GetClFlagTable()));
Options& clOptions = *pOptions;
@@ -1845,7 +1852,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
std::string const& configName)
{
- cmsys::auto_ptr<Options> pOptions(new Options(
+ CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable()));
Options& rcOptions = *pOptions;
@@ -1902,7 +1909,7 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
std::string const& configName)
{
- cmsys::auto_ptr<Options> pOptions(new Options(
+ CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable()));
Options& masmOptions = *pOptions;
@@ -2055,7 +2062,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* nativeLibDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDirectoriesExpression);
std::string nativeLibDirs =
cge->Evaluate(this->LocalGenerator, configName);
@@ -2068,7 +2075,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
this->GeneratorTarget->GetProperty(
"ANDROID_NATIVE_LIB_DEPENDENCIES")) {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDependenciesExpression);
std::string nativeLibDeps =
cge->Evaluate(this->LocalGenerator, configName);
@@ -2087,7 +2094,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* jarDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(jarDirectoriesExpression);
std::string jarDirectories =
cge->Evaluate(this->LocalGenerator, configName);
@@ -2147,7 +2154,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string const& config)
{
- cmsys::auto_ptr<Options> pOptions(new Options(
+ CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this));
Options& linkOptions = *pOptions;
@@ -2341,7 +2348,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
"%(IgnoreSpecificDefaultLibraries)");
}
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
+ if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
+ this->GeneratorTarget->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (this->GeneratorTarget->GetPropertyAsBool(
"WINDOWS_EXPORT_ALL_SYMBOLS")) {
@@ -2409,9 +2417,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
ItemVector libs = cli.GetItems();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
- std::string path = this->LocalGenerator->Convert(
- l->Value.c_str(), cmOutputConverter::START_OUTPUT,
- cmOutputConverter::UNCHANGED);
+ std::string path = this->LocalGenerator->ConvertToRelativePath(
+ l->Value.c_str(), cmOutputConverter::START_OUTPUT);
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||
@@ -2508,7 +2515,8 @@ void cmVisualStudio10TargetGenerator::WriteEvents(
std::string const& configName)
{
bool addedPrelink = false;
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
+ if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
+ this->GeneratorTarget->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (this->GeneratorTarget->GetPropertyAsBool(
"WINDOWS_EXPORT_ALL_SYMBOLS")) {
@@ -2649,6 +2657,20 @@ void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension(
void cmVisualStudio10TargetGenerator::WriteSDKReferences()
{
+ std::vector<std::string> sdkReferences;
+ bool hasWrittenItemGroup = false;
+ if (const char* vsSDKReferences =
+ this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) {
+ cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences);
+ this->WriteString("<ItemGroup>\n", 1);
+ hasWrittenItemGroup = true;
+ for (std::vector<std::string>::iterator ri = sdkReferences.begin();
+ ri != sdkReferences.end(); ++ri) {
+ this->WriteString("<SDKReference Include=\"", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\"/>\n";
+ }
+ }
+
// This only applies to Windows 10 apps
if (this->GlobalGenerator->TargetsWindowsStore() &&
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) {
@@ -2661,7 +2683,10 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
if (desktopExtensionsVersion || mobileExtensionsVersion ||
iotExtensionsVersion) {
- this->WriteString("<ItemGroup>\n", 1);
+ if (!hasWrittenItemGroup) {
+ this->WriteString("<ItemGroup>\n", 1);
+ hasWrittenItemGroup = true;
+ }
if (desktopExtensionsVersion) {
this->WriteSingleSDKReference("WindowsDesktop",
desktopExtensionsVersion);
@@ -2673,6 +2698,9 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
if (iotExtensionsVersion) {
this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion);
}
+ }
+
+ if (hasWrittenItemGroup) {
this->WriteString("</ItemGroup>\n", 1);
}
}
@@ -2713,9 +2741,9 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
this->WriteString("<AppxPackageArtifactsDir>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(artifactDir)
<< "\\</AppxPackageArtifactsDir>\n";
- this->WriteString("<ProjectPriFullPath>"
- "$(TargetDir)resources.pri</ProjectPriFullPath>\n",
- 2);
+ this->WriteString("<ProjectPriFullPath>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(artifactDir)
+ << "\\resources.pri</ProjectPriFullPath>\n";
// If we are missing files and we don't have a certificate and
// aren't targeting WP8.0, add a default certificate
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index bec2861..93a6271 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -37,8 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endwhile for this while loop then execute
if (!this->Depth) {
// Remove the function blocker for this scope or bail.
- cmsys::auto_ptr<cmFunctionBlocker> fb(
- mf.RemoveFunctionBlocker(this, lff));
+ CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 0f35be8..bd354c7 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -21,10 +21,10 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker
{
public:
cmWhileFunctionBlocker(cmMakefile* mf);
- ~cmWhileFunctionBlocker();
- virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
- cmExecutionStatus&);
- virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf);
+ ~cmWhileFunctionBlocker() CM_OVERRIDE;
+ bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
+ cmExecutionStatus&) CM_OVERRIDE;
+ bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE;
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
@@ -41,20 +41,21 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmWhileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmWhileCommand; }
/**
* This overrides the default InvokeInitialPass implementation.
* It records the arguments before expansion.
*/
- virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&);
+ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const&, cmExecutionStatus&)
+ bool InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
@@ -62,12 +63,12 @@ public:
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "while"; }
+ std::string GetName() const CM_OVERRIDE { return "while"; }
cmTypeMacro(cmWhileCommand, cmCommand);
};
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index b0eef9c..db24b0e 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -24,24 +24,24 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() { return new cmWriteFileCommand; }
+ cmCommand* Clone() CM_OVERRIDE { return new cmWriteFileCommand; }
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.
*/
- virtual bool IsScriptable() const { return true; }
+ bool IsScriptable() const CM_OVERRIDE { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual std::string GetName() const { return "write_file"; }
+ std::string GetName() const CM_OVERRIDE { return "write_file"; }
cmTypeMacro(cmWriteFileCommand, cmCommand);
};
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 3d31343..fabf097 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -83,6 +83,22 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
}
}
+bool cmXCodeObject::IsEmpty() const
+{
+ switch (this->TypeValue) {
+ case OBJECT_LIST:
+ return this->List.empty();
+ case STRING:
+ return this->String.empty();
+ case ATTRIBUTE_GROUP:
+ return this->ObjectAttributes.empty();
+ case OBJECT_REF:
+ case OBJECT:
+ return this->Object == 0;
+ }
+ return true; // unreachable, but quiets warnings
+}
+
void cmXCodeObject::Indent(int level, std::ostream& out)
{
while (level) {
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index d2f7cb7..ed917af 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -59,21 +59,30 @@ public:
static const char* PBXTypeNames[];
virtual ~cmXCodeObject();
cmXCodeObject(PBXType ptype, Type type);
- Type GetType() { return this->TypeValue; }
- PBXType GetIsA() { return this->IsA; }
+ Type GetType() const { return this->TypeValue; }
+ PBXType GetIsA() const { return this->IsA; }
+
+ bool IsEmpty() const;
void SetString(const std::string& s);
- const std::string& GetString() { return this->String; }
+ const std::string& GetString() const { return this->String; }
void AddAttribute(const std::string& name, cmXCodeObject* value)
{
this->ObjectAttributes[name] = value;
}
+ void AddAttributeIfNotEmpty(const std::string& name, cmXCodeObject* value)
+ {
+ if (value && !value->IsEmpty()) {
+ AddAttribute(name, value);
+ }
+ }
+
void SetObject(cmXCodeObject* value) { this->Object = value; }
cmXCodeObject* GetObject() { return this->Object; }
void AddObject(cmXCodeObject* value) { this->List.push_back(value); }
- bool HasObject(cmXCodeObject* o)
+ bool HasObject(cmXCodeObject* o) const
{
return !(std::find(this->List.begin(), this->List.end(), o) ==
this->List.end());
@@ -94,23 +103,25 @@ public:
virtual void PrintComment(std::ostream&) {}
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out);
- const std::string& GetId() { return this->Id; }
+ const std::string& GetId() const { return this->Id; }
void SetId(const std::string& id) { this->Id = id; }
- cmGeneratorTarget* GetTarget() { return this->Target; }
+ cmGeneratorTarget* GetTarget() const { return this->Target; }
void SetTarget(cmGeneratorTarget* t) { this->Target = t; }
- const std::string& GetComment() { return this->Comment; }
- bool HasComment() { return (!this->Comment.empty()); }
- cmXCodeObject* GetObject(const char* name)
+ const std::string& GetComment() const { return this->Comment; }
+ bool HasComment() const { return (!this->Comment.empty()); }
+ cmXCodeObject* GetObject(const char* name) const
{
- if (this->ObjectAttributes.count(name)) {
- return this->ObjectAttributes[name];
+ std::map<std::string, cmXCodeObject*>::const_iterator i =
+ this->ObjectAttributes.find(name);
+ if (i != this->ObjectAttributes.end()) {
+ return i->second;
}
return 0;
}
// search the attribute list for an object of the specified type
- cmXCodeObject* GetObject(cmXCodeObject::PBXType t)
+ cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const
{
- for (std::vector<cmXCodeObject*>::iterator i = this->List.begin();
+ for (std::vector<cmXCodeObject*>::const_iterator i = this->List.begin();
i != this->List.end(); ++i) {
cmXCodeObject* o = *i;
if (o->IsA == t) {
@@ -126,7 +137,7 @@ public:
{
this->DependLibraries[configName].push_back(l);
}
- std::map<std::string, StringVec> const& GetDependLibraries()
+ std::map<std::string, StringVec> const& GetDependLibraries() const
{
return this->DependLibraries;
}
@@ -134,11 +145,14 @@ public:
{
this->DependTargets[configName].push_back(tName);
}
- std::map<std::string, StringVec> const& GetDependTargets()
+ std::map<std::string, StringVec> const& GetDependTargets() const
{
return this->DependTargets;
}
- std::vector<cmXCodeObject*> const& GetObjectList() { return this->List; }
+ std::vector<cmXCodeObject*> const& GetObjectList() const
+ {
+ return this->List;
+ }
void SetComment(const std::string& c) { this->Comment = c; }
static void PrintString(std::ostream& os, std::string String);
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 5e06d36..7c53a3d 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -11,10 +11,12 @@
============================================================================*/
#include "cmXMLParser.h"
-#include <cmsys/FStream.hxx>
-
#include <cm_expat.h>
+#include <cmsys/FStream.hxx>
#include <ctype.h>
+#include <iostream>
+#include <sstream>
+#include <string.h>
cmXMLParser::cmXMLParser()
{
@@ -198,7 +200,7 @@ void cmXMLParser::ReportXmlParseError()
XML_ErrorString(XML_GetErrorCode(parser)));
}
-void cmXMLParser::ReportError(int line, int, const char* msg)
+void cmXMLParser::ReportError(int line, int /*unused*/, const char* msg)
{
if (this->ReportCallback) {
this->ReportCallback(line, msg, this->ReportCallbackData);
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index 6aae81d..319b295 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -12,7 +12,9 @@
#ifndef cmXMLParser_h
#define cmXMLParser_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
extern "C" {
void cmXMLParserStartElement(void*, const char*, const char**);
diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx
index f899f57..8575181 100644
--- a/Source/cmXMLSafe.cxx
+++ b/Source/cmXMLSafe.cxx
@@ -13,9 +13,7 @@
#include "cm_utf8.h"
-#include <iostream>
#include <sstream>
-
#include <stdio.h>
#include <string.h>
diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h
index 11ced13..a187437 100644
--- a/Source/cmXMLSafe.h
+++ b/Source/cmXMLSafe.h
@@ -12,7 +12,7 @@
#ifndef cmXMLSafe_h
#define cmXMLSafe_h
-#include <cmsys/Configure.hxx>
+#include <cmConfigure.h> // IWYU pragma: keep
#include <iosfwd>
#include <string>
diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx
index 98c2680..eda5bef 100644
--- a/Source/cmXMLWriter.cxx
+++ b/Source/cmXMLWriter.cxx
@@ -11,10 +11,8 @@
============================================================================*/
#include "cmXMLWriter.h"
-#include "cmXMLSafe.h"
-
#include <cassert>
-#include <fstream>
+#include <cmsys/FStream.hxx>
cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level)
: Output(output)
@@ -107,7 +105,7 @@ void cmXMLWriter::ProcessingInstruction(const char* target, const char* data)
void cmXMLWriter::FragmentFile(const char* fname)
{
this->CloseStartElement();
- std::ifstream fin(fname, std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname, std::ios::in | std::ios::binary);
this->Output << fin.rdbuf();
}
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 8a88dd4..c303963 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -12,7 +12,7 @@
#ifndef cmXMLWiter_h
#define cmXMLWiter_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include "cmXMLSafe.h"
diff --git a/Source/kwsys/auto_ptr.hxx.in b/Source/cm_auto_ptr.hxx
index ad9654c..2cd35c3 100644
--- a/Source/kwsys/auto_ptr.hxx.in
+++ b/Source/cm_auto_ptr.hxx
@@ -1,6 +1,6 @@
/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2016 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -9,26 +9,29 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_auto_ptr_hxx
-#define @KWSYS_NAMESPACE@_auto_ptr_hxx
+#ifndef CM_AUTO_PTR_HXX
+#define CM_AUTO_PTR_HXX
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
+#include <cmsys/Configure.hxx>
-// The HP compiler and VS6 cannot handle the conversions necessary to use
+// FIXME: Use std::auto_ptr on compilers that do not warn about it.
+#define CM_AUTO_PTR cm::auto_ptr
+
+// The HP compiler cannot handle the conversions necessary to use
// auto_ptr_ref to pass an auto_ptr returned from one function
// directly to another function as in use_auto_ptr(get_auto_ptr()).
// We instead use const_cast to achieve the syntax on those platforms.
// We do not use const_cast on other platforms to maintain the C++
// standard design and guarantee that if an auto_ptr is bound
// to a reference-to-const then ownership will be maintained.
-#if defined(__HP_aCC) || (defined(_MSC_VER) && _MSC_VER <= 1200)
-# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 0
-# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST const
-# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) cast(a)
+#if defined(__HP_aCC)
+#define cm_AUTO_PTR_REF 0
+#define cm_AUTO_PTR_CONST const
+#define cm_AUTO_PTR_CAST(a) cast(a)
#else
-# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 1
-# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST
-# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) a
+#define cm_AUTO_PTR_REF 1
+#define cm_AUTO_PTR_CONST
+#define cm_AUTO_PTR_CAST(a) a
#endif
// In C++11, clang will warn about using dynamic exception specifications
@@ -36,24 +39,24 @@
// mimic std::auto_ptr, we want to keep the 'throw()' decorations below.
// So we suppress the warning.
#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wdeprecated"
-# endif
+#if __has_warning("-Wdeprecated")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
#endif
-namespace @KWSYS_NAMESPACE@
-{
+namespace cm {
-template <class X> class auto_ptr;
+template <class X>
+class auto_ptr;
-#if @KWSYS_NAMESPACE@_AUTO_PTR_REF
-namespace detail
-{
+#if cm_AUTO_PTR_REF
+namespace detail {
// The auto_ptr_ref template is supposed to be a private member of
// auto_ptr but Borland 5.8 cannot handle it. Instead put it in
// a private namespace.
-template <class Y> struct auto_ptr_ref
+template <class Y>
+struct auto_ptr_ref
{
Y* p_;
@@ -62,7 +65,10 @@ template <class Y> struct auto_ptr_ref
// this should be done with the explicit keyword but Borland 5.x
// generates code in the conversion operator to call itself
// infinately.
- auto_ptr_ref(Y* p, int): p_(p) {}
+ auto_ptr_ref(Y* p, int)
+ : p_(p)
+ {
+ }
};
}
#endif
@@ -71,10 +77,12 @@ template <class Y> struct auto_ptr_ref
template <class X>
class auto_ptr
{
-#if !@KWSYS_NAMESPACE@_AUTO_PTR_REF
+#if !cm_AUTO_PTR_REF
template <typename Y>
static inline auto_ptr<Y>& cast(auto_ptr<Y> const& a)
- { return const_cast<auto_ptr<Y>&>(a); }
+ {
+ return const_cast<auto_ptr<Y>&>(a);
+ }
#endif
/** The pointer to the object held. */
@@ -87,19 +95,19 @@ public:
/** Construct from an auto_ptr holding a compatible object. This
transfers ownership to the newly constructed auto_ptr. */
template <class Y>
- auto_ptr(auto_ptr<Y> @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw():
- x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release())
- {
- }
+ auto_ptr(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
+ : x_(cm_AUTO_PTR_CAST(a).release())
+ {
+ }
/** Assign from an auto_ptr holding a compatible object. This
transfers ownership to the left-hand-side of the assignment. */
template <class Y>
- auto_ptr& operator=(auto_ptr<Y> @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw()
- {
- this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release());
+ auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
+ {
+ this->reset(cm_AUTO_PTR_CAST(a).release());
return *this;
- }
+ }
/**
* Explicitly construct from a raw pointer. This is typically
@@ -107,113 +115,107 @@ public:
*
* auto_ptr<X> ptr(new X());
*/
- explicit auto_ptr(X* p=0) throw(): x_(p)
- {
- }
+ explicit auto_ptr(X* p = 0) throw()
+ : x_(p)
+ {
+ }
/** Construct from another auto_ptr holding an object of the same
type. This transfers ownership to the newly constructed
auto_ptr. */
- auto_ptr(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw():
- x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release())
- {
- }
+ auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw()
+ : x_(cm_AUTO_PTR_CAST(a).release())
+ {
+ }
/** Assign from another auto_ptr holding an object of the same type.
This transfers ownership to the newly constructed auto_ptr. */
- auto_ptr& operator=(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw()
- {
- this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release());
+ auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw()
+ {
+ this->reset(cm_AUTO_PTR_CAST(a).release());
return *this;
- }
+ }
/** Destruct and delete the object held. */
~auto_ptr() throw()
- {
+ {
// Assume object destructor is nothrow.
delete this->x_;
- }
+ }
/** Dereference and return a reference to the object held. */
- X& operator*() const throw()
- {
- return *this->x_;
- }
+ X& operator*() const throw() { return *this->x_; }
/** Return a pointer to the object held. */
- X* operator->() const throw()
- {
- return this->x_;
- }
+ X* operator->() const throw() { return this->x_; }
/** Return a pointer to the object held. */
- X* get() const throw()
- {
- return this->x_;
- }
+ X* get() const throw() { return this->x_; }
/** Return a pointer to the object held and reset to hold no object.
This transfers ownership to the caller. */
X* release() throw()
- {
+ {
X* x = this->x_;
this->x_ = 0;
return x;
- }
+ }
/** Assume ownership of the given object. The object previously
held is deleted. */
- void reset(X* p=0) throw()
- {
- if(this->x_ != p)
- {
+ void reset(X* p = 0) throw()
+ {
+ if (this->x_ != p) {
// Assume object destructor is nothrow.
delete this->x_;
this->x_ = p;
- }
}
+ }
/** Convert to an auto_ptr holding an object of a compatible type.
This transfers ownership to the returned auto_ptr. */
- template <class Y> operator auto_ptr<Y>() throw()
- {
+ template <class Y>
+ operator auto_ptr<Y>() throw()
+ {
return auto_ptr<Y>(this->release());
- }
+ }
-#if @KWSYS_NAMESPACE@_AUTO_PTR_REF
+#if cm_AUTO_PTR_REF
/** Construct from an auto_ptr_ref. This is used when the
constructor argument is a call to a function returning an
auto_ptr. */
- auto_ptr(detail::auto_ptr_ref<X> r) throw(): x_(r.p_)
- {
- }
+ auto_ptr(detail::auto_ptr_ref<X> r) throw()
+ : x_(r.p_)
+ {
+ }
/** Assign from an auto_ptr_ref. This is used when a function
returning an auto_ptr is passed on the right-hand-side of an
assignment. */
auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
- {
+ {
this->reset(r.p_);
return *this;
- }
+ }
/** Convert to an auto_ptr_ref. This is used when a function
returning an auto_ptr is the argument to the constructor of
another auto_ptr. */
- template <class Y> operator detail::auto_ptr_ref<Y>() throw()
- {
+ template <class Y>
+ operator detail::auto_ptr_ref<Y>() throw()
+ {
return detail::auto_ptr_ref<Y>(this->release(), 1);
- }
+ }
#endif
};
-} // namespace @KWSYS_NAMESPACE@
+} // namespace cm
// Undo warning suppression.
#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-# pragma clang diagnostic pop
-# endif
+#if __has_warning("-Wdeprecated")
+#pragma clang diagnostic pop
+#endif
#endif
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 89ea955..701a5e5 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -19,14 +19,20 @@
#include "cmFileTimeComparison.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmMessenger.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmTest.h"
+#include "cmUtils.hxx"
+#include "cmVersionMacros.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmGraphVizWriter.h"
#include "cmVariableWatch.h"
#include <cmsys/SystemInformation.hxx>
+
+#include "cm_jsoncpp_value.h"
+#include "cm_jsoncpp_writer.h"
#endif
#include <cmsys/FStream.hxx>
@@ -109,11 +115,24 @@
#include <list>
+namespace {
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+#ifdef CMake_HAVE_CXX_UNORDERED_MAP
+typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
+#else
+typedef cmsys::hash_map<std::string, Json::Value> JsonValueMapType;
+#endif
+#endif
+
+} // namespace
+
static bool cmakeCheckStampFile(const char* stampName);
static bool cmakeCheckStampList(const char* stampName);
-void cmWarnUnusedCliWarning(const std::string& variable, int, void* ctx,
- const char*, const cmMakefile*)
+void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
+ void* ctx, const char* /*unused*/,
+ const cmMakefile* /*unused*/)
{
cmake* cm = reinterpret_cast<cmake*>(ctx);
cm->MarkCliAsUsed(variable);
@@ -134,6 +153,7 @@ cmake::cmake()
this->State = new cmState;
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
+ this->Messenger = new cmMessenger(this->State);
#ifdef __APPLE__
struct rlimit rlp;
@@ -145,10 +165,9 @@ cmake::cmake()
}
#endif
- this->Verbose = false;
- this->GlobalGenerator = 0;
- this->ProgressCallback = 0;
- this->ProgressCallbackClientData = 0;
+ this->GlobalGenerator = CM_NULLPTR;
+ this->ProgressCallback = CM_NULLPTR;
+ this->ProgressCallbackClientData = CM_NULLPTR;
this->CurrentWorkingMode = NORMAL_MODE;
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -190,9 +209,10 @@ cmake::cmake()
cmake::~cmake()
{
delete this->State;
+ delete this->Messenger;
if (this->GlobalGenerator) {
delete this->GlobalGenerator;
- this->GlobalGenerator = 0;
+ this->GlobalGenerator = CM_NULLPTR;
}
cmDeleteAll(this->Generators);
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -201,6 +221,68 @@ cmake::~cmake()
delete this->FileComparison;
}
+std::string cmake::ReportCapabilities() const
+{
+ std::string result;
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ Json::Value obj = Json::objectValue;
+ // Version information:
+ Json::Value version = Json::objectValue;
+ version["string"] = CMake_VERSION;
+ version["major"] = CMake_VERSION_MAJOR;
+ version["minor"] = CMake_VERSION_MINOR;
+ version["suffix"] = CMake_VERSION_SUFFIX;
+ version["isDirty"] = (CMake_VERSION_IS_DIRTY == 1);
+ version["patch"] = CMake_VERSION_PATCH;
+
+ obj["version"] = version;
+
+ // Generators:
+ std::vector<cmake::GeneratorInfo> generatorInfoList;
+ this->GetRegisteredGenerators(generatorInfoList);
+
+ JsonValueMapType generatorMap;
+ for (std::vector<cmake::GeneratorInfo>::const_iterator i =
+ generatorInfoList.begin();
+ i != generatorInfoList.end(); ++i) {
+ if (i->isAlias) { // skip aliases, they are there for compatibility reasons
+ // only
+ continue;
+ }
+
+ if (i->extraName.empty()) {
+ Json::Value gen = Json::objectValue;
+ gen["name"] = i->name;
+ gen["toolsetSupport"] = i->supportsToolset;
+ gen["platformSupport"] = i->supportsPlatform;
+ gen["extraGenerators"] = Json::arrayValue;
+ generatorMap[i->name] = gen;
+ } else {
+ Json::Value& gen = generatorMap[i->baseName];
+ gen["extraGenerators"].append(i->extraName);
+ }
+ }
+
+ Json::Value generators = Json::arrayValue;
+ for (JsonValueMapType::const_iterator i = generatorMap.begin();
+ i != generatorMap.end(); ++i) {
+ generators.append(i->second);
+ }
+ obj["generators"] = generators;
+
+#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE
+ obj["serverMode"] = true;
+#else
+ obj["serverMode"] = false;
+#endif
+ Json::FastWriter writer;
+ result = writer.write(obj);
+#else
+ result = "Not supported";
+#endif
+ return result;
+}
+
void cmake::CleanupCommandsAndMacros()
{
this->CurrentSnapshot = this->State->Reset();
@@ -398,7 +480,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
snapshot.GetDirectory().SetCurrentSource(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.SetDefaultDefinitions();
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(gg, snapshot));
if (this->GetWorkingMode() != NORMAL_MODE) {
std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file);
@@ -464,7 +546,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
gg->CreateGenerationObjects();
cmLocalGenerator* lg = gg->LocalGenerators[0];
- std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language);
+ std::string includeFlags =
+ lg->GetIncludeFlags(includeDirs, CM_NULLPTR, language);
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
@@ -482,6 +565,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType);
}
+ std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
+
std::string linkLibs;
std::string frameworkPath;
std::string linkPath;
@@ -490,8 +576,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
gg->CreateGenerationObjects();
cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
- lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
- gtgt, false);
+ lg->GetTargetFlags(buildType, linkLibs, frameworkPath, linkPath, flags,
+ linkFlags, gtgt, false);
linkLibs = frameworkPath + linkPath + linkLibs;
printf("%s\n", linkLibs.c_str());
@@ -555,9 +641,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
this->VSSolutionFile = args[++i];
}
#endif
- else if (arg.find("-V", 0) == 0) {
- this->Verbose = true;
- } else if (arg.find("-D", 0) == 0) {
+ else if (arg.find("-D", 0) == 0) {
// skip for now
} else if (arg.find("-U", 0) == 0) {
// skip for now
@@ -589,6 +673,11 @@ void cmake::SetArgs(const std::vector<std::string>& args,
std::cout << "Running with expanded trace output on.\n";
this->SetTrace(true);
this->SetTraceExpand(true);
+ } else if (arg.find("--trace-source=", 0) == 0) {
+ std::string file = arg.substr(strlen("--trace-source="));
+ cmSystemTools::ConvertToUnixSlashes(file);
+ this->AddTraceSource(file);
+ this->SetTrace(true);
} else if (arg.find("--trace", 0) == 0) {
std::cout << "Running with trace output on.\n";
this->SetTrace(true);
@@ -786,57 +875,26 @@ int cmake::AddCMakePaths()
return 1;
}
-void cmake::AddExtraGenerator(const std::string& name,
- CreateExtraGeneratorFunctionType newFunction)
-{
- cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
- const std::vector<std::string>& supportedGlobalGenerators =
- extraGenerator->GetSupportedGlobalGenerators();
-
- for (std::vector<std::string>::const_iterator it =
- supportedGlobalGenerators.begin();
- it != supportedGlobalGenerators.end(); ++it) {
- std::string fullName =
- cmExternalMakefileProjectGenerator::CreateFullGeneratorName(*it, name);
- this->ExtraGenerators[fullName] = newFunction;
- }
- delete extraGenerator;
-}
-
void cmake::AddDefaultExtraGenerators()
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#if defined(_WIN32) && !defined(__CYGWIN__)
-// e.g. kdevelop4 ?
-#endif
-
- this->AddExtraGenerator(cmExtraCodeBlocksGenerator::GetActualName(),
- &cmExtraCodeBlocksGenerator::New);
- this->AddExtraGenerator(cmExtraCodeLiteGenerator::GetActualName(),
- &cmExtraCodeLiteGenerator::New);
- this->AddExtraGenerator(cmExtraSublimeTextGenerator::GetActualName(),
- &cmExtraSublimeTextGenerator::New);
- this->AddExtraGenerator(cmExtraKateGenerator::GetActualName(),
- &cmExtraKateGenerator::New);
+ this->ExtraGenerators.push_back(cmExtraCodeBlocksGenerator::GetFactory());
+ this->ExtraGenerators.push_back(cmExtraCodeLiteGenerator::GetFactory());
+ this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory());
+ this->ExtraGenerators.push_back(cmExtraKateGenerator::GetFactory());
#ifdef CMAKE_USE_ECLIPSE
- this->AddExtraGenerator(cmExtraEclipseCDT4Generator::GetActualName(),
- &cmExtraEclipseCDT4Generator::New);
+ this->ExtraGenerators.push_back(cmExtraEclipseCDT4Generator::GetFactory());
#endif
#ifdef CMAKE_USE_KDEVELOP
- this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
- &cmGlobalKdevelopGenerator::New);
- // for kdevelop also add the generator with just the name of the
- // extra generator, since it was this way since cmake 2.2
- this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()] =
- &cmGlobalKdevelopGenerator::New;
+ this->ExtraGenerators.push_back(cmGlobalKdevelopGenerator::GetFactory());
#endif
-
#endif
}
-void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators)
+void cmake::GetRegisteredGenerators(
+ std::vector<GeneratorInfo>& generators) const
{
for (RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(),
e = this->Generators.end();
@@ -847,34 +905,85 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators)
for (size_t j = 0; j < names.size(); ++j) {
GeneratorInfo info;
info.supportsToolset = (*i)->SupportsToolset();
+ info.supportsPlatform = (*i)->SupportsPlatform();
info.name = names[j];
+ info.baseName = names[j];
+ info.isAlias = false;
generators.push_back(info);
}
}
- for (RegisteredExtraGeneratorsMap::const_iterator
+ for (RegisteredExtraGeneratorsVector::const_iterator
i = this->ExtraGenerators.begin(),
e = this->ExtraGenerators.end();
i != e; ++i) {
- GeneratorInfo info;
- info.name = i->first;
- info.supportsToolset = false;
- generators.push_back(info);
+ const std::vector<std::string> genList =
+ (*i)->GetSupportedGlobalGenerators();
+ for (std::vector<std::string>::const_iterator gen = genList.begin();
+ gen != genList.end(); ++gen) {
+ GeneratorInfo info;
+ info.name = cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
+ (*i)->GetName(), *gen);
+ info.baseName = *gen;
+ info.extraName = (*i)->GetName();
+ info.supportsPlatform = false;
+ info.supportsToolset = false;
+ info.isAlias = false;
+ generators.push_back(info);
+ }
+ for (std::vector<std::string>::const_iterator a = (*i)->Aliases.begin();
+ a != (*i)->Aliases.end(); ++a) {
+ GeneratorInfo info;
+ info.name = *a;
+ if (!genList.empty()) {
+ info.baseName = genList.at(0);
+ }
+ info.extraName = (*i)->GetName();
+ info.supportsPlatform = false;
+ info.supportsToolset = false;
+ info.isAlias = true;
+ generators.push_back(info);
+ }
}
}
-cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
+static std::pair<cmExternalMakefileProjectGenerator*, std::string>
+createExtraGenerator(
+ const std::vector<cmExternalMakefileProjectGeneratorFactory*>& in,
+ const std::string& name)
{
- cmExternalMakefileProjectGenerator* extraGenerator = 0;
- std::string name = gname;
- RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
- this->ExtraGenerators.find(name);
- if (extraGenIt != this->ExtraGenerators.end()) {
- extraGenerator = (extraGenIt->second)();
- name = extraGenerator->GetGlobalGeneratorName(name);
+ for (std::vector<cmExternalMakefileProjectGeneratorFactory*>::const_iterator
+ i = in.begin();
+ i != in.end(); ++i) {
+ const std::vector<std::string> generators =
+ (*i)->GetSupportedGlobalGenerators();
+ if ((*i)->GetName() == name) { // Match aliases
+ return std::make_pair((*i)->CreateExternalMakefileProjectGenerator(),
+ generators.at(0));
+ }
+ for (std::vector<std::string>::const_iterator g = generators.begin();
+ g != generators.end(); ++g) {
+ const std::string fullName =
+ cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
+ *g, (*i)->GetName());
+ if (fullName == name) {
+ return std::make_pair((*i)->CreateExternalMakefileProjectGenerator(),
+ *g);
+ }
+ }
}
+ return std::make_pair(
+ static_cast<cmExternalMakefileProjectGenerator*>(CM_NULLPTR), name);
+}
+
+cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
+{
+ std::pair<cmExternalMakefileProjectGenerator*, std::string> extra =
+ createExtraGenerator(this->ExtraGenerators, gname);
+ cmExternalMakefileProjectGenerator* extraGenerator = extra.first;
+ const std::string name = extra.second;
- cmGlobalGenerator* generator = 0;
+ cmGlobalGenerator* generator = CM_NULLPTR;
for (RegisteredGeneratorsVector::const_iterator i = this->Generators.begin();
i != this->Generators.end(); ++i) {
generator = (*i)->CreateGlobalGenerator(name, this);
@@ -949,16 +1058,10 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator* gg)
cmSystemTools::SetForceUnixPaths(this->GlobalGenerator->GetForceUnixPaths());
// Save the environment variables CXX and CC
- const char* cxx = getenv("CXX");
- const char* cc = getenv("CC");
- if (cxx) {
- this->CXXEnvironment = cxx;
- } else {
+ if (!cmSystemTools::GetEnv("CXX", this->CXXEnvironment)) {
this->CXXEnvironment = "";
}
- if (cc) {
- this->CCEnvironment = cc;
- } else {
+ if (!cmSystemTools::GetEnv("CC", this->CCEnvironment)) {
this->CCEnvironment = "";
}
}
@@ -1413,9 +1516,8 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
if (this->GetWorkingMode() != NORMAL_MODE) {
if (cmSystemTools::GetErrorOccuredFlag()) {
return -1;
- } else {
- return 0;
}
+ return 0;
}
// If MAKEFLAGS are given in the environment, remove the environment
@@ -1423,7 +1525,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// should fail (if "-i" is an option). We cannot simply test
// whether "-i" is given and remove it because some make programs
// encode the MAKEFLAGS variable in a strange way.
- if (getenv("MAKEFLAGS")) {
+ if (cmSystemTools::HasEnv("MAKEFLAGS")) {
cmSystemTools::PutEnv("MAKEFLAGS=");
}
@@ -1648,15 +1750,32 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
(*i)->GetDocumentation(e);
v.push_back(e);
}
- for (RegisteredExtraGeneratorsMap::const_iterator i =
+ for (RegisteredExtraGeneratorsVector::const_iterator i =
this->ExtraGenerators.begin();
i != this->ExtraGenerators.end(); ++i) {
- cmDocumentationEntry e;
- cmExternalMakefileProjectGenerator* generator = (i->second)();
- generator->GetDocumentation(e, i->first);
- e.Name = i->first;
- delete generator;
- v.push_back(e);
+ const std::string doc = (*i)->GetDocumentation();
+ const std::string name = (*i)->GetName();
+
+ // Aliases:
+ for (std::vector<std::string>::const_iterator a = (*i)->Aliases.begin();
+ a != (*i)->Aliases.end(); ++a) {
+ cmDocumentationEntry e;
+ e.Name = *a;
+ e.Brief = doc;
+ v.push_back(e);
+ }
+
+ // Full names:
+ const std::vector<std::string> generators =
+ (*i)->GetSupportedGlobalGenerators();
+ for (std::vector<std::string>::const_iterator g = generators.begin();
+ g != generators.end(); ++g) {
+ cmDocumentationEntry e;
+ e.Name =
+ cmExternalMakefileProjectGenerator::CreateFullGeneratorName(*g, name);
+ e.Brief = doc;
+ v.push_back(e);
+ }
}
}
@@ -1698,12 +1817,8 @@ void cmake::UpdateConversionPathTable()
int cmake::CheckBuildSystem()
{
- // We do not need to rerun CMake. Check dependency integrity. Use
- // the make system's VERBOSE environment variable to enable verbose
- // output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set
- // by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) &&
- (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+ // We do not need to rerun CMake. Check dependency integrity.
+ const bool verbose = isCMakeVerbose();
// This method will check the integrity of the build system if the
// option was given on the command line. It reads the given file to
@@ -1737,7 +1852,7 @@ int cmake::CheckBuildSystem()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag()) {
if (verbose) {
@@ -1758,14 +1873,12 @@ int cmake::CheckBuildSystem()
}
// Create the generator and use it to clear the dependencies.
- cmsys::auto_ptr<cmGlobalGenerator> ggd(
- this->CreateGlobalGenerator(genName));
+ CM_AUTO_PTR<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName));
if (ggd.get()) {
cm.GetCurrentSnapshot().SetDefaultDefinitions();
- cmsys::auto_ptr<cmMakefile> mfd(
+ CM_AUTO_PTR<cmMakefile> mfd(
new cmMakefile(ggd.get(), cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lgd(
- ggd->CreateLocalGenerator(mfd.get()));
+ CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mfd.get()));
lgd->ClearDependencies(mfd.get(), verbose);
}
}
@@ -1905,7 +2018,7 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const char* fileName) const
{
#ifdef CMAKE_BUILD_WITH_CMAKE
- cmsys::auto_ptr<cmGraphVizWriter> gvWriter(
+ CM_AUTO_PTR<cmGraphVizWriter> gvWriter(
new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
std::string settingsFile = this->GetHomeOutputDirectory();
@@ -1952,11 +2065,10 @@ cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
if (i != this->InstalledFiles.end()) {
cmInstalledFile& file = i->second;
return &file;
- } else {
- cmInstalledFile& file = this->InstalledFiles[name];
- file.SetName(mf, name);
- return &file;
}
+ cmInstalledFile& file = this->InstalledFiles[name];
+ file.SetName(mf, name);
+ return &file;
}
cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
@@ -1967,9 +2079,8 @@ cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
if (i != this->InstalledFiles.end()) {
cmInstalledFile const& file = i->second;
return &file;
- } else {
- return 0;
}
+ return CM_NULLPTR;
}
int cmake::GetSystemInformation(std::vector<std::string>& args)
@@ -1989,9 +2100,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
bool writeToStdout = true;
for (unsigned int i = 1; i < args.size(); ++i) {
std::string arg = args[i];
- if (arg.find("-V", 0) == 0) {
- this->Verbose = true;
- } else if (arg.find("-G", 0) == 0) {
+ if (arg.find("-G", 0) == 0) {
std::string value = arg.substr(2);
if (value.empty()) {
++i;
@@ -2096,7 +2205,7 @@ static bool cmakeCheckStampFile(const char* stampName)
#if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
#else
- cmsys::ifstream fin(stampDepends.c_str(), std::ios::in);
+ cmsys::ifstream fin(stampDepends.c_str());
#endif
if (!fin) {
// The stamp dependencies file cannot be read. Just assume the
@@ -2144,11 +2253,10 @@ static bool cmakeCheckStampFile(const char* stampName)
std::cout << "CMake does not need to re-run because " << stampName
<< " is up-to-date.\n";
return true;
- } else {
- cmSystemTools::RemoveFile(stampTemp);
- cmSystemTools::Error("Cannot restore timestamp ", stampName);
- return false;
}
+ cmSystemTools::RemoveFile(stampTemp);
+ cmSystemTools::Error("Cannot restore timestamp ", stampName);
+ return false;
}
static bool cmakeCheckStampList(const char* stampList)
@@ -2176,155 +2284,10 @@ static bool cmakeCheckStampList(const char* stampList)
return true;
}
-cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t)
-{
- bool warningsAsErrors;
-
- if (t == cmake::AUTHOR_WARNING || t == cmake::AUTHOR_ERROR) {
- warningsAsErrors = this->GetDevWarningsAsErrors();
- if (warningsAsErrors && t == cmake::AUTHOR_WARNING) {
- t = cmake::AUTHOR_ERROR;
- } else if (!warningsAsErrors && t == cmake::AUTHOR_ERROR) {
- t = cmake::AUTHOR_WARNING;
- }
- } else if (t == cmake::DEPRECATION_WARNING ||
- t == cmake::DEPRECATION_ERROR) {
- warningsAsErrors = this->GetDeprecatedWarningsAsErrors();
- if (warningsAsErrors && t == cmake::DEPRECATION_WARNING) {
- t = cmake::DEPRECATION_ERROR;
- } else if (!warningsAsErrors && t == cmake::DEPRECATION_ERROR) {
- t = cmake::DEPRECATION_WARNING;
- }
- }
-
- return t;
-}
-
-bool cmake::IsMessageTypeVisible(cmake::MessageType t)
-{
- bool isVisible = true;
-
- if (t == cmake::DEPRECATION_ERROR) {
- if (!this->GetDeprecatedWarningsAsErrors()) {
- isVisible = false;
- }
- } else if (t == cmake::DEPRECATION_WARNING) {
- if (this->GetSuppressDeprecatedWarnings()) {
- isVisible = false;
- }
- } else if (t == cmake::AUTHOR_ERROR) {
- if (!this->GetDevWarningsAsErrors()) {
- isVisible = false;
- }
- } else if (t == cmake::AUTHOR_WARNING) {
- if (this->GetSuppressDevWarnings()) {
- isVisible = false;
- }
- }
-
- return isVisible;
-}
-
-bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg)
-{
- // Construct the message header.
- if (t == cmake::FATAL_ERROR) {
- msg << "CMake Error";
- } else if (t == cmake::INTERNAL_ERROR) {
- msg << "CMake Internal Error (please report a bug)";
- } else if (t == cmake::LOG) {
- msg << "CMake Debug Log";
- } else if (t == cmake::DEPRECATION_ERROR) {
- msg << "CMake Deprecation Error";
- } else if (t == cmake::DEPRECATION_WARNING) {
- msg << "CMake Deprecation Warning";
- } else if (t == cmake::AUTHOR_WARNING) {
- msg << "CMake Warning (dev)";
- } else if (t == cmake::AUTHOR_ERROR) {
- msg << "CMake Error (dev)";
- } else {
- msg << "CMake Warning";
- }
- return true;
-}
-
-void printMessageText(std::ostream& msg, std::string const& text)
-{
- msg << ":\n";
- cmDocumentationFormatter formatter;
- formatter.SetIndent(" ");
- formatter.PrintFormatted(msg, text.c_str());
-}
-
-void displayMessage(cmake::MessageType t, std::ostringstream& msg)
-{
-
- // Add a note about warning suppression.
- if (t == cmake::AUTHOR_WARNING) {
- msg << "This warning is for project developers. Use -Wno-dev to suppress "
- "it.";
- } else if (t == cmake::AUTHOR_ERROR) {
- msg << "This error is for project developers. Use -Wno-error=dev to "
- "suppress "
- "it.";
- }
-
- // Add a terminating blank line.
- msg << "\n";
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Add a C++ stack trace to internal errors.
- if (t == cmake::INTERNAL_ERROR) {
- std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0);
- if (!stack.empty()) {
- if (cmHasLiteralPrefix(stack, "WARNING:")) {
- stack = "Note:" + stack.substr(8);
- }
- msg << stack << "\n";
- }
- }
-#endif
-
- // Output the message.
- if (t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR ||
- t == cmake::DEPRECATION_ERROR || t == cmake::AUTHOR_ERROR) {
- cmSystemTools::SetErrorOccured();
- cmSystemTools::Message(msg.str().c_str(), "Error");
- } else {
- cmSystemTools::Message(msg.str().c_str(), "Warning");
- }
-}
-
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& backtrace, bool force)
+ cmListFileBacktrace const& backtrace) const
{
- if (!force) {
- // override the message type, if needed, for warnings and errors
- cmake::MessageType override = this->ConvertMessageType(t);
- if (override != t) {
- t = override;
- force = true;
- }
- }
-
- if (!force && !this->IsMessageTypeVisible(t)) {
- return;
- }
-
- std::ostringstream msg;
- if (!this->PrintMessagePreamble(t, msg)) {
- return;
- }
-
- // Add the immediate context.
- backtrace.PrintTitle(msg);
-
- printMessageText(msg, text);
-
- // Add the rest of the context.
- backtrace.PrintCallStack(msg);
-
- displayMessage(t, msg);
+ this->Messenger->IssueMessage(t, text, backtrace);
}
std::vector<std::string> cmake::GetDebugConfigs()
@@ -2344,6 +2307,11 @@ std::vector<std::string> cmake::GetDebugConfigs()
return configs;
}
+cmMessenger* cmake::GetMessenger() const
+{
+ return this->Messenger;
+}
+
int cmake::Build(const std::string& dir, const std::string& target,
const std::string& config,
const std::vector<std::string>& nativeOptions, bool clean)
@@ -2383,7 +2351,7 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
- cmsys::auto_ptr<cmGlobalGenerator> gen(
+ CM_AUTO_PTR<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(cachedGenerator));
if (!gen.get()) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator
@@ -2448,19 +2416,9 @@ void cmake::RunCheckForUnusedVariables()
#endif
}
-bool cmake::GetSuppressDevWarnings(cmMakefile const* mf)
+bool cmake::GetSuppressDevWarnings() const
{
- /*
- * The suppression CMake variable may be set in the CMake configuration file
- * itself, so we have to check what its set to in the makefile if we can.
- */
- if (mf) {
- return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- } else {
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- return cmSystemTools::IsOn(cacheEntryValue);
- }
+ return this->Messenger->GetSuppressDevWarnings();
}
void cmake::SetSuppressDevWarnings(bool b)
@@ -2482,20 +2440,9 @@ void cmake::SetSuppressDevWarnings(bool b)
cmState::INTERNAL);
}
-bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf)
+bool cmake::GetSuppressDeprecatedWarnings() const
{
- /*
- * The suppression CMake variable may be set in the CMake configuration file
- * itself, so we have to check what its set to in the makefile if we can.
- */
- if (mf) {
- return (mf->IsSet("CMAKE_WARN_DEPRECATED") &&
- !mf->IsOn("CMAKE_WARN_DEPRECATED"));
- } else {
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
- return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
- }
+ return this->Messenger->GetSuppressDeprecatedWarnings();
}
void cmake::SetSuppressDeprecatedWarnings(bool b)
@@ -2517,16 +2464,9 @@ void cmake::SetSuppressDeprecatedWarnings(bool b)
cmState::INTERNAL);
}
-bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf)
+bool cmake::GetDevWarningsAsErrors() const
{
- if (mf) {
- return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
- !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS"));
- } else {
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
- return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue);
- }
+ return this->Messenger->GetDevWarningsAsErrors();
}
void cmake::SetDevWarningsAsErrors(bool b)
@@ -2548,15 +2488,9 @@ void cmake::SetDevWarningsAsErrors(bool b)
cmState::INTERNAL);
}
-bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf)
+bool cmake::GetDeprecatedWarningsAsErrors() const
{
- if (mf) {
- return mf->IsOn("CMAKE_ERROR_DEPRECATED");
- } else {
- const char* cacheEntryValue =
- this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
- return cmSystemTools::IsOn(cacheEntryValue);
- }
+ return this->Messenger->GetDeprecatedWarningsAsErrors();
}
void cmake::SetDeprecatedWarningsAsErrors(bool b)
diff --git a/Source/cmake.h b/Source/cmake.h
index 266c33d..dbe936b 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -25,9 +25,10 @@ class cmGlobalGeneratorFactory;
class cmGlobalGenerator;
class cmLocalGenerator;
class cmMakefile;
+class cmMessenger;
class cmVariableWatch;
class cmFileTimeComparison;
-class cmExternalMakefileProjectGenerator;
+class cmExternalMakefileProjectGeneratorFactory;
class cmDocumentationSection;
class cmTarget;
class cmGeneratedFileStream;
@@ -103,7 +104,11 @@ public:
struct GeneratorInfo
{
std::string name;
+ std::string baseName;
+ std::string extraName;
bool supportsToolset;
+ bool supportsPlatform;
+ bool isAlias;
};
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
@@ -113,6 +118,8 @@ public:
/// Destructor
~cmake();
+ std::string ReportCapabilities() const;
+
static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; }
static const char* GetCMakeFilesDirectoryPostSlash()
{
@@ -183,7 +190,7 @@ public:
void SetGlobalGenerator(cmGlobalGenerator*);
///! Get the names of the current registered generators
- void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators);
+ void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) const;
///! Set the name of the selected generator-specific platform.
void SetGeneratorPlatform(std::string const& ts)
@@ -209,9 +216,6 @@ public:
return this->GeneratorToolset;
}
- ///! get the cmCachemManager used by this invocation of cmake
- cmCacheManager* GetCacheManager() { return this->CacheManager; }
-
const std::vector<std::string>& GetSourceExtensions() const
{
return this->SourceFileExtensions;
@@ -253,7 +257,8 @@ public:
* number provided may be negative in cases where a message is
* to be displayed without any progress percentage.
*/
- void SetProgressCallback(ProgressCallbackType f, void* clientData = 0);
+ void SetProgressCallback(ProgressCallbackType f,
+ void* clientData = CM_NULLPTR);
///! this is called by generators to update the progress
void UpdateProgress(const char* msg, float prog);
@@ -310,6 +315,14 @@ public:
void SetTrace(bool b) { this->Trace = b; }
bool GetTraceExpand() { return this->TraceExpand; }
void SetTraceExpand(bool b) { this->TraceExpand = b; }
+ void AddTraceSource(std::string const& file)
+ {
+ this->TraceOnlyThisSources.push_back(file);
+ }
+ std::vector<std::string> const& GetTraceSources() const
+ {
+ return this->TraceOnlyThisSources;
+ }
bool GetWarnUninitialized() { return this->WarnUninitialized; }
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
bool GetWarnUnused() { return this->WarnUnused; }
@@ -334,12 +347,14 @@ public:
return this->CMakeEditCommand;
}
+ cmMessenger* GetMessenger() const;
+
/*
* Get the state of the suppression of developer (author) warnings.
* Returns false, by default, if developer warnings should be shown, true
* otherwise.
*/
- bool GetSuppressDevWarnings(cmMakefile const* mf = NULL);
+ bool GetSuppressDevWarnings() const;
/*
* Set the state of the suppression of developer (author) warnings.
*/
@@ -350,7 +365,7 @@ public:
* Returns false, by default, if deprecated warnings should be shown, true
* otherwise.
*/
- bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL);
+ bool GetSuppressDeprecatedWarnings() const;
/*
* Set the state of the suppression of deprecated warnings.
*/
@@ -361,7 +376,7 @@ public:
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
*/
- bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL);
+ bool GetDevWarningsAsErrors() const;
/**
* Set the state of treating developer (author) warnings as errors.
*/
@@ -372,7 +387,7 @@ public:
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
*/
- bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL);
+ bool GetDeprecatedWarningsAsErrors() const;
/**
* Set the state of treating developer (author) warnings as errors.
*/
@@ -381,8 +396,7 @@ public:
/** Display a message to the user. */
void IssueMessage(
cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& backtrace = cmListFileBacktrace(),
- bool force = false);
+ cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
///! run the --build option
int Build(const std::string& dir, const std::string& target,
@@ -407,21 +421,16 @@ protected:
void InitializeProperties();
int HandleDeleteCacheVariables(const std::string& var);
- typedef cmExternalMakefileProjectGenerator* (
- *CreateExtraGeneratorFunctionType)();
- typedef std::map<std::string, CreateExtraGeneratorFunctionType>
- RegisteredExtraGeneratorsMap;
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
RegisteredGeneratorsVector Generators;
- RegisteredExtraGeneratorsMap ExtraGenerators;
+ typedef std::vector<cmExternalMakefileProjectGeneratorFactory*>
+ RegisteredExtraGeneratorsVector;
+ RegisteredExtraGeneratorsVector ExtraGenerators;
void AddDefaultCommands();
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- void AddExtraGenerator(const std::string& name,
- CreateExtraGeneratorFunctionType newFunction);
cmGlobalGenerator* GlobalGenerator;
- cmCacheManager* CacheManager;
std::map<std::string, DiagLevel> DiagLevels;
std::string GeneratorPlatform;
std::string GeneratorToolset;
@@ -455,7 +464,6 @@ private:
void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData;
- bool Verbose;
bool InTryCompile;
WorkingMode CurrentWorkingMode;
bool DebugOutput;
@@ -483,6 +491,9 @@ private:
cmState* State;
cmState::Snapshot CurrentSnapshot;
+ cmMessenger* Messenger;
+
+ std::vector<std::string> TraceOnlyThisSources;
void UpdateConversionPathTable();
@@ -493,15 +504,13 @@ private:
* Convert a message type between a warning and an error, based on the state
* of the error output CMake variables, in the cache.
*/
- cmake::MessageType ConvertMessageType(cmake::MessageType t);
+ cmake::MessageType ConvertMessageType(cmake::MessageType t) const;
/*
* Check if messages of this type should be output, based on the state of the
* warning and error output CMake variables, in the cache.
*/
- bool IsMessageTypeVisible(cmake::MessageType t);
-
- bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg);
+ bool IsMessageTypeVisible(cmake::MessageType t) const;
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 056671a..db6d51b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -27,24 +27,29 @@
#include "cmcmd.h"
#include <cmsys/Encoding.hxx>
+#ifdef CMAKE_USE_LIBUV
+#include "cm_uv.h"
+#endif
+
#ifdef CMAKE_BUILD_WITH_CMAKE
static const char* cmDocumentationName[][2] = {
- { 0, " cmake - Cross-Platform Makefile Generator." },
- { 0, 0 }
+ { CM_NULLPTR, " cmake - Cross-Platform Makefile Generator." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationUsage[][2] = {
- { 0, " cmake [options] <path-to-source>\n"
- " cmake [options] <path-to-existing-build>" },
- { 0, "Specify a source directory to (re-)generate a build system for "
- "it in the current working directory. Specify an existing build "
- "directory to re-generate its build system." },
- { 0, 0 }
+ { CM_NULLPTR, " cmake [options] <path-to-source>\n"
+ " cmake [options] <path-to-existing-build>" },
+ { CM_NULLPTR,
+ "Specify a source directory to (re-)generate a build system for "
+ "it in the current working directory. Specify an existing build "
+ "directory to re-generate its build system." },
+ { CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationUsageNote[][2] = {
- { 0, "Run 'cmake --help' for more information." },
- { 0, 0 }
+ { CM_NULLPTR, "Run 'cmake --help' for more information." },
+ { CM_NULLPTR, CM_NULLPTR }
};
#define CMAKE_BUILD_OPTIONS \
@@ -73,12 +78,14 @@ static const char* cmDocumentationOptions[][2] = {
{ "--debug-output", "Put cmake in a debug mode." },
{ "--trace", "Put cmake in trace mode." },
{ "--trace-expand", "Put cmake in trace mode with variable expansion." },
+ { "--trace-source=<file>",
+ "Trace only this CMake file/module. Multiple options allowed." },
{ "--warn-uninitialized", "Warn about uninitialized values." },
{ "--warn-unused-vars", "Warn about unused variables." },
{ "--no-warn-unused-cli", "Don't warn about command line options." },
{ "--check-system-vars", "Find problems with variable usage in system "
"files." },
- { 0, 0 }
+ { CM_NULLPTR, CM_NULLPTR }
};
#endif
@@ -104,7 +111,7 @@ static cmMakefile* cmakemainGetMakefile(void* clientdata)
return gg->GetCurrentMakefile();
}
}
- return 0;
+ return CM_NULLPTR;
}
static std::string cmakemainGetStack(void* clientdata)
@@ -121,8 +128,8 @@ static std::string cmakemainGetStack(void* clientdata)
return msg;
}
-static void cmakemainMessageCallback(const char* m, const char*, bool&,
- void* clientdata)
+static void cmakemainMessageCallback(const char* m, const char* /*unused*/,
+ bool& /*unused*/, void* clientdata)
{
std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
}
@@ -160,7 +167,8 @@ int main(int ac, char const* const* av)
if (ac > 1) {
if (strcmp(av[1], "--build") == 0) {
return do_build(ac, av);
- } else if (strcmp(av[1], "-E") == 0) {
+ }
+ if (strcmp(av[1], "-E") == 0) {
return do_command(ac, av);
}
}
@@ -168,6 +176,9 @@ int main(int ac, char const* const* av)
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
#endif
+#ifdef CMAKE_USE_LIBUV
+ uv_loop_close(uv_default_loop());
+#endif
return ret;
}
@@ -234,7 +245,8 @@ int do_cmake(int ac, char const* const* av)
"Use cmake-gui or ccmake for an interactive dialog.\n";
/* clang-format on */
return 1;
- } else if (strcmp(av[i], "--system-information") == 0) {
+ }
+ if (strcmp(av[i], "--system-information") == 0) {
sysinfo = true;
} else if (strcmp(av[i], "-N") == 0) {
view_only = true;
@@ -310,9 +322,8 @@ int do_cmake(int ac, char const* const* av)
// interpret negative return values as errors.
if (res != 0) {
return 1;
- } else {
- return 0;
}
+ return 0;
}
static int do_build(int ac, char const* const* av)
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 8b0cede..167d60a 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -21,6 +21,7 @@
#include <cmSystemTools.h>
#include <cmsys/Encoding.hxx>
+#include <algorithm>
#include <sstream>
#include <windows.h>
@@ -213,7 +214,7 @@ static int process(const std::string& srcfilename, const std::string& dfile,
dir.c_str(), cmSystemTools::OUTPUT_NONE);
// process the include directives and output everything else
- std::stringstream ss(output);
+ std::istringstream ss(output);
std::string line;
std::vector<std::string> includes;
bool isFirstLine = true; // cl prints always first the source filename
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 471028a..f25c085 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -16,6 +16,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmQtAutoGenerators.h"
+#include "cmUtils.hxx"
#include "cmVersion.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -27,8 +28,7 @@
#include <cmsys/Process.h>
#include <cmsys/Terminal.h>
-#if defined(CMAKE_HAVE_VS_GENERATORS)
-#include "cmCallVisualStudioMacro.h"
+#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
#include "cmVisualStudioWCEPlatformParser.h"
#endif
@@ -60,6 +60,8 @@ void CMakeCommandUsage(const char* program)
errorStream
<< "Usage: " << program << " -E <command> [arguments...]\n"
<< "Available commands: \n"
+ << " capabilities - Report capabilities built into cmake "
+ "in JSON format\n"
<< " chdir dir cmd [args...] - run command in a given directory\n"
<< " compare_files file1 file2 - check if file1 is same as file2\n"
<< " copy <file>... destination - copy files to destination "
@@ -260,7 +262,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// run include what you use command and then run the compile
// command. This is an internal undocumented option and should
// only be used by CMake itself when running iwyu.
- else if (args[1] == "__run_iwyu") {
+ if (args[1] == "__run_iwyu") {
if (args.size() < 3) {
std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]"
" [--tidy=/path/tidy] -- compile command\n";
@@ -271,6 +273,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string iwyu;
std::string tidy;
std::string sourceFile;
+ std::string lwyu;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
std::string const& arg = args[cc];
if (arg == "--") {
@@ -281,6 +284,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
tidy = arg.substr(7);
} else if (doing_options && cmHasLiteralPrefix(arg, "--source=")) {
sourceFile = arg.substr(9);
+ } else if (doing_options && cmHasLiteralPrefix(arg, "--lwyu=")) {
+ lwyu = arg.substr(7);
} else if (doing_options) {
std::cerr << "__run_iwyu given unknown argument: " << arg << "\n";
return 1;
@@ -288,7 +293,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
orig_cmd.push_back(arg);
}
}
- if (tidy.empty() && iwyu.empty()) {
+ if (tidy.empty() && iwyu.empty() && lwyu.empty()) {
std::cerr << "__run_iwyu missing --tidy= or --iwyu=\n";
return 1;
}
@@ -296,7 +301,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "__run_iwyu --tidy= requires --source=\n";
return 1;
}
- if (orig_cmd.empty()) {
+ if (orig_cmd.empty() && lwyu.empty()) {
std::cerr << "__run_iwyu missing compile command after --\n";
return 1;
}
@@ -312,7 +317,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Run the iwyu command line. Capture its stderr and hide its stdout.
std::string stdErr;
- if (!cmSystemTools::RunSingleCommand(iwyu_cmd, 0, &stdErr, &ret, 0,
+ if (!cmSystemTools::RunSingleCommand(iwyu_cmd, CM_NULLPTR, &stdErr,
+ &ret, CM_NULLPTR,
cmSystemTools::OUTPUT_NONE)) {
std::cerr << "Error running '" << iwyu_cmd[0] << "': " << stdErr
<< "\n";
@@ -340,19 +346,46 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Run the tidy command line. Capture its stdout and hide its stderr.
std::string stdOut;
- if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, 0, &ret, 0,
+ if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, CM_NULLPTR,
+ &ret, CM_NULLPTR,
cmSystemTools::OUTPUT_NONE)) {
std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
return 1;
}
-
// Output the stdout from clang-tidy to stderr
std::cerr << stdOut;
}
+ if (!lwyu.empty()) {
+ // Construct the ldd -r -u (link what you use lwyu) command line
+ // ldd -u -r lwuy target
+ std::vector<std::string> lwyu_cmd;
+ lwyu_cmd.push_back("ldd");
+ lwyu_cmd.push_back("-u");
+ lwyu_cmd.push_back("-r");
+ lwyu_cmd.push_back(lwyu);
+
+ // Run the ldd -u -r command line.
+ // Capture its stdout and hide its stderr.
+ std::string stdOut;
+ if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, CM_NULLPTR,
+ &ret, CM_NULLPTR,
+ cmSystemTools::OUTPUT_NONE)) {
+ std::cerr << "Error running '" << lwyu_cmd[0] << "'\n";
+ return 1;
+ }
+ // Output the stdout from ldd -r -u to stderr
+ // Warn if lwyu reported anything.
+ if (stdOut.find("Unused direct dependencies:") != stdOut.npos) {
+ std::cerr << "Warning: " << stdOut;
+ }
+ }
+ ret = 0;
// Now run the real compiler command and return its result value.
- if (!cmSystemTools::RunSingleCommand(
- orig_cmd, 0, 0, &ret, 0, cmSystemTools::OUTPUT_PASSTHROUGH)) {
+ if (lwyu.empty() &&
+ !cmSystemTools::RunSingleCommand(
+ orig_cmd, CM_NULLPTR, CM_NULLPTR, &ret, CM_NULLPTR,
+ cmSystemTools::OUTPUT_PASSTHROUGH)) {
std::cerr << "Error running '" << orig_cmd[0] << "'\n";
return 1;
}
@@ -360,13 +393,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Echo string
- else if (args[1] == "echo") {
+ if (args[1] == "echo") {
std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl;
return 0;
}
// Echo string no new line
- else if (args[1] == "echo_append") {
+ if (args[1] == "echo_append") {
std::cout << cmJoin(cmMakeRange(args).advance(2), " ");
return 0;
}
@@ -402,7 +435,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Execute command from remaining arguments.
std::vector<std::string> cmd(ai, ae);
int retval;
- if (cmSystemTools::RunSingleCommand(cmd, 0, 0, &retval, NULL,
+ if (cmSystemTools::RunSingleCommand(cmd, CM_NULLPTR, CM_NULLPTR, &retval,
+ CM_NULLPTR,
cmSystemTools::OUTPUT_PASSTHROUGH)) {
return retval;
}
@@ -478,6 +512,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+ // capabilities
+ else if (args[1] == "capabilities") {
+ if (args.size() > 2) {
+ std::cerr << "-E capabilities accepts no additional arguments\n";
+ return 1;
+ }
+ cmake cm;
+ std::cout << cm.ReportCapabilities();
+ return 0;
+ }
// Sleep command
else if (args[1] == "sleep" && args.size() > 2) {
@@ -510,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
time(&time_start);
clock_start = clock();
int ret = 0;
- cmSystemTools::RunSingleCommand(command, 0, 0, &ret);
+ cmSystemTools::RunSingleCommand(command, CM_NULLPTR, CM_NULLPTR, &ret);
clock_finish = clock();
time(&time_finish);
@@ -561,8 +605,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
int retval = 0;
int timeout = 0;
if (cmSystemTools::RunSingleCommand(
- command.c_str(), 0, 0, &retval, directory.c_str(),
- cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
+ command.c_str(), CM_NULLPTR, CM_NULLPTR, &retval,
+ directory.c_str(), cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
return retval;
}
@@ -640,36 +684,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return cmcmd::SymlinkExecutable(args);
}
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- // Internal CMake support for calling Visual Studio macros.
- else if (args[1] == "cmake_call_visual_studio_macro" && args.size() >= 4) {
- // args[2] = full path to .sln file or "ALL"
- // args[3] = name of Visual Studio macro to call
- // args[4..args.size()-1] = [optional] args for Visual Studio macro
-
- std::string macroArgs;
-
- if (args.size() > 4) {
- macroArgs = args[4];
-
- for (size_t i = 5; i < args.size(); ++i) {
- macroArgs += " ";
- macroArgs += args[i];
- }
- }
-
- return cmCallVisualStudioMacro::CallMacro(args[2], args[3], macroArgs,
- true);
- }
-#endif
-
// Internal CMake dependency scanning support.
else if (args[1] == "cmake_depends" && args.size() >= 6) {
- // Use the make system's VERBOSE environment variable to enable
- // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
- // (which is set by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) &&
- (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+ const bool verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
cmake cm;
@@ -732,9 +749,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lgd(
- ggd->CreateLocalGenerator(mf.get()));
+ CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot));
+ CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mf.get()));
// Actually scan dependencies.
return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0
@@ -835,7 +851,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::Error("Can not use compression flags with format: ",
format.c_str());
return 1;
- } else if (nCompress > 1) {
+ }
+ if (nCompress > 1) {
cmSystemTools::Error("Can only compress a tar file one way; "
"at most one flag of z, j, or J may be used");
return 1;
@@ -868,9 +885,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
// is set in the env, its value will be used instead of 100.
int delay = 100;
- const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
- if (delayVar) {
- delay = atoi(delayVar);
+ std::string delayVar;
+ if (cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY", delayVar)) {
+ delay = atoi(delayVar.c_str());
}
if (delay) {
cmSystemTools::Delay(delay);
@@ -979,12 +996,12 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num)
int count = 0;
if (!progFile) {
return;
- } else {
- if (1 != fscanf(progFile, "%i", &count)) {
- cmSystemTools::Message("Could not read from progress file.");
- }
- fclose(progFile);
}
+ if (1 != fscanf(progFile, "%i", &count)) {
+ cmSystemTools::Message("Could not read from progress file.");
+ }
+ fclose(progFile);
+
const char* last = num.c_str();
for (const char* c = last;; ++c) {
if (*c == ',' || *c == '\0') {
@@ -1027,11 +1044,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
// Enable or disable color based on the switch value.
std::string value = args[i].substr(9);
if (!value.empty()) {
- if (cmSystemTools::IsOn(value.c_str())) {
- enabled = true;
- } else {
- enabled = false;
- }
+ enabled = cmSystemTools::IsOn(value.c_str());
}
} else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) {
progressDir = args[i].substr(15);
@@ -1123,7 +1136,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
}
// Setup this command line.
- const char* cmd[2] = { command.c_str(), 0 };
+ const char* cmd[2] = { command.c_str(), CM_NULLPTR };
cmsysProcess_SetCommand(cp, cmd);
// Report the command if verbose output is enabled.
@@ -1133,7 +1146,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
// Run the command and wait for it to exit.
cmsysProcess_Execute(cp);
- cmsysProcess_WaitForExit(cp, 0);
+ cmsysProcess_WaitForExit(cp, CM_NULLPTR);
// Report failure if any.
switch (cmsysProcess_GetState(cp)) {
@@ -1167,7 +1180,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
{
-#if defined(CMAKE_HAVE_VS_GENERATORS)
+#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
cmVisualStudioWCEPlatformParser parser(name.c_str());
parser.ParseVersion(version);
if (parser.Found()) {
@@ -1226,7 +1239,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
if (args.size() < 2) {
return -1;
}
- bool verbose = cmSystemTools::GetEnv("VERBOSE") ? true : false;
+ const bool verbose = cmSystemTools::HasEnv("VERBOSE");
std::vector<std::string> expandedArgs;
for (std::vector<std::string>::iterator i = args.begin(); i != args.end();
++i) {
@@ -1250,7 +1263,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
}
static bool RunCommand(const char* comment, std::vector<std::string>& command,
- bool verbose, int* retCodeOut = 0)
+ bool verbose, int* retCodeOut = CM_NULLPTR)
{
if (verbose) {
std::cout << comment << ":\n";
@@ -1259,8 +1272,9 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
std::string output;
int retCode = 0;
// use rc command to create .res file
- bool res = cmSystemTools::RunSingleCommand(
- command, &output, &output, &retCode, 0, cmSystemTools::OUTPUT_NONE);
+ bool res =
+ cmSystemTools::RunSingleCommand(command, &output, &output, &retCode,
+ CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 4edd62e..38ff64f 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -21,12 +21,13 @@
#include "cmsys/Encoding.hxx"
static const char* cmDocumentationName[][2] = {
- { 0, " ctest - Testing driver provided by CMake." },
- { 0, 0 }
+ { CM_NULLPTR, " ctest - Testing driver provided by CMake." },
+ { CM_NULLPTR, CM_NULLPTR }
};
-static const char* cmDocumentationUsage[][2] = { { 0, " ctest [options]" },
- { 0, 0 } };
+static const char* cmDocumentationUsage[][2] = { { CM_NULLPTR,
+ " ctest [options]" },
+ { CM_NULLPTR, CM_NULLPTR } };
static const char* cmDocumentationOptions[][2] = {
{ "-C <cfg>, --build-config <cfg>", "Choose configuration to test." },
@@ -108,7 +109,7 @@ static const char* cmDocumentationOptions[][2] = {
{ "--http1.0", "Submit using HTTP 1.0." },
{ "--no-compress-output", "Do not compress test output when submitting." },
{ "--print-labels", "Print all available test labels." },
- { 0, 0 }
+ { CM_NULLPTR, CM_NULLPTR }
};
// this is a test driver program for cmCTest.
diff --git a/Source/dir.dox b/Source/dir.dox
new file mode 100644
index 0000000..66e3de7
--- /dev/null
+++ b/Source/dir.dox
@@ -0,0 +1,7 @@
+/*!
+
+\dir
+
+\brief Root \c ${CMake_SOURCE_DIR}/Source directory
+
+*/
diff --git a/Source/dir.dox.in b/Source/dir.dox.in
new file mode 100644
index 0000000..78cf58d
--- /dev/null
+++ b/Source/dir.dox.in
@@ -0,0 +1,7 @@
+/*!
+
+\dir
+
+\brief Generated \c ${CMake_BINARY_DIR}/Source directory
+
+*/
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 8b15394..87f6048 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -632,6 +632,11 @@ IF(KWSYS_USE_SystemInformation)
ENDIF()
ENDIF()
+IF(KWSYS_USE_FStream)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
+ "Checking whether <ext/stdio_filebuf.h> is available" DIRECT)
+ENDIF()
+
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
IF(NOT KWSYS_HEADER_ROOT)
@@ -663,7 +668,6 @@ SET(KWSYS_CLASSES)
SET(KWSYS_H_FILES Configure SharedForward)
SET(KWSYS_HXX_FILES Configure String
hashtable hash_fun hash_map hash_set
- auto_ptr
)
# Add selected C++ classes.
@@ -903,7 +907,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# C++ tests
IF(NOT WATCOM)
SET(KWSYS_CXX_TESTS
- testAutoPtr
testHashSTL
)
ENDIF()
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index ff8e49d..4ce680d 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -17,6 +17,8 @@
/* Whether wstring is available. */
#define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@
+/* Whether <ext/stdio_filebuf.h> is available. */
+#define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@
/* If building a C++ file in kwsys itself, give the source file
access to the macros without a configured namespace. */
@@ -24,8 +26,9 @@
# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys @KWSYS_NAMESPACE@
# endif
-# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
+# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
+# define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
#endif
#endif
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index c549792..15480e1 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -84,9 +84,9 @@ void Directory::Clear()
} // namespace KWSYS_NAMESPACE
-// First microsoft compilers
+// First Windows platforms
-#if defined(_MSC_VER) || defined(__WATCOMC__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#include <io.h>
#include <ctype.h>
@@ -97,15 +97,25 @@ void Directory::Clear()
#include <sys/stat.h>
#include <sys/types.h>
+// Wide function names can vary depending on compiler:
+#ifdef __BORLANDC__
+# define _wfindfirst_func __wfindfirst
+# define _wfindnext_func __wfindnext
+#else
+# define _wfindfirst_func _wfindfirst
+# define _wfindnext_func _wfindnext
+#endif
+
namespace KWSYS_NAMESPACE
{
bool Directory::Load(const std::string& name)
{
this->Clear();
-#if _MSC_VER < 1300
+#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
+ // Older Visual C++ and Embarcadero compilers.
long srchHandle;
-#else
+#else // Newer Visual C++
intptr_t srchHandle;
#endif
char* buf;
@@ -132,7 +142,7 @@ bool Directory::Load(const std::string& name)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
- srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
+ srchHandle = _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete [] buf;
if ( srchHandle == -1 )
@@ -145,16 +155,17 @@ bool Directory::Load(const std::string& name)
{
this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
}
- while ( _wfindnext(srchHandle, &data) != -1 );
+ while ( _wfindnext_func(srchHandle, &data) != -1 );
this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
-#if _MSC_VER < 1300
+#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
+ // Older Visual C++ and Embarcadero compilers.
long srchHandle;
-#else
+#else // Newer Visual C++
intptr_t srchHandle;
#endif
char* buf;
@@ -172,7 +183,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
- srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
+ srchHandle = _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete [] buf;
if ( srchHandle == -1 )
@@ -186,7 +197,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
count++;
}
- while ( _wfindnext(srchHandle, &data) != -1 );
+ while ( _wfindnext_func(srchHandle, &data) != -1 );
_findclose(srchHandle);
return count;
}
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index 681e4d8..5471247 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -12,154 +12,248 @@
#ifndef @KWSYS_NAMESPACE@_FStream_hxx
#define @KWSYS_NAMESPACE@_FStream_hxx
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/Encoding.hxx>
#include <fstream>
+#if defined(_WIN32)
+# if !defined(_MSC_VER) && @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
+# include <ext/stdio_filebuf.h>
+# endif
+#endif
namespace @KWSYS_NAMESPACE@
{
-#if defined(_MSC_VER) && _MSC_VER >= 1400
+#if defined(_WIN32) && (defined(_MSC_VER) || @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H)
# if defined(_NOEXCEPT)
# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT _NOEXCEPT
# else
# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT
# endif
+
+#if defined(_MSC_VER)
+
template<typename CharType,typename Traits>
class basic_filebuf : public std::basic_filebuf<CharType,Traits>
{
+# if _MSC_VER >= 1400
public:
typedef std::basic_filebuf<CharType,Traits> my_base_type;
basic_filebuf *open(char const *s,std::ios_base::openmode mode)
{
+ const std::wstring wstr = Encoding::ToWide(s);
return static_cast<basic_filebuf*>(
- my_base_type::open(Encoding::ToWide(s).c_str(), mode)
+ my_base_type::open(wstr.c_str(), mode)
);
}
+# endif
+ };
+
+#else
+
+ inline std::wstring getcmode(const std::ios_base::openmode mode) {
+ std::wstring cmode;
+ bool plus = false;
+ if (mode & std::ios_base::app) {
+ cmode += L"a";
+ plus = mode & std::ios_base::in ? true : false;
+ } else if (mode & std::ios_base::trunc ||
+ (mode & std::ios_base::out && (mode & std::ios_base::in) == 0)) {
+ cmode += L"w";
+ plus = mode & std::ios_base::in ? true : false;
+ } else {
+ cmode += L"r";
+ plus = mode & std::ios_base::out ? true : false;
+ }
+ if (plus) {
+ cmode += L"+";
+ }
+ if (mode & std::ios_base::binary) {
+ cmode += L"b";
+ } else {
+ cmode += L"t";
+ }
+ return cmode;
};
+#endif
+
template<typename CharType,typename Traits = std::char_traits<CharType> >
- class basic_ifstream : public std::basic_istream<CharType,Traits>
+ class basic_efilebuf
{
+ public:
+#if defined(_MSC_VER)
+ typedef basic_filebuf<CharType,Traits> internal_buffer_type;
+#else
+ typedef __gnu_cxx::stdio_filebuf<CharType,Traits> internal_buffer_type;
+#endif
+
+ basic_efilebuf() : file_(0)
+ {
+ buf_ = 0;
+ }
+
+ bool _open(char const *file_name,std::ios_base::openmode mode)
+ {
+ if (is_open() || file_) {
+ return false;
+ }
+#if defined(_MSC_VER)
+ const bool success = buf_->open(file_name,mode) != 0;
+#else
+ const std::wstring wstr = Encoding::ToWide(file_name);
+ bool success = false;
+ std::wstring cmode = getcmode(mode);
+ file_ = _wfopen(wstr.c_str(), cmode.c_str());
+ if (file_) {
+ if (buf_) {
+ delete buf_;
+ }
+ buf_ = new internal_buffer_type(file_, mode);
+ success = true;
+ }
+#endif
+ return success;
+ }
+
+ bool is_open()
+ {
+ if (!buf_) {
+ return false;
+ }
+ return buf_->is_open();
+ }
+
+ bool is_open() const
+ {
+ if (!buf_) {
+ return false;
+ }
+ return buf_->is_open();
+ }
+
+ bool _close()
+ {
+ bool success = false;
+ if (buf_) {
+ success = buf_->close() != 0;
+#if !defined(_MSC_VER)
+ if (file_) {
+ success = fclose(file_) == 0 ? success : false;
+ file_ = 0;
+ }
+#endif
+ }
+ return success;
+ }
+
+ static void _set_state(bool success, std::basic_ios<CharType,Traits> *ios, basic_efilebuf* efilebuf)
+ {
+#if !defined(_MSC_VER)
+ ios->rdbuf(efilebuf->buf_);
+#endif
+ if (!success) {
+ ios->setstate(std::ios_base::failbit);
+ } else {
+ ios->clear();
+ }
+ }
+
+ ~basic_efilebuf()
+ {
+ if (buf_) {
+ delete buf_;
+ }
+ }
+
+ protected:
+ internal_buffer_type* buf_;
+ FILE *file_;
+ };
+
+template<typename CharType,typename Traits = std::char_traits<CharType> >
+class basic_ifstream : public std::basic_istream<CharType,Traits>,
+ public basic_efilebuf<CharType,Traits>
+{
+ using basic_efilebuf<CharType,Traits>::is_open;
+
public:
- typedef basic_filebuf<CharType,Traits> internal_buffer_type;
+ typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type internal_buffer_type;
typedef std::basic_istream<CharType,Traits> internal_stream_type;
basic_ifstream() : internal_stream_type(new internal_buffer_type())
{
- buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
+ this->buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
}
explicit basic_ifstream(char const *file_name,
std::ios_base::openmode mode = std::ios_base::in)
: internal_stream_type(new internal_buffer_type())
{
- buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
+ this->buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
open(file_name,mode);
}
+
void open(char const *file_name,std::ios_base::openmode mode = std::ios_base::in)
{
- if(!buf_->open(file_name,mode | std::ios_base::in))
- {
- this->setstate(std::ios_base::failbit);
- }
- else
- {
- this->clear();
- }
- }
- bool is_open()
- {
- return buf_->is_open();
- }
- bool is_open() const
- {
- return buf_->is_open();
+ mode = mode | std::ios_base::in;
+ this->_set_state(this->_open(file_name, mode), this, this);
}
+
void close()
{
- if(!buf_->close())
- {
- this->setstate(std::ios_base::failbit);
- }
- else
- {
- this->clear();
- }
+ this->_set_state(this->_close(), this, this);
}
internal_buffer_type *rdbuf() const
{
- return buf_;
+ return this->buf_;
}
~basic_ifstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT
{
- buf_->close();
- delete buf_;
+ close();
}
-
- private:
- internal_buffer_type* buf_;
};
template<typename CharType,typename Traits = std::char_traits<CharType> >
-class basic_ofstream : public std::basic_ostream<CharType,Traits>
+class basic_ofstream : public std::basic_ostream<CharType,Traits>,
+ public basic_efilebuf<CharType,Traits>
{
+ using basic_efilebuf<CharType,Traits>::is_open;
+
public:
- typedef basic_filebuf<CharType,Traits> internal_buffer_type;
+ typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type internal_buffer_type;
typedef std::basic_ostream<CharType,Traits> internal_stream_type;
basic_ofstream() : internal_stream_type(new internal_buffer_type())
{
- buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
+ this->buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
}
explicit basic_ofstream(char const *file_name,std::ios_base::openmode mode = std::ios_base::out) :
internal_stream_type(new internal_buffer_type())
{
- buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
+ this->buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
open(file_name,mode);
}
void open(char const *file_name,std::ios_base::openmode mode = std::ios_base::out)
{
- if(!buf_->open(file_name,mode | std::ios_base::out))
- {
- this->setstate(std::ios_base::failbit);
- }
- else
- {
- this->clear();
- }
- }
- bool is_open()
- {
- return buf_->is_open();
- }
- bool is_open() const
- {
- return buf_->is_open();
+ mode = mode | std::ios_base::out;
+ this->_set_state(this->_open(file_name, mode), this, this);
}
+
void close()
{
- if(!buf_->close())
- {
- this->setstate(std::ios_base::failbit);
- }
- else
- {
- this->clear();
- }
+ this->_set_state(this->_close(), this, this);
}
internal_buffer_type *rdbuf() const
{
- return buf_.get();
+ return this->buf_;
}
+
~basic_ofstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT
{
- buf_->close();
- delete buf_;
+ close();
}
-
- private:
- internal_buffer_type* buf_;
};
typedef basic_ifstream<char> ifstream;
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 81fb2f9..56a635a 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -79,9 +79,9 @@ typedef int siginfo_t;
# undef _WIN32
#endif
-#ifdef __FreeBSD__
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+# include <sys/param.h>
# include <sys/sysctl.h>
-# include <fenv.h>
# include <sys/socket.h>
# include <netdb.h>
# include <netinet/in.h>
@@ -91,19 +91,10 @@ typedef int siginfo_t;
# endif
#endif
-#if defined(__OpenBSD__) || defined(__NetBSD__)
-# include <sys/param.h>
-# include <sys/sysctl.h>
-#endif
-
#if defined(KWSYS_SYS_HAS_MACHINE_CPU_H)
# include <machine/cpu.h>
#endif
-#if defined(__DragonFly__)
-# include <sys/sysctl.h>
-#endif
-
#ifdef __APPLE__
# include <sys/sysctl.h>
# include <mach/vm_statistics.h>
@@ -123,7 +114,7 @@ typedef int siginfo_t;
# endif
#endif
-#ifdef __linux
+#if defined(__linux) || defined (__sun) || defined(_SCO_DS)
# include <fenv.h>
# include <sys/socket.h>
# include <netdb.h>
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index c6e668d..1a73b16 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -388,6 +388,72 @@ class SystemToolsTranslationMap :
{
};
+/* Type of character storing the environment. */
+#if defined(_WIN32)
+typedef wchar_t envchar;
+#else
+typedef char envchar;
+#endif
+
+/* Order by environment key only (VAR from VAR=VALUE). */
+struct kwsysEnvCompare
+{
+ bool operator() (const envchar* l, const envchar* r) const
+ {
+#if defined(_WIN32)
+ const wchar_t* leq = wcschr(l, L'=');
+ const wchar_t* req = wcschr(r, L'=');
+ size_t llen = leq? (leq-l) : wcslen(l);
+ size_t rlen = req? (req-r) : wcslen(r);
+ if(llen == rlen)
+ {
+ return wcsncmp(l,r,llen) < 0;
+ }
+ else
+ {
+ return wcscmp(l,r) < 0;
+ }
+#else
+ const char* leq = strchr(l, '=');
+ const char* req = strchr(r, '=');
+ size_t llen = leq? (leq-l) : strlen(l);
+ size_t rlen = req? (req-r) : strlen(r);
+ if(llen == rlen)
+ {
+ return strncmp(l,r,llen) < 0;
+ }
+ else
+ {
+ return strcmp(l,r) < 0;
+ }
+#endif
+ }
+};
+
+class kwsysEnvSet: public std::set<const envchar*, kwsysEnvCompare>
+{
+public:
+ class Free
+ {
+ const envchar* Env;
+ public:
+ Free(const envchar* env): Env(env) {}
+ ~Free() { free(const_cast<envchar*>(this->Env)); }
+ };
+
+ const envchar* Release(const envchar* env)
+ {
+ const envchar* old = 0;
+ iterator i = this->find(env);
+ if(i != this->end())
+ {
+ old = *i;
+ this->erase(i);
+ }
+ return old;
+ }
+};
+
#ifdef _WIN32
struct SystemToolsPathCaseCmp
{
@@ -406,6 +472,9 @@ struct SystemToolsPathCaseCmp
class SystemToolsPathCaseMap:
public std::map<std::string, std::string,
SystemToolsPathCaseCmp> {};
+
+class SystemToolsEnvMap :
+ public std::map<std::string,std::string> {};
#endif
// adds the elements of the env variable path to the arg passed in
@@ -421,14 +490,12 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
{
env = "PATH";
}
- const char* cpathEnv = SystemTools::GetEnv(env);
- if ( !cpathEnv )
+ std::string pathEnv;
+ if ( !SystemTools::GetEnv(env, pathEnv) )
{
return;
}
- std::string pathEnv = cpathEnv;
-
// A hack to make the below algorithm work.
if(!pathEnv.empty() && *pathEnv.rbegin() != pathSep)
{
@@ -456,28 +523,52 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
}
}
+const char* SystemTools::GetEnvImpl(const char* key)
+{
+ const char *v = 0;
+#if defined(_WIN32)
+ std::string env;
+ if (SystemTools::GetEnv(key, env))
+ {
+ std::string& menv = (*SystemTools::EnvMap)[key];
+ menv = env;
+ v = menv.c_str();
+ }
+#else
+ v = getenv(key);
+#endif
+ return v;
+}
+
const char* SystemTools::GetEnv(const char* key)
{
- return getenv(key);
+ return SystemTools::GetEnvImpl(key);
}
const char* SystemTools::GetEnv(const std::string& key)
{
- return SystemTools::GetEnv(key.c_str());
+ return SystemTools::GetEnvImpl(key.c_str());
}
bool SystemTools::GetEnv(const char* key, std::string& result)
{
+#if defined(_WIN32)
+ const std::wstring wkey = Encoding::ToWide(key);
+ const wchar_t* wv = _wgetenv(wkey.c_str());
+ if (wv)
+ {
+ result = Encoding::ToNarrow(wv);
+ return true;
+ }
+#else
const char* v = getenv(key);
if(v)
{
result = v;
return true;
}
- else
- {
- return false;
- }
+#endif
+ return false;
}
bool SystemTools::GetEnv(const std::string& key, std::string& result)
@@ -485,13 +576,23 @@ bool SystemTools::GetEnv(const std::string& key, std::string& result)
return SystemTools::GetEnv(key.c_str(), result);
}
-//----------------------------------------------------------------------------
-
-#if defined(__CYGWIN__) || defined(__GLIBC__)
-# define KWSYS_PUTENV_NAME /* putenv("A") removes A. */
-#elif defined(_WIN32)
-# define KWSYS_PUTENV_EMPTY /* putenv("A=") removes A. */
+bool SystemTools::HasEnv(const char* key)
+{
+#if defined(_WIN32)
+ const std::wstring wkey = Encoding::ToWide(key);
+ const wchar_t* v = _wgetenv(wkey.c_str());
+#else
+ const char* v = getenv(key);
#endif
+ return v != 0;
+}
+
+bool SystemTools::HasEnv(const std::string& key)
+{
+ return SystemTools::HasEnv(key.c_str());
+}
+
+//----------------------------------------------------------------------------
#if KWSYS_CXX_HAS_UNSETENV
/* unsetenv("A") removes A from the environment.
@@ -511,18 +612,15 @@ static int kwsysUnPutEnv(const std::string& env)
return 0;
}
-#elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME)
-/* putenv("A=") or putenv("A") removes A from the environment. */
+#elif defined(__CYGWIN__) || defined(__GLIBC__)
+/* putenv("A") removes A from the environment. It must not put the
+ memory in the environment because it does not have any "=" syntax. */
static int kwsysUnPutEnv(const std::string& env)
{
int err = 0;
size_t pos = env.find('=');
size_t const len = pos == env.npos ? env.size() : pos;
-# ifdef KWSYS_PUTENV_EMPTY
- size_t const sz = len + 2;
-# else
size_t const sz = len + 1;
-# endif
char local_buf[256];
char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf;
if(!buf)
@@ -530,20 +628,11 @@ static int kwsysUnPutEnv(const std::string& env)
return -1;
}
strncpy(buf, env.c_str(), len);
-# ifdef KWSYS_PUTENV_EMPTY
- buf[len] = '=';
- buf[len+1] = 0;
- if(putenv(buf) < 0)
- {
- err = errno;
- }
-# else
buf[len] = 0;
if(putenv(buf) < 0 && errno != EINVAL)
{
err = errno;
}
-# endif
if(buf != local_buf)
{
free(buf);
@@ -556,6 +645,30 @@ static int kwsysUnPutEnv(const std::string& env)
return 0;
}
+#elif defined(_WIN32)
+/* putenv("A=") places "A=" in the environment, which is as close to
+ removal as we can get with the putenv API. We have to leak the
+ most recent value placed in the environment for each variable name
+ on program exit in case exit routines access it. */
+
+static kwsysEnvSet kwsysUnPutEnvSet;
+
+static int kwsysUnPutEnv(std::string const& env)
+{
+ std::wstring wEnv = Encoding::ToWide(env);
+ size_t const pos = wEnv.find('=');
+ size_t const len = pos == wEnv.npos ? wEnv.size() : pos;
+ wEnv.resize(len+1, L'=');
+ wchar_t* newEnv = _wcsdup(wEnv.c_str());
+ if(!newEnv)
+ {
+ return -1;
+ }
+ kwsysEnvSet::Free oldEnv(kwsysUnPutEnvSet.Release(newEnv));
+ kwsysUnPutEnvSet.insert(newEnv);
+ return _wputenv(newEnv);
+}
+
#else
/* Manipulate the "environ" global directly. */
static int kwsysUnPutEnv(const std::string& env)
@@ -623,68 +736,46 @@ bool SystemTools::UnPutEnv(const std::string& env)
# pragma warning disable 444 /* base has non-virtual destructor */
# endif
-/* Order by environment key only (VAR from VAR=VALUE). */
-struct kwsysEnvCompare
+class kwsysEnv: public kwsysEnvSet
{
- bool operator() (const char* l, const char* r) const
- {
- const char* leq = strchr(l, '=');
- const char* req = strchr(r, '=');
- size_t llen = leq? (leq-l) : strlen(l);
- size_t rlen = req? (req-r) : strlen(r);
- if(llen == rlen)
- {
- return strncmp(l,r,llen) < 0;
- }
- else
- {
- return strcmp(l,r) < 0;
- }
- }
-};
-
-class kwsysEnv: public std::set<const char*, kwsysEnvCompare>
-{
- class Free
- {
- const char* Env;
- public:
- Free(const char* env): Env(env) {}
- ~Free() { free(const_cast<char*>(this->Env)); }
- };
public:
- typedef std::set<const char*, kwsysEnvCompare> derived;
~kwsysEnv()
{
- for(derived::iterator i = this->begin(); i != this->end(); ++i)
+ for(iterator i = this->begin(); i != this->end(); ++i)
{
+#if defined(_WIN32)
+ const std::string s = Encoding::ToNarrow(*i);
+ kwsysUnPutEnv(s.c_str());
+#else
kwsysUnPutEnv(*i);
- free(const_cast<char*>(*i));
- }
- }
- const char* Release(const char* env)
- {
- const char* old = 0;
- derived::iterator i = this->find(env);
- if(i != this->end())
- {
- old = *i;
- this->erase(i);
+#endif
+ free(const_cast<envchar*>(*i));
}
- return old;
}
bool Put(const char* env)
{
- Free oldEnv(this->Release(env));
- static_cast<void>(oldEnv);
+#if defined(_WIN32)
+ const std::wstring wEnv = Encoding::ToWide(env);
+ wchar_t* newEnv = _wcsdup(wEnv.c_str());
+#else
char* newEnv = strdup(env);
+#endif
+ Free oldEnv(this->Release(newEnv));
this->insert(newEnv);
+#if defined(_WIN32)
+ return _wputenv(newEnv) == 0;
+#else
return putenv(newEnv) == 0;
+#endif
}
bool UnPut(const char* env)
{
+#if defined(_WIN32)
+ const std::wstring wEnv = Encoding::ToWide(env);
+ Free oldEnv(this->Release(wEnv.c_str()));
+#else
Free oldEnv(this->Release(env));
- static_cast<void>(oldEnv);
+#endif
return kwsysUnPutEnv(env) == 0;
}
};
@@ -1201,6 +1292,32 @@ bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
}
//----------------------------------------------------------------------------
+bool SystemTools::PathExists(const std::string& path)
+{
+ if(path.empty())
+ {
+ return false;
+ }
+#if defined(__CYGWIN__)
+ // Convert path to native windows path if possible.
+ char winpath[MAX_PATH];
+ if(SystemTools::PathCygwinToWin32(path.c_str(), winpath))
+ {
+ return (GetFileAttributesA(winpath) != INVALID_FILE_ATTRIBUTES);
+ }
+ struct stat st;
+ return lstat(path.c_str(), &st) == 0;
+#elif defined(_WIN32)
+ return (GetFileAttributesW(
+ SystemTools::ConvertToWindowsExtendedPath(path).c_str())
+ != INVALID_FILE_ATTRIBUTES);
+#else
+ struct stat st;
+ return lstat(path.c_str(), &st) == 0;
+#endif
+}
+
+//----------------------------------------------------------------------------
bool SystemTools::FileExists(const char* filename)
{
if(!filename)
@@ -1230,8 +1347,13 @@ bool SystemTools::FileExists(const std::string& filename)
SystemTools::ConvertToWindowsExtendedPath(filename).c_str())
!= INVALID_FILE_ATTRIBUTES);
#else
+// SCO OpenServer 5.0.7/3.2's command has 711 permission.
+#if defined(_SCO_DS)
+ return access(filename.c_str(), F_OK) == 0;
+#else
return access(filename.c_str(), R_OK) == 0;
#endif
+#endif
}
//----------------------------------------------------------------------------
@@ -2044,8 +2166,8 @@ void SystemTools::ConvertToUnixSlashes(std::string& path)
pathCString = path.c_str();
if(pathCString[0] == '~' && (pathCString[1] == '/' || pathCString[1] == '\0'))
{
- const char* homeEnv = SystemTools::GetEnv("HOME");
- if (homeEnv)
+ std::string homeEnv;
+ if (SystemTools::GetEnv("HOME", homeEnv))
{
path.replace(0,1,homeEnv);
}
@@ -4061,16 +4183,9 @@ void SystemTools::SplitPath(const std::string& p,
if(root.size() == 1)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
- if(const char* userp = getenv("USERPROFILE"))
- {
- homedir = userp;
- }
- else
+ if (!SystemTools::GetEnv("USERPROFILE", homedir))
#endif
- if(const char* h = getenv("HOME"))
- {
- homedir = h;
- }
+ SystemTools::GetEnv("HOME", homedir);
}
#ifdef HAVE_GETPWNAM
else if(passwd* pw = getpwnam(root.c_str()+1))
@@ -4610,8 +4725,11 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
std::wstring wtempPath = Encoding::ToWide(tempPath);
DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0);
std::vector<wchar_t> buffer(ret);
- ret = GetShortPathNameW(wtempPath.c_str(),
- &buffer[0], static_cast<DWORD>(buffer.size()));
+ if (ret != 0)
+ {
+ ret = GetShortPathNameW(wtempPath.c_str(),
+ &buffer[0], static_cast<DWORD>(buffer.size()));
+ }
if (ret == 0)
{
@@ -4811,7 +4929,7 @@ int SystemTools::GetTerminalWidth()
int width = -1;
#ifdef HAVE_TTY_INFO
struct winsize ws;
- char *columns; /* Unix98 environment variable */
+ std::string columns; /* Unix98 environment variable */
if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0)
{
width = ws.ws_col;
@@ -4820,12 +4938,11 @@ int SystemTools::GetTerminalWidth()
{
width = -1;
}
- columns = getenv("COLUMNS");
- if(columns && *columns)
+ if(SystemTools::GetEnv("COLUMNS", columns) && !columns.empty())
{
long t;
char *endptr;
- t = strtol(columns, &endptr, 0);
+ t = strtol(columns.c_str(), &endptr, 0);
if(endptr && !*endptr && (t>0) && (t<1000))
{
width = static_cast<int>(t);
@@ -5371,6 +5488,7 @@ static unsigned int SystemToolsManagerCount;
SystemToolsTranslationMap *SystemTools::TranslationMap;
#ifdef _WIN32
SystemToolsPathCaseMap *SystemTools::PathCaseMap;
+SystemToolsEnvMap *SystemTools::EnvMap;
#endif
#ifdef __CYGWIN__
SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
@@ -5421,6 +5539,7 @@ void SystemTools::ClassInitialize()
SystemTools::TranslationMap = new SystemToolsTranslationMap;
#ifdef _WIN32
SystemTools::PathCaseMap = new SystemToolsPathCaseMap;
+ SystemTools::EnvMap = new SystemToolsEnvMap;
#endif
#ifdef __CYGWIN__
SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
@@ -5435,7 +5554,8 @@ void SystemTools::ClassInitialize()
// If the current working directory is a logical path then keep the
// logical name.
- if(const char* pwd = getenv("PWD"))
+ std::string pwd_str;
+ if(SystemTools::GetEnv("PWD", pwd_str))
{
char buf[2048];
if(const char* cwd = Getcwd(buf, 2048))
@@ -5447,10 +5567,9 @@ void SystemTools::ClassInitialize()
std::string pwd_changed;
// Test progressively shorter logical-to-physical mappings.
- std::string pwd_str = pwd;
std::string cwd_str = cwd;
std::string pwd_path;
- Realpath(pwd, pwd_path);
+ Realpath(pwd_str.c_str(), pwd_path);
while(cwd_str == pwd_path && cwd_str != pwd_str)
{
// The current pair of paths is a working logical mapping.
@@ -5480,6 +5599,7 @@ void SystemTools::ClassFinalize()
delete SystemTools::TranslationMap;
#ifdef _WIN32
delete SystemTools::PathCaseMap;
+ delete SystemTools::EnvMap;
#endif
#ifdef __CYGWIN__
delete SystemTools::Cyg2Win32Map;
@@ -5505,8 +5625,8 @@ static int SystemToolsDebugReport(int, char* message, int*)
void SystemTools::EnableMSVCDebugHook()
{
- if (getenv("DART_TEST_FROM_DART") ||
- getenv("DASHBOARD_TEST_FROM_CTEST"))
+ if (SystemTools::HasEnv("DART_TEST_FROM_DART") ||
+ SystemTools::HasEnv("DASHBOARD_TEST_FROM_CTEST"))
{
_CrtSetReportHook(SystemToolsDebugReport);
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index bba5a5c..28ff0b3 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -53,6 +53,7 @@ namespace @KWSYS_NAMESPACE@
class SystemToolsTranslationMap;
class SystemToolsPathCaseMap;
+class SystemToolsEnvMap;
/** \class SystemToolsManager
* \brief Use to make sure SystemTools is initialized before it is used
@@ -305,6 +306,11 @@ public:
static std::string ConvertToWindowsOutputPath(const std::string&);
/**
+ * Return true if a path with the given name exists in the current directory.
+ */
+ static bool PathExists(const std::string& path);
+
+ /**
* Return true if a file exists in the current directory.
* If isFile = true, then make sure the file is a file and
* not a directory. If isFile = false, then return true
@@ -843,6 +849,8 @@ public:
static const char* GetEnv(const std::string& key);
static bool GetEnv(const char* key, std::string& result);
static bool GetEnv(const std::string& key, std::string& result);
+ static bool HasEnv(const char* key);
+ static bool HasEnv(const std::string& key);
/** Put a string into the environment
of the form var=value */
@@ -981,6 +989,7 @@ private:
std::vector<std::string>(),
bool no_system_path = false);
+ static const char* GetEnvImpl(const char* key);
/**
* Path translation table from dir to refdir
@@ -989,6 +998,7 @@ private:
static SystemToolsTranslationMap *TranslationMap;
#ifdef _WIN32
static SystemToolsPathCaseMap *PathCaseMap;
+ static SystemToolsEnvMap *EnvMap;
#endif
#ifdef __CYGWIN__
static SystemToolsTranslationMap *Cyg2Win32Map;
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index fc87f91..b35808b 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -349,3 +349,8 @@ int main()
void f(std ::wstring*) {}
int main() { return 0; }
#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
+#include <ext/stdio_filebuf.h>
+int main() { return 0; }
+#endif
diff --git a/Source/kwsys/testAutoPtr.cxx b/Source/kwsys/testAutoPtr.cxx
deleted file mode 100644
index ed75ff4..0000000
--- a/Source/kwsys/testAutoPtr.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifdef __BORLANDC__
-# pragma warn -8027 /* 'for' not inlined. */
-# pragma warn -8026 /* exception not inlined. */
-#endif
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(auto_ptr.hxx)
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "auto_ptr.hxx.in"
-#endif
-
-#include <stdio.h>
-
-#define ASSERT(x,y) if (!(x)) { printf("FAIL: " y "\n"); status = 1; }
-
-int instances = 0; // don't declare as static
-
-struct A
-{
- A() { ++instances; }
- ~A() { --instances; }
- A* self() {return this; }
-};
-struct B: public A {};
-
-static int function_call(kwsys::auto_ptr<A> a)
-{
- return a.get()? 1:0;
-}
-
-static A* get_A(A& a) { return &a; }
-
-static kwsys::auto_ptr<A> generate_auto_ptr_A()
-{
- return kwsys::auto_ptr<A>(new A);
-}
-
-static kwsys::auto_ptr<B> generate_auto_ptr_B()
-{
- return kwsys::auto_ptr<B>(new B);
-}
-
-int testAutoPtr(int, char*[])
-{
- int status = 0;
-
- // Keep everything in a subscope so we can detect leaks.
- {
- kwsys::auto_ptr<A> pa0;
- kwsys::auto_ptr<A> pa1(new A());
- kwsys::auto_ptr<B> pb1(new B());
- kwsys::auto_ptr<B> pb2(new B());
- kwsys::auto_ptr<A> pa2(new B());
-
- A* ptr = get_A(*pa1);
- ASSERT(ptr == pa1.get(),
- "auto_ptr does not return correct object when dereferenced");
- ptr = pa1->self();
- ASSERT(ptr == pa1.get(),
- "auto_ptr does not return correct pointer from operator->");
-
- A* before = pa0.get();
- pa0.reset(new A());
- ASSERT(pa0.get() && pa0.get() != before,
- "auto_ptr empty after reset(new A())");
-
- before = pa0.get();
- pa0.reset(new B());
- ASSERT(pa0.get() && pa0.get() != before,
- "auto_ptr empty after reset(new B())");
-
- delete pa0.release();
- ASSERT(!pa0.get(), "auto_ptr holds an object after release()");
-
- kwsys::auto_ptr<A> pa3(pb1);
- ASSERT(!pb1.get(),
- "auto_ptr full after being used to construct another");
- ASSERT(pa3.get(),
- "auto_ptr empty after construction from another");
-
- {
- kwsys::auto_ptr<A> pa;
- pa = pa3;
- ASSERT(!pa3.get(),
- "auto_ptr full after assignment to another");
- ASSERT(pa.get(),
- "auto_ptr empty after assignment from another");
- }
-
- {
- kwsys::auto_ptr<A> pa;
- pa = pb2;
- ASSERT(!pb2.get(),
- "auto_ptr full after assignment to compatible");
- ASSERT(pa.get(),
- "auto_ptr empty after assignment from compatible");
- }
-
- {
- int receive = function_call(pa2);
- ASSERT(receive,
- "auto_ptr did not receive ownership in called function");
- ASSERT(!pa2.get(),
- "auto_ptr did not release ownership to called function");
- }
-
- {
- int received = function_call(generate_auto_ptr_A());
- ASSERT(received,
- "auto_ptr in called function did not take ownership "
- "from factory function");
- }
-
-#if 0
- // Is this allowed by the standard?
- {
- int received = function_call(generate_auto_ptr_B());
- ASSERT(received,
- "auto_ptr in called function did not take ownership "
- "from factory function with conversion");
- }
-#endif
-
- {
- kwsys::auto_ptr<A> pa(generate_auto_ptr_A());
- ASSERT(pa.get(),
- "auto_ptr empty after construction from factory function");
- }
-
- {
- kwsys::auto_ptr<A> pa;
- pa = generate_auto_ptr_A();
- ASSERT(pa.get(),
- "auto_ptr empty after assignment from factory function");
- }
-
- {
- kwsys::auto_ptr<A> pa(generate_auto_ptr_B());
- ASSERT(pa.get(),
- "auto_ptr empty after construction from compatible factory function");
- }
-
- {
- kwsys::auto_ptr<A> pa;
- pa = generate_auto_ptr_B();
- ASSERT(pa.get(),
- "auto_ptr empty after assignment from compatible factory function");
- }
- }
-
- ASSERT(instances == 0, "auto_ptr leaked an object");
-
- return status;
-}
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 4d97688..9252ea6 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -204,6 +204,14 @@ static bool CheckFileOperations()
<< testNewDir << std::endl;
res = false;
}
+ // check existence
+ if (!kwsys::SystemTools::PathExists(testNewDir))
+ {
+ std::cerr
+ << "Problem with PathExists for: "
+ << testNewDir << std::endl;
+ res = false;
+ }
// remove it
if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
{
@@ -221,6 +229,15 @@ static bool CheckFileOperations()
<< testNewDir << std::endl;
res = false;
}
+ // check existence
+ if (kwsys::SystemTools::PathExists(testNewDir))
+ {
+ std::cerr
+ << "After RemoveADirectory: "
+ << "Problem with PathExists for: "
+ << testNewDir << std::endl;
+ res = false;
+ }
// create it using the char* version
if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str()))
{
@@ -329,6 +346,31 @@ static bool CheckFileOperations()
res = false;
}
+ // calling with an empty string should return false
+ if (kwsys::SystemTools::PathExists(std::string()))
+ {
+ std::cerr
+ << "Problem with PathExists(std::string())"
+ << std::endl;
+ res = false;
+ }
+ // PathExists(x) should return true on a directory
+ if (!kwsys::SystemTools::PathExists(testNewDir))
+ {
+ std::cerr
+ << "Problem with PathExists for: "
+ << testNewDir << std::endl;
+ res = false;
+ }
+ // should work, was created as new file before
+ if (!kwsys::SystemTools::PathExists(testNewFile))
+ {
+ std::cerr
+ << "Problem with PathExists for: "
+ << testNewDir << std::endl;
+ res = false;
+ }
+
// Reset umask
#if defined(_WIN32) && !defined(__CYGWIN__)
// NOTE: Windows doesn't support toggling _S_IREAD.
@@ -848,9 +890,9 @@ static bool CheckPutEnv(const std::string& env, const char* name, const char* va
<< "\") failed!" << std::endl;
return false;
}
- const char* v = kwsys::SystemTools::GetEnv(name);
- v = v? v : "(null)";
- if(strcmp(v, value) != 0)
+ std::string v = "(null)";
+ kwsys::SystemTools::GetEnv(name, v);
+ if(v != value)
{
std::cerr << "GetEnv(\"" << name << "\") returned \""
<< v << "\", not \"" << value << "\"!" << std::endl;
@@ -867,7 +909,8 @@ static bool CheckUnPutEnv(const char* env, const char* name)
<< std::endl;
return false;
}
- if(const char* v = kwsys::SystemTools::GetEnv(name))
+ std::string v;
+ if(kwsys::SystemTools::GetEnv(name, v))
{
std::cerr << "GetEnv(\"" << name << "\") returned \""
<< v << "\", not (null)!" << std::endl;