summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeCPack.cmake345
-rw-r--r--CMakeLists.txt83
-rw-r--r--Help/generator/VS_TOOLSET_HOST_ARCH.txt10
-rw-r--r--Help/generator/Visual Studio 10 2010.rst7
-rw-r--r--Help/generator/Visual Studio 11 2012.rst7
-rw-r--r--Help/generator/Visual Studio 12 2013.rst9
-rw-r--r--Help/generator/Visual Studio 14 2015.rst9
-rw-r--r--Help/generator/Visual Studio 15.rst9
-rw-r--r--Help/generator/Xcode.rst7
-rw-r--r--Help/manual/OPTIONS_BUILD.txt11
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst3
-rw-r--r--Help/prop_test/TIMEOUT_AFTER_MATCH.rst4
-rw-r--r--Help/prop_tgt/BUILD_RPATH.rst10
-rw-r--r--Help/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.rst22
-rw-r--r--Help/release/3.7.rst2
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/ExternalData-multiple-hashes.rst7
-rw-r--r--Help/release/dev/add-BUILD_RPATH.rst6
-rw-r--r--Help/release/dev/allow-fallback-config-mapping.rst6
-rw-r--r--Help/release/dev/cpack-rpm-single-debuginfo.rst11
-rw-r--r--Help/release/dev/external-project-clone-progress.rst5
-rw-r--r--Help/release/dev/math-EXPR-unary.rst5
-rw-r--r--Help/release/dev/st2-exclude-patterns-variable.rst7
-rw-r--r--Help/release/dev/vs-host-x64-tools.rst7
-rw-r--r--Help/release/index.rst2
-rw-r--r--Help/variable/CMAKE_BUILD_RPATH.rst10
-rw-r--r--Help/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE.rst7
-rw-r--r--Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst10
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake5
-rw-r--r--Modules/CPackRPM.cmake322
-rw-r--r--Modules/CTestUseLaunchers.cmake4
-rw-r--r--Modules/CheckFunctionExists.c2
-rw-r--r--Modules/CompilerId/VS-10.vcxproj.in3
-rw-r--r--Modules/ExternalData.cmake110
-rw-r--r--Modules/ExternalProject.cmake64
-rw-r--r--Modules/FindBoost.cmake24
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/FindSDL.cmake7
-rw-r--r--Modules/Platform/Darwin.cmake2
-rw-r--r--Source/CMakeLists.txt304
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h1
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx2
-rw-r--r--Source/CPack/cmCPack7zGenerator.h1
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h3
-rw-r--r--Source/CPack/cmCPackDebGenerator.h1
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.h21
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h9
-rw-r--r--Source/CPack/cmCPackLog.cxx2
-rw-r--r--Source/CPack/cmCPackLog.h19
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h1
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h3
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx245
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h1
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h1
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h1
-rw-r--r--Source/CPack/cmCPackTXZGenerator.h1
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h1
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h1
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h1
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h3
-rw-r--r--Source/CTest/cmCTestBuildCommand.h3
-rw-r--r--Source/CTest/cmCTestBuildHandler.h3
-rw-r--r--Source/CTest/cmCTestCommand.h2
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx4
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h3
-rw-r--r--Source/CTest/cmCTestConfigureHandler.h3
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h3
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h3
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h3
-rw-r--r--Source/CTest/cmCTestGenericHandler.h5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h3
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h3
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h3
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h3
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx3
-rw-r--r--Source/CTest/cmCTestScriptHandler.h3
-rw-r--r--Source/CTest/cmCTestSleepCommand.h3
-rw-r--r--Source/CTest/cmCTestStartCommand.h3
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx1
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h3
-rw-r--r--Source/CTest/cmCTestTestCommand.h3
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx9
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h3
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h3
-rw-r--r--Source/CTest/cmCTestUploadCommand.h3
-rw-r--r--Source/CTest/cmCTestUploadHandler.h3
-rw-r--r--Source/CTest/cmProcess.cxx1
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx11
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx32
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h4
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.cxx6
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesWidget.h6
-rw-r--r--Source/QtDialog/QCMake.cxx26
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx4
-rw-r--r--Source/cmAddCompileOptionsCommand.h8
-rw-r--r--Source/cmAddCustomCommandCommand.h2
-rw-r--r--Source/cmAddCustomTargetCommand.h2
-rw-r--r--Source/cmAddDefinitionsCommand.h2
-rw-r--r--Source/cmAddDependenciesCommand.h2
-rw-r--r--Source/cmAddExecutableCommand.cxx8
-rw-r--r--Source/cmAddExecutableCommand.h2
-rw-r--r--Source/cmAddLibraryCommand.cxx70
-rw-r--r--Source/cmAddLibraryCommand.h2
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx2
-rw-r--r--Source/cmAddSubDirectoryCommand.h2
-rw-r--r--Source/cmAddTestCommand.h2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx10
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h8
-rw-r--r--Source/cmBootstrapCommands1.cxx87
-rw-r--r--Source/cmBootstrapCommands2.cxx94
-rw-r--r--Source/cmBreakCommand.h2
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildCommand.h2
-rw-r--r--Source/cmBuildNameCommand.cxx12
-rw-r--r--Source/cmBuildNameCommand.h7
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx7
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h12
-rw-r--r--Source/cmCMakeMinimumRequired.cxx1
-rw-r--r--Source/cmCMakeMinimumRequired.h2
-rw-r--r--Source/cmCMakePolicyCommand.cxx3
-rw-r--r--Source/cmCMakePolicyCommand.h2
-rw-r--r--Source/cmCPluginAPI.cxx66
-rw-r--r--Source/cmCTest.cxx10
-rw-r--r--Source/cmCacheManager.cxx34
-rw-r--r--Source/cmCacheManager.h19
-rw-r--r--Source/cmCommand.cxx48
-rw-r--r--Source/cmCommand.h86
-rw-r--r--Source/cmCommands.cxx238
-rw-r--r--Source/cmCommands.cxx.in10
-rw-r--r--Source/cmCommands.h10
-rw-r--r--Source/cmCommandsForBootstrap.cxx7
-rw-r--r--Source/cmCommonTargetGenerator.cxx15
-rw-r--r--Source/cmCommonTargetGenerator.h4
-rw-r--r--Source/cmComputeLinkDepends.cxx6
-rw-r--r--Source/cmComputeLinkInformation.cxx52
-rw-r--r--Source/cmComputeTargetDepends.cxx21
-rw-r--r--Source/cmConditionEvaluator.cxx13
-rw-r--r--Source/cmConfigureFileCommand.cxx2
-rw-r--r--Source/cmConfigureFileCommand.h2
-rw-r--r--Source/cmContinueCommand.cxx3
-rw-r--r--Source/cmContinueCommand.h2
-rw-r--r--Source/cmConvertMSBuildXMLToJSON.py453
-rw-r--r--Source/cmCoreTryCompile.cxx40
-rw-r--r--Source/cmCoreTryCompile.h4
-rw-r--r--Source/cmCreateTestSourceList.cxx1
-rw-r--r--Source/cmCreateTestSourceList.h2
-rw-r--r--Source/cmCustomCommandGenerator.cxx8
-rw-r--r--Source/cmDefinePropertyCommand.cxx1
-rw-r--r--Source/cmDefinePropertyCommand.h2
-rw-r--r--Source/cmDefinitions.h21
-rw-r--r--Source/cmDependsFortran.cxx46
-rw-r--r--Source/cmDependsFortran.h3
-rw-r--r--Source/cmELF.cxx224
-rw-r--r--Source/cmELF.h23
-rw-r--r--Source/cmElseCommand.h2
-rw-r--r--Source/cmElseIfCommand.cxx2
-rw-r--r--Source/cmElseIfCommand.h10
-rw-r--r--Source/cmEnableLanguageCommand.h2
-rw-r--r--Source/cmEnableTestingCommand.h2
-rw-r--r--Source/cmEndForEachCommand.h2
-rw-r--r--Source/cmEndFunctionCommand.h2
-rw-r--r--Source/cmEndIfCommand.h2
-rw-r--r--Source/cmEndMacroCommand.h2
-rw-r--r--Source/cmEndWhileCommand.h2
-rw-r--r--Source/cmExecProgramCommand.h2
-rw-r--r--Source/cmExecuteProcessCommand.h2
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx24
-rw-r--r--Source/cmExportBuildFileGenerator.cxx10
-rw-r--r--Source/cmExportCommand.cxx22
-rw-r--r--Source/cmExportCommand.h9
-rw-r--r--Source/cmExportFileGenerator.cxx20
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx2
-rw-r--r--Source/cmExportInstallFileGenerator.cxx8
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx16
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h7
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx4
-rw-r--r--Source/cmExprParser.cxx1768
-rw-r--r--Source/cmExprParser.y157
-rw-r--r--Source/cmExprParserTokens.h94
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx44
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx44
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx36
-rw-r--r--Source/cmExtraKateGenerator.cxx16
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx31
-rw-r--r--Source/cmExtraSublimeTextGenerator.h2
-rw-r--r--Source/cmFLTKWrapUICommand.cxx8
-rw-r--r--Source/cmFLTKWrapUICommand.h9
-rw-r--r--Source/cmFileCommand.cxx62
-rw-r--r--Source/cmFileCommand.h2
-rw-r--r--Source/cmFileMonitor.cxx4
-rw-r--r--Source/cmFileTimeComparison.cxx34
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindBase.h1
-rw-r--r--Source/cmFindCommon.cxx2
-rw-r--r--Source/cmFindCommon.h1
-rw-r--r--Source/cmFindFileCommand.h2
-rw-r--r--Source/cmFindLibraryCommand.cxx11
-rw-r--r--Source/cmFindLibraryCommand.h2
-rw-r--r--Source/cmFindPackageCommand.cxx22
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmFindPathCommand.cxx9
-rw-r--r--Source/cmFindPathCommand.h1
-rw-r--r--Source/cmFindProgramCommand.cxx8
-rw-r--r--Source/cmFindProgramCommand.h2
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmForEachCommand.h2
-rw-r--r--Source/cmFunctionCommand.cxx11
-rw-r--r--Source/cmFunctionCommand.h2
-rw-r--r--Source/cmGeneratedFileStream.cxx19
-rw-r--r--Source/cmGeneratedFileStream.h7
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx5
-rw-r--r--Source/cmGeneratorExpressionNode.cxx24
-rw-r--r--Source/cmGeneratorTarget.cxx313
-rw-r--r--Source/cmGeneratorTarget.h13
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx1
-rw-r--r--Source/cmGetCMakePropertyCommand.h2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h2
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx12
-rw-r--r--Source/cmGetFilenameComponentCommand.h2
-rw-r--r--Source/cmGetPropertyCommand.cxx16
-rw-r--r--Source/cmGetPropertyCommand.h2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx13
-rw-r--r--Source/cmGetTargetPropertyCommand.h2
-rw-r--r--Source/cmGetTestPropertyCommand.h2
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx25
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx77
-rw-r--r--Source/cmGlobalGenerator.h52
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx9
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h2
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx4
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx94
-rw-r--r--Source/cmGlobalNinjaGenerator.h13
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx89
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx44
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h7
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx15
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx26
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx10
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx46
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h5
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx165
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmGraphVizWriter.cxx18
-rw-r--r--Source/cmGraphVizWriter.h4
-rw-r--r--Source/cmHexFileConverter.cxx4
-rw-r--r--Source/cmIfCommand.cxx1
-rw-r--r--Source/cmIfCommand.h2
-rw-r--r--Source/cmIncludeCommand.cxx3
-rw-r--r--Source/cmIncludeCommand.h2
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmIncludeDirectoryCommand.h2
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx12
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h8
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h2
-rw-r--r--Source/cmInstallCommand.cxx28
-rw-r--r--Source/cmInstallCommand.h2
-rw-r--r--Source/cmInstallFilesCommand.cxx2
-rw-r--r--Source/cmInstallFilesCommand.h2
-rw-r--r--Source/cmInstallProgramsCommand.cxx8
-rw-r--r--Source/cmInstallProgramsCommand.h8
-rw-r--r--Source/cmInstallTargetGenerator.cxx46
-rw-r--r--Source/cmInstallTargetsCommand.cxx2
-rw-r--r--Source/cmInstallTargetsCommand.h2
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmLinkDirectoriesCommand.h2
-rw-r--r--Source/cmLinkLibrariesCommand.cxx11
-rw-r--r--Source/cmLinkLibrariesCommand.h8
-rw-r--r--Source/cmLinkLineComputer.cxx181
-rw-r--r--Source/cmLinkLineComputer.h50
-rw-r--r--Source/cmListCommand.cxx1
-rw-r--r--Source/cmListCommand.h2
-rw-r--r--Source/cmListFileCache.cxx7
-rw-r--r--Source/cmListFileCache.h12
-rw-r--r--Source/cmLoadCacheCommand.cxx10
-rw-r--r--Source/cmLoadCacheCommand.h9
-rw-r--r--Source/cmLoadCommandCommand.cxx15
-rw-r--r--Source/cmLoadCommandCommand.h7
-rw-r--r--Source/cmLocalGenerator.cxx692
-rw-r--r--Source/cmLocalGenerator.h91
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx47
-rw-r--r--Source/cmLocalNinjaGenerator.h12
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx90
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx79
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx36
-rw-r--r--Source/cmMSVC60LinkLineComputer.h19
-rw-r--r--Source/cmMacroCommand.cxx11
-rw-r--r--Source/cmMacroCommand.h2
-rw-r--r--Source/cmMakeDirectoryCommand.cxx2
-rw-r--r--Source/cmMakeDirectoryCommand.h2
-rw-r--r--Source/cmMakefile.cxx225
-rw-r--r--Source/cmMakefile.h67
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx77
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx148
-rw-r--r--Source/cmMakefileTargetGenerator.cxx213
-rw-r--r--Source/cmMakefileTargetGenerator.h13
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx5
-rw-r--r--Source/cmMarkAsAdvancedCommand.h2
-rw-r--r--Source/cmMathCommand.h2
-rw-r--r--Source/cmMessageCommand.cxx1
-rw-r--r--Source/cmMessageCommand.h2
-rw-r--r--Source/cmNinjaLinkLineComputer.cxx19
-rw-r--r--Source/cmNinjaLinkLineComputer.h26
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx91
-rw-r--r--Source/cmNinjaTargetGenerator.cxx76
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx4
-rw-r--r--Source/cmObject.h41
-rw-r--r--Source/cmOptionCommand.cxx7
-rw-r--r--Source/cmOptionCommand.h2
-rw-r--r--Source/cmOutputConverter.cxx104
-rw-r--r--Source/cmOutputConverter.h42
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx12
-rw-r--r--Source/cmOutputRequiredFilesCommand.h8
-rw-r--r--Source/cmParseArgumentsCommand.cxx1
-rw-r--r--Source/cmParseArgumentsCommand.h2
-rw-r--r--Source/cmPolicies.cxx3
-rw-r--r--Source/cmProjectCommand.cxx8
-rw-r--r--Source/cmProjectCommand.h2
-rw-r--r--Source/cmQTWrapCPPCommand.cxx7
-rw-r--r--Source/cmQTWrapCPPCommand.h8
-rw-r--r--Source/cmQTWrapUICommand.cxx7
-rw-r--r--Source/cmQTWrapUICommand.h7
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx1
-rw-r--r--Source/cmQtAutoGenerators.cxx4
-rw-r--r--Source/cmRemoveCommand.cxx5
-rw-r--r--Source/cmRemoveCommand.h8
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx4
-rw-r--r--Source/cmRemoveDefinitionsCommand.h8
-rw-r--r--Source/cmReturnCommand.cxx2
-rw-r--r--Source/cmReturnCommand.h2
-rw-r--r--Source/cmRulePlaceholderExpander.cxx304
-rw-r--r--Source/cmRulePlaceholderExpander.h83
-rw-r--r--Source/cmSearchPath.cxx1
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx2
-rw-r--r--Source/cmSeparateArgumentsCommand.h2
-rw-r--r--Source/cmServerProtocol.cxx32
-rw-r--r--Source/cmSetCommand.cxx12
-rw-r--r--Source/cmSetCommand.h2
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h2
-rw-r--r--Source/cmSetPropertyCommand.cxx4
-rw-r--r--Source/cmSetPropertyCommand.h2
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx1
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h2
-rw-r--r--Source/cmSetTargetPropertiesCommand.h2
-rw-r--r--Source/cmSetTestsPropertiesCommand.h2
-rw-r--r--Source/cmSiteNameCommand.cxx5
-rw-r--r--Source/cmSiteNameCommand.h2
-rw-r--r--Source/cmSourceFile.cxx1
-rw-r--r--Source/cmSourceGroupCommand.cxx8
-rw-r--r--Source/cmSourceGroupCommand.h8
-rw-r--r--Source/cmStandardIncludes.h1
-rw-r--r--Source/cmState.cxx1131
-rw-r--r--Source/cmState.h234
-rw-r--r--Source/cmStateDirectory.cxx518
-rw-r--r--Source/cmStateDirectory.h82
-rw-r--r--Source/cmStatePrivate.h94
-rw-r--r--Source/cmStateSnapshot.cxx415
-rw-r--r--Source/cmStateSnapshot.h88
-rw-r--r--Source/cmStateTypes.h55
-rw-r--r--Source/cmStringCommand.cxx1
-rw-r--r--Source/cmStringCommand.h2
-rw-r--r--Source/cmSubdirCommand.cxx2
-rw-r--r--Source/cmSubdirCommand.h2
-rw-r--r--Source/cmSubdirDependsCommand.cxx4
-rw-r--r--Source/cmSubdirDependsCommand.h7
-rw-r--r--Source/cmSystemTools.cxx73
-rw-r--r--Source/cmTarget.cxx633
-rw-r--r--Source/cmTarget.h56
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx7
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h10
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx8
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h10
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx9
-rw-r--r--Source/cmTargetCompileOptionsCommand.h10
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx10
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h10
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx43
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h2
-rw-r--r--Source/cmTargetPropCommandBase.cxx14
-rw-r--r--Source/cmTargetPropCommandBase.h2
-rw-r--r--Source/cmTargetPropertyComputer.cxx90
-rw-r--r--Source/cmTargetPropertyComputer.h111
-rw-r--r--Source/cmTargetSourcesCommand.cxx10
-rw-r--r--Source/cmTargetSourcesCommand.h10
-rw-r--r--Source/cmTest.cxx1
-rw-r--r--Source/cmTestGenerator.cxx4
-rw-r--r--Source/cmTimestamp.cxx2
-rw-r--r--Source/cmTryCompileCommand.h2
-rw-r--r--Source/cmTryRunCommand.cxx14
-rw-r--r--Source/cmTryRunCommand.h2
-rw-r--r--Source/cmTypeMacro.h31
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmUnsetCommand.h2
-rw-r--r--Source/cmUseMangledMesaCommand.cxx7
-rw-r--r--Source/cmUseMangledMesaCommand.h7
-rw-r--r--Source/cmUtilitySourceCommand.cxx14
-rw-r--r--Source/cmUtilitySourceCommand.h7
-rw-r--r--Source/cmVariableRequiresCommand.cxx5
-rw-r--r--Source/cmVariableRequiresCommand.h7
-rw-r--r--Source/cmVariableWatchCommand.cxx7
-rw-r--r--Source/cmVariableWatchCommand.h9
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx115
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx5
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h1
-rw-r--r--Source/cmWhileCommand.cxx1
-rw-r--r--Source/cmWhileCommand.h2
-rw-r--r--Source/cmWriteFileCommand.cxx5
-rw-r--r--Source/cmWriteFileCommand.h8
-rw-r--r--Source/cm_codecvt.cxx215
-rw-r--r--Source/cm_codecvt.hxx57
-rw-r--r--Source/cm_unordered_map.hxx25
-rw-r--r--Source/cm_unordered_set.hxx25
-rw-r--r--Source/cmake.cxx185
-rw-r--r--Source/cmake.h15
-rw-r--r--Source/cmakemain.cxx6
-rw-r--r--Source/cmcldeps.cxx11
-rw-r--r--Source/cmcmd.cxx96
-rw-r--r--Source/ctest.cxx4
-rw-r--r--Tests/BootstrapTest.cmake9
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindPackageModeMakefileTest/CMakeLists.txt13
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt8
-rw-r--r--Tests/GeneratorExpression/check-part3.cmake2
-rw-r--r--Tests/MacRuntimePath/A/CMakeLists.txt15
-rw-r--r--Tests/MathTest/CMakeLists.txt3
-rw-r--r--Tests/Module/ExternalData/CMakeLists.txt2
-rw-r--r--Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md51
-rw-r--r--Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha11
-rw-r--r--Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md51
-rw-r--r--Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha11
-rw-r--r--Tests/RunCMake/CPack/MAIN_COMPONENT.cmake14
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake30
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake56
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake1
-rw-r--r--Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt2
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake2
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt2
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake2
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt2
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake2
-rw-r--r--Tests/RunCMake/Ninja/NinjaToolMissing-result.txt1
-rw-r--r--Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt6
-rw-r--r--Tests/RunCMake/Ninja/NinjaToolMissing.cmake0
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/ctest_build/CMakeLists.txt.in1
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/ctest_build/test.cmake.in1
-rw-r--r--Utilities/GitSetup/config2
-rw-r--r--Utilities/Release/README2
-rw-r--r--Utilities/Release/linux64_release.cmake1
-rw-r--r--Utilities/Release/osx_release.cmake2
-rwxr-xr-xbootstrap190
504 files changed, 9648 insertions, 6346 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index 1889be2..fc042bc 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -1,205 +1,200 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-# If the cmake version includes cpack, use it
-if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
- if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
- option(CMAKE_INSTALL_DEBUG_LIBRARIES
- "Install Microsoft runtime debug libraries with CMake." FALSE)
- mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
-
- # By default, do not warn when built on machines using only VS Express:
- if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
- set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
- endif()
+option(CMAKE_INSTALL_DEBUG_LIBRARIES
+ "Install Microsoft runtime debug libraries with CMake." FALSE)
+mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
- if(CMake_INSTALL_DEPENDENCIES)
- include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
- endif()
- endif()
+# By default, do not warn when built on machines using only VS Express:
+if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
+ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
+endif()
- set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
- set(CPACK_PACKAGE_VENDOR "Kitware")
- set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
- set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
- set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
- set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
- set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
- set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
+if(CMake_INSTALL_DEPENDENCIES)
+ include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
+endif()
- # Installers for 32- vs. 64-bit CMake:
- # - Root install directory (displayed to end user at installer-run time)
- # - "NSIS package/display name" (text used in the installer GUI)
- # - Registry key used to store info about the installation
- if(CMAKE_CL_64)
- set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
- set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
+set(CPACK_PACKAGE_VENDOR "Kitware")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
+
+# Installers for 32- vs. 64-bit CMake:
+# - Root install directory (displayed to end user at installer-run time)
+# - "NSIS package/display name" (text used in the installer GUI)
+# - Registry key used to store info about the installation
+if(CMAKE_CL_64)
+ set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
+ set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
+else()
+ set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
+ set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+endif()
+set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
+
+if(NOT DEFINED CPACK_SYSTEM_NAME)
+ # make sure package is not Cygwin-unknown, for Cygwin just
+ # cygwin is good for the system name
+ if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
+ set(CPACK_SYSTEM_NAME Cygwin)
else()
- set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
- set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
- endif()
- set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
-
- if(NOT DEFINED CPACK_SYSTEM_NAME)
- # make sure package is not Cygwin-unknown, for Cygwin just
- # cygwin is good for the system name
- if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
- set(CPACK_SYSTEM_NAME Cygwin)
- else()
- set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
- endif()
+ set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif()
- if(${CPACK_SYSTEM_NAME} MATCHES Windows)
- if(CMAKE_CL_64)
- set(CPACK_SYSTEM_NAME win64-x64)
- set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
- else()
- set(CPACK_SYSTEM_NAME win32-x86)
- endif()
+endif()
+if(${CPACK_SYSTEM_NAME} MATCHES Windows)
+ if(CMAKE_CL_64)
+ set(CPACK_SYSTEM_NAME win64-x64)
+ set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
+ else()
+ set(CPACK_SYSTEM_NAME win32-x86)
endif()
+endif()
- # Components
- if(CMake_INSTALL_COMPONENTS)
- set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
- if(WIN32 AND NOT CYGWIN)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
- endif()
- if(APPLE)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
- endif()
- if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
- set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
- ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
- else()
- set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
- endif()
- list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
- string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
- _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
- if(BUILD_CursesDialog)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
- endif()
- if(BUILD_QtDialog)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
- if(USE_LGPL)
- set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES
- \"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\")")
- endif()
- endif()
- if(SPHINX_MAN)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
- endif()
- if(SPHINX_HTML)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
- endif()
- if(SPHINX_SINGLEHTML)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
+# Components
+if(CMake_INSTALL_COMPONENTS)
+ set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
+ if(WIN32 AND NOT CYGWIN)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
+ endif()
+ if(APPLE)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
+ endif()
+ if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
+ set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
+ ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
+ else()
+ set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
+ endif()
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
+ string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
+ _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
+ if(BUILD_CursesDialog)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
+ endif()
+ if(BUILD_QtDialog)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
+ if(USE_LGPL)
+ set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES
+ \"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\")")
endif()
- if(SPHINX_QTHELP)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
+ endif()
+ if(SPHINX_MAN)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
+ endif()
+ if(SPHINX_HTML)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
+ endif()
+ if(SPHINX_SINGLEHTML)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
+ endif()
+ if(SPHINX_QTHELP)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
+ endif()
+ if(CMake_BUILD_DEVELOPER_REFERENCE)
+ if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
endif()
- if(CMake_BUILD_DEVELOPER_REFERENCE)
- if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
- endif()
- if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
- list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-qthelp)
- endif()
+ if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-qthelp)
endif()
- set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
- # Components
- set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
- set(CPACK_COMPONENTS_GROUPING IGNORE)
+ endif()
+ set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
+# Components
+set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
+set(CPACK_COMPONENTS_GROUPING IGNORE)
")
- else()
- if(BUILD_QtDialog AND USE_LGPL)
- set(_CPACK_IFW_ADDITIONAL_LICENSES
- "\"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\"")
- endif()
+else()
+ if(BUILD_QtDialog AND USE_LGPL)
+ set(_CPACK_IFW_ADDITIONAL_LICENSES
+ "\"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\"")
endif()
+endif()
- # Components scripts configuration
- foreach(_script
- CMake
- CMake.Documentation.SphinxHTML
- CMake.DeveloperReference.HTML)
- configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
- "${CMake_BINARY_DIR}/${_script}.qs" @ONLY)
- endforeach()
-
- if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
- set(_CPACK_IFW_PACKAGE_ICON
- "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
- if(BUILD_QtDialog)
- set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
- endif()
- if(SPHINX_HTML)
- set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
- endif()
- if(CMake_BUILD_DEVELOPER_REFERENCE)
- if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
- set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/developer-reference/html/index.html\", \"@StartMenuDir@/CMake Developer Reference.lnk\");\n")
- endif()
- endif()
- configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
- "${CMake_BINARY_DIR}/installscript.qs" @ONLY
- )
- install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
- DESTINATION "${CMAKE_DOC_DIR}"
- )
- if(CMake_INSTALL_COMPONENTS)
- set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs")
- else()
- set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
+# Components scripts configuration
+foreach(_script
+ CMake
+ CMake.Documentation.SphinxHTML
+ CMake.DeveloperReference.HTML)
+ configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
+ "${CMake_BINARY_DIR}/${_script}.qs" @ONLY)
+endforeach()
+
+if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
+ set(_CPACK_IFW_PACKAGE_ICON
+ "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
+ if(BUILD_QtDialog)
+ set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
+ endif()
+ if(SPHINX_HTML)
+ set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
+ endif()
+ if(CMake_BUILD_DEVELOPER_REFERENCE)
+ if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
+ set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/developer-reference/html/index.html\", \"@StartMenuDir@/CMake Developer Reference.lnk\");\n")
endif()
endif()
-
- if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
- set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
- set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
+ configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
+ "${CMake_BINARY_DIR}/installscript.qs" @ONLY
+ )
+ install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
+ DESTINATION "${CMAKE_DOC_DIR}"
+ )
+ if(CMake_INSTALL_COMPONENTS)
+ set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs")
+ else()
+ set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
endif()
+endif()
- set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
+if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
+ set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
+ set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
+endif()
- if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
- # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
- # default to source package - system, on cygwin system is not
- # needed
- if(CYGWIN)
- set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
- else()
- set(CPACK_PACKAGE_FILE_NAME
- "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
- endif()
+set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
+
+if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
+ # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
+ # default to source package - system, on cygwin system is not
+ # needed
+ if(CYGWIN)
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+ else()
+ set(CPACK_PACKAGE_FILE_NAME
+ "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
endif()
+endif()
- set(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
+set(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
- if(UNIX)
- set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest")
- set(CPACK_SOURCE_STRIP_FILES "")
- set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
- endif()
+if(UNIX)
+ set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest")
+ set(CPACK_SOURCE_STRIP_FILES "")
+ set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
+endif()
- set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
+set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
- if(MSVC AND NOT "$ENV{WIX}" STREQUAL "")
- set(WIX_CUSTOM_ACTION_ENABLED TRUE)
- if(CMAKE_CONFIGURATION_TYPES)
- set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
- else()
- set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
- endif()
+if(MSVC AND NOT "$ENV{WIX}" STREQUAL "")
+ set(WIX_CUSTOM_ACTION_ENABLED TRUE)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
else()
- set(WIX_CUSTOM_ACTION_ENABLED FALSE)
+ set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
endif()
+else()
+ set(WIX_CUSTOM_ACTION_ENABLED FALSE)
+endif()
- # Set the options file that needs to be included inside CMakeCPackOptions.cmake
- set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
- configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
- "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
- set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
+# Set the options file that needs to be included inside CMakeCPackOptions.cmake
+set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
+configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
+ "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
+set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
- # include CPack model once all variables are set
- include(CPack)
-endif()
+# include CPack model once all variables are set
+include(CPack)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4a577c..b8a635f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -366,31 +366,55 @@ macro (CMAKE_BUILD_UTILITIES)
set(CMAKE_COMPRESS_LIBRARIES "cmcompress")
add_subdirectory(Utilities/cmcompress)
CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
- if(CMAKE_USE_SYSTEM_BZIP2)
- find_package(BZip2)
+
+ #---------------------------------------------------------------------
+ # Build expat library for CMake, CTest, and libarchive.
+ if(CMAKE_USE_SYSTEM_EXPAT)
+ find_package(EXPAT)
+ if(NOT EXPAT_FOUND)
+ message(FATAL_ERROR
+ "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
+ endif()
+ set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
+ set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
else()
- set(BZIP2_INCLUDE_DIR
- "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
- set(BZIP2_LIBRARIES cmbzip2)
- add_subdirectory(Utilities/cmbzip2)
- CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
+ set(CMAKE_EXPAT_INCLUDES)
+ set(CMAKE_EXPAT_LIBRARIES cmexpat)
+ add_subdirectory(Utilities/cmexpat)
+ CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
+ endif()
+
+ #---------------------------------------------------------------------
+ # Build or use system libbz2 for libarchive.
+ if(NOT CMAKE_USE_SYSTEM_LIBARCHIVE)
+ if(CMAKE_USE_SYSTEM_BZIP2)
+ find_package(BZip2)
+ else()
+ set(BZIP2_INCLUDE_DIR
+ "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
+ set(BZIP2_LIBRARIES cmbzip2)
+ add_subdirectory(Utilities/cmbzip2)
+ CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
+ endif()
endif()
#---------------------------------------------------------------------
# Build or use system liblzma for libarchive.
- if(CMAKE_USE_SYSTEM_LIBLZMA)
- find_package(LibLZMA)
- if(NOT LIBLZMA_FOUND)
- message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
+ if(NOT CMAKE_USE_SYSTEM_LIBARCHIVE)
+ if(CMAKE_USE_SYSTEM_LIBLZMA)
+ find_package(LibLZMA)
+ if(NOT LIBLZMA_FOUND)
+ message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
+ endif()
+ set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
+ set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
+ else()
+ add_subdirectory(Utilities/cmliblzma)
+ CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
+ set(LZMA_INCLUDE_DIR
+ "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
+ set(LZMA_LIBRARY cmliblzma)
endif()
- set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
- set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
- else()
- add_subdirectory(Utilities/cmliblzma)
- CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
- set(LZMA_INCLUDE_DIR
- "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
- set(LZMA_LIBRARY cmliblzma)
endif()
#---------------------------------------------------------------------
@@ -403,6 +427,8 @@ macro (CMAKE_BUILD_UTILITIES)
set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS})
set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES})
else()
+ set(EXPAT_INCLUDE_DIR ${CMAKE_EXPAT_INCLUDES})
+ set(EXPAT_LIBRARY ${CMAKE_EXPAT_LIBRARIES})
set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
add_definitions(-DLIBARCHIVE_STATIC)
@@ -412,7 +438,7 @@ macro (CMAKE_BUILD_UTILITIES)
set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system found libxml2 library if found")
- set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
+ set(ENABLE_EXPAT ON CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found")
set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found")
set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
@@ -425,23 +451,6 @@ macro (CMAKE_BUILD_UTILITIES)
endif()
#---------------------------------------------------------------------
- # Build expat library for CMake and CTest.
- if(CMAKE_USE_SYSTEM_EXPAT)
- find_package(EXPAT)
- if(NOT EXPAT_FOUND)
- message(FATAL_ERROR
- "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
- endif()
- set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
- set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
- else()
- set(CMAKE_EXPAT_INCLUDES)
- set(CMAKE_EXPAT_LIBRARIES cmexpat)
- add_subdirectory(Utilities/cmexpat)
- CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
- endif()
-
- #---------------------------------------------------------------------
# Build jsoncpp library.
if(CMAKE_USE_SYSTEM_JSONCPP)
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
diff --git a/Help/generator/VS_TOOLSET_HOST_ARCH.txt b/Help/generator/VS_TOOLSET_HOST_ARCH.txt
new file mode 100644
index 0000000..58e9223
--- /dev/null
+++ b/Help/generator/VS_TOOLSET_HOST_ARCH.txt
@@ -0,0 +1,10 @@
+For each toolset that comes with this version of Visual Studio, there are
+variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts
+(independent of the architecture they target). By default Visual Studio
+chooses the 32-bit variant even on a 64-bit host. One may request use of the
+64-bit host tools by adding ``host=x64`` to the toolset specification:
+
+``host=x64``
+ Select the 64-bit variant of the default toolset.
+``<toolset>,host=x64``
+ Select the 64-bit variant of the ``<toolset>`` toolset.
diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst
index c694443..04eef10 100644
--- a/Help/generator/Visual Studio 10 2010.rst
+++ b/Help/generator/Visual Studio 10 2010.rst
@@ -17,3 +17,10 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name ``Visual Studio 10`` without the year component.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+The ``v100`` toolset that comes with Visual Studio 10 2010 is selected by
+default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst
index 2f1e729..347a153 100644
--- a/Help/generator/Visual Studio 11 2012.rst
+++ b/Help/generator/Visual Studio 11 2012.rst
@@ -20,3 +20,10 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 11" without the year component.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+The ``v110`` toolset that comes with Visual Studio 11 2012 is selected by
+default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst
index 6e8545b..5071b20 100644
--- a/Help/generator/Visual Studio 12 2013.rst
+++ b/Help/generator/Visual Studio 12 2013.rst
@@ -17,3 +17,12 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 12" without the year component.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+The ``v120`` toolset that comes with Visual Studio 12 2013 is selected by
+default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
+
+.. include:: VS_TOOLSET_HOST_ARCH.txt
diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst
index 707caf9..64254b5 100644
--- a/Help/generator/Visual Studio 14 2015.rst
+++ b/Help/generator/Visual Studio 14 2015.rst
@@ -14,3 +14,12 @@ a target platform name optionally at the end of this generator name:
``Visual Studio 14 2015 ARM``
Specify target platform ``ARM``.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+The ``v140`` toolset that comes with Visual Studio 14 2015 is selected by
+default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
+
+.. include:: VS_TOOLSET_HOST_ARCH.txt
diff --git a/Help/generator/Visual Studio 15.rst b/Help/generator/Visual Studio 15.rst
index ae456eb..2eb9052 100644
--- a/Help/generator/Visual Studio 15.rst
+++ b/Help/generator/Visual Studio 15.rst
@@ -14,3 +14,12 @@ a target platform name optionally at the end of this generator name:
``Visual Studio 15 ARM``
Specify target platform ``ARM``.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+The ``v141`` toolset that comes with Visual Studio 15 is selected by
+default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
+
+.. include:: VS_TOOLSET_HOST_ARCH.txt
diff --git a/Help/generator/Xcode.rst b/Help/generator/Xcode.rst
index d8a6790..25ff4c7 100644
--- a/Help/generator/Xcode.rst
+++ b/Help/generator/Xcode.rst
@@ -2,3 +2,10 @@ Xcode
-----
Generate Xcode project files.
+
+Toolset Selection
+^^^^^^^^^^^^^^^^^
+
+By default Xcode is allowed to select its own default toolchain.
+The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index fa0e4c1..9b3f717 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -52,13 +52,12 @@
Specify toolset name if supported by generator.
Some CMake generators support a toolset name to be given to the
- native build system to choose a compiler. This is supported only on
- specific generators:
-
- ::
+ native build system to choose a compiler.
+ See the :variable:`CMAKE_GENERATOR_TOOLSET` variable.
+ This is supported only on specific generators:
- Visual Studio >= 10
- Xcode >= 3.0
+ * :ref:`Visual Studio Generators` for VS 2010 and above
+ * The :generator:`Xcode` generator for Xcode 3.0 and above
See native build system documentation for allowed toolset names.
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 271f497..fa21a1f 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -121,6 +121,7 @@ Properties on Targets
/prop_tgt/AUTORCC
/prop_tgt/AUTORCC_OPTIONS
/prop_tgt/BINARY_DIR
+ /prop_tgt/BUILD_RPATH
/prop_tgt/BUILD_WITH_INSTALL_RPATH
/prop_tgt/BUNDLE_EXTENSION
/prop_tgt/BUNDLE
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index b74f867..a5b1daa 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -82,6 +82,7 @@ Variables that Provide Information
/variable/CMAKE_VS_NsightTegra_VERSION
/variable/CMAKE_VS_PLATFORM_NAME
/variable/CMAKE_VS_PLATFORM_TOOLSET
+ /variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
/variable/CMAKE_XCODE_PLATFORM_TOOLSET
/variable/PROJECT_BINARY_DIR
@@ -159,6 +160,7 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
+ /variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
/variable/CMAKE_SYSTEM_APPBUNDLE_PATH
/variable/CMAKE_SYSTEM_FRAMEWORK_PATH
/variable/CMAKE_SYSTEM_IGNORE_PATH
@@ -257,6 +259,7 @@ Variables that Control the Build
/variable/CMAKE_AUTORCC_OPTIONS
/variable/CMAKE_AUTOUIC
/variable/CMAKE_AUTOUIC_OPTIONS
+ /variable/CMAKE_BUILD_RPATH
/variable/CMAKE_BUILD_WITH_INSTALL_RPATH
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
diff --git a/Help/prop_test/TIMEOUT_AFTER_MATCH.rst b/Help/prop_test/TIMEOUT_AFTER_MATCH.rst
index a191a9c..d607992 100644
--- a/Help/prop_test/TIMEOUT_AFTER_MATCH.rst
+++ b/Help/prop_test/TIMEOUT_AFTER_MATCH.rst
@@ -22,7 +22,9 @@ When the test outputs a line that matches ``regex`` its start time is
reset to the current time and its timeout duration is changed to
``seconds``. Prior to this, the timeout duration is determined by the
:prop_test:`TIMEOUT` property or the :variable:`CTEST_TEST_TIMEOUT`
-variable if either of these are set.
+variable if either of these are set. Because the test's start time is
+reset, its execution time will not include any time that was spent
+waiting for the matching output.
:prop_test:`TIMEOUT_AFTER_MATCH` is useful for avoiding spurious
timeouts when your test must wait for some system resource to become
diff --git a/Help/prop_tgt/BUILD_RPATH.rst b/Help/prop_tgt/BUILD_RPATH.rst
new file mode 100644
index 0000000..27393f5
--- /dev/null
+++ b/Help/prop_tgt/BUILD_RPATH.rst
@@ -0,0 +1,10 @@
+BUILD_RPATH
+-----------
+
+A :ref:`;-list <CMake Language Lists>` specifying runtime path (``RPATH``)
+entries to add to binaries linked in the build tree (for platforms that
+support it). The entries will *not* be used for binaries in the install
+tree. See also the :prop_tgt:`INSTALL_RPATH` target property.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_BUILD_RPATH` if it is set when a target is created.
diff --git a/Help/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.rst b/Help/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.rst
index 09ff0ce..4da855b 100644
--- a/Help/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.rst
+++ b/Help/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.rst
@@ -1,19 +1,25 @@
MAP_IMPORTED_CONFIG_<CONFIG>
----------------------------
-Map from project configuration to IMPORTED target's configuration.
+Map from project configuration to
+:ref:`imported target <IMPORTED targets>`'s configuration.
Set this to the list of configurations of an imported target that may
-be used for the current project's <CONFIG> configuration. Targets
+be used for the current project's ``<CONFIG>`` configuration. Targets
imported from another project may not provide the same set of
configuration names available in the current project. Setting this
property tells CMake what imported configurations are suitable for use
-when building the <CONFIG> configuration. The first configuration in
-the list found to be provided by the imported target is selected. If
-this property is set and no matching configurations are available,
+when building the ``<CONFIG>`` configuration. The first configuration in
+the list found to be provided by the imported target (i.e. via
+:prop_tgt:`IMPORTED_LOCATION_<CONFIG>` for the mapped-to ``<CONFIG>``)
+is selected. As a special case, an empty list element refers to the
+configuration-less imported target location
+(i.e. :prop_tgt:`IMPORTED_LOCATION`).
+
+If this property is set and no matching configurations are available,
then the imported target is considered to be not found. This property
is ignored for non-imported targets.
-This property is initialized by the value of the variable
-CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is
-created.
+This property is initialized by the value of the
+:variable:`CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` variable if it is set when a
+target is created.
diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst
index 9794267..3b8ade6 100644
--- a/Help/release/3.7.rst
+++ b/Help/release/3.7.rst
@@ -32,7 +32,7 @@ Generators
with :ref:`Makefile Generators`.
* The :generator:`Visual Studio 15` generator was added. This is
- experimental and based on Preview 4 because this version of VS
+ experimental and based on Preview 5 because this version of VS
has not been released.
* :ref:`Visual Studio Generators` for VS 2010 and above learned to
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
new file mode 100644
index 0000000..e4cc01e
--- /dev/null
+++ b/Help/release/dev/0-sample-topic.rst
@@ -0,0 +1,7 @@
+0-sample-topic
+--------------
+
+* This is a sample release note for the change in a topic.
+ Developers should add similar notes for each topic branch
+ making a noteworthy change. Each document should be named
+ and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/dev/ExternalData-multiple-hashes.rst b/Help/release/dev/ExternalData-multiple-hashes.rst
new file mode 100644
index 0000000..608a277
--- /dev/null
+++ b/Help/release/dev/ExternalData-multiple-hashes.rst
@@ -0,0 +1,7 @@
+ExternalData-multiple-hashes
+----------------------------
+
+* The :module:`ExternalData` module learned to support multiple
+ content links for one data file using different hashes, e.g.
+ ``img.png.sha256`` and ``img.png.sha1``. This allows objects
+ to be fetched from sources indexed by different hash algorithms.
diff --git a/Help/release/dev/add-BUILD_RPATH.rst b/Help/release/dev/add-BUILD_RPATH.rst
new file mode 100644
index 0000000..0d69e45
--- /dev/null
+++ b/Help/release/dev/add-BUILD_RPATH.rst
@@ -0,0 +1,6 @@
+add-BUILD_RPATH
+---------------
+
+* A :variable:`CMAKE_BUILD_RPATH` variable and corresponding
+ :prop_tgt:`BUILD_RPATH` target property were added to support custom
+ ``RPATH`` locations to be added to binaries in the build tree.
diff --git a/Help/release/dev/allow-fallback-config-mapping.rst b/Help/release/dev/allow-fallback-config-mapping.rst
new file mode 100644
index 0000000..2522e10
--- /dev/null
+++ b/Help/release/dev/allow-fallback-config-mapping.rst
@@ -0,0 +1,6 @@
+allow-fallback-config-mapping
+-----------------------------
+
+* The :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property learned
+ to interpret empty list elements as referring to the configuration-less
+ imported location specified by :prop_tgt:`IMPORTED_LOCATION`.
diff --git a/Help/release/dev/cpack-rpm-single-debuginfo.rst b/Help/release/dev/cpack-rpm-single-debuginfo.rst
new file mode 100644
index 0000000..34a710d
--- /dev/null
+++ b/Help/release/dev/cpack-rpm-single-debuginfo.rst
@@ -0,0 +1,11 @@
+cpack-rpm-single-debuginfo
+--------------------------
+
+* The :module:`CPackRPM` module learned to generate main component package
+ which forces generation of a rpm for defined component without component
+ suffix in filename and package name.
+ See :variable:`CPACK_RPM_MAIN_COMPONENT` variable.
+
+* The :module:`CPackRPM` module learned to generate a single debuginfo package
+ on demand even if components packagin is used.
+ See :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` variable.
diff --git a/Help/release/dev/external-project-clone-progress.rst b/Help/release/dev/external-project-clone-progress.rst
new file mode 100644
index 0000000..766a1a3
--- /dev/null
+++ b/Help/release/dev/external-project-clone-progress.rst
@@ -0,0 +1,5 @@
+external-project-clone-progress
+-------------------------------
+
+* The :module:`ExternalProject` module gained the ``GIT_PROGRESS`` option to
+ force Git to show progress when cloning repositories.
diff --git a/Help/release/dev/math-EXPR-unary.rst b/Help/release/dev/math-EXPR-unary.rst
new file mode 100644
index 0000000..d4af15b
--- /dev/null
+++ b/Help/release/dev/math-EXPR-unary.rst
@@ -0,0 +1,5 @@
+math-EXPR-unary
+---------------
+
+* The :command:`math(EXPR)` command gained support for unary
+ ``+`` and ``-`` expressions.
diff --git a/Help/release/dev/st2-exclude-patterns-variable.rst b/Help/release/dev/st2-exclude-patterns-variable.rst
new file mode 100644
index 0000000..8706c1f
--- /dev/null
+++ b/Help/release/dev/st2-exclude-patterns-variable.rst
@@ -0,0 +1,7 @@
+st2-exclude-patterns-variable
+-----------------------------
+
+* The :generator:`Sublime Text 2` extra generator no longer excludes the
+ build tree from the ``.sublime-project`` when it is inside the source tree.
+ The :variable:`CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE` variable
+ was added to control the behavior explicitly.
diff --git a/Help/release/dev/vs-host-x64-tools.rst b/Help/release/dev/vs-host-x64-tools.rst
new file mode 100644
index 0000000..e42881a
--- /dev/null
+++ b/Help/release/dev/vs-host-x64-tools.rst
@@ -0,0 +1,7 @@
+vs-host-x64-tools
+-----------------
+
+* The :ref:`Visual Studio Generators` for VS 2013 and above learned to
+ support a ``host=x64`` option in the :variable:`CMAKE_GENERATOR_TOOLSET`
+ value (e.g. via the :manual:`cmake(1)` ``-T`` option) to request use
+ of a VS 64-bit toolchain on 64-bit hosts.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 25c6c3e..30decd5 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -5,6 +5,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
+.. include:: dev.txt
+
Releases
========
diff --git a/Help/variable/CMAKE_BUILD_RPATH.rst b/Help/variable/CMAKE_BUILD_RPATH.rst
new file mode 100644
index 0000000..f20eb41
--- /dev/null
+++ b/Help/variable/CMAKE_BUILD_RPATH.rst
@@ -0,0 +1,10 @@
+CMAKE_BUILD_RPATH
+-----------------
+
+A :ref:`;-list <CMake Language Lists>` specifying runtime path (``RPATH``)
+entries to add to binaries linked in the build tree (for platforms that
+support it). The entries will *not* be used for binaries in the install
+tree. See also the :variable:`CMAKE_INSTALL_RPATH` variable.
+
+This is used to initialize the :prop_tgt:`BUILD_RPATH` target property
+for all targets.
diff --git a/Help/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE.rst b/Help/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE.rst
new file mode 100644
index 0000000..d654425
--- /dev/null
+++ b/Help/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE.rst
@@ -0,0 +1,7 @@
+CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
+---------------------------------------
+
+If this variable evaluates to ``ON`` at the end of the top-level
+``CMakeLists.txt`` file, the :generator:`Sublime Text 2` extra generator
+excludes the build tree from the ``.sublime-project`` if it is inside the
+source tree.
diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst
new file mode 100644
index 0000000..4c04e97
--- /dev/null
+++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst
@@ -0,0 +1,10 @@
+CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE
+-------------------------------------------
+
+Visual Studio preferred tool architecture.
+
+The :ref:`Visual Studio Generators` for VS 2013 and above support optional
+selection of a 64-bit toolchain on 64-bit hosts by specifying a ``host=64``
+value in the :variable:`CMAKE_GENERATOR_TOOLSET` option. CMake provides
+the selected toolchain architecture preference in this variable (either
+``x64`` or empty).
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 145efc6..59d8ab6 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -182,6 +182,11 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
+ if(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE)
+ set(id_PreferredToolArchitecture "<PreferredToolArchitecture>${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}</PreferredToolArchitecture>")
+ else()
+ set(id_PreferredToolArchitecture "")
+ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 15b62c7..6017ce3 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -95,6 +95,17 @@
# and it is up to the packager to set the variables in a manner that will
# prevent such errors.
#
+# .. variable:: CPACK_RPM_MAIN_COMPONENT
+#
+# Main component that is packaged without component suffix.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# This variable can be set to any component or group name so that component or
+# group rpm package is generated without component suffix in filename and
+# package name.
+#
# .. variable:: CPACK_RPM_PACKAGE_VERSION
#
# The RPM package version.
@@ -792,6 +803,26 @@
# * Mandatory : NO
# * Default : -
#
+# .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
+#
+# Create a single debuginfo package even if components packaging is set.
+#
+# * Mandatory : NO
+# * Default : OFF
+#
+# When this variable is enabled it produces a single debuginfo package even if
+# component packaging is enabled.
+#
+# When using this feature in combination with components packaging and there is
+# more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
+# to be set.
+#
+# .. note::
+#
+# If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
+# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
+# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
+#
# Packaging of sources (SRPM)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
@@ -1649,10 +1680,16 @@ function(cpack_rpm_generate_package)
endif()
if(CPACK_RPM_PACKAGE_COMPONENT)
- string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
- cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME"
- "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME"
- "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME")
+ string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
+ CPACK_RPM_MAIN_COMPONENT_UPPER)
+
+ if(NOT CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
+
+ cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME")
+ endif()
endif()
# CPACK_RPM_PACKAGE_VERSION (mandatory)
@@ -2059,7 +2096,7 @@ function(cpack_rpm_generate_package)
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_PACKAGE"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_PACKAGE"
"CPACK_RPM_DEBUGINFO_PACKAGE")
- if(CPACK_RPM_DEBUGINFO_PACKAGE)
+ if(CPACK_RPM_DEBUGINFO_PACKAGE OR (CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND NOT GENERATE_SPEC_PARTS))
cpack_rpm_variable_fallback("CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_BUILD_SOURCE_DIRS_PREFIX"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_BUILD_SOURCE_DIRS_PREFIX"
@@ -2067,9 +2104,81 @@ function(cpack_rpm_generate_package)
if(NOT CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
endif()
- cpack_rpm_debugsymbol_check("${CPACK_RPM_INSTALL_FILES}" "${WDIR}")
- set(TMP_RPM_DEBUGINFO "
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS)
+ file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.files"
+ "${CPACK_RPM_INSTALL_FILES}")
+ else()
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND CPACK_RPM_PACKAGE_COMPONENT)
+ # this part is only required by components packaging - with monolithic
+ # packages we can be certain that there are no other components present
+ # so CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE is a noop
+ if(CPACK_RPM_DEBUGINFO_PACKAGE)
+ # only add current package files to debuginfo list if debuginfo
+ # generation is enabled for current package
+ set(install_files_ "${CPACK_RPM_INSTALL_FILES}")
+ else()
+ unset(install_files_)
+ endif()
+
+ file(GLOB files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.files")
+
+ foreach(f_ IN LISTS files_)
+ file(READ "${f_}" tmp_)
+ string(APPEND install_files_ ";${tmp_}")
+ endforeach()
+
+ # if there were other components/groups so we need to move files from them
+ # to current component otherwise those files won't be found
+ file(GLOB components_ LIST_DIRECTORIES true RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/*")
+ foreach(component_ IN LISTS components_)
+ string(TOUPPER "${component_}" component_dir_upper_)
+ if(component_dir_upper_ STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ # skip current component
+ continue()
+ endif()
+
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
+ cmake_policy(POP)
+
+ foreach(f_ IN LISTS files_for_move_)
+ get_filename_component(dir_path_ "${f_}" DIRECTORY)
+ set(src_file_
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}")
+
+ # check that we are not overriding an existing file that doesn't
+ # match the file that we want to copy
+ if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E compare_files "${src_file_}" "${WDIR}/${f_}"
+ RESULT_VARIABLE res_
+ )
+ if(res_)
+ message(FATAL_ERROR "CPackRPM:Error: File on path '${WDIR}/${f_}'"
+ " already exists but is a different than the one in component"
+ " '${component_}'! Packages will not be generated.")
+ endif()
+ endif()
+
+ file(MAKE_DIRECTORY "${WDIR}/${dir_path_}")
+ file(RENAME "${src_file_}"
+ "${WDIR}/${f_}")
+ endforeach()
+ endforeach()
+
+ cpack_rpm_debugsymbol_check("${install_files_}" "${WDIR}")
+ else()
+ cpack_rpm_debugsymbol_check("${CPACK_RPM_INSTALL_FILES}" "${WDIR}")
+ endif()
+
+ if(TMP_DEBUGINFO_ADDITIONAL_SOURCES)
+ set(TMP_RPM_DEBUGINFO "
# Modified version of %%debug_package macro
# defined in /usr/lib/rpm/macros as that one
# can't handle injection of extra source files.
@@ -2088,6 +2197,15 @@ package or when debugging this package.
${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
%endif
")
+ elseif(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE)
+ message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested"
+ " but will not be generated as no source files were found!")
+ else()
+ message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested"
+ " but will not be generated as no source files were found! Component: '"
+ "${CPACK_RPM_PACKAGE_COMPONENT}'.")
+ endif()
+ endif()
endif()
# Prepare install files
@@ -2164,12 +2282,25 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
cmake_policy(POP)
else()
# old file name format for back compatibility
- set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
+ string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
+ CPACK_RPM_MAIN_COMPONENT_UPPER)
+
+ if(CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ # this is the main component so ignore the component filename part
+ set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.rpm")
+ else()
+ set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
+ endif()
endif()
# else example:
#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
- if(NOT CPACK_RPM_DEBUGINFO_PACKAGE)
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS)
+ string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" expected_filename_)
+
+ file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.rpm_name"
+ "${expected_filename_};${CPACK_RPM_FILE_NAME}")
+ elseif(NOT CPACK_RPM_DEBUGINFO_PACKAGE)
set(FILE_NAME_DEFINE "%define _rpmfilename ${CPACK_RPM_FILE_NAME}")
endif()
endif()
@@ -2264,7 +2395,54 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@CPACK_RPM_SPEC_CHANGELOG\@
"
)
+
+ elseif(GENERATE_SPEC_PARTS) # binary rpm with single debuginfo package
+ file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
+ "# -*- rpm-spec -*-
+%package -n \@CPACK_RPM_PACKAGE_NAME\@
+Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
+Version: \@CPACK_RPM_PACKAGE_VERSION\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+
+\@TMP_RPM_URL\@
+\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_REQUIRES_PRE\@
+\@TMP_RPM_REQUIRES_POST\@
+\@TMP_RPM_REQUIRES_PREUN\@
+\@TMP_RPM_REQUIRES_POSTUN\@
+\@TMP_RPM_PROVIDES\@
+\@TMP_RPM_OBSOLETES\@
+\@TMP_RPM_CONFLICTS\@
+\@TMP_RPM_AUTOPROV\@
+\@TMP_RPM_AUTOREQ\@
+\@TMP_RPM_AUTOREQPROV\@
+\@TMP_RPM_BUILDARCH\@
+\@TMP_RPM_PREFIXES\@
+
+%description -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+
+%files -n \@CPACK_RPM_PACKAGE_NAME\@
+%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@)
+\@CPACK_RPM_INSTALL_FILES\@
+\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@
+\@CPACK_RPM_USER_INSTALL_FILES\@
+"
+ )
+
else() # binary rpm
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE)
+ # find generated spec file and take its name
+ file(GLOB spec_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.spec")
+
+ foreach(f_ IN LISTS spec_files_)
+ file(READ "${f_}" tmp_)
+ string(APPEND TMP_OTHER_COMPONENTS "\n${tmp_}\n")
+ endforeach()
+ endif()
# We should generate a USER spec file template:
# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
@@ -2350,6 +2528,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
+
+\@TMP_OTHER_COMPONENTS\@
"
)
endif()
@@ -2376,60 +2556,90 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
endif()
- if(RPMBUILD_EXECUTABLE)
- # Now call rpmbuild using the SPECFILE
- execute_process(
- COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
- --define "_topdir ${CPACK_RPM_DIRECTORY}"
- --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
- "${CPACK_RPM_BINARY_SPECFILE}"
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
- ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
- OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
- message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
- message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
+ if(NOT GENERATE_SPEC_PARTS) # generate package
+ if(RPMBUILD_EXECUTABLE)
+ # Now call rpmbuild using the SPECFILE
+ execute_process(
+ COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
+ --define "_topdir ${CPACK_RPM_DIRECTORY}"
+ --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
+ "${CPACK_RPM_BINARY_SPECFILE}"
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
+ ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
+ OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
+ message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
+ message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
+ endif()
+ else()
+ if(ALIEN_EXECUTABLE)
+ message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+ endif()
endif()
- else()
- if(ALIEN_EXECUTABLE)
- message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+
+ # find generated rpm files and take their names
+ cmake_policy(PUSH)
+ # Tell file(GLOB_RECURSE) not to follow directory symlinks
+ # even if the project does not set this policy to NEW.
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
+ "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
+ cmake_policy(POP)
+
+ if(NOT GENERATED_FILES)
+ message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
endif()
- endif()
- # find generated rpm files and take their names
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
- "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
- cmake_policy(POP)
+ unset(expected_filenames_)
+ unset(filenames_)
+ if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
+ string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" efn_)
+ list(APPEND expected_filenames_ "${efn_}")
+ list(APPEND filenames_ "${CPACK_RPM_FILE_NAME}")
+ endif()
- if(NOT GENERATED_FILES)
- message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
- endif()
+ # check if other files have to be renamed
+ file(GLOB rename_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.rpm_name")
+ if(rename_files_)
+ foreach(f_ IN LISTS rename_files_)
+ file(READ "${f_}" tmp_)
+ list(GET tmp_ 0 efn_)
+ list(APPEND expected_filenames_ "${efn_}")
+ list(GET tmp_ 1 fn_)
+ list(APPEND filenames_ "${fn_}")
+ endforeach()
+ endif()
- if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
- string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" EXPECTED_FILENAME)
+ if(expected_filenames_)
+ foreach(F IN LISTS GENERATED_FILES)
+ unset(matched_)
+ foreach(expected_ IN LISTS expected_filenames_)
+ if(F MATCHES ".*/${expected_}")
+ list(FIND expected_filenames_ "${expected_}" idx_)
+ list(GET filenames_ ${idx_} filename_)
+ get_filename_component(FILE_PATH "${F}" DIRECTORY)
+ file(RENAME "${F}" "${FILE_PATH}/${filename_}")
+ list(APPEND new_files_list_ "${FILE_PATH}/${filename_}")
+ set(matched_ "YES")
+
+ break()
+ endif()
+ endforeach()
- foreach(F IN LISTS GENERATED_FILES)
- if(F MATCHES ".*/${EXPECTED_FILENAME}")
- get_filename_component(FILE_PATH "${F}" DIRECTORY)
- file(RENAME "${F}" "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
- list(APPEND new_files_list_ "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
- else()
- list(APPEND new_files_list_ "${F}")
- endif()
- endforeach()
+ if(NOT matched_)
+ list(APPEND new_files_list_ "${F}")
+ endif()
+ endforeach()
- set(GENERATED_FILES "${new_files_list_}")
+ set(GENERATED_FILES "${new_files_list_}")
+ endif()
endif()
set(GEN_CPACK_OUTPUT_FILES "${GENERATED_FILES}" PARENT_SCOPE)
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index 1cf20eb..dc90513 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -24,7 +24,9 @@
# include(CTestUseLaunchers), it will use the value of the ENV variable
# to initialize a CTEST_USE_LAUNCHERS cache variable. This cache
# variable initialization only occurs if CTEST_USE_LAUNCHERS is not
-# already defined.
+# already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script
+# the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE
+# to the cmake command used to configure the project.
if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}"
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
index 2304000..224e340 100644
--- a/Modules/CheckFunctionExists.c
+++ b/Modules/CheckFunctionExists.c
@@ -4,7 +4,7 @@
extern "C"
#endif
char
- CHECK_FUNCTION_EXISTS();
+ CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__
int main()
{
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 2870a11..50be9cb 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -16,6 +16,9 @@
@id_WindowsSDKDesktopARMSupport@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup>
+ @id_PreferredToolArchitecture@
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index b00de14..07cd114 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -201,6 +201,11 @@ For example, the argument ``DATA{img.png}`` may be satisfied by either a
real ``img.png`` file in the current source directory or a ``img.png.md5``
file containing its MD5 sum.
+Multiple content links of the same name with different hash algorithms
+are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as
+they all correspond to the same real file. This allows objects to be
+fetched from sources indexed by different hash algorithms.
+
Referencing File Series
"""""""""""""""""""""""
@@ -429,8 +434,10 @@ function(ExternalData_add_target target)
string(REPLACE "|" ";" tuple "${entry}")
list(GET tuple 0 file)
list(GET tuple 1 name)
- list(GET tuple 2 ext)
- set(stamp "${ext}-stamp")
+ list(GET tuple 2 exts)
+ string(REPLACE "+" ";" exts_list "${exts}")
+ list(GET exts_list 0 first_ext)
+ set(stamp "-hash-stamp")
if(NOT DEFINED "_ExternalData_FILE_${file}")
set("_ExternalData_FILE_${file}" 1)
get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}")
@@ -446,12 +453,12 @@ function(ExternalData_add_target target)
OUTPUT "${file}${stamp}" "${file}"
# Run the data fetch/update script.
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
- -Dfile=${file} -Dname=${name} -Dext=${ext}
+ -Dfile=${file} -Dname=${name} -Dexts=${exts}
-DExternalData_ACTION=fetch
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
# Update whenever the object hash changes.
- MAIN_DEPENDENCY "${name}${ext}"
+ MAIN_DEPENDENCY "${name}${first_ext}"
)
endif()
list(APPEND files "${file}${stamp}")
@@ -798,6 +805,7 @@ function(_ExternalData_arg_find_files glob pattern regex)
cmake_policy(SET CMP0009 NEW)
file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
cmake_policy(POP)
+ set(externals_count -1)
foreach(entry IN LISTS globbed)
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
set(relname "${CMAKE_MATCH_1}")
@@ -817,7 +825,11 @@ function(_ExternalData_arg_find_files glob pattern regex)
set(name "${top_src}/${relname}")
set(file "${top_bin}/${relname}")
if(alg)
- list(APPEND external "${file}|${name}|${alg}")
+ if(NOT "${external_${externals_count}_file_name}" STREQUAL "${file}|${name}")
+ math(EXPR externals_count "${externals_count} + 1")
+ set(external_${externals_count}_file_name "${file}|${name}")
+ endif()
+ list(APPEND external_${externals_count}_algs "${alg}")
elseif(ExternalData_LINK_CONTENT)
_ExternalData_link_content("${name}" alg)
list(APPEND external "${file}|${name}|${alg}")
@@ -830,6 +842,14 @@ function(_ExternalData_arg_find_files glob pattern regex)
endif()
endif()
endforeach()
+ if(${externals_count} GREATER -1)
+ foreach(ii RANGE ${externals_count})
+ string(REPLACE ";" "+" algs_delim "${external_${ii}_algs}")
+ list(APPEND external "${external_${ii}_file_name}|${algs_delim}")
+ unset(external_${ii}_algs)
+ unset(external_${ii}_file_name)
+ endforeach()
+ endif()
set(external "${external}" PARENT_SCOPE)
set(internal "${internal}" PARENT_SCOPE)
set(have_original "${have_original}" PARENT_SCOPE)
@@ -947,13 +967,28 @@ function(_ExternalData_custom_fetch key loc file err_var msg_var)
set("${msg_var}" "${msg}" PARENT_SCOPE)
endfunction()
-function(_ExternalData_download_object name hash algo var_obj)
+function(_ExternalData_get_from_object_store hash algo var_obj var_success)
+ # Search all object stores for an existing object.
+ foreach(dir ${ExternalData_OBJECT_STORES})
+ set(obj "${dir}/${algo}/${hash}")
+ if(EXISTS "${obj}")
+ message(STATUS "Found object: \"${obj}\"")
+ set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" 1 PARENT_SCOPE)
+ return()
+ endif()
+ endforeach()
+endfunction()
+
+function(_ExternalData_download_object name hash algo var_obj var_success var_errorMsg)
# Search all object stores for an existing object.
+ set(success 1)
foreach(dir ${ExternalData_OBJECT_STORES})
set(obj "${dir}/${algo}/${hash}")
if(EXISTS "${obj}")
message(STATUS "Found object: \"${obj}\"")
set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" "${success}" PARENT_SCOPE)
return()
endif()
endforeach()
@@ -1008,6 +1043,7 @@ function(_ExternalData_download_object name hash algo var_obj)
get_filename_component(dir "${name}" PATH)
set(staged "${dir}/.ExternalData_${algo}_${hash}")
+ set(success 1)
if(found)
file(RENAME "${tmp}" "${obj}")
message(STATUS "Downloaded object: \"${obj}\"")
@@ -1018,38 +1054,74 @@ function(_ExternalData_download_object name hash algo var_obj)
if(NOT tried)
set(tried "\n (No ExternalData_URL_TEMPLATES given)")
endif()
- message(FATAL_ERROR "Object ${algo}=${hash} not found at:${tried}")
+ set(success 0)
+ set("${var_errorMsg}" "Object ${algo}=${hash} not found at:${tried}" PARENT_SCOPE)
endif()
set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" "${success}" PARENT_SCOPE)
endfunction()
if("${ExternalData_ACTION}" STREQUAL "fetch")
- foreach(v ExternalData_OBJECT_STORES file name ext)
+ foreach(v ExternalData_OBJECT_STORES file name exts)
if(NOT DEFINED "${v}")
message(FATAL_ERROR "No \"-D${v}=\" value provided!")
endif()
endforeach()
- file(READ "${name}${ext}" hash)
- string(STRIP "${hash}" hash)
-
- if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$")
- string(TOUPPER "${CMAKE_MATCH_1}" algo)
- else()
- message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"")
- endif()
+ string(REPLACE "+" ";" exts_list "${exts}")
+ set(succeeded 0)
+ set(errorMsg "")
+ set(hash_list )
+ set(algo_list )
+ set(hash )
+ set(algo )
+ foreach(ext ${exts_list})
+ file(READ "${name}${ext}" hash)
+ string(STRIP "${hash}" hash)
+
+ if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$")
+ string(TOUPPER "${CMAKE_MATCH_1}" algo)
+ else()
+ message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"")
+ endif()
- _ExternalData_download_object("${name}" "${hash}" "${algo}" obj)
+ list(APPEND hash_list ${hash})
+ list(APPEND algo_list ${algo})
+ endforeach()
+ list(LENGTH exts_list num_extensions)
+ math(EXPR exts_range "${num_extensions} - 1")
+ foreach(ii RANGE 0 ${exts_range})
+ list(GET hash_list ${ii} hash)
+ list(GET algo_list ${ii} algo)
+ _ExternalData_get_from_object_store("${hash}" "${algo}" obj succeeded)
+ if(succeeded)
+ break()
+ endif()
+ endforeach()
+ if(NOT succeeded)
+ foreach(ii RANGE 0 ${exts_range})
+ list(GET hash_list ${ii} hash)
+ list(GET algo_list ${ii} algo)
+ _ExternalData_download_object("${name}" "${hash}" "${algo}"
+ obj succeeded algoErrorMsg)
+ set(errorMsg "${errorMsg}\n${algoErrorMsg}")
+ if(succeeded)
+ break()
+ endif()
+ endforeach()
+ endif()
+ if(NOT succeeded)
+ message(FATAL_ERROR "${errorMsg}")
+ endif()
# Check if file already corresponds to the object.
- set(stamp "${ext}-stamp")
+ set(stamp "-hash-stamp")
set(file_up_to_date 0)
if(EXISTS "${file}" AND EXISTS "${file}${stamp}")
file(READ "${file}${stamp}" f_hash)
string(STRIP "${f_hash}" f_hash)
if("${f_hash}" STREQUAL "${hash}")
- #message(STATUS "File already corresponds to object")
set(file_up_to_date 1)
endif()
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 4551cc8..1e0be09 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -65,9 +65,14 @@ Create custom targets to build projects in external trees
``GIT_SUBMODULES <module>...``
Git submodules that shall be updated, all if empty
``GIT_SHALLOW 1``
- Tell Git to clone with ``--depth 1``. Use when ``GIT_TAG`` is not
+ Tell Git to clone with ``--depth 1``. Use when ``GIT_TAG`` is not
specified or when it names a branch in order to download only the
tip of the branch without the rest of its history.
+ ``GIT_PROGRESS 1``
+ Tell Git to clone with ``--progress``. For large projects, the clone step
+ does not output anything which can make the build appear to have stalled.
+ This option forces Git to output progress information during the clone step
+ so that forward progress is indicated.
``HG_REPOSITORY <url>``
URL of mercurial repo
``HG_TAG <tag>``
@@ -509,7 +514,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED
"ExternalProject module."
)
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules git_shallow src_name work_dir gitclone_infofile gitclone_stampfile tls_verify)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules git_shallow git_progress src_name work_dir gitclone_infofile gitclone_stampfile tls_verify)
if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.10)
set(git_clone_shallow_options "--depth 1 --no-single-branch")
else()
@@ -555,6 +560,11 @@ if(git_shallow)
list(APPEND git_clone_options ${git_clone_shallow_options})
endif()
+set(git_progress \"${git_progress}\")
+if(git_progress)
+ list(APPEND git_clone_options --progress)
+endif()
+
# try the clone 3 times incase there is an odd git clone issue
set(error_code 1)
set(number_of_tries 0)
@@ -1180,6 +1190,7 @@ function(_ep_write_initial_cache target_name script_filename script_initial_cach
# Write out values into an initial cache, that will be passed to CMake with -C
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
+ _ep_replace_location_tags(${target_name} script_filename)
# Write out the initial cache file to the location specified.
file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
endfunction()
@@ -1800,6 +1811,7 @@ function(_ep_add_download_command name)
set(tls_verify "${CMAKE_TLS_VERIFY}")
endif()
get_property(git_shallow TARGET ${name} PROPERTY _EP_GIT_SHALLOW)
+ get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo
@@ -1824,7 +1836,7 @@ function(_ep_add_download_command name)
# The script will delete the source directory and then call git clone.
#
_ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
- ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" "${git_shallow}" ${src_name} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" "${git_shallow}" "${git_progress}" ${src_name} ${work_dir}
${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt "${tls_verify}"
)
set(comment "Performing download step (git clone) for '${name}'")
@@ -2181,24 +2193,7 @@ function(_ep_add_patch_command name)
endfunction()
-# TODO: Make sure external projects use the proper compiler
-function(_ep_add_configure_command name)
- ExternalProject_Get_Property(${name} source_dir source_subdir binary_dir tmp_dir)
-
- # Depend on other external projects (file-level).
- set(file_deps)
- get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
- foreach(dep IN LISTS deps)
- get_property(dep_type TARGET ${dep} PROPERTY TYPE)
- if(dep_type STREQUAL "UTILITY")
- get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
- if(is_ep)
- _ep_get_step_stampfile(${dep} "done" done_stamp_file)
- list(APPEND file_deps ${done_stamp_file})
- endif()
- endif()
- endforeach()
-
+function(_ep_extract_configure_command var name)
get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
if(cmd_set)
get_property(cmd TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND)
@@ -2219,7 +2214,7 @@ function(_ep_add_configure_command name)
get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
if(cmake_cache_args OR cmake_cache_default_args)
- set(_ep_cache_args_script "${tmp_dir}/${name}-cache-$<CONFIG>.cmake")
+ set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
if(cmake_cache_args)
_ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
endif()
@@ -2261,9 +2256,32 @@ function(_ep_add_configure_command name)
endif()
endif()
- list(APPEND cmd "${source_dir}${source_subdir}")
+ list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
endif()
+ set("${var}" "${cmd}" PARENT_SCOPE)
+endfunction()
+
+# TODO: Make sure external projects use the proper compiler
+function(_ep_add_configure_command name)
+ ExternalProject_Get_Property(${name} binary_dir tmp_dir)
+
+ # Depend on other external projects (file-level).
+ set(file_deps)
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(dep IN LISTS deps)
+ get_property(dep_type TARGET ${dep} PROPERTY TYPE)
+ if(dep_type STREQUAL "UTILITY")
+ get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(is_ep)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endif()
+ endif()
+ endforeach()
+
+ _ep_extract_configure_command(cmd ${name})
+
# If anything about the configure command changes, (command itself, cmake
# used, cmake args or cmake generator) then re-run the configure step.
# Fixes issue https://gitlab.kitware.com/cmake/cmake/issues/10258
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 184fb05..9bd7a30 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1313,13 +1313,13 @@ string(APPEND _boost_DEBUG_ABI_TAG "d")
# p using the STLport standard library rather than the
# default one supplied with your compiler
if(Boost_USE_STLPORT)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
+ string(APPEND _boost_RELEASE_ABI_TAG "p")
+ string(APPEND _boost_DEBUG_ABI_TAG "p")
endif()
# n using the STLport deprecated "native iostreams" feature
if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
+ string(APPEND _boost_RELEASE_ABI_TAG "n")
+ string(APPEND _boost_DEBUG_ABI_TAG "n")
endif()
if(Boost_DEBUG)
@@ -1390,9 +1390,9 @@ endif()
if( Boost_USE_STATIC_LIBS )
set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a)
else()
- set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
endif()
@@ -1418,7 +1418,7 @@ endif()
set(_boost_STATIC_RUNTIME_WORKAROUND false)
if(WIN32 AND Boost_USE_STATIC_LIBS)
if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
- set(_boost_STATIC_RUNTIME_WORKAROUND true)
+ set(_boost_STATIC_RUNTIME_WORKAROUND TRUE)
endif()
endif()
@@ -1681,13 +1681,11 @@ if(Boost_FOUND)
endif()
if(EXISTS "${_boost_LIB_DIR}/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+ string(APPEND _boost_LIB_DIR /lib)
+ elseif(EXISTS "${_boost_LIB_DIR}/stage/lib")
+ string(APPEND _boost_LIB_DIR "/stage/lib")
else()
- if(EXISTS "${_boost_LIB_DIR}/stage/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
- else()
- set(_boost_LIB_DIR "")
- endif()
+ set(_boost_LIB_DIR "")
endif()
if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 14e392a..3ffd5a7 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -264,7 +264,7 @@ function(_protobuf_find_libraries name filename)
mark_as_advanced(${name}_LIBRARY_RELEASE)
find_library(${name}_LIBRARY_DEBUG
- NAMES ${filename}
+ NAMES ${filename}d ${filename}
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
mark_as_advanced(${name}_LIBRARY_DEBUG)
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index c0cdd98..4e4411f 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -122,11 +122,10 @@ if(NOT APPLE)
find_package(Threads)
endif()
-# MinGW needs an additional library, mwindows
-# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
-# (Actually on second look, I think it only needs one of the m* libraries.)
+# MinGW needs an additional link flag, -mwindows
+# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
if(MINGW)
- set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
+ set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
endif()
if(SDL_LIBRARY_TEMP)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index bb085ac..c09bac4 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -105,8 +105,6 @@ if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
set(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1)
endif()
-set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
set(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ec49481..09c0acf 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -159,14 +159,10 @@ endif()
set(SRCS
cmArchiveWrite.cxx
cmBase32.cxx
- cmBootstrapCommands1.cxx
- cmBootstrapCommands2.cxx
cmCacheManager.cxx
cmCacheManager.h
- "${CMAKE_CURRENT_BINARY_DIR}/cmCommands.cxx"
cmCLocaleEnvironmentScope.h
cmCLocaleEnvironmentScope.cxx
- cmCommands.h
cmCommandArgumentLexer.cxx
cmCommandArgumentParser.cxx
cmCommandArgumentParserHelper.cxx
@@ -300,6 +296,8 @@ set(SRCS
cmInstallDirectoryGenerator.cxx
cmLinkedTree.h
cmLinkItem.h
+ cmLinkLineComputer.cxx
+ cmLinkLineComputer.h
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c
@@ -307,6 +305,8 @@ set(SRCS
cmLocalCommonGenerator.h
cmLocalGenerator.cxx
cmLocalGenerator.h
+ cmRulePlaceholderExpander.cxx
+ cmRulePlaceholderExpander.h
cmLocalUnixMakefileGenerator3.cxx
cmLocale.h
${MACH_SRCS}
@@ -318,6 +318,8 @@ set(SRCS
cmMakefileUtilityTargetGenerator.cxx
cmMessenger.cxx
cmMessenger.h
+ cmMSVC60LinkLineComputer.cxx
+ cmMSVC60LinkLineComputer.h
cmOSXBundleGenerator.cxx
cmOSXBundleGenerator.h
cmOutputConverter.cxx
@@ -354,10 +356,17 @@ set(SRCS
cmSourceGroup.h
cmState.cxx
cmState.h
+ cmStateDirectory.cxx
+ cmStateDirectory.h
+ cmStateSnapshot.cxx
+ cmStateSnapshot.h
+ cmStateTypes.h
cmSystemTools.cxx
cmSystemTools.h
cmTarget.cxx
cmTarget.h
+ cmTargetPropertyComputer.cxx
+ cmTargetPropertyComputer.h
cmTargetExport.h
cmTest.cxx
cmTest.h
@@ -377,6 +386,243 @@ set(SRCS
cmake.cxx
cmake.h
+ cmCommand.cxx
+ cmCommand.h
+ cmCommands.cxx
+ cmCommands.h
+ cmAddCompileOptionsCommand.cxx
+ cmAddCompileOptionsCommand.h
+ cmAddCustomCommandCommand.cxx
+ cmAddCustomCommandCommand.h
+ cmAddCustomTargetCommand.cxx
+ cmAddCustomTargetCommand.h
+ cmAddDefinitionsCommand.cxx
+ cmAddDefinitionsCommand.h
+ cmAddDependenciesCommand.cxx
+ cmAddDependenciesCommand.h
+ cmAddExecutableCommand.cxx
+ cmAddExecutableCommand.h
+ cmAddLibraryCommand.cxx
+ cmAddLibraryCommand.h
+ cmAddSubDirectoryCommand.cxx
+ cmAddSubDirectoryCommand.h
+ cmAddTestCommand.cxx
+ cmAddTestCommand.h
+ cmAuxSourceDirectoryCommand.cxx
+ cmAuxSourceDirectoryCommand.h
+ cmBreakCommand.cxx
+ cmBreakCommand.h
+ cmBuildCommand.cxx
+ cmBuildCommand.h
+ cmBuildNameCommand.cxx
+ cmBuildNameCommand.h
+ cmCMakeHostSystemInformationCommand.cxx
+ cmCMakeHostSystemInformationCommand.h
+ cmCMakeMinimumRequired.cxx
+ cmCMakeMinimumRequired.h
+ cmCMakePolicyCommand.cxx
+ cmCMakePolicyCommand.h
+ cmCommandArgumentsHelper.cxx
+ cmCommandArgumentsHelper.h
+ cmConditionEvaluator.cxx
+ cmConditionEvaluator.h
+ cmConfigureFileCommand.cxx
+ cmConfigureFileCommand.h
+ cmContinueCommand.cxx
+ cmContinueCommand.h
+ cmCoreTryCompile.cxx
+ cmCoreTryCompile.h
+ cmCreateTestSourceList.cxx
+ cmCreateTestSourceList.h
+ cmDefinePropertyCommand.cxx
+ cmDefinePropertyCommand.h
+ cmElseCommand.cxx
+ cmElseCommand.h
+ cmElseIfCommand.cxx
+ cmElseIfCommand.h
+ cmEnableLanguageCommand.cxx
+ cmEnableLanguageCommand.h
+ cmEnableTestingCommand.cxx
+ cmEnableTestingCommand.h
+ cmEndForEachCommand.cxx
+ cmEndForEachCommand.h
+ cmEndFunctionCommand.cxx
+ cmEndFunctionCommand.h
+ cmEndIfCommand.cxx
+ cmEndIfCommand.h
+ cmEndMacroCommand.cxx
+ cmEndMacroCommand.h
+ cmEndWhileCommand.cxx
+ cmEndWhileCommand.h
+ cmExecProgramCommand.cxx
+ cmExecProgramCommand.h
+ cmExecuteProcessCommand.cxx
+ cmExecuteProcessCommand.h
+ cmExpandedCommandArgument.cxx
+ cmExpandedCommandArgument.h
+ cmExportCommand.cxx
+ cmExportCommand.h
+ cmExportLibraryDependenciesCommand.cxx
+ cmExportLibraryDependenciesCommand.h
+ cmFLTKWrapUICommand.cxx
+ cmFLTKWrapUICommand.h
+ cmFileCommand.cxx
+ cmFileCommand.h
+ cmFindBase.cxx
+ cmFindBase.h
+ cmFindCommon.cxx
+ cmFindCommon.h
+ cmFindFileCommand.cxx
+ cmFindFileCommand.h
+ cmFindLibraryCommand.cxx
+ cmFindLibraryCommand.h
+ cmFindPackageCommand.cxx
+ cmFindPackageCommand.h
+ cmFindPathCommand.cxx
+ cmFindPathCommand.h
+ cmFindProgramCommand.cxx
+ cmFindProgramCommand.h
+ cmForEachCommand.cxx
+ cmForEachCommand.h
+ cmFunctionCommand.cxx
+ cmFunctionCommand.h
+ cmGetCMakePropertyCommand.cxx
+ cmGetCMakePropertyCommand.h
+ cmGetDirectoryPropertyCommand.cxx
+ cmGetDirectoryPropertyCommand.h
+ cmGetFilenameComponentCommand.cxx
+ cmGetFilenameComponentCommand.h
+ cmGetPropertyCommand.cxx
+ cmGetPropertyCommand.h
+ cmGetSourceFilePropertyCommand.cxx
+ cmGetSourceFilePropertyCommand.h
+ cmGetTargetPropertyCommand.cxx
+ cmGetTargetPropertyCommand.h
+ cmGetTestPropertyCommand.cxx
+ cmGetTestPropertyCommand.h
+ cmHexFileConverter.cxx
+ cmHexFileConverter.h
+ cmIfCommand.cxx
+ cmIfCommand.h
+ cmIncludeCommand.cxx
+ cmIncludeCommand.h
+ cmIncludeDirectoryCommand.cxx
+ cmIncludeDirectoryCommand.h
+ cmIncludeExternalMSProjectCommand.cxx
+ cmIncludeExternalMSProjectCommand.h
+ cmIncludeRegularExpressionCommand.cxx
+ cmIncludeRegularExpressionCommand.h
+ cmInstallCommand.cxx
+ cmInstallCommand.h
+ cmInstallCommandArguments.cxx
+ cmInstallCommandArguments.h
+ cmInstallFilesCommand.cxx
+ cmInstallFilesCommand.h
+ cmInstallProgramsCommand.cxx
+ cmInstallProgramsCommand.h
+ cmInstallTargetsCommand.cxx
+ cmInstallTargetsCommand.h
+ cmLinkDirectoriesCommand.cxx
+ cmLinkDirectoriesCommand.h
+ cmLinkLibrariesCommand.cxx
+ cmLinkLibrariesCommand.h
+ cmListCommand.cxx
+ cmListCommand.h
+ cmLoadCacheCommand.cxx
+ cmLoadCacheCommand.h
+ cmLoadCommandCommand.cxx
+ cmLoadCommandCommand.h
+ cmMacroCommand.cxx
+ cmMacroCommand.h
+ cmMakeDirectoryCommand.cxx
+ cmMakeDirectoryCommand.h
+ cmMarkAsAdvancedCommand.cxx
+ cmMarkAsAdvancedCommand.h
+ cmMathCommand.cxx
+ cmMathCommand.h
+ cmMessageCommand.cxx
+ cmMessageCommand.h
+ cmOptionCommand.cxx
+ cmOptionCommand.h
+ cmOutputRequiredFilesCommand.cxx
+ cmOutputRequiredFilesCommand.h
+ cmParseArgumentsCommand.cxx
+ cmParseArgumentsCommand.h
+ cmPathLabel.cxx
+ cmPathLabel.h
+ cmProjectCommand.cxx
+ cmProjectCommand.h
+ cmQTWrapCPPCommand.cxx
+ cmQTWrapCPPCommand.h
+ cmQTWrapUICommand.cxx
+ cmQTWrapUICommand.h
+ cmRemoveCommand.cxx
+ cmRemoveCommand.h
+ cmRemoveDefinitionsCommand.cxx
+ cmRemoveDefinitionsCommand.h
+ cmReturnCommand.cxx
+ cmReturnCommand.h
+ cmSearchPath.cxx
+ cmSearchPath.h
+ cmSeparateArgumentsCommand.cxx
+ cmSeparateArgumentsCommand.h
+ cmSetCommand.cxx
+ cmSetCommand.h
+ cmSetDirectoryPropertiesCommand.cxx
+ cmSetDirectoryPropertiesCommand.h
+ cmSetPropertyCommand.cxx
+ cmSetPropertyCommand.h
+ cmSetSourceFilesPropertiesCommand.cxx
+ cmSetSourceFilesPropertiesCommand.h
+ cmSetTargetPropertiesCommand.cxx
+ cmSetTargetPropertiesCommand.h
+ cmSetTestsPropertiesCommand.cxx
+ cmSetTestsPropertiesCommand.h
+ cmSiteNameCommand.cxx
+ cmSiteNameCommand.h
+ cmSourceGroupCommand.cxx
+ cmSourceGroupCommand.h
+ cmStringCommand.cxx
+ cmStringCommand.h
+ cmSubdirCommand.cxx
+ cmSubdirCommand.h
+ cmSubdirDependsCommand.cxx
+ cmSubdirDependsCommand.h
+ cmTargetCompileDefinitionsCommand.cxx
+ cmTargetCompileDefinitionsCommand.h
+ cmTargetCompileFeaturesCommand.cxx
+ cmTargetCompileFeaturesCommand.h
+ cmTargetCompileOptionsCommand.cxx
+ cmTargetCompileOptionsCommand.h
+ cmTargetIncludeDirectoriesCommand.cxx
+ cmTargetIncludeDirectoriesCommand.h
+ cmTargetLinkLibrariesCommand.cxx
+ cmTargetLinkLibrariesCommand.h
+ cmTargetPropCommandBase.cxx
+ cmTargetPropCommandBase.h
+ cmTargetSourcesCommand.cxx
+ cmTargetSourcesCommand.h
+ cmTimestamp.cxx
+ cmTimestamp.h
+ cmTryCompileCommand.cxx
+ cmTryCompileCommand.h
+ cmTryRunCommand.cxx
+ cmTryRunCommand.h
+ cmUnsetCommand.cxx
+ cmUnsetCommand.h
+ cmUseMangledMesaCommand.cxx
+ cmUseMangledMesaCommand.h
+ cmUtilitySourceCommand.cxx
+ cmUtilitySourceCommand.h
+ cmVariableRequiresCommand.cxx
+ cmVariableRequiresCommand.h
+ cmVariableWatchCommand.cxx
+ cmVariableWatchCommand.h
+ cmWhileCommand.cxx
+ cmWhileCommand.h
+ cmWriteFileCommand.cxx
+ cmWriteFileCommand.h
+
cm_auto_ptr.hxx
cm_get_date.h
cm_get_date.c
@@ -384,54 +630,10 @@ set(SRCS
cm_sha2.c
cm_utf8.h
cm_utf8.c
+ cm_codecvt.hxx
+ cm_codecvt.cxx
)
-set(COMMAND_INCLUDES "#include \"cmTargetPropCommandBase.cxx\"\n")
-list(APPEND SRCS cmTargetPropCommandBase.cxx)
-set_property(SOURCE cmTargetPropCommandBase.cxx PROPERTY HEADER_FILE_ONLY ON)
-set(NEW_COMMANDS "")
-foreach(command_file
- cmAddCompileOptionsCommand
- cmAuxSourceDirectoryCommand
- cmBuildNameCommand
- cmCMakeHostSystemInformationCommand
- cmElseIfCommand
- cmExportCommand
- cmExportLibraryDependenciesCommand
- cmFLTKWrapUICommand
- cmIncludeExternalMSProjectCommand
- cmInstallProgramsCommand
- cmLinkLibrariesCommand
- cmLoadCacheCommand
- cmOutputRequiredFilesCommand
- cmQTWrapCPPCommand
- cmQTWrapUICommand
- cmRemoveCommand
- cmRemoveDefinitionsCommand
- cmSourceGroupCommand
- cmSubdirDependsCommand
- cmTargetCompileDefinitionsCommand
- cmTargetCompileFeaturesCommand
- cmTargetCompileOptionsCommand
- cmTargetIncludeDirectoriesCommand
- cmTargetSourcesCommand
- cmUseMangledMesaCommand
- cmUtilitySourceCommand
- cmVariableRequiresCommand
- cmVariableWatchCommand
- cmWriteFileCommand
- # This one must be last because it includes windows.h and
- # windows.h #defines GetCurrentDirectory which is a member
- # of cmMakefile
- cmLoadCommandCommand
- )
- set(COMMAND_INCLUDES "${COMMAND_INCLUDES}#include \"${command_file}.cxx\"\n")
- set(NEW_COMMANDS "${NEW_COMMANDS}commands.push_back(new ${command_file});\n")
- list(APPEND SRCS ${command_file}.cxx)
- set_property(SOURCE ${command_file}.cxx PROPERTY HEADER_FILE_ONLY ON)
-endforeach()
-configure_file(cmCommands.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/cmCommands.cxx @ONLY)
-
# Kdevelop only works on UNIX and not windows
if(UNIX)
set(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx)
@@ -543,6 +745,8 @@ set(SRCS ${SRCS}
cmNinjaNormalTargetGenerator.h
cmNinjaUtilityTargetGenerator.cxx
cmNinjaUtilityTargetGenerator.h
+ cmNinjaLinkLineComputer.cxx
+ cmNinjaLinkLineComputer.h
)
# Temporary variable for tools targets
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d8c77fc..c656fba 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 7)
-set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 2)
+set(CMake_VERSION_PATCH 20161025)
+#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 88a3741..d656063 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -10,7 +10,6 @@
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
-#include "cmTypeMacro.h"
#include <map>
#include <set>
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index d9ac909..0098a4b 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -231,7 +231,7 @@ public:
protected:
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
{
- file = name == "file" ? true : false;
+ file = name == "file";
if (file) {
hasFiles = true;
}
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
index 063b032..a617d9b 100644
--- a/Source/CPack/cmCPack7zGenerator.h
+++ b/Source/CPack/cmCPack7zGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPack7zGenerator
* \brief A generator for 7z files
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index e960a6a..df02ae8 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -7,7 +7,6 @@
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
#include <iosfwd>
#include <string>
@@ -23,7 +22,7 @@ class cmCPackComponent;
class cmCPackArchiveGenerator : public cmCPackGenerator
{
public:
- cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator);
+ typedef cmCPackGenerator Superclass;
/**
* Construct generator
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index f46ae5a..7db933e 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index d4135ce..09b9c0d 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmXMLSafe.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 9232ffc..f32dd70 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -6,9 +6,7 @@
#include <cmConfigure.h>
#include "cmCPackComponentGroup.h"
-#include "cmObject.h"
#include "cmSystemTools.h"
-#include "cmTypeMacro.h"
#include <map>
#include <sstream>
@@ -20,7 +18,8 @@ class cmInstalledFile;
class cmMakefile;
#define cmCPackTypeMacro(klass, superclass) \
- cmTypeMacro(klass, superclass); \
+ typedef superclass Superclass; \
+ const char* GetNameOfClass() CM_OVERRIDE { return #klass; } \
static cmCPackGenerator* CreateGenerator() { return new klass; } \
class cmCPackTypeMacro_UseTrailingSemicolon
@@ -32,24 +31,14 @@ class cmMakefile;
cmCPackLog_msg.str().c_str()); \
} while (0)
-#ifdef cerr
-#undef cerr
-#endif
-#define cerr no_cerr_use_cmCPack_Log
-
-#ifdef cout
-#undef cout
-#endif
-#define cout no_cout_use_cmCPack_Log
-
/** \class cmCPackGenerator
* \brief A superclass of all CPack Generators
*
*/
-class cmCPackGenerator : public cmObject
+class cmCPackGenerator
{
public:
- cmTypeMacro(cmCPackGenerator, cmObject);
+ virtual const char* GetNameOfClass() = 0;
/**
* If verbose then more information is printed out
*/
@@ -93,7 +82,7 @@ public:
* Construct generator
*/
cmCPackGenerator();
- ~cmCPackGenerator() CM_OVERRIDE;
+ virtual ~cmCPackGenerator();
//! Set and get the options
void SetOption(const std::string& op, const char* value);
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 145867e..0a98f91 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -5,9 +5,6 @@
#include <cmConfigure.h>
-#include "cmObject.h"
-#include "cmTypeMacro.h"
-
#include <map>
#include <string>
#include <vector>
@@ -19,13 +16,11 @@ class cmCPackLog;
* \brief A container for CPack generators
*
*/
-class cmCPackGeneratorFactory : public cmObject
+class cmCPackGeneratorFactory
{
public:
- cmTypeMacro(cmCPackGeneratorFactory, cmObject);
-
cmCPackGeneratorFactory();
- ~cmCPackGeneratorFactory() CM_OVERRIDE;
+ ~cmCPackGeneratorFactory();
//! Get the generator
cmCPackGenerator* NewGenerator(const std::string& name);
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index be429fe..317f613 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -15,8 +15,6 @@ cmCPackLog::cmCPackLog()
this->NewLine = true;
this->LastTag = cmCPackLog::NOTAG;
-#undef cerr
-#undef cout
this->DefaultOutput = &std::cout;
this->DefaultError = &std::cerr;
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 0831843..9ffe5c4 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -5,9 +5,6 @@
#include <cmConfigure.h>
-#include "cmObject.h"
-#include "cmTypeMacro.h"
-
#include <ostream>
#include <string.h>
#include <string>
@@ -19,27 +16,15 @@
(ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str()); \
} while (0)
-#ifdef cerr
-#undef cerr
-#endif
-#define cerr no_cerr_use_cmCPack_Log
-
-#ifdef cout
-#undef cout
-#endif
-#define cout no_cout_use_cmCPack_Log
-
/** \class cmCPackLog
* \brief A container for CPack generators
*
*/
-class cmCPackLog : public cmObject
+class cmCPackLog
{
public:
- cmTypeMacro(cmCPackLog, cmObject);
-
cmCPackLog();
- ~cmCPackLog() CM_OVERRIDE;
+ ~cmCPackLog();
enum __log_tags
{
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index d61341c..b4bf2d4 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
#include <iosfwd>
#include <set>
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index 5569185..bb3c1a7 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -3,6 +3,9 @@
#ifndef cmCPackPKGGenerator_h
#define cmCPackPKGGenerator_h
+#include <cmConfigure.h>
+#include <set>
+
#include "cmCPackGenerator.h"
class cmCPackComponent;
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index bd55206..9817327 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -105,39 +105,224 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
packageFileNames.clear();
std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
- // The default behavior is to have one package by component group
- // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
- if (!ignoreGroup) {
- std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
- for (compGIt = this->ComponentGroups.begin();
- compGIt != this->ComponentGroups.end(); ++compGIt) {
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
- << compGIt->first << std::endl);
- retval &= PackageOnePack(initialTopLevel, compGIt->first);
+ const char* mainComponent = this->GetOption("CPACK_RPM_MAIN_COMPONENT");
+
+ if (this->IsOn("CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE") &&
+ !this->IsOn("CPACK_RPM_DEBUGINFO_PACKAGE")) {
+ // check if we need to set CPACK_RPM_DEBUGINFO_PACKAGE because non of
+ // the components is setting per component debuginfo package variable
+ bool shouldSet = true;
+
+ if (ignoreGroup) {
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ std::string component(compIt->first);
+ std::transform(component.begin(), component.end(), component.begin(),
+ ::toupper);
+
+ if (this->IsOn("CPACK_RPM_" + compIt->first + "_DEBUGINFO_PACKAGE") ||
+ this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
+ shouldSet = false;
+ break;
+ }
+ }
+ } else {
+ std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
+ for (compGIt = this->ComponentGroups.begin();
+ compGIt != this->ComponentGroups.end(); ++compGIt) {
+ std::string component(compGIt->first);
+ std::transform(component.begin(), component.end(), component.begin(),
+ ::toupper);
+
+ if (this->IsOn("CPACK_RPM_" + compGIt->first + "_DEBUGINFO_PACKAGE") ||
+ this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
+ shouldSet = false;
+ break;
+ }
+ }
+
+ if (shouldSet) {
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin();
+ compIt != this->Components.end(); ++compIt) {
+ // Does the component belong to a group?
+ if (compIt->second.Group == CM_NULLPTR) {
+ std::string component(compIt->first);
+ std::transform(component.begin(), component.end(),
+ component.begin(), ::toupper);
+
+ if (this->IsOn("CPACK_RPM_" + compIt->first +
+ "_DEBUGINFO_PACKAGE") ||
+ this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
+ shouldSet = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (shouldSet) {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Setting "
+ << "CPACK_RPM_DEBUGINFO_PACKAGE because "
+ << "CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE is set but "
+ << " none of the "
+ << "CPACK_RPM_<component>_DEBUGINFO_PACKAGE variables "
+ << "are set." << std::endl);
+ this->SetOption("CPACK_RPM_DEBUGINFO_PACKAGE", "ON");
}
- // Handle Orphan components (components not belonging to any groups)
- std::map<std::string, cmCPackComponent>::iterator compIt;
- for (compIt = this->Components.begin(); compIt != this->Components.end();
- ++compIt) {
- // Does the component belong to a group?
- if (compIt->second.Group == CM_NULLPTR) {
- cmCPackLogger(
- cmCPackLog::LOG_VERBOSE, "Component <"
- << compIt->second.Name
- << "> does not belong to any group, package it separately."
- << std::endl);
+ }
+
+ if (mainComponent) {
+ if (this->IsOn("CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE")) {
+ this->SetOption("GENERATE_SPEC_PARTS", "ON");
+ }
+
+ std::string mainComponentUpper(mainComponent);
+ std::transform(mainComponentUpper.begin(), mainComponentUpper.end(),
+ mainComponentUpper.begin(), ::toupper);
+
+ // The default behavior is to have one package by component group
+ // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
+ if (!ignoreGroup) {
+ std::map<std::string, cmCPackComponentGroup>::iterator mainCompGIt =
+ this->ComponentGroups.end();
+
+ std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
+ for (compGIt = this->ComponentGroups.begin();
+ compGIt != this->ComponentGroups.end(); ++compGIt) {
+ std::string component(compGIt->first);
+ std::transform(component.begin(), component.end(), component.begin(),
+ ::toupper);
+
+ if (mainComponentUpper == component) {
+ // main component will be handled last
+ mainCompGIt = compGIt;
+ continue;
+ }
+
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
+ << compGIt->first << std::endl);
+ retval &= PackageOnePack(initialTopLevel, compGIt->first);
+ }
+ // Handle Orphan components (components not belonging to any groups)
+ std::map<std::string, cmCPackComponent>::iterator mainCompIt =
+ this->Components.end();
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ // Does the component belong to a group?
+ if (compIt->second.Group == CM_NULLPTR) {
+ std::string component(compIt->first);
+ std::transform(component.begin(), component.end(), component.begin(),
+ ::toupper);
+
+ if (mainComponentUpper == component) {
+ // main component will be handled last
+ mainCompIt = compIt;
+ continue;
+ }
+
+ cmCPackLogger(
+ cmCPackLog::LOG_VERBOSE, "Component <"
+ << compIt->second.Name
+ << "> does not belong to any group, package it separately."
+ << std::endl);
+ retval &= PackageOnePack(initialTopLevel, compIt->first);
+ }
+ }
+
+ if (retval) {
+ this->SetOption("GENERATE_SPEC_PARTS", "OFF");
+
+ if (mainCompGIt != this->ComponentGroups.end()) {
+ retval &= PackageOnePack(initialTopLevel, mainCompGIt->first);
+ } else if (mainCompIt != this->Components.end()) {
+ retval &= PackageOnePack(initialTopLevel, mainCompIt->first);
+ } else {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_RPM_MAIN_COMPONENT set"
+ << " to non existing component.\n");
+ retval = 0;
+ }
+ }
+ }
+ // CPACK_COMPONENTS_IGNORE_GROUPS is set
+ // We build 1 package per component
+ else {
+ std::map<std::string, cmCPackComponent>::iterator mainCompIt =
+ this->Components.end();
+
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ std::string component(compIt->first);
+ std::transform(component.begin(), component.end(), component.begin(),
+ ::toupper);
+
+ if (mainComponentUpper == component) {
+ // main component will be handled last
+ mainCompIt = compIt;
+ continue;
+ }
+
retval &= PackageOnePack(initialTopLevel, compIt->first);
}
+
+ if (retval) {
+ this->SetOption("GENERATE_SPEC_PARTS", "OFF");
+
+ if (mainCompIt != this->Components.end()) {
+ retval &= PackageOnePack(initialTopLevel, mainCompIt->first);
+ } else {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_RPM_MAIN_COMPONENT set"
+ << " to non existing component.\n");
+ retval = 0;
+ }
+ }
}
- }
- // CPACK_COMPONENTS_IGNORE_GROUPS is set
- // We build 1 package per component
- else {
- std::map<std::string, cmCPackComponent>::iterator compIt;
- for (compIt = this->Components.begin(); compIt != this->Components.end();
- ++compIt) {
- retval &= PackageOnePack(initialTopLevel, compIt->first);
+ } else if (!this->IsOn("CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE") ||
+ this->Components.size() == 1) {
+ // The default behavior is to have one package by component group
+ // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
+ if (!ignoreGroup) {
+ std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
+ for (compGIt = this->ComponentGroups.begin();
+ compGIt != this->ComponentGroups.end(); ++compGIt) {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
+ << compGIt->first << std::endl);
+ retval &= PackageOnePack(initialTopLevel, compGIt->first);
+ }
+ // Handle Orphan components (components not belonging to any groups)
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ // Does the component belong to a group?
+ if (compIt->second.Group == CM_NULLPTR) {
+ cmCPackLogger(
+ cmCPackLog::LOG_VERBOSE, "Component <"
+ << compIt->second.Name
+ << "> does not belong to any group, package it separately."
+ << std::endl);
+ retval &= PackageOnePack(initialTopLevel, compIt->first);
+ }
+ }
+ }
+ // CPACK_COMPONENTS_IGNORE_GROUPS is set
+ // We build 1 package per component
+ else {
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt = this->Components.begin(); compIt != this->Components.end();
+ ++compIt) {
+ retval &= PackageOnePack(initialTopLevel, compIt->first);
+ }
}
+ } else {
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR, "CPACK_RPM_MAIN_COMPONENT not set but"
+ << " it is mandatory with CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE"
+ << " being set.\n");
+ retval = 0;
}
if (retval) {
@@ -156,6 +341,10 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(
packageFileNames.clear();
std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
+ if (this->IsOn("CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE")) {
+ this->SetOption("CPACK_RPM_DEBUGINFO_PACKAGE", "ON");
+ }
+
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
"(CPACK_COMPONENTS_ALL_[GROUPS_]IN_ONE_PACKAGE is set)"
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index f8bcbfe..4d48bd8 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
#include <string>
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index a1bee5f..4b9c1c6 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackGenerator.h"
#include "cmCPackTGZGenerator.h"
-#include "cmTypeMacro.h"
#include <iosfwd>
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
index e93fb44..ee2e975 100644
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ b/Source/CPack/cmCPackTGZGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPackTGZGenerator
* \brief A generator for TGZ files
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
index b8a7597..876ca7d 100644
--- a/Source/CPack/cmCPackTXZGenerator.h
+++ b/Source/CPack/cmCPackTXZGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPackTXZGenerator
* \brief A generator for TXZ files
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
index 2e8ba9b..42214fd 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ b/Source/CPack/cmCPackTarBZip2Generator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPackTarBZip2Generator
* \brief A generator for TarBZip2 files
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index 7d253e1..1476642 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPackTarCompressGenerator
* \brief A generator for TarCompress files
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
index e0334fb..95b6489 100644
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ b/Source/CPack/cmCPackZIPGenerator.h
@@ -7,7 +7,6 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmTypeMacro.h"
/** \class cmCPackZIPGenerator
* \brief A generator for ZIP files
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 5c45b14..b06bd38 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -10,8 +10,8 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cmTypeMacro.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
@@ -415,9 +415,7 @@ int main(int argc, char const* const* argv)
}
doc.SetSection("Generators", v);
-#undef cout
return doc.PrintRequestedDocumentation(std::cout) ? 0 : 1;
-#define cout no_cout_use_cmCPack_Log
}
if (cmSystemTools::GetErrorOccuredFlag()) {
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index 8d787ea..5885738 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <sstream>
#include <stddef.h>
@@ -22,7 +21,7 @@ class cmake;
class cmCTestBuildAndTestHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestBuildAndTestHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 0aaf623..9cc6f7e 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -47,8 +46,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- cmTypeMacro(cmCTestBuildCommand, cmCTestHandlerCommand);
-
cmGlobalGenerator* GlobalGenerator;
protected:
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 16563ce..5bd1157 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
#include <deque>
@@ -25,7 +24,7 @@ class cmXMLWriter;
class cmCTestBuildHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestBuildHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h
index 2b9b93b..6fc237a 100644
--- a/Source/CTest/cmCTestCommand.h
+++ b/Source/CTest/cmCTestCommand.h
@@ -26,8 +26,6 @@ public:
cmCTest* CTest;
cmCTestScriptHandler* CTestScriptHandler;
-
- cmTypeMacro(cmCTestCommand, cmCommand);
};
#endif
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 62802ef..73e893d 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -102,6 +102,10 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
cmakeConfigureCommand += "\"";
}
+ if (this->Makefile->IsOn("CTEST_USE_LAUNCHERS")) {
+ cmakeConfigureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\"";
+ }
+
cmakeConfigureCommand += " \"-G";
cmakeConfigureCommand += cmakeGeneratorName;
cmakeConfigureCommand += "\"";
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index 8bc69fe..22d1217 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <string>
@@ -39,8 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_configure"; }
- cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand);
-
protected:
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h
index 913e5c9..7fa95ed 100644
--- a/Source/CTest/cmCTestConfigureHandler.h
+++ b/Source/CTest/cmCTestConfigureHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
/** \class cmCTestConfigureHandler
* \brief A class that handles ctest -S invocations
@@ -15,7 +14,7 @@
class cmCTestConfigureHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestConfigureHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index d54e68d..bf42aa1 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <set>
#include <string>
@@ -40,7 +39,7 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_coverage"; }
- cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand);
+ typedef cmCTestHandlerCommand Superclass;
protected:
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 062f971..339b5d7 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
#include <iosfwd>
@@ -38,7 +37,7 @@ public:
class cmCTestCoverageHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestCoverageHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index 8b5d5a4..4c1438b 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -51,8 +50,6 @@ public:
{
return "ctest_empty_binary_directory";
}
-
- cmTypeMacro(cmCTestEmptyBinaryDirectoryCommand, cmCTestCommand);
};
#endif
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index b2ab1d2..4176eb2 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTest.h"
-#include "cmObject.h"
#include "cmSystemTools.h"
#include <map>
@@ -22,7 +21,7 @@ class cmMakefile;
* \brief A superclass of all CTest Handlers
*
*/
-class cmCTestGenericHandler : public cmObject
+class cmCTestGenericHandler
{
public:
/**
@@ -70,7 +69,7 @@ public:
* Construct handler
*/
cmCTestGenericHandler();
- ~cmCTestGenericHandler() CM_OVERRIDE;
+ virtual ~cmCTestGenericHandler();
typedef std::map<std::string, std::string> t_StringToString;
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index 3fd384f..92748af 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <stddef.h>
#include <string>
@@ -32,8 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand);
-
enum
{
ct_NONE,
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index e5c50b2..224681a 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -7,7 +7,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index d3b8be7..30d9e2b 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestTestCommand.h"
-#include "cmTypeMacro.h"
#include <string>
@@ -39,8 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; }
- cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand);
-
protected:
cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE;
};
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index b37db30..0052a16 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -375,11 +375,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.StartElement("DefectList");
for (cc = 0; cc < this->GlobalResults.size(); cc++) {
if (this->GlobalResults[cc]) {
-#ifdef cerr
-#undef cerr
-#endif
std::cerr.width(35);
-#define cerr no_cerr
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
this->ResultStringsLong[cc]
<< " - " << this->GlobalResults[cc] << std::endl,
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 8d678af..b12da28 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestTestHandler.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -23,7 +22,7 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler
friend class cmCTestRunTest;
public:
- cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
+ typedef cmCTestTestHandler Superclass;
void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 29eba90..e155595 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -46,8 +45,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; }
-
- cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand);
};
#endif
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index 2978bb9..01ed62e 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -47,8 +46,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; }
-
- cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand);
};
#endif
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 8848a70..7ee0f75 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -22,6 +22,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -280,7 +281,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
- cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot();
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
snapshot.GetDirectory().SetCurrentSource(cwd);
snapshot.GetDirectory().SetCurrentBinary(cwd);
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 2bace58..47644be 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -56,7 +55,7 @@ class cmake;
class cmCTestScriptHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestScriptHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/**
* Add a script to run, and if is should run in the current process
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index b144012..1052f76 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <string>
#include <vector>
@@ -47,8 +46,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; }
-
- cmTypeMacro(cmCTestSleepCommand, cmCTestCommand);
};
#endif
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index 6bb0bc6..cc72d0c 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestCommand.h"
-#include "cmTypeMacro.h"
#include <iosfwd>
#include <string>
@@ -60,8 +59,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_start"; }
- cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
-
private:
bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
bool CreateNewTag;
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index db8a604..f5b52c1 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <set>
#include <string>
@@ -55,7 +54,7 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_submit"; }
- cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
+ typedef cmCTestHandlerCommand Superclass;
protected:
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 06cd77f..d21471d 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -8,6 +8,7 @@
#include "cmCurl.h"
#include "cmGeneratedFileStream.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmake.h"
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index abe4fa2..baaf8af 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <iosfwd>
#include <set>
@@ -23,7 +22,7 @@
class cmCTestSubmitHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
cmCTestSubmitHandler();
~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = CM_NULLPTR; }
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 6161acb..3250d93 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <string>
@@ -39,8 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_test"; }
- cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand);
-
protected:
virtual cmCTestGenericHandler* InitializeActualHandler();
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 0d0237f..132d049 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -10,6 +10,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cm_auto_ptr.hxx"
@@ -58,8 +59,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "subdirs"; }
- cmTypeMacro(cmCTestSubdirCommand, cmCommand);
-
cmCTestTestHandler* TestHandler;
};
@@ -139,8 +138,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
- cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
-
cmCTestTestHandler* TestHandler;
};
@@ -213,8 +210,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "add_test"; }
- cmTypeMacro(cmCTestAddTestCommand, cmCommand);
-
cmCTestTestHandler* TestHandler;
};
@@ -253,8 +248,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
- cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand);
-
cmCTestTestHandler* TestHandler;
};
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 73b3174..5b07e98 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <cmsys/RegularExpression.hxx>
#include <iosfwd>
@@ -32,7 +31,7 @@ class cmCTestTestHandler : public cmCTestGenericHandler
friend class cmCTestBatchTestHandler;
public:
- cmTypeMacro(cmCTestTestHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/**
* The main entry point for this class
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index 9d1a86e..5761f50 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <string>
@@ -39,8 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_update"; }
- cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand);
-
protected:
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
};
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
index c9a8682..87781e8 100644
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -6,7 +6,6 @@
#include <cmConfigure.h>
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
#include <string>
#include <utility>
@@ -19,7 +18,7 @@
class cmCTestUpdateHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestUpdateHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index b858077..474f699 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmCTestHandlerCommand.h"
-#include "cmTypeMacro.h"
#include <string>
@@ -41,7 +40,7 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "ctest_upload"; }
- cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand);
+ typedef cmCTestHandlerCommand Superclass;
protected:
cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h
index 251cd3e..77c2aec 100644
--- a/Source/CTest/cmCTestUploadHandler.h
+++ b/Source/CTest/cmCTestUploadHandler.h
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-#include "cmTypeMacro.h"
/** \class cmCTestUploadHandler
* \brief Helper class for CTest
@@ -18,7 +17,7 @@
class cmCTestUploadHandler : public cmCTestGenericHandler
{
public:
- cmTypeMacro(cmCTestUploadHandler, cmCTestGenericHandler);
+ typedef cmCTestGenericHandler Superclass;
cmCTestUploadHandler();
~cmCTestUploadHandler() CM_OVERRIDE {}
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index cf3c7ac..a24fe21 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -225,6 +225,7 @@ void cmProcess::ChangeTimeout(double t)
void cmProcess::ResetStartTime()
{
cmsysProcess_ResetStartTime(this->Process);
+ this->StartTime = cmSystemTools::GetTime();
}
int cmProcess::GetExitException()
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx
index 5268a5d..80a5b5b 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.cxx
+++ b/Source/CursesDialog/cmCursesBoolWidget.cxx
@@ -3,7 +3,7 @@
#include "cmCursesBoolWidget.h"
#include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <string>
@@ -11,7 +11,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left,
int top)
: cmCursesWidget(width, height, left, top)
{
- this->Type = cmState::BOOL;
+ this->Type = cmStateEnums::BOOL;
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
field_opts_off(this->Field, O_STATIC);
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 93785e0..5539fbe 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -10,6 +10,7 @@
#include "cmCursesStringWidget.h"
#include "cmCursesWidget.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -47,7 +48,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
const char* value = cm->GetState()->GetCacheEntryValue(key);
assert(value);
switch (cm->GetState()->GetCacheEntryType(key)) {
- case cmState::BOOL:
+ case cmStateEnums::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
if (cmSystemTools::IsOn(value)) {
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
@@ -55,15 +56,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
}
break;
- case cmState::PATH:
+ case cmStateEnums::PATH:
this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
break;
- case cmState::FILEPATH:
+ case cmStateEnums::FILEPATH:
this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
break;
- case cmState::STRING: {
+ case cmStateEnums::STRING: {
const char* stringsProp =
cm->GetState()->GetCacheEntryProperty(key, "STRINGS");
if (stringsProp) {
@@ -83,7 +84,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
break;
}
- case cmState::UNINITIALIZED:
+ case cmStateEnums::UNINITIALIZED:
cmSystemTools::Error("Found an undefined variable: ", key.c_str());
break;
default:
diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx
index 61d07e2..da0478a 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.cxx
+++ b/Source/CursesDialog/cmCursesDummyWidget.cxx
@@ -3,13 +3,13 @@
#include "cmCursesDummyWidget.h"
#include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left,
int top)
: cmCursesWidget(width, height, left, top)
{
- this->Type = cmState::INTERNAL;
+ this->Type = cmStateEnums::INTERNAL;
}
bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/,
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx
index 670c50f..518da4f 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.cxx
+++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx
@@ -3,11 +3,11 @@
#include "cmCursesFilePathWidget.h"
#include "cmCursesPathWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left,
int top)
: cmCursesPathWidget(width, height, left, top)
{
- this->Type = cmState::FILEPATH;
+ this->Type = cmStateEnums::FILEPATH;
}
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 0c3d29d..ebd35f3 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -12,6 +12,7 @@
#include "cmCursesStringWidget.h"
#include "cmCursesWidget.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -106,10 +107,10 @@ void cmCursesMainForm::InitializeUI()
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) {
- cmState::CacheEntryType t =
+ cmStateEnums::CacheEntryType t =
this->CMakeInstance->GetState()->GetCacheEntryType(*it);
- if (t != cmState::INTERNAL && t != cmState::STATIC &&
- t != cmState::UNINITIALIZED) {
+ if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC &&
+ t != cmStateEnums::UNINITIALIZED) {
++count;
}
}
@@ -130,10 +131,10 @@ void cmCursesMainForm::InitializeUI()
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) {
std::string key = *it;
- cmState::CacheEntryType t =
+ cmStateEnums::CacheEntryType t =
this->CMakeInstance->GetState()->GetCacheEntryType(*it);
- if (t == cmState::INTERNAL || t == cmState::STATIC ||
- t == cmState::UNINITIALIZED) {
+ if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+ t == cmStateEnums::UNINITIALIZED) {
continue;
}
@@ -148,10 +149,10 @@ void cmCursesMainForm::InitializeUI()
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) {
std::string key = *it;
- cmState::CacheEntryType t =
+ cmStateEnums::CacheEntryType t =
this->CMakeInstance->GetState()->GetCacheEntryType(*it);
- if (t == cmState::INTERNAL || t == cmState::STATIC ||
- t == cmState::UNINITIALIZED) {
+ if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+ t == cmStateEnums::UNINITIALIZED) {
continue;
}
@@ -249,8 +250,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
cmCursesWidget* cw =
reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
// If in edit mode, get out of it
- if (cw->GetType() == cmState::STRING || cw->GetType() == cmState::PATH ||
- cw->GetType() == cmState::FILEPATH) {
+ if (cw->GetType() == cmStateEnums::STRING ||
+ cw->GetType() == cmStateEnums::PATH ||
+ cw->GetType() == cmStateEnums::FILEPATH) {
cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
sw->SetInEdit(false);
}
@@ -704,7 +706,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
std::string newValue = (*this->Entries)[i]->Entry->GetValue();
std::string fixedOldValue;
std::string fixedNewValue;
- cmState::CacheEntryType t =
+ cmStateEnums::CacheEntryType t =
this->CMakeInstance->GetState()->GetCacheEntryType(cacheKey);
this->FixValue(t, oldValue, fixedOldValue);
this->FixValue(t, newValue, fixedNewValue);
@@ -720,14 +722,14 @@ void cmCursesMainForm::FillCacheManagerFromUI()
}
}
-void cmCursesMainForm::FixValue(cmState::CacheEntryType type,
+void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type,
const std::string& in, std::string& out) const
{
out = in.substr(0, in.find_last_not_of(' ') + 1);
- if (type == cmState::PATH || type == cmState::FILEPATH) {
+ if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
cmSystemTools::ConvertToUnixSlashes(out);
}
- if (type == cmState::BOOL) {
+ if (type == cmStateEnums::BOOL) {
if (cmSystemTools::IsOff(out.c_str())) {
out = "OFF";
} else {
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 4bf452d..d891ea0 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -7,7 +7,7 @@
#include "cmCursesForm.h"
#include "cmCursesStandardIncludes.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <stddef.h>
#include <string>
@@ -110,7 +110,7 @@ protected:
// cache.
void FillCacheManagerFromUI();
// Fix formatting of values to a consistent form.
- void FixValue(cmState::CacheEntryType type, const std::string& in,
+ void FixValue(cmStateEnums::CacheEntryType type, const std::string& in,
std::string& out) const;
// Re-post the existing fields. Used to toggle between
// normal and advanced modes. Render() should be called
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index e23a82d..d26a98f 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -3,7 +3,7 @@
#include "cmCursesOptionsWidget.h"
#include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#define ctrl(z) ((z)&037)
@@ -11,7 +11,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
int top)
: cmCursesWidget(width, height, left, top)
{
- this->Type = cmState::BOOL; // this is a bit of a hack
+ this->Type = cmStateEnums::BOOL; // this is a bit of a hack
// there is no option type, and string type causes ccmake to cast
// the widget into a string widget at some point. BOOL is safe for
// now.
diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx
index d208598..05c3279 100644
--- a/Source/CursesDialog/cmCursesPathWidget.cxx
+++ b/Source/CursesDialog/cmCursesPathWidget.cxx
@@ -4,7 +4,7 @@
#include "cmCursesMainForm.h"
#include "cmCursesStringWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include <vector>
@@ -13,7 +13,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left,
int top)
: cmCursesStringWidget(width, height, left, top)
{
- this->Type = cmState::PATH;
+ this->Type = cmStateEnums::PATH;
this->Cycle = false;
this->CurrentIndex = 0;
}
@@ -50,7 +50,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
std::vector<std::string> dirs;
cmSystemTools::SimpleGlob(glob, dirs,
- (this->Type == cmState::PATH ? -1 : 0));
+ (this->Type == cmStateEnums::PATH ? -1 : 0));
if (this->CurrentIndex < dirs.size()) {
cstr = dirs[this->CurrentIndex];
}
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index f068f67..eabc642 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -6,7 +6,7 @@
#include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.h"
#include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <stdio.h>
#include <string.h>
@@ -21,7 +21,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left,
: cmCursesWidget(width, height, left, top)
{
this->InEdit = false;
- this->Type = cmState::STRING;
+ this->Type = cmStateEnums::STRING;
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
field_opts_off(this->Field, O_STATIC);
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index bb26cf6..d226dd7 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -6,7 +6,7 @@
#include <cmConfigure.h> // IWYU pragma: keep
#include "cmCursesStandardIncludes.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <string>
@@ -41,7 +41,7 @@ public:
/**
* Get the type of the widget (STRING, PATH etc...)
*/
- cmState::CacheEntryType GetType() { return this->Type; }
+ cmStateEnums::CacheEntryType GetType() { return this->Type; }
/**
* If there are any, print the widget specific commands
@@ -62,7 +62,7 @@ protected:
cmCursesWidget(const cmCursesWidget& from);
void operator=(const cmCursesWidget&);
- cmState::CacheEntryType Type;
+ cmStateEnums::CacheEntryType Type;
std::string Value;
FIELD* Field;
// The page in the main form this widget is in
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index cfb10f3..abeff97 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -196,8 +196,8 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) {
- cmState::CacheEntryType t = state->GetCacheEntryType(*it);
- if (t == cmState::INTERNAL || t == cmState::STATIC) {
+ cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*it);
+ if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC) {
continue;
}
@@ -232,19 +232,19 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
if (s.Type == QCMakeProperty::BOOL) {
this->CMakeInstance->AddCacheEntry(
s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF",
- s.Help.toLocal8Bit().data(), cmState::BOOL);
+ s.Help.toLocal8Bit().data(), cmStateEnums::BOOL);
} else if (s.Type == QCMakeProperty::STRING) {
this->CMakeInstance->AddCacheEntry(
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(), cmState::STRING);
+ s.Help.toLocal8Bit().data(), cmStateEnums::STRING);
} else if (s.Type == QCMakeProperty::PATH) {
this->CMakeInstance->AddCacheEntry(
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(), cmState::PATH);
+ s.Help.toLocal8Bit().data(), cmStateEnums::PATH);
} else if (s.Type == QCMakeProperty::FILEPATH) {
this->CMakeInstance->AddCacheEntry(
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(), cmState::FILEPATH);
+ s.Help.toLocal8Bit().data(), cmStateEnums::FILEPATH);
}
}
@@ -259,9 +259,9 @@ QCMakePropertyList QCMake::properties() const
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
i != cacheKeys.end(); ++i) {
- cmState::CacheEntryType t = state->GetCacheEntryType(*i);
- if (t == cmState::INTERNAL || t == cmState::STATIC ||
- t == cmState::UNINITIALIZED) {
+ cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*i);
+ if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+ t == cmStateEnums::UNINITIALIZED) {
continue;
}
@@ -273,14 +273,14 @@ QCMakePropertyList QCMake::properties() const
QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING"));
prop.Value = QString::fromLocal8Bit(cachedValue);
prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
- if (t == cmState::BOOL) {
+ if (t == cmStateEnums::BOOL) {
prop.Type = QCMakeProperty::BOOL;
prop.Value = cmSystemTools::IsOn(cachedValue);
- } else if (t == cmState::PATH) {
+ } else if (t == cmStateEnums::PATH) {
prop.Type = QCMakeProperty::PATH;
- } else if (t == cmState::FILEPATH) {
+ } else if (t == cmStateEnums::FILEPATH) {
prop.Type = QCMakeProperty::FILEPATH;
- } else if (t == cmState::STRING) {
+ } else if (t == cmStateEnums::STRING) {
prop.Type = QCMakeProperty::STRING;
const char* stringsProperty =
state->GetCacheEntryProperty(*i, "STRINGS");
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index 9265cba..21a8012 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileOptionsCommand.h"
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
bool cmAddCompileOptionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 52c4b51..71009b4 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -3,8 +3,14 @@
#ifndef cmAddCompileOptionsCommand_h
#define cmAddCompileOptionsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmAddCompileOptionsCommand : public cmCommand
{
public:
@@ -24,8 +30,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_compile_options"; }
-
- cmTypeMacro(cmAddCompileOptionsCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 527bb6c..643163c 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -31,8 +31,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "add_custom_command"; }
- cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
-
protected:
bool CheckOutputs(const std::vector<std::string>& outputs);
};
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index a4475c7..2ad244c 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -31,8 +31,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_custom_target"; }
-
- cmTypeMacro(cmAddCustomTargetCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 43d0199..c6b5699 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -30,8 +30,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_definitions"; }
-
- cmTypeMacro(cmAddDefinitionsCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 95e2ac6..2c7aa02 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -29,8 +29,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_dependencies"; }
-
- cmTypeMacro(cmAddDependenciesCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 96ad82a..3d0729b 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddExecutableCommand.h"
+#include "cmGlobalGenerator.h"
+
// cmExecutableCommand
bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -133,8 +135,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
this->SetError(e.str());
return false;
}
- cmState::TargetType type = aliasedTarget->GetType();
- if (type != cmState::EXECUTABLE) {
+ cmStateEnums::TargetType type = aliasedTarget->GetType();
+ if (type != cmStateEnums::EXECUTABLE) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is not an "
@@ -165,7 +167,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
}
// Create the imported target.
- this->Makefile->AddImportedTarget(exename, cmState::EXECUTABLE,
+ this->Makefile->AddImportedTarget(exename, cmStateEnums::EXECUTABLE,
importGlobal);
return true;
}
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index fc08e8b..03faaf1 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -30,8 +30,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_executable"; }
-
- cmTypeMacro(cmAddExecutableCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 26e38b8..56cf91a 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -2,7 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddLibraryCommand.h"
+#include "cmGlobalGenerator.h"
#include "cmState.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
#include "cmake.h"
// cmLibraryCommand
@@ -15,10 +18,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
- cmState::TargetType type = cmState::SHARED_LIBRARY;
+ cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
if (cmSystemTools::IsOff(
this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
- type = cmState::STATIC_LIBRARY;
+ type = cmStateEnums::STATIC_LIBRARY;
}
bool excludeFromAll = false;
bool importTarget = false;
@@ -38,57 +41,57 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
while (s != args.end()) {
std::string libType = *s;
if (libType == "STATIC") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting STATIC type.";
this->SetError(e.str());
return false;
}
++s;
- type = cmState::STATIC_LIBRARY;
+ type = cmStateEnums::STATIC_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "SHARED") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting SHARED type.";
this->SetError(e.str());
return false;
}
++s;
- type = cmState::SHARED_LIBRARY;
+ type = cmStateEnums::SHARED_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "MODULE") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting MODULE type.";
this->SetError(e.str());
return false;
}
++s;
- type = cmState::MODULE_LIBRARY;
+ type = cmStateEnums::MODULE_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "OBJECT") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting OBJECT type.";
this->SetError(e.str());
return false;
}
++s;
- type = cmState::OBJECT_LIBRARY;
+ type = cmStateEnums::OBJECT_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "UNKNOWN") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting UNKNOWN type.";
this->SetError(e.str());
return false;
}
++s;
- type = cmState::UNKNOWN_LIBRARY;
+ type = cmStateEnums::UNKNOWN_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "ALIAS") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
this->SetError(e.str());
@@ -116,10 +119,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
++s;
- type = cmState::INTERFACE_LIBRARY;
+ type = cmStateEnums::INTERFACE_LIBRARY;
haveSpecifiedType = true;
} else if (*s == "EXCLUDE_FROM_ALL") {
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
this->SetError(e.str());
@@ -133,7 +136,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
} else if (importTarget && *s == "GLOBAL") {
++s;
importGlobal = true;
- } else if (type == cmState::INTERFACE_LIBRARY && *s == "GLOBAL") {
+ } else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
std::ostringstream e;
e << "GLOBAL option may only be used with IMPORTED libraries.";
this->SetError(e.str());
@@ -143,7 +146,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
}
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (s != args.end()) {
std::ostringstream e;
e << "INTERFACE library requires no source arguments.";
@@ -170,7 +173,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
bool issueMessage = false;
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) {
case cmPolicies::WARN:
- if (type != cmState::INTERFACE_LIBRARY) {
+ if (type != cmStateEnums::INTERFACE_LIBRARY) {
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
issueMessage = true;
}
@@ -233,12 +236,12 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
this->SetError(e.str());
return false;
}
- cmState::TargetType aliasedType = aliasedTarget->GetType();
- if (aliasedType != cmState::SHARED_LIBRARY &&
- aliasedType != cmState::STATIC_LIBRARY &&
- aliasedType != cmState::MODULE_LIBRARY &&
- aliasedType != cmState::OBJECT_LIBRARY &&
- aliasedType != cmState::INTERFACE_LIBRARY) {
+ cmStateEnums::TargetType aliasedType = aliasedTarget->GetType();
+ if (aliasedType != cmStateEnums::SHARED_LIBRARY &&
+ aliasedType != cmStateEnums::STATIC_LIBRARY &&
+ aliasedType != cmStateEnums::MODULE_LIBRARY &&
+ aliasedType != cmStateEnums::OBJECT_LIBRARY &&
+ aliasedType != cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is not a library.";
@@ -265,16 +268,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
- if ((type == cmState::SHARED_LIBRARY || type == cmState::MODULE_LIBRARY) &&
- (this->Makefile->GetState()->GetGlobalPropertyAsBool(
- "TARGET_SUPPORTS_SHARED_LIBS") == false)) {
+ if ((type == cmStateEnums::SHARED_LIBRARY ||
+ type == cmStateEnums::MODULE_LIBRARY) &&
+ !this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "TARGET_SUPPORTS_SHARED_LIBS")) {
std::ostringstream w;
w << "ADD_LIBRARY called with "
- << (type == cmState::SHARED_LIBRARY ? "SHARED" : "MODULE")
+ << (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
<< " option but the target platform does not support dynamic linking. "
"Building a STATIC library instead. This may lead to problems.";
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- type = cmState::STATIC_LIBRARY;
+ type = cmStateEnums::STATIC_LIBRARY;
}
// Handle imported target creation.
@@ -284,13 +288,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("called with IMPORTED argument but no library type.");
return false;
}
- if (type == cmState::OBJECT_LIBRARY) {
+ if (type == cmStateEnums::OBJECT_LIBRARY) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The OBJECT library type may not be used for IMPORTED libraries.");
return true;
}
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
std::ostringstream e;
e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
@@ -314,7 +318,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
// A non-imported target may not have UNKNOWN type.
- if (type == cmState::UNKNOWN_LIBRARY) {
+ if (type == cmStateEnums::UNKNOWN_LIBRARY) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The UNKNOWN library type may be used only for IMPORTED libraries.");
@@ -332,7 +336,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> srclists;
- if (type == cmState::INTERFACE_LIBRARY) {
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (!cmGeneratorExpression::IsValidTargetName(libName) ||
libName.find("::") != std::string::npos) {
std::ostringstream e;
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index d072b80..d8eba8d 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -30,8 +30,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_library"; }
-
- cmTypeMacro(cmAddLibraryCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index bb1e239..0ebe35d 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddSubDirectoryCommand.h"
+#include "cmSystemTools.h"
+
// cmAddSubDirectoryCommand
bool cmAddSubDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 7347482..f300b2e 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -31,8 +31,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
-
- cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
};
#endif
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 92db7bc..7bbf7cf 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -30,8 +30,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "add_test"; }
- cmTypeMacro(cmAddTestCommand, cmCommand);
-
private:
bool HandleNameMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 6655911..04e1a0b 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -2,9 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAuxSourceDirectoryCommand.h"
+#include <algorithm>
+#include <cmsys/Directory.hxx>
+#include <stddef.h>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
-#include <cmsys/Directory.hxx>
+class cmExecutionStatus;
// cmAuxSourceDirectoryCommand
bool cmAuxSourceDirectoryCommand::InitialPass(
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index cca70dc..d99bf7b 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -3,8 +3,14 @@
#ifndef cmAuxSourceDirectoryCommand_h
#define cmAuxSourceDirectoryCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmAuxSourceDirectoryCommand
* \brief Specify auxiliary source code directories.
*
@@ -33,8 +39,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "aux_source_directory"; }
-
- cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand);
};
#endif
diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx
deleted file mode 100644
index 2b3b62f..0000000
--- a/Source/cmBootstrapCommands1.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-// This file is used to compile all the commands
-// that CMake knows about at compile time.
-// This is sort of a boot strapping approach since you would
-// like to have CMake to build CMake.
-#include "cmAddCustomCommandCommand.cxx"
-#include "cmAddCustomTargetCommand.cxx"
-#include "cmAddDefinitionsCommand.cxx"
-#include "cmAddDependenciesCommand.cxx"
-#include "cmAddExecutableCommand.cxx"
-#include "cmAddLibraryCommand.cxx"
-#include "cmAddSubDirectoryCommand.cxx"
-#include "cmAddTestCommand.cxx"
-#include "cmBreakCommand.cxx"
-#include "cmBuildCommand.cxx"
-#include "cmCMakeMinimumRequired.cxx"
-#include "cmCMakePolicyCommand.cxx"
-#include "cmCommandArgumentsHelper.cxx"
-#include "cmCommands.h"
-#include "cmConfigureFileCommand.cxx"
-#include "cmContinueCommand.cxx"
-#include "cmCoreTryCompile.cxx"
-#include "cmCreateTestSourceList.cxx"
-#include "cmDefinePropertyCommand.cxx"
-#include "cmElseCommand.cxx"
-#include "cmEnableLanguageCommand.cxx"
-#include "cmEnableTestingCommand.cxx"
-#include "cmEndForEachCommand.cxx"
-#include "cmEndFunctionCommand.cxx"
-#include "cmEndIfCommand.cxx"
-#include "cmEndMacroCommand.cxx"
-#include "cmEndWhileCommand.cxx"
-#include "cmExecProgramCommand.cxx"
-#include "cmExecuteProcessCommand.cxx"
-#include "cmFileCommand.cxx"
-#include "cmFindBase.cxx"
-#include "cmFindCommon.cxx"
-#include "cmFindFileCommand.cxx"
-#include "cmFindLibraryCommand.cxx"
-#include "cmFindPackageCommand.cxx"
-#include "cmFindPathCommand.cxx"
-#include "cmFindProgramCommand.cxx"
-#include "cmForEachCommand.cxx"
-#include "cmFunctionCommand.cxx"
-#include "cmParseArgumentsCommand.cxx"
-#include "cmPathLabel.cxx"
-#include "cmSearchPath.cxx"
-
-void GetBootstrapCommands1(std::vector<cmCommand*>& commands)
-{
- commands.push_back(new cmAddCustomCommandCommand);
- commands.push_back(new cmAddCustomTargetCommand);
- commands.push_back(new cmAddDefinitionsCommand);
- commands.push_back(new cmAddDependenciesCommand);
- commands.push_back(new cmAddExecutableCommand);
- commands.push_back(new cmAddLibraryCommand);
- commands.push_back(new cmAddSubDirectoryCommand);
- commands.push_back(new cmAddTestCommand);
- commands.push_back(new cmBreakCommand);
- commands.push_back(new cmBuildCommand);
- commands.push_back(new cmCMakeMinimumRequired);
- commands.push_back(new cmCMakePolicyCommand);
- commands.push_back(new cmConfigureFileCommand);
- commands.push_back(new cmContinueCommand);
- commands.push_back(new cmCreateTestSourceList);
- commands.push_back(new cmDefinePropertyCommand);
- commands.push_back(new cmElseCommand);
- commands.push_back(new cmEnableLanguageCommand);
- commands.push_back(new cmEnableTestingCommand);
- commands.push_back(new cmEndForEachCommand);
- commands.push_back(new cmEndFunctionCommand);
- commands.push_back(new cmEndIfCommand);
- commands.push_back(new cmEndMacroCommand);
- commands.push_back(new cmEndWhileCommand);
- commands.push_back(new cmExecProgramCommand);
- commands.push_back(new cmExecuteProcessCommand);
- commands.push_back(new cmFileCommand);
- commands.push_back(new cmFindFileCommand);
- commands.push_back(new cmFindLibraryCommand);
- commands.push_back(new cmFindPackageCommand);
- commands.push_back(new cmFindPathCommand);
- commands.push_back(new cmFindProgramCommand);
- commands.push_back(new cmForEachCommand);
- commands.push_back(new cmFunctionCommand);
- commands.push_back(new cmParseArgumentsCommand);
-}
diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx
deleted file mode 100644
index 625c3e0..0000000
--- a/Source/cmBootstrapCommands2.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-// This file is used to compile all the commands
-// that CMake knows about at compile time.
-// This is sort of a boot strapping approach since you would
-// like to have CMake to build CMake.
-#include "cmCommands.h"
-#include "cmConditionEvaluator.cxx"
-#include "cmExpandedCommandArgument.cxx"
-#include "cmGetCMakePropertyCommand.cxx"
-#include "cmGetDirectoryPropertyCommand.cxx"
-#include "cmGetFilenameComponentCommand.cxx"
-#include "cmGetPropertyCommand.cxx"
-#include "cmGetSourceFilePropertyCommand.cxx"
-#include "cmGetTargetPropertyCommand.cxx"
-#include "cmGetTestPropertyCommand.cxx"
-#include "cmHexFileConverter.cxx"
-#include "cmIfCommand.cxx"
-#include "cmIncludeCommand.cxx"
-#include "cmIncludeDirectoryCommand.cxx"
-#include "cmIncludeRegularExpressionCommand.cxx"
-#include "cmInstallCommand.cxx"
-#include "cmInstallCommandArguments.cxx"
-#include "cmInstallFilesCommand.cxx"
-#include "cmInstallTargetsCommand.cxx"
-#include "cmLinkDirectoriesCommand.cxx"
-#include "cmListCommand.cxx"
-#include "cmMacroCommand.cxx"
-#include "cmMakeDirectoryCommand.cxx"
-#include "cmMarkAsAdvancedCommand.cxx"
-#include "cmMathCommand.cxx"
-#include "cmMessageCommand.cxx"
-#include "cmOptionCommand.cxx"
-#include "cmProjectCommand.cxx"
-#include "cmReturnCommand.cxx"
-#include "cmSeparateArgumentsCommand.cxx"
-#include "cmSetCommand.cxx"
-#include "cmSetDirectoryPropertiesCommand.cxx"
-#include "cmSetPropertyCommand.cxx"
-#include "cmSetSourceFilesPropertiesCommand.cxx"
-#include "cmSetTargetPropertiesCommand.cxx"
-#include "cmSetTestsPropertiesCommand.cxx"
-#include "cmSiteNameCommand.cxx"
-#include "cmStringCommand.cxx"
-#include "cmSubdirCommand.cxx"
-#include "cmTargetLinkLibrariesCommand.cxx"
-#include "cmTimestamp.cxx"
-#include "cmTryCompileCommand.cxx"
-#include "cmTryRunCommand.cxx"
-#include "cmUnsetCommand.cxx"
-#include "cmWhileCommand.cxx"
-
-void GetBootstrapCommands2(std::vector<cmCommand*>& commands)
-{
- commands.push_back(new cmGetCMakePropertyCommand);
- commands.push_back(new cmGetDirectoryPropertyCommand);
- commands.push_back(new cmGetFilenameComponentCommand);
- commands.push_back(new cmGetPropertyCommand);
- commands.push_back(new cmGetSourceFilePropertyCommand);
- commands.push_back(new cmGetTargetPropertyCommand);
- commands.push_back(new cmIfCommand);
- commands.push_back(new cmIncludeCommand);
- commands.push_back(new cmIncludeDirectoryCommand);
- commands.push_back(new cmIncludeRegularExpressionCommand);
- commands.push_back(new cmInstallCommand);
- commands.push_back(new cmInstallFilesCommand);
- commands.push_back(new cmInstallTargetsCommand);
- commands.push_back(new cmLinkDirectoriesCommand);
- commands.push_back(new cmListCommand);
- commands.push_back(new cmMacroCommand);
- commands.push_back(new cmMakeDirectoryCommand);
- commands.push_back(new cmMarkAsAdvancedCommand);
- commands.push_back(new cmMathCommand);
- commands.push_back(new cmMessageCommand);
- commands.push_back(new cmOptionCommand);
- commands.push_back(new cmProjectCommand);
- commands.push_back(new cmReturnCommand);
- commands.push_back(new cmSeparateArgumentsCommand);
- commands.push_back(new cmSetCommand);
- commands.push_back(new cmSetDirectoryPropertiesCommand);
- commands.push_back(new cmSetPropertyCommand);
- commands.push_back(new cmSetSourceFilesPropertiesCommand);
- commands.push_back(new cmSetTargetPropertiesCommand);
- commands.push_back(new cmGetTestPropertyCommand);
- commands.push_back(new cmSetTestsPropertiesCommand);
- commands.push_back(new cmSiteNameCommand);
- commands.push_back(new cmStringCommand);
- commands.push_back(new cmSubdirCommand);
- commands.push_back(new cmTargetLinkLibrariesCommand);
- commands.push_back(new cmTryCompileCommand);
- commands.push_back(new cmTryRunCommand);
- commands.push_back(new cmUnsetCommand);
- commands.push_back(new cmWhileCommand);
-}
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index ab58ab2..f1ade9a 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "break"; }
-
- cmTypeMacro(cmBreakCommand, cmCommand);
};
#endif
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 365a426..8aa4102 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -116,6 +116,6 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
this->Makefile->AddCacheDefinition(define, makecommand.c_str(),
"Command used to build entire project "
"from the command line.",
- cmState::STRING);
+ cmStateEnums::STRING);
return true;
}
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index a53a099..0dce4e4 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -40,8 +40,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "build_command"; }
- cmTypeMacro(cmBuildCommand, cmCommand);
-
private:
bool IgnoreErrors() const;
};
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 9134b9a..3257c93 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -2,8 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmBuildNameCommand.h"
+#include <algorithm>
#include <cmsys/RegularExpression.hxx>
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmBuildNameCommand
bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -27,7 +35,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
std::replace(cv.begin(), cv.end(), '(', '_');
std::replace(cv.begin(), cv.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
- cmState::STRING);
+ cmStateEnums::STRING);
}
return true;
}
@@ -53,6 +61,6 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
std::replace(buildname.begin(), buildname.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
- "Name of build.", cmState::STRING);
+ "Name of build.", cmStateEnums::STRING);
return true;
}
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 7c09d73..1e1f4b5 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -3,12 +3,17 @@
#ifndef cmBuildNameCommand_h
#define cmBuildNameCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmBuildNameCommand : public cmCommand
{
public:
- cmTypeMacro(cmBuildNameCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 018010e..7da93ac 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -2,6 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCMakeHostSystemInformationCommand.h"
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmsys/SystemInformation.hxx"
+
+class cmExecutionStatus;
+
// cmCMakeHostSystemInformation
bool cmCMakeHostSystemInformationCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 4ab6aa1..22f3d54 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -3,9 +3,17 @@
#ifndef cmCMakeHostSystemInformationCommand_h
#define cmCMakeHostSystemInformationCommand_h
+#include <cmConfigure.h>
+#include <stddef.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
-#include <cmsys/SystemInformation.hxx>
+class cmExecutionStatus;
+namespace cmsys {
+class SystemInformation;
+} // namespace cmsys
/** \class cmCMakeHostSystemInformationCommand
* \brief Query host system specific information
@@ -44,8 +52,6 @@ public:
return "cmake_host_system_information";
}
- cmTypeMacro(cmCMakeHostSystemInformationCommand, cmCommand);
-
private:
bool GetValue(cmsys::SystemInformation& info, std::string const& key,
std::string& value);
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 80b5108..d71172c 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCMakeMinimumRequired.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
// cmCMakeMinimumRequired
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 425aeed..3acedd2 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -35,8 +35,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
- cmTypeMacro(cmCMakeMinimumRequired, cmCommand);
-
private:
std::vector<std::string> UnknownArguments;
bool EnforceUnknownArguments();
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index eea76f2..67581b6 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCMakePolicyCommand.h"
+#include "cmState.h"
#include "cmVersion.h"
// cmCMakePolicyCommand
@@ -79,7 +80,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args)
"For backwards compatibility, what version of CMake "
"commands and "
"syntax should this version of CMake try to support.",
- cmState::STRING);
+ cmStateEnums::STRING);
}
}
return true;
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index d5c5cb5..68d9f7b 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -36,8 +36,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
- cmTypeMacro(cmCMakePolicyCommand, cmCommand);
-
private:
bool HandleSetMode(std::vector<std::string> const& args);
bool HandleGetMode(std::vector<std::string> const& args);
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 3a08aea..b70074e 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -7,10 +7,12 @@
#include "cmCPluginAPI.h"
+#include "cmExecutionStatus.h"
+#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmVersion.h"
-
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmVersion.h"
#include <stdlib.h>
@@ -75,22 +77,22 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
switch (type) {
case CM_CACHE_BOOL:
- mf->AddCacheDefinition(name, value, doc, cmState::BOOL);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL);
break;
case CM_CACHE_PATH:
- mf->AddCacheDefinition(name, value, doc, cmState::PATH);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH);
break;
case CM_CACHE_FILEPATH:
- mf->AddCacheDefinition(name, value, doc, cmState::FILEPATH);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH);
break;
case CM_CACHE_STRING:
- mf->AddCacheDefinition(name, value, doc, cmState::STRING);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING);
break;
case CM_CACHE_INTERNAL:
- mf->AddCacheDefinition(name, value, doc, cmState::INTERNAL);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL);
break;
case CM_CACHE_STATIC:
- mf->AddCacheDefinition(name, value, doc, cmState::STATIC);
+ mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC);
break;
}
}
@@ -162,7 +164,14 @@ void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
const char* d)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->AddLinkDirectoryForTarget(tgt, d);
+ cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
+ if (!t) {
+ cmSystemTools::Error(
+ "Attempt to add link directories to non-existent target: ", tgt,
+ " for directory ", d);
+ return;
+ }
+ t->AddLinkDirectory(d);
}
void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
@@ -330,6 +339,35 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
cctype, no_comment, no_working_dir);
}
+static void addLinkLibrary(cmMakefile* mf, std::string const& target,
+ std::string const& lib, cmTargetLinkLibraryType llt)
+{
+ cmTarget* t = mf->FindLocalNonAliasTarget(target);
+ if (!t) {
+ std::ostringstream e;
+ e << "Attempt to add link library \"" << lib << "\" to target \"" << target
+ << "\" which is not built in this directory.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
+ cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib);
+ if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
+ (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
+ (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
+ !tgt->IsExecutableWithExports()) {
+ std::ostringstream e;
+ e << "Target \"" << lib << "\" of type "
+ << cmState::GetTargetTypeName(tgt->GetType())
+ << " may not be linked into another target. "
+ << "One may link only to STATIC or SHARED libraries, or "
+ << "to executables with the ENABLE_EXPORTS property set.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+
+ t->AddLinkLibrary(*mf, lib, llt);
+}
+
void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
const char* value, int libtype)
{
@@ -337,13 +375,13 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
switch (libtype) {
case CM_LIBRARY_GENERAL:
- mf->AddLinkLibraryForTarget(tgt, value, GENERAL_LibraryType);
+ addLinkLibrary(mf, tgt, value, GENERAL_LibraryType);
break;
case CM_LIBRARY_DEBUG:
- mf->AddLinkLibraryForTarget(tgt, value, DEBUG_LibraryType);
+ addLinkLibrary(mf, tgt, value, DEBUG_LibraryType);
break;
case CM_LIBRARY_OPTIMIZED:
- mf->AddLinkLibraryForTarget(tgt, value, OPTIMIZED_LibraryType);
+ addLinkLibrary(mf, tgt, value, OPTIMIZED_LibraryType);
break;
}
}
@@ -357,8 +395,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
for (i = 0; i < numSrcs; ++i) {
srcs2.push_back(srcs[i]);
}
- mf->AddLibrary(libname,
- (shared ? cmState::SHARED_LIBRARY : cmState::STATIC_LIBRARY),
+ mf->AddLibrary(libname, (shared ? cmStateEnums::SHARED_LIBRARY
+ : cmStateEnums::STATIC_LIBRARY),
srcs2);
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 1824d94..024260c 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -21,6 +21,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmVersionConfig.h"
@@ -1969,7 +1970,7 @@ bool cmCTest::AddVariableDefinition(const std::string& arg)
{
std::string name;
std::string value;
- cmState::CacheEntryType type = cmState::UNINITIALIZED;
+ cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
if (cmake::ParseCacheEntry(arg, name, value, type)) {
this->Definitions[name] = value;
@@ -2651,13 +2652,6 @@ static const char* cmCTestStringLogType[] = { "DEBUG",
"ERROR_MESSAGE",
CM_NULLPTR };
-#ifdef cerr
-#undef cerr
-#endif
-#ifdef cout
-#undef cout
-#endif
-
#define cmCTestLogOutputFileLine(stream) \
if (this->ShowLineNumbers) { \
(stream) << std::endl << file << ":" << line << " "; \
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 4b03499..e84012c 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -94,13 +94,13 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
// If the entry is not internal to the cache being loaded
// or if it is in the list of internal entries to be
// imported, load it.
- if (internal || (e.Type != cmState::INTERNAL) ||
+ if (internal || (e.Type != cmStateEnums::INTERNAL) ||
(includes.find(entryKey) != includes.end())) {
// If we are loading the cache from another project,
// make all loaded entries internal so that it is
// not visible in the gui
if (!internal) {
- e.Type = cmState::INTERNAL;
+ e.Type = cmStateEnums::INTERNAL;
helpString = "DO NOT EDIT, ";
helpString += entryKey;
helpString += " loaded from external file. "
@@ -142,11 +142,11 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
"Minor version of cmake used to create the "
"current loaded cache",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
"Major version of cmake used to create the "
"current loaded cache",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
// check to make sure the cache directory has not
// been moved
@@ -178,7 +178,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
CacheEntry& e)
{
// All property entries are internal.
- if (e.Type != cmState::INTERNAL) {
+ if (e.Type != cmStateEnums::INTERNAL) {
return false;
}
@@ -192,7 +192,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
if (it.IsAtEnd()) {
// Create an entry and store the property.
CacheEntry& ne = this->Cache[key];
- ne.Type = cmState::UNINITIALIZED;
+ ne.Type = cmStateEnums::UNINITIALIZED;
ne.SetProperty(*p, e.Value.c_str());
} else {
// Store this property on its entry.
@@ -244,17 +244,17 @@ bool cmCacheManager::SaveCache(const std::string& path)
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
"Minor version of cmake used to create the "
"current loaded cache",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
sprintf(temp, "%d", cmVersion::GetMajorVersion());
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
"Major version of cmake used to create the "
"current loaded cache",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
sprintf(temp, "%d", cmVersion::GetPatchVersion());
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
"Patch version of cmake used to create the "
"current loaded cache",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
// Let us store the current working directory so that if somebody
// Copies it, he will not be surprised
@@ -268,7 +268,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
"This is the directory where this CMakeCache.txt"
" was created",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
/* clang-format off */
fout << "# This is the CMakeCache file.\n"
@@ -301,14 +301,14 @@ bool cmCacheManager::SaveCache(const std::string& path)
this->Cache.begin();
i != this->Cache.end(); ++i) {
const CacheEntry& ce = (*i).second;
- cmState::CacheEntryType t = ce.Type;
+ cmStateEnums::CacheEntryType t = ce.Type;
if (!ce.Initialized) {
/*
// This should be added in, but is not for now.
cmSystemTools::Error("Cache entry \"", (*i).first.c_str(),
"\" is uninitialized");
*/
- } else if (t != cmState::INTERNAL) {
+ } else if (t != cmStateEnums::INTERNAL) {
// Format is key:type=value
if (const char* help = ce.GetProperty("HELPSTRING")) {
cmCacheManager::OutputHelpString(fout, help);
@@ -334,9 +334,9 @@ bool cmCacheManager::SaveCache(const std::string& path)
continue;
}
- cmState::CacheEntryType t = i.GetType();
+ cmStateEnums::CacheEntryType t = i.GetType();
this->WritePropertyEntries(fout, i);
- if (t == cmState::INTERNAL) {
+ if (t == cmStateEnums::INTERNAL) {
// Format is key:type=value
if (const char* help = i.GetProperty("HELPSTRING")) {
this->OutputHelpString(fout, help);
@@ -465,7 +465,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
for (std::map<std::string, CacheEntry>::const_iterator i =
this->Cache.begin();
i != this->Cache.end(); ++i) {
- if ((*i).second.Type != cmState::INTERNAL) {
+ if ((*i).second.Type != cmStateEnums::INTERNAL) {
out << (*i).first << " = " << (*i).second.Value << std::endl;
}
}
@@ -477,7 +477,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
const char* helpString,
- cmState::CacheEntryType type)
+ cmStateEnums::CacheEntryType type)
{
CacheEntry& e = this->Cache[key];
if (value) {
@@ -488,7 +488,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
}
e.Type = type;
// make sure we only use unix style paths
- if (type == cmState::FILEPATH || type == cmState::PATH) {
+ if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
if (e.Value.find(';') != e.Value.npos) {
std::vector<std::string> paths;
cmSystemTools::ExpandListArgument(e.Value, paths);
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 16a2e78..90731f5 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -34,7 +34,7 @@ private:
struct CacheEntry
{
std::string Value;
- cmState::CacheEntryType Type;
+ cmStateEnums::CacheEntryType Type;
cmPropertyMap Properties;
std::vector<std::string> GetPropertyList() const;
const char* GetProperty(const std::string&) const;
@@ -44,7 +44,7 @@ private:
bool Initialized;
CacheEntry()
: Value("")
- , Type(cmState::UNINITIALIZED)
+ , Type(cmStateEnums::UNINITIALIZED)
, Initialized(false)
{
}
@@ -70,8 +70,14 @@ public:
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const;
void SetValue(const char*);
- cmState::CacheEntryType GetType() const { return this->GetEntry().Type; }
- void SetType(cmState::CacheEntryType ty) { this->GetEntry().Type = ty; }
+ cmStateEnums::CacheEntryType GetType() const
+ {
+ return this->GetEntry().Type;
+ }
+ void SetType(cmStateEnums::CacheEntryType ty)
+ {
+ this->GetEntry().Type = ty;
+ }
bool Initialized() { return this->GetEntry().Initialized; }
cmCacheManager& Container;
std::map<std::string, CacheEntry>::iterator Position;
@@ -137,7 +143,7 @@ public:
return this->GetCacheIterator(key.c_str()).GetProperty(propName);
}
- cmState::CacheEntryType GetCacheEntryType(std::string const& key)
+ cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key)
{
return this->GetCacheIterator(key.c_str()).GetType();
}
@@ -200,7 +206,8 @@ public:
protected:
///! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
- const char* helpString, cmState::CacheEntryType type);
+ const char* helpString,
+ cmStateEnums::CacheEntryType type);
///! Get a cache entry object for a key
CacheEntry* GetCacheEntry(const std::string& key);
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx
new file mode 100644
index 0000000..3c839de
--- /dev/null
+++ b/Source/cmCommand.cxx
@@ -0,0 +1,48 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCommand.h"
+
+bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus& status)
+{
+ std::vector<std::string> expandedArguments;
+ if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
+ // There was an error expanding arguments. It was already
+ // reported, so we can skip this command without error.
+ return true;
+ }
+ return this->InitialPass(expandedArguments, status);
+}
+
+const char* cmCommand::GetError()
+{
+ if (this->Error.empty()) {
+ this->Error = this->GetName();
+ this->Error += " unknown error.";
+ }
+ return this->Error.c_str();
+}
+
+void cmCommand::SetError(const std::string& e)
+{
+ this->Error = this->GetName();
+ this->Error += " ";
+ this->Error += e;
+}
+
+bool cmCommand::Disallowed(cmPolicies::PolicyID pol, const char* e)
+{
+ switch (this->Makefile->GetPolicyStatus(pol)) {
+ case cmPolicies::WARN:
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(pol));
+ case cmPolicies::OLD:
+ return false;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
+ break;
+ }
+ return true;
+}
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index d8e337d..dcfe8da 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -3,8 +3,6 @@
#ifndef cmCommand_h
#define cmCommand_h
-#include "cmObject.h"
-
#include "cmCommandArgumentsHelper.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
@@ -19,24 +17,21 @@
* to support such features as enable/disable, inheritance,
* documentation, and construction.
*/
-class cmCommand : public cmObject
+class cmCommand
{
public:
- cmTypeMacro(cmCommand, cmObject);
-
/**
- * Construct the command. By default it is enabled with no makefile.
+ * Construct the command. By default it has no makefile.
*/
cmCommand()
+ : Makefile(CM_NULLPTR)
{
- this->Makefile = CM_NULLPTR;
- this->Enabled = true;
}
/**
* Need virtual destructor to destroy real command type.
*/
- ~cmCommand() CM_OVERRIDE {}
+ virtual ~cmCommand() {}
/**
* Specify the makefile.
@@ -50,16 +45,7 @@ public:
* arguments and then invokes the InitialPass.
*/
virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus& status)
- {
- std::vector<std::string> expandedArguments;
- if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
- // There was an error expanding arguments. It was already
- // reported, so we can skip this command without error.
- return true;
- }
- return this->InitialPass(expandedArguments, status);
- }
+ cmExecutionStatus& status);
/**
* This is called when the command is first encountered in
@@ -92,12 +78,10 @@ public:
virtual bool IsScriptable() const { return false; }
/**
- * This is used to avoid including this command
- * in documentation. This is mainly used by
- * cmMacroHelperCommand and cmFunctionHelperCommand
- * which cannot provide appropriate documentation.
+ * This determines if the command is defined in a cmake script.
+ * It is the case for cmMacroHelperCommand and cmFunctionHelperCommand.
*/
- virtual bool ShouldAppearInDocumentation() const { return true; }
+ virtual bool IsUserDefined() const { return false; }
/**
* The name of the command as specified in CMakeList.txt.
@@ -105,71 +89,23 @@ public:
virtual std::string GetName() const = 0;
/**
- * Enable the command.
- */
- void EnabledOn() { this->Enabled = true; }
-
- /**
- * Disable the command.
- */
- void EnabledOff() { this->Enabled = false; }
-
- /**
- * Query whether the command is enabled.
- */
- bool GetEnabled() const { return this->Enabled; }
-
- /**
- * Disable or enable the command.
- */
- void SetEnabled(bool enabled) { this->Enabled = enabled; }
-
- /**
* Return the last error string.
*/
- const char* GetError()
- {
- if (this->Error.empty()) {
- this->Error = this->GetName();
- this->Error += " unknown error.";
- }
- return this->Error.c_str();
- }
+ const char* GetError();
/**
* Set the error message
*/
- void SetError(const std::string& e)
- {
- this->Error = this->GetName();
- this->Error += " ";
- this->Error += e;
- }
+ void SetError(const std::string& e);
/** Check if the command is disallowed by a policy. */
- bool Disallowed(cmPolicies::PolicyID pol, const char* e)
- {
- switch (this->Makefile->GetPolicyStatus(pol)) {
- case cmPolicies::WARN:
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(pol));
- case cmPolicies::OLD:
- return false;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
- break;
- }
- return true;
- }
+ bool Disallowed(cmPolicies::PolicyID pol, const char* e);
protected:
cmMakefile* Makefile;
cmCommandArgumentsHelper Helper;
private:
- bool Enabled;
std::string Error;
};
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
new file mode 100644
index 0000000..0697d4b
--- /dev/null
+++ b/Source/cmCommands.cxx
@@ -0,0 +1,238 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCommands.h"
+
+#include "cmAddCustomCommandCommand.h"
+#include "cmAddCustomTargetCommand.h"
+#include "cmAddDefinitionsCommand.h"
+#include "cmAddDependenciesCommand.h"
+#include "cmAddExecutableCommand.h"
+#include "cmAddLibraryCommand.h"
+#include "cmAddSubDirectoryCommand.h"
+#include "cmAddTestCommand.h"
+#include "cmBreakCommand.h"
+#include "cmBuildCommand.h"
+#include "cmCMakeMinimumRequired.h"
+#include "cmCMakePolicyCommand.h"
+#include "cmCommandArgumentsHelper.h"
+#include "cmConditionEvaluator.h"
+#include "cmConfigureFileCommand.h"
+#include "cmContinueCommand.h"
+#include "cmCoreTryCompile.h"
+#include "cmCreateTestSourceList.h"
+#include "cmDefinePropertyCommand.h"
+#include "cmElseCommand.h"
+#include "cmEnableLanguageCommand.h"
+#include "cmEnableTestingCommand.h"
+#include "cmEndForEachCommand.h"
+#include "cmEndFunctionCommand.h"
+#include "cmEndIfCommand.h"
+#include "cmEndMacroCommand.h"
+#include "cmEndWhileCommand.h"
+#include "cmExecProgramCommand.h"
+#include "cmExecuteProcessCommand.h"
+#include "cmExpandedCommandArgument.h"
+#include "cmFileCommand.h"
+#include "cmFindBase.h"
+#include "cmFindCommon.h"
+#include "cmFindFileCommand.h"
+#include "cmFindLibraryCommand.h"
+#include "cmFindPackageCommand.h"
+#include "cmFindPathCommand.h"
+#include "cmFindProgramCommand.h"
+#include "cmForEachCommand.h"
+#include "cmFunctionCommand.h"
+#include "cmGetCMakePropertyCommand.h"
+#include "cmGetDirectoryPropertyCommand.h"
+#include "cmGetFilenameComponentCommand.h"
+#include "cmGetPropertyCommand.h"
+#include "cmGetSourceFilePropertyCommand.h"
+#include "cmGetTargetPropertyCommand.h"
+#include "cmGetTestPropertyCommand.h"
+#include "cmHexFileConverter.h"
+#include "cmIfCommand.h"
+#include "cmIncludeCommand.h"
+#include "cmIncludeDirectoryCommand.h"
+#include "cmIncludeRegularExpressionCommand.h"
+#include "cmInstallCommand.h"
+#include "cmInstallCommandArguments.h"
+#include "cmInstallFilesCommand.h"
+#include "cmInstallTargetsCommand.h"
+#include "cmLinkDirectoriesCommand.h"
+#include "cmListCommand.h"
+#include "cmMacroCommand.h"
+#include "cmMakeDirectoryCommand.h"
+#include "cmMarkAsAdvancedCommand.h"
+#include "cmMathCommand.h"
+#include "cmMessageCommand.h"
+#include "cmOptionCommand.h"
+#include "cmParseArgumentsCommand.h"
+#include "cmPathLabel.h"
+#include "cmProjectCommand.h"
+#include "cmReturnCommand.h"
+#include "cmSearchPath.h"
+#include "cmSeparateArgumentsCommand.h"
+#include "cmSetCommand.h"
+#include "cmSetDirectoryPropertiesCommand.h"
+#include "cmSetPropertyCommand.h"
+#include "cmSetSourceFilesPropertiesCommand.h"
+#include "cmSetTargetPropertiesCommand.h"
+#include "cmSetTestsPropertiesCommand.h"
+#include "cmSiteNameCommand.h"
+#include "cmStringCommand.h"
+#include "cmSubdirCommand.h"
+#include "cmTargetLinkLibrariesCommand.h"
+#include "cmTimestamp.h"
+#include "cmTryCompileCommand.h"
+#include "cmTryRunCommand.h"
+#include "cmUnsetCommand.h"
+#include "cmWhileCommand.h"
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include "cmAddCompileOptionsCommand.h"
+#include "cmAuxSourceDirectoryCommand.h"
+#include "cmBuildNameCommand.h"
+#include "cmCMakeHostSystemInformationCommand.h"
+#include "cmElseIfCommand.h"
+#include "cmExportCommand.h"
+#include "cmExportLibraryDependenciesCommand.h"
+#include "cmFLTKWrapUICommand.h"
+#include "cmIncludeExternalMSProjectCommand.h"
+#include "cmInstallProgramsCommand.h"
+#include "cmLinkLibrariesCommand.h"
+#include "cmLoadCacheCommand.h"
+#include "cmLoadCommandCommand.h"
+#include "cmOutputRequiredFilesCommand.h"
+#include "cmQTWrapCPPCommand.h"
+#include "cmQTWrapUICommand.h"
+#include "cmRemoveCommand.h"
+#include "cmRemoveDefinitionsCommand.h"
+#include "cmSourceGroupCommand.h"
+#include "cmSubdirDependsCommand.h"
+#include "cmTargetCompileDefinitionsCommand.h"
+#include "cmTargetCompileFeaturesCommand.h"
+#include "cmTargetCompileOptionsCommand.h"
+#include "cmTargetIncludeDirectoriesCommand.h"
+#include "cmTargetPropCommandBase.h"
+#include "cmTargetSourcesCommand.h"
+#include "cmUseMangledMesaCommand.h"
+#include "cmUtilitySourceCommand.h"
+#include "cmVariableRequiresCommand.h"
+#include "cmVariableWatchCommand.h"
+#include "cmWriteFileCommand.h"
+#endif
+
+std::vector<cmCommand*> GetPredefinedCommands()
+{
+ std::vector<cmCommand*> commands;
+
+ commands.push_back(new cmAddCustomCommandCommand);
+ commands.push_back(new cmAddCustomTargetCommand);
+ commands.push_back(new cmAddDefinitionsCommand);
+ commands.push_back(new cmAddDependenciesCommand);
+ commands.push_back(new cmAddExecutableCommand);
+ commands.push_back(new cmAddLibraryCommand);
+ commands.push_back(new cmAddSubDirectoryCommand);
+ commands.push_back(new cmAddTestCommand);
+ commands.push_back(new cmBreakCommand);
+ commands.push_back(new cmBuildCommand);
+ commands.push_back(new cmCMakeMinimumRequired);
+ commands.push_back(new cmCMakePolicyCommand);
+ commands.push_back(new cmConfigureFileCommand);
+ commands.push_back(new cmContinueCommand);
+ commands.push_back(new cmCreateTestSourceList);
+ commands.push_back(new cmDefinePropertyCommand);
+ commands.push_back(new cmElseCommand);
+ commands.push_back(new cmEnableLanguageCommand);
+ commands.push_back(new cmEnableTestingCommand);
+ commands.push_back(new cmEndForEachCommand);
+ commands.push_back(new cmEndFunctionCommand);
+ commands.push_back(new cmEndIfCommand);
+ commands.push_back(new cmEndMacroCommand);
+ commands.push_back(new cmEndWhileCommand);
+ commands.push_back(new cmExecProgramCommand);
+ commands.push_back(new cmExecuteProcessCommand);
+ commands.push_back(new cmFileCommand);
+ commands.push_back(new cmFindFileCommand);
+ commands.push_back(new cmFindLibraryCommand);
+ commands.push_back(new cmFindPackageCommand);
+ commands.push_back(new cmFindPathCommand);
+ commands.push_back(new cmFindProgramCommand);
+ commands.push_back(new cmForEachCommand);
+ commands.push_back(new cmFunctionCommand);
+ commands.push_back(new cmGetCMakePropertyCommand);
+ commands.push_back(new cmGetDirectoryPropertyCommand);
+ commands.push_back(new cmGetFilenameComponentCommand);
+ commands.push_back(new cmGetPropertyCommand);
+ commands.push_back(new cmGetSourceFilePropertyCommand);
+ commands.push_back(new cmGetTargetPropertyCommand);
+ commands.push_back(new cmGetTestPropertyCommand);
+ commands.push_back(new cmIfCommand);
+ commands.push_back(new cmIncludeCommand);
+ commands.push_back(new cmIncludeDirectoryCommand);
+ commands.push_back(new cmIncludeRegularExpressionCommand);
+ commands.push_back(new cmInstallCommand);
+ commands.push_back(new cmInstallFilesCommand);
+ commands.push_back(new cmInstallTargetsCommand);
+ commands.push_back(new cmLinkDirectoriesCommand);
+ commands.push_back(new cmListCommand);
+ commands.push_back(new cmMacroCommand);
+ commands.push_back(new cmMakeDirectoryCommand);
+ commands.push_back(new cmMarkAsAdvancedCommand);
+ commands.push_back(new cmMathCommand);
+ commands.push_back(new cmMessageCommand);
+ commands.push_back(new cmOptionCommand);
+ commands.push_back(new cmParseArgumentsCommand);
+ commands.push_back(new cmProjectCommand);
+ commands.push_back(new cmReturnCommand);
+ commands.push_back(new cmSeparateArgumentsCommand);
+ commands.push_back(new cmSetCommand);
+ commands.push_back(new cmSetDirectoryPropertiesCommand);
+ commands.push_back(new cmSetPropertyCommand);
+ commands.push_back(new cmSetSourceFilesPropertiesCommand);
+ commands.push_back(new cmSetTargetPropertiesCommand);
+ commands.push_back(new cmSetTestsPropertiesCommand);
+ commands.push_back(new cmSiteNameCommand);
+ commands.push_back(new cmStringCommand);
+ commands.push_back(new cmSubdirCommand);
+ commands.push_back(new cmTargetLinkLibrariesCommand);
+ commands.push_back(new cmTryCompileCommand);
+ commands.push_back(new cmTryRunCommand);
+ commands.push_back(new cmUnsetCommand);
+ commands.push_back(new cmWhileCommand);
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ commands.push_back(new cmAddCompileOptionsCommand);
+ commands.push_back(new cmAuxSourceDirectoryCommand);
+ commands.push_back(new cmBuildNameCommand);
+ commands.push_back(new cmCMakeHostSystemInformationCommand);
+ commands.push_back(new cmElseIfCommand);
+ commands.push_back(new cmExportCommand);
+ commands.push_back(new cmExportLibraryDependenciesCommand);
+ commands.push_back(new cmFLTKWrapUICommand);
+ commands.push_back(new cmIncludeExternalMSProjectCommand);
+ commands.push_back(new cmInstallProgramsCommand);
+ commands.push_back(new cmLinkLibrariesCommand);
+ commands.push_back(new cmLoadCacheCommand);
+ commands.push_back(new cmLoadCommandCommand);
+ commands.push_back(new cmOutputRequiredFilesCommand);
+ commands.push_back(new cmQTWrapCPPCommand);
+ commands.push_back(new cmQTWrapUICommand);
+ commands.push_back(new cmRemoveCommand);
+ commands.push_back(new cmRemoveDefinitionsCommand);
+ commands.push_back(new cmSourceGroupCommand);
+ commands.push_back(new cmSubdirDependsCommand);
+ commands.push_back(new cmTargetCompileDefinitionsCommand);
+ commands.push_back(new cmTargetCompileFeaturesCommand);
+ commands.push_back(new cmTargetCompileOptionsCommand);
+ commands.push_back(new cmTargetIncludeDirectoriesCommand);
+ commands.push_back(new cmTargetSourcesCommand);
+ commands.push_back(new cmUseMangledMesaCommand);
+ commands.push_back(new cmUtilitySourceCommand);
+ commands.push_back(new cmVariableRequiresCommand);
+ commands.push_back(new cmVariableWatchCommand);
+ commands.push_back(new cmWriteFileCommand);
+#endif
+
+ return commands;
+}
diff --git a/Source/cmCommands.cxx.in b/Source/cmCommands.cxx.in
deleted file mode 100644
index 9eddf30..0000000
--- a/Source/cmCommands.cxx.in
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCommands.h"
-
-@COMMAND_INCLUDES@
-
-void GetPredefinedCommands(std::vector<cmCommand*>& commands)
-{
-@NEW_COMMANDS@
-}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index c2a59b8..649dea6 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -10,13 +10,9 @@
class cmCommand;
/**
* Global function to return all compiled in commands.
- * To add a new command edit cmCommands.cxx or cmBootstrapCommands[12].cxx
- * and add your command.
- * It is up to the caller to delete the commands created by this
- * call.
+ * To add a new command edit cmCommands.cxx and add your command.
+ * It is up to the caller to delete the commands created by this call.
*/
-void GetBootstrapCommands1(std::vector<cmCommand*>& commands);
-void GetBootstrapCommands2(std::vector<cmCommand*>& commands);
-void GetPredefinedCommands(std::vector<cmCommand*>& commands);
+std::vector<cmCommand*> GetPredefinedCommands();
#endif
diff --git a/Source/cmCommandsForBootstrap.cxx b/Source/cmCommandsForBootstrap.cxx
deleted file mode 100644
index 1b3bf51..0000000
--- a/Source/cmCommandsForBootstrap.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCommands.h"
-
-void GetPredefinedCommands(std::vector<cmCommand*>&)
-{
-}
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 6887a31..95b95c1 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -12,11 +12,13 @@
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalCommonGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
: GeneratorTarget(gt)
@@ -59,7 +61,8 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
}
}
-void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
+void cmCommonTargetGenerator::AddModuleDefinitionFlag(
+ cmLinkLineComputer* linkLineComputer, std::string& flags)
{
if (!this->ModuleDefinitionFile) {
return;
@@ -75,8 +78,10 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
// Append the flag and value. Use ConvertToLinkReference to help
// vs6's "cl -link" pass it to the linker.
std::string flag = defFileFlag;
- flag += (this->LocalGenerator->ConvertToLinkReference(
- this->ModuleDefinitionFile->GetFullPath()));
+ flag += this->LocalGenerator->ConvertToOutputFormat(
+ linkLineComputer->ConvertToLinkReference(
+ this->ModuleDefinitionFile->GetFullPath()),
+ cmOutputConverter::SHELL);
this->LocalGenerator->AppendFlags(flags, flag);
}
@@ -167,7 +172,7 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories()
// We can ignore the INTERFACE_LIBRARY items because
// Target->GetLinkInformation already processed their
// link interface and they don't have any output themselves.
- && linkee->GetType() != cmState::INTERFACE_LIBRARY &&
+ && linkee->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
emitted.insert(linkee).second) {
cmLocalGenerator* lg = linkee->GetLocalGenerator();
std::string di = lg->GetCurrentBinaryDirectory();
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 707b81e..fe27038 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -16,6 +16,7 @@ class cmGlobalCommonGenerator;
class cmLocalCommonGenerator;
class cmMakefile;
class cmSourceFile;
+class cmLinkLineComputer;
/** \class cmCommonTargetGenerator
* \brief Common infrastructure for Makefile and Ninja per-target generators
@@ -37,7 +38,8 @@ protected:
bool GetFeatureAsBool(const std::string& feature);
// Helper to add flag for windows .def file.
- void AddModuleDefinitionFlag(std::string& flags);
+ void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
+ std::string& flags);
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 93f3289..3e2cf18 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -8,7 +8,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -262,7 +262,7 @@ cmComputeLinkDepends::Compute()
LinkEntry const& e = this->EntryList[i];
cmGeneratorTarget const* t = e.Target;
// Entries that we know the linker will re-use do not need to be repeated.
- bool uniquify = t && t->GetType() == cmState::SHARED_LIBRARY;
+ bool uniquify = t && t->GetType() == cmStateEnums::SHARED_LIBRARY;
if (!uniquify || emmitted.insert(i).second) {
this->FinalLinkEntries.push_back(e);
}
@@ -345,7 +345,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if (cmLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) {
const bool isIface =
- entry.Target->GetType() == cmState::INTERFACE_LIBRARY;
+ entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY;
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index dc8236d..28aa533 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -12,6 +12,7 @@
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -282,7 +283,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// the program that will load it.
this->LoaderFlag = CM_NULLPTR;
if (!this->UseImportLibrary &&
- this->Target->GetType() == cmState::MODULE_LIBRARY) {
+ this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
loader_flag_var += this->LinkLanguage;
loader_flag_var += "_FLAG";
@@ -299,10 +300,10 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Get options needed to specify RPATHs.
this->RuntimeUseChrpath = false;
- if (this->Target->GetType() != cmState::STATIC_LIBRARY) {
- const char* tType =
- ((this->Target->GetType() == cmState::EXECUTABLE) ? "EXECUTABLE"
- : "SHARED_LIBRARY");
+ if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
+ const char* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE)
+ ? "EXECUTABLE"
+ : "SHARED_LIBRARY");
std::string rtVar = "CMAKE_";
rtVar += tType;
rtVar += "_RUNTIME_";
@@ -446,10 +447,10 @@ cmComputeLinkInformation::GetSharedLibrariesLinked()
bool cmComputeLinkInformation::Compute()
{
// Skip targets that do not link.
- if (!(this->Target->GetType() == cmState::EXECUTABLE ||
- this->Target->GetType() == cmState::SHARED_LIBRARY ||
- this->Target->GetType() == cmState::MODULE_LIBRARY ||
- this->Target->GetType() == cmState::STATIC_LIBRARY)) {
+ if (!(this->Target->GetType() == cmStateEnums::EXECUTABLE ||
+ this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->Target->GetType() == cmStateEnums::STATIC_LIBRARY)) {
return false;
}
@@ -498,7 +499,7 @@ bool cmComputeLinkInformation::Compute()
i != wrongItems.end(); ++i) {
cmGeneratorTarget const* tgt = *i;
bool implib = (this->UseImportLibrary &&
- (tgt->GetType() == cmState::SHARED_LIBRARY));
+ (tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
std::string lib = tgt->GetFullPath(this->Config, implib, true);
this->OldLinkDirItems.push_back(lib);
}
@@ -600,20 +601,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
linkItem += exe;
this->Items.push_back(Item(linkItem, true, tgt));
this->Depends.push_back(exe);
- } else if (tgt->GetType() == cmState::INTERFACE_LIBRARY) {
+ } else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
this->Items.push_back(Item(std::string(), false, tgt));
} else {
// Decide whether to use an import library.
- bool implib = (this->UseImportLibrary &&
- (impexe || tgt->GetType() == cmState::SHARED_LIBRARY));
+ bool implib =
+ (this->UseImportLibrary &&
+ (impexe || tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
// Pass the full path to the target file.
std::string lib = tgt->GetFullPath(config, implib, true);
if (!this->LinkDependsNoShared ||
- tgt->GetType() != cmState::SHARED_LIBRARY) {
+ tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
this->Depends.push_back(lib);
}
@@ -652,7 +654,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
if (tgt) {
// The target will provide a full path. Make sure it is a shared
// library.
- if (tgt->GetType() != cmState::SHARED_LIBRARY) {
+ if (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
return;
}
} else {
@@ -725,13 +727,13 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
const char* shared_link_type_flag = CM_NULLPTR;
const char* target_type_str = CM_NULLPTR;
switch (this->Target->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
target_type_str = "EXE";
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
target_type_str = "SHARED_LIBRARY";
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
target_type_str = "SHARED_MODULE";
break;
default:
@@ -964,12 +966,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// shared and static libraries but static-mode can handle only
// static libraries. If a previous user item changed the link type
// to static we need to make sure it is back to shared.
- if (target->GetType() != cmState::STATIC_LIBRARY) {
+ if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
this->SetCurrentLinkType(LinkShared);
}
// Keep track of shared library targets linked.
- if (target->GetType() == cmState::SHARED_LIBRARY) {
+ if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
this->SharedLibrariesLinked.insert(target);
}
@@ -1590,13 +1592,13 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
// Libraries with unknown type must be handled using just the file
// on disk.
- if (target->GetType() == cmState::UNKNOWN_LIBRARY) {
+ if (target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
this->AddLibraryRuntimeInfo(fullPath);
return;
}
// Skip targets that are not shared libraries (modules cannot be linked).
- if (target->GetType() != cmState::SHARED_LIBRARY) {
+ if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
return;
}
@@ -1710,6 +1712,12 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH");
cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted);
}
+ if (use_build_rpath) {
+ // Add directories explicitly specified by user
+ if (const char* build_rpath = this->Target->GetProperty("BUILD_RPATH")) {
+ cmCLI_ExpandListUnique(build_rpath, runtimeDirs, emitted);
+ }
+ }
if (use_build_rpath || use_link_rpath) {
std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
const char* stagePath =
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 735bc32..cfebda2 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -11,6 +11,7 @@
#include "cmPolicies.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -187,7 +188,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
cmGeneratorTarget const* depender = this->Targets[depender_index];
- if (depender->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (depender->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
@@ -212,10 +213,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
oi != objectFiles.end(); ++oi) {
std::string objLib = (*oi)->GetObjectLibrary();
if (!objLib.empty() && emitted.insert(objLib).second) {
- if (depender->GetType() != cmState::EXECUTABLE &&
- depender->GetType() != cmState::STATIC_LIBRARY &&
- depender->GetType() != cmState::SHARED_LIBRARY &&
- depender->GetType() != cmState::MODULE_LIBRARY) {
+ if (depender->GetType() != cmStateEnums::EXECUTABLE &&
+ depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ depender->GetType() != cmStateEnums::MODULE_LIBRARY) {
this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
@@ -287,7 +288,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
- if (dependee && dependee->GetType() == cmState::EXECUTABLE &&
+ if (dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
dependee = CM_NULLPTR;
}
@@ -316,7 +317,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
cmGeneratorTarget const* dependee = dependee_name.Target;
if (!dependee && !linking &&
- (depender->GetType() != cmState::GLOBAL_TARGET)) {
+ (depender->GetType() != cmStateEnums::GLOBAL_TARGET)) {
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
std::ostringstream e;
@@ -351,7 +352,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
- if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE &&
+ if (linking && dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
dependee = CM_NULLPTR;
}
@@ -366,7 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
bool linking)
{
if (dependee->IsImported() ||
- dependee->GetType() == cmState::INTERFACE_LIBRARY) {
+ dependee->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies.
std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
@@ -452,7 +453,7 @@ bool cmComputeTargetDepends::CheckComponents(
// Make sure the component is all STATIC_LIBRARY targets.
for (NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) {
- if (this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) {
+ if (this->Targets[*ni]->GetType() != cmStateEnums::STATIC_LIBRARY) {
this->ComplainAboutBadComponent(ccg, c);
return false;
}
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 420a777..7d98e73 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
#include "cmSystemTools.h"
static std::string const keyAND = "AND";
@@ -221,7 +222,7 @@ bool cmConditionEvaluator::GetBooleanValue(
double d = strtod(arg.c_str(), &end);
if (*end == '\0') {
// The whole string is a number. Use C conversion to bool.
- return d ? true : false;
+ return static_cast<bool>(d);
}
}
@@ -443,7 +444,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
if (this->IsKeyword(keyCOMMAND, *arg) && argP1 != newArgs.end()) {
cmCommand* command =
this->Makefile.GetState()->GetCommand(argP1->c_str());
- this->HandlePredicate(command ? true : false, reducible, arg, newArgs,
+ this->HandlePredicate(command != CM_NULLPTR, reducible, arg, newArgs,
argP1, argP2);
}
// does a policy exist
@@ -455,7 +456,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
// does a target exist
if (this->IsKeyword(keyTARGET, *arg) && argP1 != newArgs.end()) {
this->HandlePredicate(
- this->Makefile.FindTargetToUse(argP1->GetValue()) ? true : false,
+ this->Makefile.FindTargetToUse(argP1->GetValue()) != CM_NULLPTR,
reducible, arg, newArgs, argP1, argP2);
}
// does a test exist
@@ -463,7 +464,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
this->Policy64Status != cmPolicies::WARN) {
if (this->IsKeyword(keyTEST, *arg) && argP1 != newArgs.end()) {
const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str());
- this->HandlePredicate(haveTest ? true : false, reducible, arg,
+ this->HandlePredicate(haveTest != CM_NULLPTR, reducible, arg,
newArgs, argP1, argP2);
}
} else if (this->Policy64Status == cmPolicies::WARN &&
@@ -637,8 +638,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
bool success = cmSystemTools::FileTimeCompare(
arg->GetValue(), (argP2)->GetValue(), &fileIsNewer);
this->HandleBinaryOp(
- (success == false || fileIsNewer == 1 || fileIsNewer == 0),
- reducible, arg, newArgs, argP1, argP2);
+ (!success || fileIsNewer == 1 || fileIsNewer == 0), reducible, arg,
+ newArgs, argP1, argP2);
}
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 6a451f5..0755dce 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmConfigureFileCommand.h"
+#include "cmSystemTools.h"
+
#include <cmsys/RegularExpression.hxx>
// cmConfigureFileCommand
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index f9a0f2a..9df4550 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -8,8 +8,6 @@
class cmConfigureFileCommand : public cmCommand
{
public:
- cmTypeMacro(cmConfigureFileCommand, cmCommand);
-
cmCommand* Clone() CM_OVERRIDE { return new cmConfigureFileCommand; }
/**
diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx
index ce36463..dc3e02c 100644
--- a/Source/cmContinueCommand.cxx
+++ b/Source/cmContinueCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmContinueCommand.h"
+#include "cmExecutionStatus.h"
+#include "cmSystemTools.h"
+
// cmContinueCommand
bool cmContinueCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status)
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index a36d5f3..0c4e650 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "continue"; }
-
- cmTypeMacro(cmContinueCommand, cmCommand);
};
#endif
diff --git a/Source/cmConvertMSBuildXMLToJSON.py b/Source/cmConvertMSBuildXMLToJSON.py
new file mode 100644
index 0000000..93ab8a8
--- /dev/null
+++ b/Source/cmConvertMSBuildXMLToJSON.py
@@ -0,0 +1,453 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+import argparse
+import codecs
+import copy
+import logging
+import json
+import os
+
+from collections import OrderedDict
+from xml.dom.minidom import parse, parseString, Element
+
+
+class VSFlags:
+ """Flags corresponding to cmIDEFlagTable."""
+ UserValue = "UserValue" # (1 << 0)
+ UserIgnored = "UserIgnored" # (1 << 1)
+ UserRequired = "UserRequired" # (1 << 2)
+ Continue = "Continue" #(1 << 3)
+ SemicolonAppendable = "SemicolonAppendable" # (1 << 4)
+ UserFollowing = "UserFollowing" # (1 << 5)
+ CaseInsensitive = "CaseInsensitive" # (1 << 6)
+ UserValueIgnored = [UserValue, UserIgnored]
+ UserValueRequired = [UserValue, UserRequired]
+
+
+def vsflags(*args):
+ """Combines the flags."""
+ values = []
+
+ for arg in args:
+ __append_list(values, arg)
+
+ return values
+
+
+def read_msbuild_xml(path, values={}):
+ """Reads the MS Build XML file at the path and returns its contents.
+
+ Keyword arguments:
+ values -- The map to append the contents to (default {})
+ """
+
+ # Attempt to read the file contents
+ try:
+ document = parse(path)
+ except Exception as e:
+ logging.exception('Could not read MS Build XML file at %s', path)
+ return values
+
+ # Convert the XML to JSON format
+ logging.info('Processing MS Build XML file at %s', path)
+
+ # Get the rule node
+ rule = document.getElementsByTagName('Rule')[0]
+
+ rule_name = rule.attributes['Name'].value
+
+ logging.info('Found rules for %s', rule_name)
+
+ # Proprocess Argument values
+ __preprocess_arguments(rule)
+
+ # Get all the values
+ converted_values = []
+ __convert(rule, 'EnumProperty', converted_values, __convert_enum)
+ __convert(rule, 'BoolProperty', converted_values, __convert_bool)
+ __convert(rule, 'StringListProperty', converted_values,
+ __convert_string_list)
+ __convert(rule, 'StringProperty', converted_values, __convert_string)
+ __convert(rule, 'IntProperty', converted_values, __convert_string)
+
+ values[rule_name] = converted_values
+
+ return values
+
+
+def read_msbuild_json(path, values=[]):
+ """Reads the MS Build JSON file at the path and returns its contents.
+
+ Keyword arguments:
+ values -- The list to append the contents to (default [])
+ """
+ if not os.path.exists(path):
+ logging.info('Could not find MS Build JSON file at %s', path)
+ return values
+
+ try:
+ values.extend(__read_json_file(path))
+ except Exception as e:
+ logging.exception('Could not read MS Build JSON file at %s', path)
+ return values
+
+ logging.info('Processing MS Build JSON file at %s', path)
+
+ return values
+
+
+def main():
+ """Script entrypoint."""
+ # Parse the arguments
+ parser = argparse.ArgumentParser(
+ description='Convert MSBuild XML to JSON format')
+
+ parser.add_argument(
+ '-t', '--toolchain', help='The name of the toolchain', required=True)
+ parser.add_argument(
+ '-o', '--output', help='The output directory', default='')
+ parser.add_argument(
+ '-r',
+ '--overwrite',
+ help='Whether previously output should be overwritten',
+ dest='overwrite',
+ action='store_true')
+ parser.set_defaults(overwrite=False)
+ parser.add_argument(
+ '-d',
+ '--debug',
+ help="Debug tool output",
+ action="store_const",
+ dest="loglevel",
+ const=logging.DEBUG,
+ default=logging.WARNING)
+ parser.add_argument(
+ '-v',
+ '--verbose',
+ help="Verbose output",
+ action="store_const",
+ dest="loglevel",
+ const=logging.INFO)
+ parser.add_argument('input', help='The input files', nargs='+')
+
+ args = parser.parse_args()
+
+ toolchain = args.toolchain
+
+ logging.basicConfig(level=args.loglevel)
+ logging.info('Creating %s toolchain files', toolchain)
+
+ values = {}
+
+ # Iterate through the inputs
+ for input in args.input:
+ input = __get_path(input)
+
+ read_msbuild_xml(input, values)
+
+ # Determine if the output directory needs to be created
+ output_dir = __get_path(args.output)
+
+ if not os.path.exists(output_dir):
+ os.mkdir(output_dir)
+ logging.info('Created output directory %s', output_dir)
+
+ for key, value in values.items():
+ output_path = __output_path(toolchain, key, output_dir)
+
+ if os.path.exists(output_path) and not args.overwrite:
+ logging.info('Comparing previous output to current')
+
+ __merge_json_values(value, read_msbuild_json(output_path))
+ else:
+ logging.info('Original output will be overwritten')
+
+ logging.info('Writing MS Build JSON file at %s', output_path)
+
+ __write_json_file(output_path, value)
+
+
+###########################################################################################
+# private joining functions
+def __merge_json_values(current, previous):
+ """Merges the values between the current and previous run of the script."""
+ for value in current:
+ name = value['name']
+
+ # Find the previous value
+ previous_value = __find_and_remove_value(previous, value)
+
+ if previous_value is not None:
+ flags = value['flags']
+ previous_flags = previous_value['flags']
+
+ if flags != previous_flags:
+ logging.warning(
+ 'Flags for %s are different. Using previous value.', name)
+
+ value['flags'] = previous_flags
+ else:
+ logging.warning('Value %s is a new value', name)
+
+ for value in previous:
+ name = value['name']
+ logging.warning(
+ 'Value %s not present in current run. Appending value.', name)
+
+ current.append(value)
+
+
+def __find_and_remove_value(list, compare):
+ """Finds the value in the list that corresponds with the value of compare."""
+ # next throws if there are no matches
+ try:
+ found = next(value for value in list
+ if value['name'] == compare['name'] and value['switch'] ==
+ compare['switch'])
+ except:
+ return None
+
+ list.remove(found)
+
+ return found
+
+
+###########################################################################################
+# private xml functions
+def __convert(root, tag, values, func):
+ """Converts the tag type found in the root and converts them using the func
+ and appends them to the values.
+ """
+ elements = root.getElementsByTagName(tag)
+
+ for element in elements:
+ converted = func(element)
+
+ # Append to the list
+ __append_list(values, converted)
+
+
+def __convert_enum(node):
+ """Converts an EnumProperty node to JSON format."""
+ name = __get_attribute(node, 'Name')
+ logging.debug('Found EnumProperty named %s', name)
+
+ converted_values = []
+
+ for value in node.getElementsByTagName('EnumValue'):
+ converted = __convert_node(value)
+
+ converted['value'] = converted['name']
+ converted['name'] = name
+
+ # Modify flags when there is an argument child
+ __with_argument(value, converted)
+
+ converted_values.append(converted)
+
+ return converted_values
+
+
+def __convert_bool(node):
+ """Converts an BoolProperty node to JSON format."""
+ converted = __convert_node(node, default_value='true')
+
+ # Check for a switch for reversing the value
+ reverse_switch = __get_attribute(node, 'ReverseSwitch')
+
+ if reverse_switch:
+ converted_reverse = copy.deepcopy(converted)
+
+ converted_reverse['switch'] = reverse_switch
+ converted_reverse['value'] = 'false'
+
+ return [converted_reverse, converted]
+
+ # Modify flags when there is an argument child
+ __with_argument(node, converted)
+
+ return __check_for_flag(converted)
+
+
+def __convert_string_list(node):
+ """Converts a StringListProperty node to JSON format."""
+ converted = __convert_node(node)
+
+ # Determine flags for the string list
+ flags = vsflags(VSFlags.UserValue)
+
+ # Check for a separator to determine if it is semicolon appendable
+ # If not present assume the value should be ;
+ separator = __get_attribute(node, 'Separator', default_value=';')
+
+ if separator == ';':
+ flags = vsflags(flags, VSFlags.SemicolonAppendable)
+
+ converted['flags'] = flags
+
+ return __check_for_flag(converted)
+
+
+def __convert_string(node):
+ """Converts a StringProperty node to JSON format."""
+ converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
+
+ return __check_for_flag(converted)
+
+
+def __convert_node(node, default_value='', default_flags=vsflags()):
+ """Converts a XML node to a JSON equivalent."""
+ name = __get_attribute(node, 'Name')
+ logging.debug('Found %s named %s', node.tagName, name)
+
+ converted = {}
+ converted['name'] = name
+ converted['switch'] = __get_attribute(node, 'Switch')
+ converted['comment'] = __get_attribute(node, 'DisplayName')
+ converted['value'] = default_value
+
+ # Check for the Flags attribute in case it was created during preprocessing
+ flags = __get_attribute(node, 'Flags')
+
+ if flags:
+ flags = flags.split(',')
+ else:
+ flags = default_flags
+
+ converted['flags'] = flags
+
+ return converted
+
+
+def __check_for_flag(value):
+ """Checks whether the value has a switch value.
+
+ If not then returns None as it should not be added.
+ """
+ if value['switch']:
+ return value
+ else:
+ logging.warning('Skipping %s which has no command line switch',
+ value['name'])
+ return None
+
+
+def __with_argument(node, value):
+ """Modifies the flags in value if the node contains an Argument."""
+ arguments = node.getElementsByTagName('Argument')
+
+ if arguments:
+ logging.debug('Found argument within %s', value['name'])
+ value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue)
+
+
+def __preprocess_arguments(root):
+ """Preprocesses occurrances of Argument within the root.
+
+ Argument XML values reference other values within the document by name. The
+ referenced value does not contain a switch. This function will add the
+ switch associated with the argument.
+ """
+ # Set the flags to require a value
+ flags = ','.join(vsflags(VSFlags.UserValueRequired))
+
+ # Search through the arguments
+ arguments = root.getElementsByTagName('Argument')
+
+ for argument in arguments:
+ reference = __get_attribute(argument, 'Property')
+ found = None
+
+ # Look for the argument within the root's children
+ for child in root.childNodes:
+ # Ignore Text nodes
+ if isinstance(child, Element):
+ name = __get_attribute(child, 'Name')
+
+ if name == reference:
+ found = child
+ break
+
+ if found is not None:
+ logging.info('Found property named %s', reference)
+ # Get the associated switch
+ switch = __get_attribute(argument.parentNode, 'Switch')
+
+ # See if there is already a switch associated with the element.
+ if __get_attribute(found, 'Switch'):
+ logging.debug('Copying node %s', reference)
+ clone = found.cloneNode(True)
+ root.insertBefore(clone, found)
+ found = clone
+
+ found.setAttribute('Switch', switch)
+ found.setAttribute('Flags', flags)
+ else:
+ logging.warning('Could not find property named %s', reference)
+
+
+def __get_attribute(node, name, default_value=''):
+ """Retrieves the attribute of the given name from the node.
+
+ If not present then the default_value is used.
+ """
+ if node.hasAttribute(name):
+ return node.attributes[name].value.strip()
+ else:
+ return default_value
+
+
+###########################################################################################
+# private path functions
+def __get_path(path):
+ """Gets the path to the file."""
+ if not os.path.isabs(path):
+ path = os.path.join(os.getcwd(), path)
+
+ return os.path.normpath(path)
+
+
+def __output_path(toolchain, rule, output_dir):
+ """Gets the output path for a file given the toolchain, rule and output_dir"""
+ filename = '%s_%s.json' % (toolchain, rule)
+ return os.path.join(output_dir, filename)
+
+
+###########################################################################################
+# private JSON file functions
+def __read_json_file(path):
+ """Reads a JSON file at the path."""
+ with open(path, 'r') as f:
+ return json.load(f)
+
+
+def __write_json_file(path, values):
+ """Writes a JSON file at the path with the values provided."""
+ # Sort the keys to ensure ordering
+ sort_order = ['name', 'switch', 'comment', 'value', 'flags']
+ sorted_values = [
+ OrderedDict(
+ sorted(
+ value.items(), key=lambda value: sort_order.index(value[0])))
+ for value in values
+ ]
+
+ with open(path, 'w') as f:
+ json.dump(sorted_values, f, indent=2, separators=(',', ': '))
+
+
+###########################################################################################
+# private list helpers
+def __append_list(append_to, value):
+ """Appends the value to the list."""
+ if value is not None:
+ if isinstance(value, list):
+ append_to.extend(value)
+ else:
+ append_to.append(value)
+
+###########################################################################################
+# main entry point
+if __name__ == "__main__":
+ main()
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index a409d40..c7b6d58 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -6,6 +6,7 @@
#include "cmExportTryCompileFileGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
#include "cmake.h"
#include <cmsys/Directory.hxx>
@@ -43,24 +44,25 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// which signature were we called with ?
this->SrcFileSignature = true;
- cmState::TargetType targetType = cmState::EXECUTABLE;
+ cmStateEnums::TargetType targetType = cmStateEnums::EXECUTABLE;
const char* tt =
this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_TARGET_TYPE");
if (!isTryRun && tt && *tt) {
- if (strcmp(tt, cmState::GetTargetTypeName(cmState::EXECUTABLE)) == 0) {
- targetType = cmState::EXECUTABLE;
+ if (strcmp(tt, cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) ==
+ 0) {
+ targetType = cmStateEnums::EXECUTABLE;
} else if (strcmp(tt, cmState::GetTargetTypeName(
- cmState::STATIC_LIBRARY)) == 0) {
- targetType = cmState::STATIC_LIBRARY;
+ cmStateEnums::STATIC_LIBRARY)) == 0) {
+ targetType = cmStateEnums::STATIC_LIBRARY;
} else {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR, std::string("Invalid value '") + tt +
"' for "
"CMAKE_TRY_COMPILE_TARGET_TYPE. Only "
"'" +
- cmState::GetTargetTypeName(cmState::EXECUTABLE) + "' and "
- "'" +
- cmState::GetTargetTypeName(cmState::STATIC_LIBRARY) +
+ cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE) + "' and "
+ "'" +
+ cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY) +
"' "
"are allowed.");
return -1;
@@ -122,12 +124,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
libsToLink += "\"" + cmSystemTools::TrimWhitespace(argv[i]) + "\" ";
if (cmTarget* tgt = this->Makefile->FindTargetToUse(argv[i])) {
switch (tgt->GetType()) {
- case cmState::SHARED_LIBRARY:
- case cmState::STATIC_LIBRARY:
- case cmState::INTERFACE_LIBRARY:
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
break;
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if (tgt->IsExecutableWithExports()) {
break;
}
@@ -481,13 +483,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
? "NEW"
: "OLD");
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
fprintf(fout, "add_executable(%s", targetName.c_str());
- } else // if (targetType == cmState::STATIC_LIBRARY)
+ } else // if (targetType == cmStateEnums::STATIC_LIBRARY)
{
/* Put the static library at a known location (for COPY_FILE). */
fprintf(fout, "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \"%s\")\n",
@@ -530,7 +532,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// set the result var to the return value to indicate success or failure
this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"),
"Result of TRY_COMPILE",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
if (!outputVariable.empty()) {
this->Makefile->AddDefinition(outputVariable, output.c_str());
@@ -627,16 +629,16 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
}
void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
- cmState::TargetType targetType)
+ cmStateEnums::TargetType targetType)
{
this->FindErrorMessage = "";
this->OutputFile = "";
std::string tmpOutputFile = "/";
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
tmpOutputFile += targetName;
tmpOutputFile +=
this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX");
- } else // if (targetType == cmState::STATIC_LIBRARY)
+ } else // if (targetType == cmStateEnums::STATIC_LIBRARY)
{
tmpOutputFile +=
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index e173a16..5f909dd 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -35,9 +35,7 @@ protected:
the error message is stored in FindErrorMessage.
*/
void FindOutputFile(const std::string& targetName,
- cmState::TargetType targetType);
-
- cmTypeMacro(cmCoreTryCompile, cmCommand);
+ cmStateEnums::TargetType targetType);
std::string BinaryDirectory;
std::string OutputFile;
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index ec62c5b..b062d4d 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -3,6 +3,7 @@
#include "cmCreateTestSourceList.h"
#include "cmSourceFile.h"
+#include "cmSystemTools.h"
// cmCreateTestSourceList
bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index ffd06f0..2f71a00 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -29,8 +29,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "create_test_sourcelist"; }
-
- cmTypeMacro(cmCreateTestSourceList, cmCommand);
};
#endif
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 0fd4ffb..2125f1b 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
@@ -42,7 +42,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) {
+ if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
return target->GetProperty("CROSSCOMPILING_EMULATOR") != CM_NULLPTR;
}
return false;
@@ -52,12 +52,12 @@ std::string cmCustomCommandGenerator::GetCommand(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 &&
+ if (target && target->GetType() == cmStateEnums::EXECUTABLE &&
(target->IsImported() ||
!this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) {
return target->GetLocation(this->Config);
}
- if (target && target->GetType() == cmState::EXECUTABLE) {
+ if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
if (emulator) {
return std::string(emulator);
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 8800363..af4eff9 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -3,6 +3,7 @@
#include "cmDefinePropertyCommand.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmake.h"
bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index f494123..cdfff9f 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -22,8 +22,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "define_property"; }
- cmTypeMacro(cmDefinePropertyCommand, cmCommand);
-
private:
std::string PropertyName;
std::string BriefDocs;
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 569b3a2..8dfb9ea 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -6,20 +6,11 @@
#include <cmConfigure.h>
#include "cmLinkedTree.h"
+#include "cm_unordered_map.hxx"
#include <string>
#include <vector>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-#include <unordered_map>
-#else
-#include "cmsys/hash_map.hxx"
-#endif
-#else
-#include <map>
-#endif
-
/** \class cmDefinitions
* \brief Store a scope of variable definitions for CMake language.
*
@@ -85,15 +76,7 @@ private:
};
static Def NoDef;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- typedef std::unordered_map<std::string, Def> MapType;
-#else
- typedef cmsys::hash_map<std::string, Def> MapType;
-#endif
-#else
- typedef std::map<std::string, Def> MapType;
-#endif
+ typedef CM_UNORDERED_MAP<std::string, Def> MapType;
MapType Map;
static Def const& GetInternal(const std::string& key, StackIter begin,
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index c1c8880..c8723d0 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -7,6 +7,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include <assert.h>
@@ -198,16 +199,13 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
stamp += ".mod.stamp";
fcStream << "\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
- mod_lower)
+ << this->MaybeConvertToRelativePath(currentBinDir, mod_lower)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
- mod_upper)
+ << this->MaybeConvertToRelativePath(currentBinDir, mod_upper)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
- stamp)
+ << this->MaybeConvertToRelativePath(currentBinDir, stamp)
<< "\"\n";
}
fcStream << " )\n";
@@ -323,17 +321,16 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
// Write the include dependencies to the output stream.
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
- std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
+ std::string obj_i = this->MaybeConvertToRelativePath(binDir, obj);
std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for (std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i) {
- makeDepends
- << obj_m << ": "
- << cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
- << std::endl;
+ makeDepends << obj_m << ": "
+ << cmSystemTools::ConvertToOutputPath(
+ this->MaybeConvertToRelativePath(binDir, *i).c_str())
+ << std::endl;
internalDepends << " " << *i << std::endl;
}
makeDepends << std::endl;
@@ -359,7 +356,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += *i;
proxy += ".mod.proxy";
proxy = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
+ this->MaybeConvertToRelativePath(binDir, proxy).c_str());
// since we require some things add them to our list of requirements
makeDepends << obj_m << ".requires: " << proxy << std::endl;
@@ -375,8 +372,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
if (!required->second.empty()) {
// This module is known. Depend on its timestamp file.
std::string stampFile = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, required->second)
- .c_str());
+ this->MaybeConvertToRelativePath(binDir, required->second).c_str());
makeDepends << obj_m << ": " << stampFile << "\n";
} else {
// This module is not known to CMake. Try to locate it where
@@ -384,7 +380,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string module;
if (this->FindModule(*i, module)) {
module = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str());
+ this->MaybeConvertToRelativePath(binDir, module).c_str());
makeDepends << obj_m << ": " << module << "\n";
}
}
@@ -398,7 +394,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += *i;
proxy += ".mod.proxy";
proxy = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
+ this->MaybeConvertToRelativePath(binDir, proxy).c_str());
makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
}
@@ -420,14 +416,14 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
modFile += "/";
modFile += *i;
modFile = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(binDir, modFile),
+ this->MaybeConvertToRelativePath(binDir, modFile),
cmOutputConverter::SHELL);
std::string stampFile = stamp_dir;
stampFile += "/";
stampFile += m;
stampFile += ".mod.stamp";
stampFile = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(binDir, stampFile),
+ this->MaybeConvertToRelativePath(binDir, stampFile),
cmOutputConverter::SHELL);
makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
<< " " << stampFile;
@@ -448,7 +444,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string driver = this->TargetDirectory;
driver += "/build";
driver = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str());
+ this->MaybeConvertToRelativePath(binDir, driver).c_str());
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
@@ -708,3 +704,13 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// content.
return cmFortranStreamsDiffer(finModFile, finStampFile);
}
+
+std::string cmDependsFortran::MaybeConvertToRelativePath(
+ std::string const& base, std::string const& path)
+{
+ if (!cmOutputConverter::ContainedInDirectory(
+ base, path, this->LocalGenerator->GetStateSnapshot().GetDirectory())) {
+ return path;
+ }
+ return cmOutputConverter::ForceToRelativePath(base, path);
+}
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index 8d347f4..90b82d4 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -78,6 +78,9 @@ protected:
private:
cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
void operator=(cmDependsFortran const&); // Purposely not implemented.
+
+ std::string MaybeConvertToRelativePath(std::string const& base,
+ std::string const& path);
};
#endif
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 2d86674..0655da9 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -132,18 +132,13 @@ public:
// Forward to the per-class implementation.
virtual unsigned int GetNumberOfSections() const = 0;
- virtual unsigned int GetDynamicEntryCount() = 0;
virtual unsigned long GetDynamicEntryPosition(int j) = 0;
+ virtual cmELF::DynamicEntryList GetDynamicEntries() = 0;
+ virtual std::vector<char> EncodeDynamicEntries(
+ const cmELF::DynamicEntryList&) = 0;
virtual StringEntry const* GetDynamicSectionString(unsigned int tag) = 0;
virtual void PrintInfo(std::ostream& os) const = 0;
- bool ReadBytes(unsigned long pos, unsigned long size, char* buf)
- {
- this->Stream.seekg(pos);
- this->Stream.read(buf, size);
- return !this->Stream.fail();
- }
-
// Lookup the SONAME in the DYNAMIC section.
StringEntry const* GetSOName()
{
@@ -246,10 +241,13 @@ public:
return static_cast<unsigned int>(this->ELFHeader.e_shnum);
}
- // Get the file position and size of a dynamic section entry.
- unsigned int GetDynamicEntryCount() CM_OVERRIDE;
+ // Get the file position of a dynamic section entry.
unsigned long GetDynamicEntryPosition(int j) CM_OVERRIDE;
+ cmELF::DynamicEntryList GetDynamicEntries() CM_OVERRIDE;
+ std::vector<char> EncodeDynamicEntries(const cmELF::DynamicEntryList&)
+ CM_OVERRIDE;
+
// Lookup a string from the dynamic section with the given tag.
StringEntry const* GetDynamicSectionString(unsigned int tag) CM_OVERRIDE;
@@ -289,6 +287,10 @@ public:
}
private:
+ // ByteSwap(ELF_Dyn) assumes d_val and d_ptr are the same size
+ typedef char dyn_size_assert
+ [sizeof(ELF_Dyn().d_un.d_val) == sizeof(ELF_Dyn().d_un.d_ptr) ? 1 : -1];
+
void ByteSwap(ELF_Ehdr& elf_header)
{
cmELFByteSwap(elf_header.e_type);
@@ -323,121 +325,7 @@ private:
void ByteSwap(ELF_Dyn& dyn)
{
cmELFByteSwap(dyn.d_tag);
- switch (dyn.d_tag) {
- case DT_NULL: /* dyn.d_un ignored */
- break;
- case DT_NEEDED:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_PLTRELSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_PLTGOT:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_HASH:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_STRTAB:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_SYMTAB:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_RELA:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_RELASZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_RELAENT:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_STRSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_SYMENT:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_INIT:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_FINI:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_SONAME:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_RPATH:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_SYMBOLIC: /* dyn.d_un ignored */
- break;
- case DT_REL:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_RELSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_RELENT:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_PLTREL:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
- case DT_DEBUG:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
- case DT_TEXTREL: /* dyn.d_un ignored */
- break;
- case DT_JMPREL:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
-#ifdef T_BIND_NOW
- case T_BIND_NOW: /* dyn.d_un ignored */
- break;
-#endif
-#ifdef DT_INIT_ARRAY
- case DT_INIT_ARRAY:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
-#endif
-#ifdef DT_FINI_ARRAY
- case DT_FINI_ARRAY:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
-#endif
-#ifdef DT_INIT_ARRAYSZ
- case DT_INIT_ARRAYSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
-#endif
-#ifdef DT_FINI_ARRAYSZ
- case DT_FINI_ARRAYSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
-#endif
-#ifdef DT_RUNPATH
- case DT_RUNPATH:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
-#endif
-#ifdef DT_FLAGS
- case DT_FLAGS:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
-#endif
-#ifdef DT_PREINIT_ARRAY
- case DT_PREINIT_ARRAY:
- cmELFByteSwap(dyn.d_un.d_ptr);
- break;
-#endif
-#ifdef DT_PREINIT_ARRAYSZ
- case DT_PREINIT_ARRAYSZ:
- cmELFByteSwap(dyn.d_un.d_val);
- break;
-#endif
- }
+ cmELFByteSwap(dyn.d_un.d_val);
}
bool FileTypeValid(ELF_Half et)
@@ -636,30 +524,64 @@ bool cmELFInternalImpl<Types>::LoadDynamicSection()
}
template <class Types>
-unsigned int cmELFInternalImpl<Types>::GetDynamicEntryCount()
+unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j)
{
if (!this->LoadDynamicSection()) {
return 0;
}
- for (unsigned int i = 0; i < this->DynamicSectionEntries.size(); ++i) {
- if (this->DynamicSectionEntries[i].d_tag == DT_NULL) {
- return i;
- }
+ if (j < 0 || j >= static_cast<int>(this->DynamicSectionEntries.size())) {
+ return 0;
}
- return static_cast<unsigned int>(this->DynamicSectionEntries.size());
+ ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
+ return static_cast<unsigned long>(sec.sh_offset + sec.sh_entsize * j);
}
template <class Types>
-unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j)
+cmELF::DynamicEntryList cmELFInternalImpl<Types>::GetDynamicEntries()
{
+ cmELF::DynamicEntryList result;
+
+ // Ensure entries have been read from file
if (!this->LoadDynamicSection()) {
- return 0;
+ return result;
}
- if (j < 0 || j >= static_cast<int>(this->DynamicSectionEntries.size())) {
- return 0;
+
+ // Copy into public array
+ result.reserve(this->DynamicSectionEntries.size());
+ for (typename std::vector<ELF_Dyn>::iterator di =
+ this->DynamicSectionEntries.begin();
+ di != this->DynamicSectionEntries.end(); ++di) {
+ ELF_Dyn& dyn = *di;
+ result.push_back(
+ std::pair<unsigned long, unsigned long>(dyn.d_tag, dyn.d_un.d_val));
}
- ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
- return static_cast<unsigned long>(sec.sh_offset + sec.sh_entsize * j);
+
+ return result;
+}
+
+template <class Types>
+std::vector<char> cmELFInternalImpl<Types>::EncodeDynamicEntries(
+ const cmELF::DynamicEntryList& entries)
+{
+ std::vector<char> result;
+ result.reserve(sizeof(ELF_Dyn) * entries.size());
+
+ for (cmELF::DynamicEntryList::const_iterator it = entries.begin();
+ it != entries.end(); it++) {
+ // Store the entry in an ELF_Dyn, byteswap it, then serialize to chars
+ ELF_Dyn dyn;
+ dyn.d_tag = static_cast<tagtype>(it->first);
+ dyn.d_un.d_val = static_cast<tagtype>(it->second);
+
+ if (this->NeedSwap) {
+ ByteSwap(dyn);
+ }
+
+ char* pdyn = reinterpret_cast<char*>(&dyn);
+ result.insert(result.end(), pdyn, pdyn + sizeof(ELF_Dyn));
+ }
+
+ return result;
}
template <class Types>
@@ -752,6 +674,15 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
//============================================================================
// External class implementation.
+const long cmELF::TagRPath = DT_RPATH;
+const long cmELF::TagRunPath = DT_RUNPATH;
+
+#ifdef DT_MIPS_RLD_MAP_REL
+const long cmELF::TagMipsRldMapRel = DT_MIPS_RLD_MAP_REL;
+#else
+const long cmELF::TagMipsRldMapRel = 0;
+#endif
+
cmELF::cmELF(const char* fname)
: Internal(CM_NULLPTR)
{
@@ -839,28 +770,31 @@ unsigned int cmELF::GetNumberOfSections() const
return 0;
}
-unsigned int cmELF::GetDynamicEntryCount() const
+unsigned long cmELF::GetDynamicEntryPosition(int index) const
{
if (this->Valid()) {
- return this->Internal->GetDynamicEntryCount();
+ return this->Internal->GetDynamicEntryPosition(index);
}
return 0;
}
-unsigned long cmELF::GetDynamicEntryPosition(int index) const
+cmELF::DynamicEntryList cmELF::GetDynamicEntries() const
{
if (this->Valid()) {
- return this->Internal->GetDynamicEntryPosition(index);
+ return this->Internal->GetDynamicEntries();
}
- return 0;
+
+ return cmELF::DynamicEntryList();
}
-bool cmELF::ReadBytes(unsigned long pos, unsigned long size, char* buf) const
+std::vector<char> cmELF::EncodeDynamicEntries(
+ const cmELF::DynamicEntryList& dentries) const
{
if (this->Valid()) {
- return this->Internal->ReadBytes(pos, size, buf);
+ return this->Internal->EncodeDynamicEntries(dentries);
}
- return false;
+
+ return std::vector<char>();
}
bool cmELF::GetSOName(std::string& soname)
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 7e7c1d6..763a240 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -7,6 +7,8 @@
#include <iosfwd>
#include <string>
+#include <utility>
+#include <vector>
#if !defined(CMAKE_USE_ELF_PARSER)
#error "This file may be included only if CMAKE_USE_ELF_PARSER is enabled."
@@ -61,22 +63,27 @@ public:
int IndexInSection;
};
+ /** Represent entire dynamic section header */
+ typedef std::vector<std::pair<long, unsigned long> > DynamicEntryList;
+
/** Get the type of the file opened. */
FileType GetFileType() const;
/** Get the number of ELF sections present. */
unsigned int GetNumberOfSections() const;
- /** Get the number of DYNAMIC section entries before the first
- DT_NULL. Returns zero on error. */
- unsigned int GetDynamicEntryCount() const;
-
/** Get the position of a DYNAMIC section header entry. Returns
zero on error. */
unsigned long GetDynamicEntryPosition(int index) const;
- /** Read bytes from the file. */
- bool ReadBytes(unsigned long pos, unsigned long size, char* buf) const;
+ /** Get a copy of all the DYNAMIC section header entries.
+ Returns an empty vector on error */
+ DynamicEntryList GetDynamicEntries() const;
+
+ /** Encodes a DYNAMIC section header entry list into a char vector according
+ to the type of ELF file this is */
+ std::vector<char> EncodeDynamicEntries(
+ const DynamicEntryList& entries) const;
/** Get the SONAME field if any. */
bool GetSOName(std::string& soname);
@@ -91,6 +98,10 @@ public:
/** Print human-readable information about the ELF file. */
void PrintInfo(std::ostream& os) const;
+ /** Interesting dynamic tags.
+ If the tag is 0, it does not exist in the host ELF implementation */
+ static const long TagRPath, TagRunPath, TagMipsRldMapRel;
+
private:
friend class cmELFInternal;
bool Valid() const;
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
index 33f73ee..32e04a7 100644
--- a/Source/cmElseCommand.h
+++ b/Source/cmElseCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "else"; }
-
- cmTypeMacro(cmElseCommand, cmCommand);
};
#endif
diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx
index cc3624b..1c32248 100644
--- a/Source/cmElseIfCommand.cxx
+++ b/Source/cmElseIfCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmElseIfCommand.h"
+class cmExecutionStatus;
+
bool cmElseIfCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h
index a489e30..3f1ddde 100644
--- a/Source/cmElseIfCommand.h
+++ b/Source/cmElseIfCommand.h
@@ -3,7 +3,13 @@
#ifndef cmElseIfCommand_h
#define cmElseIfCommand_h
-#include "cmIfCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
+#include "cmCommand.h"
+
+class cmExecutionStatus;
/** \class cmElseIfCommand
* \brief ends an if block
@@ -34,8 +40,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "elseif"; }
-
- cmTypeMacro(cmElseIfCommand, cmCommand);
};
#endif
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 98b3841..34e1d3d 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -32,8 +32,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "enable_language"; }
-
- cmTypeMacro(cmEnableLanguageCommand, cmCommand);
};
#endif
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index 750ae8c..b94967a 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -37,8 +37,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "enable_testing"; }
-
- cmTypeMacro(cmEnableTestingCommand, cmCommand);
};
#endif
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
index 3bcc7cf..a146e4d 100644
--- a/Source/cmEndForEachCommand.h
+++ b/Source/cmEndForEachCommand.h
@@ -44,8 +44,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "endforeach"; }
-
- cmTypeMacro(cmEndForEachCommand, cmCommand);
};
#endif
diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h
index 8b4d2f9..ab174fd 100644
--- a/Source/cmEndFunctionCommand.h
+++ b/Source/cmEndFunctionCommand.h
@@ -44,8 +44,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "endfunction"; }
-
- cmTypeMacro(cmEndFunctionCommand, cmCommand);
};
#endif
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
index b476c72..d068bb4 100644
--- a/Source/cmEndIfCommand.h
+++ b/Source/cmEndIfCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "endif"; }
-
- cmTypeMacro(cmEndIfCommand, cmCommand);
};
#endif
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
index 806750d..34ae880 100644
--- a/Source/cmEndMacroCommand.h
+++ b/Source/cmEndMacroCommand.h
@@ -44,8 +44,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "endmacro"; }
-
- cmTypeMacro(cmEndMacroCommand, cmCommand);
};
#endif
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
index 861d2f0..2366706 100644
--- a/Source/cmEndWhileCommand.h
+++ b/Source/cmEndWhileCommand.h
@@ -44,8 +44,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "endwhile"; }
-
- cmTypeMacro(cmEndWhileCommand, cmCommand);
};
#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 1cc46d3..a3e96ae 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -37,8 +37,6 @@ public:
*/
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 = CM_NULLPTR,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index f7e376a..2242998 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -35,8 +35,6 @@ public:
* This determines if the command is invoked when in script mode.
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
-
- cmTypeMacro(cmExecuteProcessCommand, cmCommand);
};
#endif
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index f5e6628..38f95d2 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -111,8 +111,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
target->GetLocalGenerator()->FindGeneratorTargetToUse(*i);
if (gt) {
- if (gt->GetType() == cmState::SHARED_LIBRARY ||
- gt->GetType() == cmState::MODULE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
sharedLibs += " " + *i;
} else {
staticLibs += " " + *i;
@@ -168,7 +168,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
}
// Tell the NDK build system if prebuilt static libraries use C++.
- if (target->GetType() == cmState::STATIC_LIBRARY) {
+ if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
cmLinkImplementation const* li = target->GetLinkImplementation(config);
if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") !=
li->Languages.end()) {
@@ -177,19 +177,19 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
}
switch (target->GetType()) {
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
os << "include $(PREBUILT_SHARED_LIBRARY)\n";
break;
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
os << "include $(PREBUILT_STATIC_LIBRARY)\n";
break;
- case cmState::EXECUTABLE:
- case cmState::UTILITY:
- case cmState::OBJECT_LIBRARY:
- case cmState::GLOBAL_TARGET:
- case cmState::INTERFACE_LIBRARY:
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
break;
}
os << "\n";
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 68831c7..0c25268 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
@@ -57,7 +57,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->LG->GetMakefile()->GetBacktrace());
return false;
}
- if (te->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (te->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
this->GenerateRequiredCMakeVersion(os, "3.0.0");
}
}
@@ -134,12 +134,12 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig(
cmGeneratorTarget* target = *tei;
ImportPropertyMap properties;
- if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
this->SetImportLocationProperty(config, suffix, target, properties);
}
if (!properties.empty()) {
// Get the rest of the target details.
- if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
this->SetImportDetailProperties(config, suffix, target, properties,
missingTargets);
this->SetImportLinkInterface(config, suffix,
@@ -186,7 +186,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
// Add the import library for windows DLLs.
if (target->IsDLLPlatform() &&
- (target->GetType() == cmState::SHARED_LIBRARY ||
+ (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->IsExecutableWithExports()) &&
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
std::string prop = "IMPORTED_IMPLIB";
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index d438363..c9dac35 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -2,15 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportCommand.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmake.h"
-
-#include <cmsys/Encoding.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <sstream>
#include "cmExportBuildAndroidMKGenerator.h"
#include "cmExportBuildFileGenerator.h"
+#include "cmExportSetMap.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
#if defined(__HAIKU__)
#include <FindDirectory.h>
@@ -141,14 +148,14 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
}
if (cmTarget* target = gg->FindTarget(*currentTarget)) {
- if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "given OBJECT library \"" << *currentTarget
<< "\" which may not be exported.";
this->SetError(e.str());
return false;
}
- if (target->GetType() == cmState::UTILITY) {
+ if (target->GetType() == cmStateEnums::UTILITY) {
this->SetError("given custom target \"" + *currentTarget +
"\" which may not be exported.");
return false;
@@ -271,6 +278,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
+
#undef GetCurrentDirectory
void cmExportCommand::ReportRegistryError(std::string const& msg,
std::string const& key, long err)
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index ebde71c..99dac7d 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -3,9 +3,14 @@
#ifndef cmExportCommand_h
#define cmExportCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+#include "cmCommandArgumentsHelper.h"
-class cmExportBuildFileGenerator;
+class cmExecutionStatus;
class cmExportSet;
/** \class cmExportLibraryDependenciesCommand
@@ -35,8 +40,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "export"; }
- cmTypeMacro(cmExportCommand, cmCommand);
-
private:
cmCommandArgumentGroup ArgumentGroup;
cmCAStringVector Targets;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index d3a99fa..6c21eaf 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -11,7 +11,7 @@
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
@@ -492,7 +492,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
ifaceProperties);
- if (gtarget->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
std::vector<std::string> configNames;
@@ -735,8 +735,8 @@ void cmExportFileGenerator::SetImportDetailProperties(
cmMakefile* mf = target->Makefile;
// Add the soname for unix shared libraries.
- if (target->GetType() == cmState::SHARED_LIBRARY ||
- target->GetType() == cmState::MODULE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ target->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (!target->IsDLLPlatform()) {
std::string prop;
std::string value;
@@ -912,22 +912,22 @@ void cmExportFileGenerator::GenerateImportTargetCode(
// Create the imported target.
os << "# Create imported target " << targetName << "\n";
switch (target->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
os << "add_executable(" << targetName << " IMPORTED)\n";
break;
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
os << "add_library(" << targetName << " STATIC IMPORTED)\n";
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
os << "add_library(" << targetName << " SHARED IMPORTED)\n";
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
os << "add_library(" << targetName << " MODULE IMPORTED)\n";
break;
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
break;
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
break;
default: // should never happen
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index 58b7510..f9f5f3a 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -38,7 +38,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
// Collect import properties for this target.
cmTargetExport const* te = *tei;
- if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
std::string dest;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 0e043de..64ea3c8 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -14,7 +14,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
@@ -81,7 +81,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
cmGeneratorTarget* gt = (*tei)->Target;
requiresConfigFiles =
- requiresConfigFiles || gt->GetType() != cmState::INTERFACE_LIBRARY;
+ requiresConfigFiles || gt->GetType() != cmStateEnums::INTERFACE_LIBRARY;
this->GenerateImportTargetCode(os, gt);
@@ -120,7 +120,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12 = true;
}
}
- if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
require3_0_0 = true;
}
if (gt->GetProperty("INTERFACE_SOURCES")) {
@@ -316,7 +316,7 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
// Collect import properties for this target.
cmTargetExport const* te = *tei;
- if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index f80980a..bf1ea01 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -2,12 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportLibraryDependenciesCommand.h"
+#include <cm_auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
+
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
-#include "cmVersion.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetLinkLibraryType.h"
#include "cmake.h"
-#include <cm_auto_ptr.hxx>
+class cmExecutionStatus;
bool cmExportLibraryDependenciesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -79,8 +87,8 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
cmTarget const& target = l->second;
// Skip non-library targets.
- if (target.GetType() < cmState::STATIC_LIBRARY ||
- target.GetType() > cmState::MODULE_LIBRARY) {
+ if (target.GetType() < cmStateEnums::STATIC_LIBRARY ||
+ target.GetType() > cmStateEnums::MODULE_LIBRARY) {
continue;
}
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index fa9f353..be53349 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -3,12 +3,17 @@
#ifndef cmExportLibraryDependenciesCommand_h
#define cmExportLibraryDependenciesCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmExportLibraryDependenciesCommand : public cmCommand
{
public:
- cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE
{
return new cmExportLibraryDependenciesCommand;
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 9fc71f6..cd0a7e6 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_auto_ptr.hxx"
@@ -67,7 +67,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
- cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE,
+ cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
cmTarget::VisibilityNormal, tgt->Target->GetMakefile());
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
diff --git a/Source/cmExprParser.cxx b/Source/cmExprParser.cxx
index 077106f..d11d0b6 100644
--- a/Source/cmExprParser.cxx
+++ b/Source/cmExprParser.cxx
@@ -1,12 +1,13 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
-/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
- 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Bison implementation for Yacc-like parsers in C
- This program is free software; you can redistribute it and/or modify
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,17 +15,23 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
@@ -33,76 +40,35 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-/* turn off some warning as this is generated code */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4702 ) /* unreachable code */
-#endif
-
/* Identify Bison output. */
#define YYBISON 1
+/* Bison version. */
+#define YYBISON_VERSION "3.0.4"
+
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* If NAME_PREFIX is specified substitute the variables and functions
- names. */
-#define yyparse cmExpr_yyparse
-#define yylex cmExpr_yylex
-#define yyerror cmExpr_yyerror
-#define yylval cmExpr_yylval
-#define yychar cmExpr_yychar
-#define yydebug cmExpr_yydebug
-#define yynerrs cmExpr_yynerrs
-
+/* Push parsers. */
+#define YYPUSH 0
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- exp_PLUS = 258,
- exp_MINUS = 259,
- exp_TIMES = 260,
- exp_DIVIDE = 261,
- exp_MOD = 262,
- exp_SHIFTLEFT = 263,
- exp_SHIFTRIGHT = 264,
- exp_OPENPARENT = 265,
- exp_CLOSEPARENT = 266,
- exp_OR = 267,
- exp_AND = 268,
- exp_XOR = 269,
- exp_NOT = 270,
- exp_NUMBER = 271
- };
-#endif
-#define exp_PLUS 258
-#define exp_MINUS 259
-#define exp_TIMES 260
-#define exp_DIVIDE 261
-#define exp_MOD 262
-#define exp_SHIFTLEFT 263
-#define exp_SHIFTRIGHT 264
-#define exp_OPENPARENT 265
-#define exp_CLOSEPARENT 266
-#define exp_OR 267
-#define exp_AND 268
-#define exp_XOR 269
-#define exp_NOT 270
-#define exp_NUMBER 271
+/* Pull parsers. */
+#define YYPULL 1
+/* Substitute the variable and function names. */
+#define yyparse cmExpr_yyparse
+#define yylex cmExpr_yylex
+#define yyerror cmExpr_yyerror
+#define yydebug cmExpr_yydebug
+#define yynerrs cmExpr_yynerrs
/* Copy the first part of user declarations. */
-
+#line 1 "cmExprParser.y" /* yacc.c:339 */
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
@@ -112,24 +78,15 @@ This file must be translated to C and modified to build everywhere.
Run bison like this:
- bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h
- -ocmExprParser.cxx cmExprParser.y
+ bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h -ocmExprParser.cxx cmExprParser.y
Modify cmExprParser.cxx:
- - remove TABs
- - add __HP_aCC to the #if test for yyerrorlab warning suppression
+ - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
*/
-/* Configure the parser to use a lexer object. */
-#define YYPARSE_PARAM yyscanner
-#define YYLEX_PARAM yyscanner
-#define YYERROR_VERBOSE 1
-#define cmExpr_yyerror(x) \
- cmExprError(yyscanner, x)
-#define yyGetParser (cmExpr_yyget_extra(yyscanner))
-
/*-------------------------------------------------------------------------*/
+#define YYDEBUG 1
#include "cmExprParserHelper.h" /* Interface to parser object. */
#include "cmExprLexer.h" /* Interface to lexer object. */
#include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
@@ -139,99 +96,281 @@ Modify cmExprParser.cxx:
/* Forward declare the lexer entry point. */
YY_DECL;
-/* Internal utility functions. */
-static void cmExprError(yyscan_t yyscanner, const char* message);
-
-#define YYDEBUG 1
-//#define YYMAXDEPTH 100000
-//#define YYINITDEPTH 10000
-
+/* Helper function to forward error callback from parser. */
+static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
-# pragma warning (disable: 4065) /* Switch statement contains default but
- no case. */
+# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
#endif
+#line 109 "cmExprParser.cxx" /* yacc.c:339 */
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
-# define YYERROR_VERBOSE 0
+# define YYERROR_VERBOSE 1
#endif
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-typedef int YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
+/* In a future release of Bison, this section will be replaced
+ by #include "cmExprParserTokens.h". */
+#ifndef YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
+# define YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int cmExpr_yydebug;
#endif
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ exp_PLUS = 258,
+ exp_MINUS = 259,
+ exp_TIMES = 260,
+ exp_DIVIDE = 261,
+ exp_MOD = 262,
+ exp_SHIFTLEFT = 263,
+ exp_SHIFTRIGHT = 264,
+ exp_OPENPARENT = 265,
+ exp_CLOSEPARENT = 266,
+ exp_OR = 267,
+ exp_AND = 268,
+ exp_XOR = 269,
+ exp_NOT = 270,
+ exp_NUMBER = 271
+ };
+#endif
+/* Tokens. */
+#define exp_PLUS 258
+#define exp_MINUS 259
+#define exp_TIMES 260
+#define exp_DIVIDE 261
+#define exp_MOD 262
+#define exp_SHIFTLEFT 263
+#define exp_SHIFTRIGHT 264
+#define exp_OPENPARENT 265
+#define exp_CLOSEPARENT 266
+#define exp_OR 267
+#define exp_AND 268
+#define exp_XOR 269
+#define exp_NOT 270
+#define exp_NUMBER 271
+
+/* Value type. */
+
+
+
+int cmExpr_yyparse (yyscan_t yyscanner);
+#endif /* !YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED */
/* Copy the second part of user declarations. */
+#line 186 "cmExprParser.cxx" /* yacc.c:358 */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
-/* Line 214 of yacc.c. */
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
-# ifndef YYFREE
-# define YYFREE free
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# endif
-# else
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
+ /* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
+# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- short int yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -239,74 +378,74 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined (__GNUC__) && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
while (0)
#endif
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short int yysigned_char;
-#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 12
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 17
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 25
+#define YYLAST 30
-/* YYNTOKENS -- Number of terminals. */
+/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 17
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 9
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 20
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 34
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 10
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 23
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 39
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 271
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned char yytranslate[] =
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
+static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -339,210 +478,161 @@ static const unsigned char yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned char yyprhs[] =
-{
- 0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
- 25, 29, 33, 35, 39, 43, 45, 49, 53, 57,
- 59
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yysigned_char yyrhs[] =
-{
- 18, 0, -1, 19, -1, 20, -1, 19, 12, 20,
- -1, 21, -1, 20, 14, 21, -1, 22, -1, 21,
- 13, 22, -1, 23, -1, 22, 8, 23, -1, 22,
- 9, 23, -1, 24, -1, 23, 3, 24, -1, 23,
- 4, 24, -1, 25, -1, 24, 5, 25, -1, 24,
- 6, 25, -1, 24, 7, 25, -1, 16, -1, 10,
- 19, 11, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned char yyrline[] =
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint8 yyrline[] =
{
- 0, 94, 94, 100, 103, 107, 110, 114, 117, 121,
- 124, 127, 132, 135, 138, 142, 145, 148, 151, 155,
- 158
+ 0, 70, 70, 75, 78, 83, 86, 91, 94, 99,
+ 102, 105, 110, 113, 116, 121, 124, 127, 130, 135,
+ 138, 141, 146, 149
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+#if YYDEBUG || YYERROR_VERBOSE || 1
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES",
"exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT",
"exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR",
- "exp_NOT", "exp_NUMBER", "$accept", "Start", "exp", "bitwiseor",
- "bitwisexor", "bitwiseand", "shift", "term", "factor", 0
+ "exp_NOT", "exp_NUMBER", "$accept", "start", "exp", "bitwiseor",
+ "bitwisexor", "bitwiseand", "shift", "term", "unary", "factor", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const unsigned short int yytoknum[] =
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned char yyr1[] =
+#define YYPACT_NINF -8
+
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-8)))
+
+#define YYTABLE_NINF -1
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int8 yypact[] =
{
- 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
- 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
- 25
+ 0, 0, 0, 0, -8, 2, -7, -5, 8, 3,
+ 10, 1, -8, -8, -8, -8, 6, -8, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -5,
+ 8, 3, 10, 10, 1, 1, -8, -8, -8
};
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
{
- 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
- 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
- 3
+ 0, 0, 0, 0, 22, 0, 2, 3, 5, 7,
+ 9, 12, 15, 19, 20, 21, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 23, 4,
+ 6, 8, 10, 11, 13, 14, 16, 17, 18
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const unsigned char yydefact[] =
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
{
- 0, 0, 19, 0, 2, 3, 5, 7, 9, 12,
- 15, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 20, 4, 6, 8, 10, 11, 13,
- 14, 16, 17, 18
+ -8, -8, 12, 5, 11, 9, -2, 4, -1, -8
};
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yysigned_char yydefgoto[] =
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
{
- -1, 3, 4, 5, 6, 7, 8, 9, 10
+ -1, 5, 6, 7, 8, 9, 10, 11, 12, 13
};
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -14
-static const yysigned_char yypact[] =
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_uint8 yytable[] =
{
- -10, -10, -14, 18, 7, 6, 8, 2, 1, -4,
- -14, 3, -14, -10, -10, -10, -10, -10, -10, -10,
- -10, -10, -10, -14, 6, 8, 2, 1, 1, -4,
- -4, -14, -14, -14
+ 14, 15, 17, 1, 2, 18, 25, 26, 27, 19,
+ 3, 21, 22, 23, 24, 16, 4, 28, 18, 32,
+ 33, 20, 0, 29, 36, 37, 38, 34, 35, 31,
+ 30
};
-/* YYPGOTO[NTERM-NUM]. */
-static const yysigned_char yypgoto[] =
+static const yytype_int8 yycheck[] =
{
- -14, -14, 21, 10, 11, 9, 0, -6, -13
+ 1, 2, 0, 3, 4, 12, 5, 6, 7, 14,
+ 10, 8, 9, 3, 4, 3, 16, 11, 12, 21,
+ 22, 13, -1, 18, 25, 26, 27, 23, 24, 20,
+ 19
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
-static const unsigned char yytable[] =
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
{
- 1, 20, 21, 22, 18, 19, 2, 31, 32, 33,
- 16, 17, 29, 30, 23, 13, 27, 28, 12, 13,
- 14, 15, 11, 24, 26, 25
+ 0, 3, 4, 10, 16, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 25, 25, 19, 0, 12, 14,
+ 13, 8, 9, 3, 4, 5, 6, 7, 11, 20,
+ 21, 22, 23, 23, 24, 24, 25, 25, 25
};
-static const unsigned char yycheck[] =
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
{
- 10, 5, 6, 7, 3, 4, 16, 20, 21, 22,
- 8, 9, 18, 19, 11, 12, 16, 17, 0, 12,
- 14, 13, 1, 13, 15, 14
+ 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
+ 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
+ 25, 25, 26, 26
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned char yystos[] =
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
{
- 0, 10, 16, 18, 19, 20, 21, 22, 23, 24,
- 25, 19, 0, 12, 14, 13, 8, 9, 3, 4,
- 5, 6, 7, 11, 20, 21, 22, 23, 23, 24,
- 24, 25, 25, 25
+ 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
+ 2, 2, 1, 3
};
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
-#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up");\
- YYERROR; \
- } \
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (yyscanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
while (0)
-#define YYTERROR 1
-#define YYERRCODE 256
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- ((Current).first_line = (Rhs)[1].first_line, \
- (Current).first_column = (Rhs)[1].first_column, \
- (Current).last_line = (Rhs)[N].last_line, \
- (Current).last_column = (Rhs)[N].last_column)
-#endif
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -552,54 +642,85 @@ while (0)
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
} while (0)
-# define YYDSYMPRINT(Args) \
-do { \
- if (yydebug) \
- yysymprint Args; \
-} while (0)
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-# define YYDSYMPRINTF(Title, Token, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Token, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, yyscanner); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
} while (0)
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ YYUSE (yyscanner);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+{
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner);
+ YYFPRINTF (yyoutput, ")");
+}
+
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short int *bottom, short int *top)
-#else
static void
-yy_stack_print (bottom, top)
- short int *bottom;
- short int *top;
-#endif
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
- for (/* Nothing. */; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
} while (0)
@@ -607,29 +728,30 @@ do { \
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if defined (__STDC__) || defined (__cplusplus)
static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
- int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner)
{
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
int yyi;
- unsigned int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
- YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , yyscanner);
+ YYFPRINTF (stderr, "\n");
+ }
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (Rule); \
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
@@ -637,15 +759,14 @@ do { \
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -653,58 +774,40 @@ int yydebug;
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
-#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
+# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
{
- const char *yys = yystr;
-
- while (*yys++ != '\0')
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
continue;
-
- return yys - yystr - 1;
+ return yylen;
}
# endif
# endif
# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
-# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -717,91 +820,207 @@ yystpcpy (yydest, yysrc)
# endif
# endif
-#endif /* !YYERROR_VERBOSE */
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
-
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
-#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+ if (! yyres)
+ return yystrlen (yystr);
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
- if (yytype < YYNTOKENS)
+ switch (yycount)
{
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
}
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
- switch (yytype)
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
{
- default:
- break;
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
}
- YYFPRINTF (yyoutput, ")");
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
+#endif /* YYERROR_VERBOSE */
-#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
-#else
static void
-yydestruct (yytype, yyvaluep)
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner)
{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- switch (yytype)
- {
-
- default:
- break;
- }
+ YYUSE (yyvaluep);
+ YYUSE (yyscanner);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
@@ -810,90 +1029,76 @@ int yyparse ();
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int
-yyparse (void)
-#else
int
-yyparse ()
-
-#endif
-#endif
+yyparse (yyscan_t yyscanner)
{
- /* The lookahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
+/* The semantic value of the lookahead symbol. */
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ /* Number of syntax errors so far. */
+ int yynerrs;
- /* The state stack. */
- short int yyssa[YYINITDEPTH];
- short int *yyss = yyssa;
- short int *yyssp;
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
-#define YYPOPSTACK (yyvsp--, yyssp--)
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-
-
+ yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
/*------------------------------------------------------------.
@@ -901,8 +1106,7 @@ int yynerrs;
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
+ have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
@@ -915,49 +1119,46 @@ int yynerrs;
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short int *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
+ goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyoverflowlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- short int *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -965,16 +1166,18 @@ int yynerrs;
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -982,14 +1185,12 @@ int yynerrs;
`-----------*/
yybackup:
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
-
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -998,7 +1199,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex (&yylval, yyscanner);
}
if (yychar <= YYEOF)
@@ -1009,7 +1210,7 @@ yybackup:
else
{
yytoken = YYTRANSLATE (yychar);
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
@@ -1020,31 +1221,28 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
goto yynewstate;
@@ -1066,7 +1264,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1080,118 +1278,205 @@ yyreduce:
switch (yyn)
{
case 2:
-
+#line 70 "cmExprParser.y" /* yacc.c:1646 */
{
- yyGetParser->SetResult(yyvsp[0].Number);
-}
+ cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number));
+ }
+#line 1286 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 3:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 75 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1294 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 4:
-
- {yyval.Number = yyvsp[-2].Number | yyvsp[0].Number;}
+#line 78 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number);
+ }
+#line 1302 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 5:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 83 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1310 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 6:
-
- {yyval.Number = yyvsp[-2].Number ^ yyvsp[0].Number;}
+#line 86 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number);
+ }
+#line 1318 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 7:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 91 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1326 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 8:
-
- {yyval.Number = yyvsp[-2].Number & yyvsp[0].Number;}
+#line 94 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number);
+ }
+#line 1334 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 9:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 99 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1342 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 10:
-
- {yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
+#line 102 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number);
+ }
+#line 1350 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 11:
-
- {yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
+#line 105 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number);
+ }
+#line 1358 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 12:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 110 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1366 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 13:
-
- {yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
+#line 113 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number);
+ }
+#line 1374 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 14:
-
- {yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
+#line 116 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number);
+ }
+#line 1382 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 15:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 121 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1390 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 16:
-
- {yyval.Number = yyvsp[-2].Number * yyvsp[0].Number;}
+#line 124 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number);
+ }
+#line 1398 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 17:
-
- {yyval.Number = yyvsp[-2].Number / yyvsp[0].Number;}
+#line 127 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number);
+ }
+#line 1406 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 18:
-
- {yyval.Number = yyvsp[-2].Number % yyvsp[0].Number;}
+#line 130 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number);
+ }
+#line 1414 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 19:
-
- {yyval.Number = yyvsp[0].Number;}
+#line 135 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1422 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 20:
-
- {yyval.Number = yyvsp[-1].Number;}
+#line 138 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = + (yyvsp[0].Number);
+ }
+#line 1430 "cmExprParser.cxx" /* yacc.c:1646 */
break;
+ case 21:
+#line 141 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = - (yyvsp[0].Number);
+ }
+#line 1438 "cmExprParser.cxx" /* yacc.c:1646 */
+ break;
- }
-
-/* Line 1010 of yacc.c. */
+ case 22:
+#line 146 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1446 "cmExprParser.cxx" /* yacc.c:1646 */
+ break;
-
- yyvsp -= yylen;
- yyssp -= yylen;
+ case 23:
+#line 149 "cmExprParser.y" /* yacc.c:1646 */
+ {
+ (yyval.Number) = (yyvsp[-1].Number);
+ }
+#line 1454 "cmExprParser.cxx" /* yacc.c:1646 */
+ break;
+#line 1458 "cmExprParser.cxx" /* yacc.c:1646 */
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
-
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -1206,74 +1491,52 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
-#if YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- int yytype = YYTRANSLATE (yychar);
- const char* yyprefix;
- char *yymsg;
- int yyx;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 0;
-
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
- yycount += 1;
- if (yycount == 5)
- {
- yysize = 0;
- break;
- }
- }
- yysize += (sizeof ("syntax error, unexpected ")
- + yystrlen (yytname[yytype]));
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
+#if ! YYERROR_VERBOSE
+ yyerror (yyscanner, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
-
- if (yycount < 5)
- {
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
{
- yyp = yystpcpy (yyp, yyprefix);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yyprefix = " or ";
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
}
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
+ yyerror (yyscanner, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
- else
- yyerror ("syntax error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
+# undef YYSYNTAX_ERROR
+#endif
}
@@ -1281,31 +1544,23 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
{
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
- if (yychar == YYEOF)
- for (;;)
- {
- YYPOPSTACK;
- if (yyssp == yyss)
- YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp);
- }
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
}
else
- {
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval);
- yychar = YYEMPTY;
-
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, yyscanner);
+ yychar = YYEMPTY;
+ }
}
+#if 0
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -1316,15 +1571,17 @@ yyerrlab:
`---------------------------------------------------*/
yyerrorlab:
-#if defined( __GNUC__ ) || defined(__HP_aCC)
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
- if (0)
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
goto yyerrorlab;
-#endif
- yyvsp -= yylen;
- yyssp -= yylen;
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
@@ -1333,40 +1590,42 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+#endif
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp);
- YYPOPSTACK;
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, yyscanner);
+ YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
@@ -1386,33 +1645,52 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (yyscanner, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, yyscanner);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp, yyscanner);
+ YYPOPSTACK (1);
+ }
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
return yyresult;
}
-
-
-
+#line 154 "cmExprParser.y" /* yacc.c:1906 */
/* End of grammar */
/*--------------------------------------------------------------------------*/
-void cmExprError(yyscan_t yyscanner, const char* message)
+void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
- yyGetParser->Error(message);
+ cmExpr_yyget_extra(yyscanner)->Error(message);
}
-
diff --git a/Source/cmExprParser.y b/Source/cmExprParser.y
index a265c20..c7c4a7b 100644
--- a/Source/cmExprParser.y
+++ b/Source/cmExprParser.y
@@ -10,21 +10,12 @@ Run bison like this:
bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h -ocmExprParser.cxx cmExprParser.y
Modify cmExprParser.cxx:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - add __HP_aCC to the #if test for yyerrorlab warning suppression
+ - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
*/
-/* Configure the parser to use a lexer object. */
-#define YYPARSE_PARAM yyscanner
-#define YYLEX_PARAM yyscanner
-#define YYERROR_VERBOSE 1
-#define cmExpr_yyerror(x) \
- cmExprError(yyscanner, x)
-#define yyGetParser (cmExpr_yyget_extra(yyscanner))
-
/*-------------------------------------------------------------------------*/
+#define YYDEBUG 1
#include "cmExprParserHelper.h" /* Interface to parser object. */
#include "cmExprLexer.h" /* Interface to lexer object. */
#include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
@@ -34,13 +25,8 @@ Modify cmExprParser.cxx:
/* Forward declare the lexer entry point. */
YY_DECL;
-/* Internal utility functions. */
-static void cmExprError(yyscan_t yyscanner, const char* message);
-
-#define YYDEBUG 1
-//#define YYMAXDEPTH 100000
-//#define YYINITDEPTH 10000
-
+/* Helper function to forward error callback from parser. */
+static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef _MSC_VER
@@ -50,7 +36,13 @@ static void cmExprError(yyscan_t yyscanner, const char* message);
%}
/* Generate a reentrant parser object. */
-%pure_parser
+%define api.pure
+
+/* Configure the parser to use a lexer object. */
+%lex-param {yyscan_t yyscanner}
+%parse-param {yyscan_t yyscanner}
+
+%define parse.error verbose
/*-------------------------------------------------------------------------*/
/* Tokens */
@@ -74,82 +66,97 @@ static void cmExprError(yyscan_t yyscanner, const char* message);
%%
-Start:
-exp
-{
- yyGetParser->SetResult($<Number>1);
-}
+start:
+ exp {
+ cmExpr_yyget_extra(yyscanner)->SetResult($<Number>1);
+ }
exp:
-bitwiseor
-{$<Number>$ = $<Number>1;}
-|
-exp exp_OR bitwiseor
-{$<Number>$ = $<Number>1 | $<Number>3;}
+ bitwiseor {
+ $<Number>$ = $<Number>1;
+ }
+| exp exp_OR bitwiseor {
+ $<Number>$ = $<Number>1 | $<Number>3;
+ }
bitwiseor:
-bitwisexor
-{$<Number>$ = $<Number>1;}
-|
-bitwiseor exp_XOR bitwisexor
-{$<Number>$ = $<Number>1 ^ $<Number>3;}
+ bitwisexor {
+ $<Number>$ = $<Number>1;
+ }
+| bitwiseor exp_XOR bitwisexor {
+ $<Number>$ = $<Number>1 ^ $<Number>3;
+ }
bitwisexor:
-bitwiseand
-{$<Number>$ = $<Number>1;}
-|
-bitwisexor exp_AND bitwiseand
-{$<Number>$ = $<Number>1 & $<Number>3;}
+ bitwiseand {
+ $<Number>$ = $<Number>1;
+ }
+| bitwisexor exp_AND bitwiseand {
+ $<Number>$ = $<Number>1 & $<Number>3;
+ }
bitwiseand:
-shift
-{$<Number>$ = $<Number>1;}
-|
-bitwiseand exp_SHIFTLEFT shift
-{$<Number>$ = $<Number>1 << $<Number>3;}
-|
-bitwiseand exp_SHIFTRIGHT shift
-{$<Number>$ = $<Number>1 >> $<Number>3;}
-
+ shift {
+ $<Number>$ = $<Number>1;
+ }
+| bitwiseand exp_SHIFTLEFT shift {
+ $<Number>$ = $<Number>1 << $<Number>3;
+ }
+| bitwiseand exp_SHIFTRIGHT shift {
+ $<Number>$ = $<Number>1 >> $<Number>3;
+ }
shift:
-term
-{$<Number>$ = $<Number>1;}
-|
-shift exp_PLUS term
-{$<Number>$ = $<Number>1 + $<Number>3;}
-|
-shift exp_MINUS term
-{$<Number>$ = $<Number>1 - $<Number>3;}
+ term {
+ $<Number>$ = $<Number>1;
+ }
+| shift exp_PLUS term {
+ $<Number>$ = $<Number>1 + $<Number>3;
+ }
+| shift exp_MINUS term {
+ $<Number>$ = $<Number>1 - $<Number>3;
+ }
term:
-factor
-{$<Number>$ = $<Number>1;}
-|
-term exp_TIMES factor
-{$<Number>$ = $<Number>1 * $<Number>3;}
-|
-term exp_DIVIDE factor
-{$<Number>$ = $<Number>1 / $<Number>3;}
-|
-term exp_MOD factor
-{$<Number>$ = $<Number>1 % $<Number>3;}
+ unary {
+ $<Number>$ = $<Number>1;
+ }
+| term exp_TIMES unary {
+ $<Number>$ = $<Number>1 * $<Number>3;
+ }
+| term exp_DIVIDE unary {
+ $<Number>$ = $<Number>1 / $<Number>3;
+ }
+| term exp_MOD unary {
+ $<Number>$ = $<Number>1 % $<Number>3;
+ }
+
+unary:
+ factor {
+ $<Number>$ = $<Number>1;
+ }
+| exp_PLUS unary {
+ $<Number>$ = + $<Number>2;
+ }
+| exp_MINUS unary {
+ $<Number>$ = - $<Number>2;
+ }
factor:
-exp_NUMBER
-{$<Number>$ = $<Number>1;}
-|
-exp_OPENPARENT exp exp_CLOSEPARENT
-{$<Number>$ = $<Number>2;}
+ exp_NUMBER {
+ $<Number>$ = $<Number>1;
+ }
+| exp_OPENPARENT exp exp_CLOSEPARENT {
+ $<Number>$ = $<Number>2;
+ }
;
-
%%
/* End of grammar */
/*--------------------------------------------------------------------------*/
-void cmExprError(yyscan_t yyscanner, const char* message)
+void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
- yyGetParser->Error(message);
+ cmExpr_yyget_extra(yyscanner)->Error(message);
}
diff --git a/Source/cmExprParserTokens.h b/Source/cmExprParserTokens.h
index 0309c09..84b2bbd 100644
--- a/Source/cmExprParserTokens.h
+++ b/Source/cmExprParserTokens.h
@@ -1,12 +1,13 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
-/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
- 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Bison interface for Yacc-like parsers in C
- This program is free software; you can redistribute it and/or modify
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,37 +15,53 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
-/* Tokens. */
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+#ifndef YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
+# define YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int cmExpr_yydebug;
+#endif
+
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- exp_PLUS = 258,
- exp_MINUS = 259,
- exp_TIMES = 260,
- exp_DIVIDE = 261,
- exp_MOD = 262,
- exp_SHIFTLEFT = 263,
- exp_SHIFTRIGHT = 264,
- exp_OPENPARENT = 265,
- exp_CLOSEPARENT = 266,
- exp_OR = 267,
- exp_AND = 268,
- exp_XOR = 269,
- exp_NOT = 270,
- exp_NUMBER = 271
- };
+ enum yytokentype
+ {
+ exp_PLUS = 258,
+ exp_MINUS = 259,
+ exp_TIMES = 260,
+ exp_DIVIDE = 261,
+ exp_MOD = 262,
+ exp_SHIFTLEFT = 263,
+ exp_SHIFTRIGHT = 264,
+ exp_OPENPARENT = 265,
+ exp_CLOSEPARENT = 266,
+ exp_OR = 267,
+ exp_AND = 268,
+ exp_XOR = 269,
+ exp_NOT = 270,
+ exp_NUMBER = 271
+ };
#endif
+/* Tokens. */
#define exp_PLUS 258
#define exp_MINUS 259
#define exp_TIMES 260
@@ -60,17 +77,10 @@
#define exp_NOT 270
#define exp_NUMBER 271
+/* Value type. */
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-typedef int YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-
+int cmExpr_yyparse (yyscan_t yyscanner);
+#endif /* !YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED */
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 18c732d..41fc428 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -302,7 +302,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
ti != targets.end(); ti++) {
std::string targetName = (*ti)->GetName();
switch ((*ti)->GetType()) {
- case cmState::GLOBAL_TARGET: {
+ case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
@@ -311,7 +311,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
compiler.c_str(), makeArgs);
}
} break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if (((targetName.find("Nightly") == 0) &&
@@ -326,11 +326,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
compiler.c_str(), makeArgs);
break;
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
cmGeneratorTarget* gt = *ti;
this->AppendTarget(xml, targetName, gt, make.c_str(), *lg,
compiler.c_str(), makeArgs);
@@ -364,12 +364,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) {
switch ((*ti)->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY:
- case cmState::UTILITY: // can have sources since 2.6.3
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::UTILITY: // can have sources since 2.6.3
{
std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = *ti;
@@ -379,7 +379,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
si != sources.end(); si++) {
// don't add source files from UTILITY target which have the
// GENERATED property set:
- if (gt->GetType() == cmState::UTILITY &&
+ if (gt->GetType() == cmStateEnums::UTILITY &&
(*si)->GetPropertyAsBool("GENERATED")) {
continue;
}
@@ -519,7 +519,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
if (target != CM_NULLPTR) {
int cbTargetType = this->GetCBTargetType(target);
std::string workingDir = lg->GetCurrentBinaryDirectory();
- if (target->GetType() == cmState::EXECUTABLE) {
+ if (target->GetType() == cmStateEnums::EXECUTABLE) {
// Determine the directory where the executable target is created, and
// set the working directory to this dir.
const char* runtimeOutputDir =
@@ -537,7 +537,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::string location;
- if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
location =
this->CreateDummyTargetFile(const_cast<cmLocalGenerator*>(lg), target);
} else {
@@ -713,17 +713,17 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
{
switch (target->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) ||
(target->GetPropertyAsBool("MACOSX_BUNDLE"))) {
return 0;
}
return 1;
- case cmState::STATIC_LIBRARY:
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
return 2;
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return 3;
default:
return 4;
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 360c852..e79f763 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -127,7 +127,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
for (std::vector<cmGeneratorTarget*>::const_iterator lt =
(*lg)->GetGeneratorTargets().begin();
lt != (*lg)->GetGeneratorTargets().end(); lt++) {
- cmState::TargetType type = (*lt)->GetType();
+ cmStateEnums::TargetType type = (*lt)->GetType();
std::string outputDir = (*lg)->GetCurrentBinaryDirectory();
std::string filename = outputDir + "/" + (*lt)->GetName() + ".project";
retval.push_back((*lt)->GetName());
@@ -136,11 +136,11 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
this->WorkspacePath.c_str(), filename.c_str());
std::string visualname = (*lt)->GetName();
switch (type) {
- case cmState::SHARED_LIBRARY:
- case cmState::STATIC_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
visualname = "lib" + visualname;
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
xml->StartElement("Project");
xml->Attribute("Name", visualname);
xml->Attribute("Path", relafilename);
@@ -209,16 +209,16 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
std::string projectType;
switch (gt->GetType()) {
- case cmState::EXECUTABLE: {
+ case cmStateEnums::EXECUTABLE: {
projectType = "Executable";
} break;
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
projectType = "Static Library";
} break;
- case cmState::SHARED_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY: {
projectType = "Dynamic Library";
} break;
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::MODULE_LIBRARY: {
projectType = "Dynamic Library";
} break;
default: // intended fallthrough
@@ -226,10 +226,10 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
}
switch (gt->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY: {
std::vector<cmSourceFile*> sources;
gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
@@ -430,17 +430,19 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
xml.StartElement("General");
std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
- if (!outputPath.empty())
+ if (!outputPath.empty()) {
xml.Attribute("OutputFile", outputPath + "/$(ProjectName)");
- else
+ } else {
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
+ }
xml.Attribute("IntermediateDirectory", "./");
xml.Attribute("Command", "./$(ProjectName)");
xml.Attribute("CommandArguments", "");
- if (!outputPath.empty())
+ if (!outputPath.empty()) {
xml.Attribute("WorkingDirectory", outputPath);
- else
+ } else {
xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
+ }
xml.Attribute("PauseExecWhenProcTerminates", "yes");
xml.EndElement(); // General
@@ -511,9 +513,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
xml.StartElement("CodeLite_Project");
std::string visualname = gt->GetName();
switch (gt->GetType()) {
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
visualname = "lib" + visualname;
default: // intended fallthrough
break;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index e342f4c..c4e86a9 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -12,6 +12,7 @@
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -230,7 +231,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
- cacheEntryName.c_str(), cmState::STRING, true);
+ cacheEntryName.c_str(), cmStateEnums::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
} else if (!envVarSet && cacheValue != CM_NULLPTR) {
// It is already in the cache, but not in the env, so use it from the cache
@@ -245,7 +246,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
if (valueToUse.find(envVarValue) == std::string::npos) {
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
- cacheEntryName.c_str(), cmState::STRING, true);
+ cacheEntryName.c_str(), cmStateEnums::STRING,
+ true);
mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
}
}
@@ -482,13 +484,14 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
std::string linkName2 = linkName;
linkName2 += "/";
switch ((*ti)->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
const char* prefix =
- ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] ");
+ ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
+ : "[lib] ");
linkName2 += prefix;
linkName2 += (*ti)->GetName();
this->AppendLinkedResource(xml, linkName2, "virtual:/virtual",
@@ -912,14 +915,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
ti != targets.end(); ++ti) {
std::string targetName = (*ti)->GetName();
switch ((*ti)->GetType()) {
- case cmState::GLOBAL_TARGET: {
+ case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (subdir.empty()) {
this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": ");
}
} break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if (((targetName.find("Nightly") == 0) &&
@@ -933,13 +936,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": ");
break;
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
const char* prefix =
- ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] ");
+ ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
+ : "[lib] ");
this->AppendTarget(xml, targetName, make, makeArgs, subdir, prefix);
std::string fastTarget = targetName;
fastTarget += "/fast";
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index b78d09a..3730433 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include <ostream>
@@ -124,7 +124,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
ti != targets.end(); ++ti) {
std::string targetName = (*ti)->GetName();
switch ((*ti)->GetType()) {
- case cmState::GLOBAL_TARGET: {
+ case cmStateEnums::GLOBAL_TARGET: {
bool insertTarget = false;
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
@@ -147,7 +147,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
homeOutputDir);
}
} break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if (((targetName.find("Nightly") == 0) &&
@@ -162,11 +162,11 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
this->AppendTarget(fout, targetName, make, makeArgs, currentDir,
homeOutputDir);
break;
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
this->AppendTarget(fout, targetName, make, makeArgs, currentDir,
homeOutputDir);
std::string fastTarget = targetName;
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 5ae969b..f46019e 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
@@ -55,10 +55,14 @@ cmExtraSublimeTextGenerator::GetFactory()
cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator()
: cmExternalMakefileProjectGenerator()
{
+ this->ExcludeBuildFolder = false;
}
void cmExtraSublimeTextGenerator::Generate()
{
+ this->ExcludeBuildFolder = this->GlobalGenerator->GlobalSettingIsOn(
+ "CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE");
+
// for each sub project in the project create a sublime text 2 project
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
@@ -84,6 +88,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
{
const cmMakefile* mf = lgs[0]->GetMakefile();
+
cmGeneratedFileStream fout(filename.c_str());
if (!fout) {
return;
@@ -102,8 +107,10 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
if ((!outputRelativeToSourceRoot.empty()) &&
((outputRelativeToSourceRoot.length() < 3) ||
(outputRelativeToSourceRoot.substr(0, 3) != "../"))) {
- fout << ",\n\t\t\t\"folder_exclude_patterns\": [\""
- << outputRelativeToSourceRoot << "\"]";
+ if (this->ExcludeBuildFolder) {
+ fout << ",\n\t\t\t\"folder_exclude_patterns\": [\""
+ << outputRelativeToSourceRoot << "\"]";
+ }
}
} else {
fout << "\t{\n\t\t\t\"path\": \"./\"";
@@ -149,7 +156,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
ti != targets.end(); ti++) {
std::string targetName = (*ti)->GetName();
switch ((*ti)->GetType()) {
- case cmState::GLOBAL_TARGET: {
+ case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
@@ -159,7 +166,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
false);
}
} break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if (((targetName.find("Nightly") == 0) &&
@@ -175,11 +182,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
makefile, compiler.c_str(), sourceFileFlags,
false);
break;
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
this->AppendTarget(fout, targetName, *lg, *ti, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
@@ -264,7 +271,9 @@ void cmExtraSublimeTextGenerator::AppendTarget(
<< this->BuildMakeCommand(make, makefileName.c_str(), targetName)
<< "],\n";
fout << "\t\t\t\"working_dir\": \"${project_path}\",\n";
- fout << "\t\t\t\"file_regex\": \"^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$\"\n";
+ fout << "\t\t\t\"file_regex\": \""
+ "^(..[^:]*)(?::|\\\\()([0-9]+)(?::|\\\\))(?:([0-9]+):)?\\\\s*(.*)"
+ "\"\n";
fout << "\t\t}";
}
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index c917992..0c58221 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -64,6 +64,8 @@ private:
std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
cmGeneratorTarget* gtgt);
+
+ bool ExcludeBuildFolder;
};
#endif
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 5f621f1..1f0ce8d 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -2,7 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFLTKWrapUICommand.h"
+#include <stddef.h>
+
+#include "cmCustomCommandLines.h"
+#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+class cmTarget;
// cmFLTKWrapUICommand
bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 202067f..835f0a7 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -3,8 +3,15 @@
#ifndef cmFLTKWrapUICommand_h
#define cmFLTKWrapUICommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+class cmSourceFile;
+
/** \class cmFLTKWrapUICommand
* \brief Create .h and .cxx files rules for FLTK user interfaces files
*
@@ -14,8 +21,6 @@
class cmFLTKWrapUICommand : public cmCommand
{
public:
- cmTypeMacro(cmFLTKWrapUICommand, cmCommand);
-
/**
* This is a virtual constructor for the command.
*/
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index a71ff71..6b5870b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -115,41 +115,59 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
}
if (subCommand == "STRINGS") {
return this->HandleStringsCommand(args);
- } else if (subCommand == "GLOB") {
+ }
+ if (subCommand == "GLOB") {
return this->HandleGlobCommand(args, false);
- } else if (subCommand == "GLOB_RECURSE") {
+ }
+ if (subCommand == "GLOB_RECURSE") {
return this->HandleGlobCommand(args, true);
- } else if (subCommand == "MAKE_DIRECTORY") {
+ }
+ if (subCommand == "MAKE_DIRECTORY") {
return this->HandleMakeDirectoryCommand(args);
- } else if (subCommand == "RENAME") {
+ }
+ if (subCommand == "RENAME") {
return this->HandleRename(args);
- } else if (subCommand == "REMOVE") {
+ }
+ if (subCommand == "REMOVE") {
return this->HandleRemove(args, false);
- } else if (subCommand == "REMOVE_RECURSE") {
+ }
+ if (subCommand == "REMOVE_RECURSE") {
return this->HandleRemove(args, true);
- } else if (subCommand == "COPY") {
+ }
+ if (subCommand == "COPY") {
return this->HandleCopyCommand(args);
- } else if (subCommand == "INSTALL") {
+ }
+ if (subCommand == "INSTALL") {
return this->HandleInstallCommand(args);
- } else if (subCommand == "DIFFERENT") {
+ }
+ if (subCommand == "DIFFERENT") {
return this->HandleDifferentCommand(args);
- } else if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
+ }
+ if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
return this->HandleRPathChangeCommand(args);
- } else if (subCommand == "RPATH_CHECK") {
+ }
+ if (subCommand == "RPATH_CHECK") {
return this->HandleRPathCheckCommand(args);
- } else if (subCommand == "RPATH_REMOVE") {
+ }
+ if (subCommand == "RPATH_REMOVE") {
return this->HandleRPathRemoveCommand(args);
- } else if (subCommand == "RELATIVE_PATH") {
+ }
+ if (subCommand == "RELATIVE_PATH") {
return this->HandleRelativePathCommand(args);
- } else if (subCommand == "TO_CMAKE_PATH") {
+ }
+ if (subCommand == "TO_CMAKE_PATH") {
return this->HandleCMakePathCommand(args, false);
- } else if (subCommand == "TO_NATIVE_PATH") {
+ }
+ if (subCommand == "TO_NATIVE_PATH") {
return this->HandleCMakePathCommand(args, true);
- } else if (subCommand == "TIMESTAMP") {
+ }
+ if (subCommand == "TIMESTAMP") {
return this->HandleTimestampCommand(args);
- } else if (subCommand == "GENERATE") {
+ }
+ if (subCommand == "GENERATE") {
return this->HandleGenerateCommand(args);
- } else if (subCommand == "LOCK") {
+ }
+ if (subCommand == "LOCK") {
return this->HandleLockCommand(args);
}
@@ -2431,18 +2449,14 @@ public:
{
}
- ~cURLEasyGuard(void)
+ ~cURLEasyGuard()
{
if (this->Easy) {
::curl_easy_cleanup(this->Easy);
}
}
- inline void release(void)
- {
- this->Easy = CM_NULLPTR;
- return;
- }
+ void release() { this->Easy = CM_NULLPTR; }
private:
::CURL* Easy;
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 1d21a19..b53bae8 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -36,8 +36,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "file"; }
- cmTypeMacro(cmFileCommand, cmCommand);
-
protected:
bool HandleRename(std::vector<std::string> const& args);
bool HandleRemove(std::vector<std::string> const& args, bool recurse);
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index 41ec8b4..b55341b 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -36,7 +36,7 @@ public:
class cmVirtualDirectoryWatcher : public cmIBaseWatcher
{
public:
- ~cmVirtualDirectoryWatcher()
+ ~cmVirtualDirectoryWatcher() override
{
for (auto i : this->Children) {
delete i.second;
@@ -156,7 +156,7 @@ public:
p->AddChildWatcher(ps, this);
}
- ~cmRealDirectoryWatcher()
+ ~cmRealDirectoryWatcher() override
{
// Handle is freed via uv_handle_close callback!
}
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index a6c9cd0..55d8c2a 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -7,14 +7,7 @@
#include <time.h>
#include <utility>
-// Use a hash table to avoid duplicate file time checks from disk.
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-#include <unordered_map>
-#else
-#include <cmsys/hash_map.hxx>
-#endif
-#endif
+#include "cm_unordered_map.hxx"
// Use a platform-specific API to get file times efficiently.
#if !defined(_WIN32) || defined(__CYGWIN__)
@@ -35,27 +28,9 @@ public:
bool FileTimesDiffer(const char* f1, const char* f2);
private:
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Use a hash table to efficiently map from file name to modification time.
- class HashString
- {
- public:
- size_t operator()(const std::string& s) const { return h(s.c_str()); }
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- std::hash<const char*> h;
-#else
- cmsys::hash<const char*> h;
-#endif
- };
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- typedef std::unordered_map<std::string,
-#else
- typedef cmsys::hash_map<std::string,
-#endif
- cmFileTimeComparison_Type, HashString>
+ typedef CM_UNORDERED_MAP<std::string, cmFileTimeComparison_Type>
FileStatsMap;
FileStatsMap Files;
-#endif
// Internal methods to lookup and compare modification times.
inline bool Stat(const char* fname, cmFileTimeComparison_Type* st);
@@ -68,7 +43,6 @@ private:
bool cmFileTimeComparisonInternal::Stat(const char* fname,
cmFileTimeComparison_Type* st)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
// Use the stored time if available.
cmFileTimeComparisonInternal::FileStatsMap::iterator fit =
this->Files.find(fname);
@@ -76,7 +50,6 @@ bool cmFileTimeComparisonInternal::Stat(const char* fname,
*st = fit->second;
return true;
}
-#endif
#if !defined(_WIN32) || defined(__CYGWIN__)
// POSIX version. Use the stat function.
@@ -97,11 +70,8 @@ bool cmFileTimeComparisonInternal::Stat(const char* fname,
*st = fdata.ftLastWriteTime;
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
// Store the time for future use.
this->Files[fname] = *st;
-#endif
-
return true;
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 982d740..118c581 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -4,6 +4,8 @@
#include "cmAlgorithms.h"
#include "cmState.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
cmFindBase::cmFindBase()
{
@@ -300,7 +302,7 @@ bool cmFindBase::CheckForVariableInCache()
cmState* state = this->Makefile->GetState();
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
- bool cached = cacheEntry ? true : false;
+ bool cached = cacheEntry != CM_NULLPTR;
if (found) {
// If the user specifies the entry on the command line without a
// type we should add the type and docstring but keep the
@@ -308,7 +310,7 @@ bool cmFindBase::CheckForVariableInCache()
// this.
if (cached &&
state->GetCacheEntryType(this->VariableName) ==
- cmState::UNINITIALIZED) {
+ cmStateEnums::UNINITIALIZED) {
this->AlreadyInCacheWithoutMetaInfo = true;
}
return true;
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 8561f5d..2b8d4a2 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -20,7 +20,6 @@ public:
* the CMakeLists.txt file.
*/
virtual bool ParseArguments(std::vector<std::string> const& args);
- cmTypeMacro(cmFindBase, cmFindCommon);
protected:
void PrintFindStuff();
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index bd5298d..bc175ff 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindCommon.h"
+#include "cmSystemTools.h"
+
#include <algorithm>
#include <functional>
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 3211bc2..1809c0a 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -19,7 +19,6 @@ class cmFindCommon : public cmCommand
public:
cmFindCommon();
~cmFindCommon() CM_OVERRIDE;
- cmTypeMacro(cmFindCommon, cmCommand);
protected:
friend class cmSearchPath;
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index feb6ad2..e121784 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -22,8 +22,6 @@ public:
*/
cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; }
std::string GetName() const CM_OVERRIDE { return "find_file"; }
-
- cmTypeMacro(cmFindFileCommand, cmFindPathCommand);
};
#endif
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 082350f..56be0cb 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindLibraryCommand.h"
+#include "cmGlobalGenerator.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmVersion.h"
+
#include <cmsys/Directory.hxx>
cmFindLibraryCommand::cmFindLibraryCommand()
@@ -26,7 +31,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
if (this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->AddCacheDefinition(this->VariableName, "",
this->VariableDocumentation.c_str(),
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
}
return true;
}
@@ -52,13 +57,13 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
// Save the value in the cache
this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(),
this->VariableDocumentation.c_str(),
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
return true;
}
std::string notfound = this->VariableName + "-NOTFOUND";
this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(),
this->VariableDocumentation.c_str(),
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
return true;
}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 39393f6..8531e51 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -38,8 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "find_library"; }
- cmTypeMacro(cmFindLibraryCommand, cmFindBase);
-
protected:
void AddArchitecturePaths(const char* suffix);
void AddArchitecturePath(std::string const& dir,
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 554618e..373b728 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -3,9 +3,13 @@
#include "cmFindPackageCommand.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
+#include "cmVersion.h"
+
#include <cmSystemTools.h>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
+#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -669,8 +673,8 @@ bool cmFindPackageCommand::HandlePackageMode()
bool configFileSetFOUNDFalse = false;
if (fileFound) {
- if ((this->Makefile->IsDefinitionSet(foundVar)) &&
- (this->Makefile->IsOn(foundVar) == false)) {
+ if (this->Makefile->IsDefinitionSet(foundVar) &&
+ !this->Makefile->IsOn(foundVar)) {
// by removing Foo_FOUND here if it is FALSE, we don't really change
// the situation for the Config file which is about to be included,
// but we make it possible to detect later on whether the Config file
@@ -689,8 +693,8 @@ bool cmFindPackageCommand::HandlePackageMode()
found = true;
// Check whether the Config file has set Foo_FOUND to FALSE:
- if ((this->Makefile->IsDefinitionSet(foundVar)) &&
- (this->Makefile->IsOn(foundVar) == false)) {
+ if (this->Makefile->IsDefinitionSet(foundVar) &&
+ !this->Makefile->IsOn(foundVar)) {
// we get here if the Config file has set Foo_FOUND actively to FALSE
found = false;
configFileSetFOUNDFalse = true;
@@ -890,7 +894,7 @@ bool cmFindPackageCommand::FindConfig()
help += ".";
// We force the value since we do not get here if it was already set.
this->Makefile->AddCacheDefinition(this->Variable, init.c_str(),
- help.c_str(), cmState::PATH, true);
+ help.c_str(), cmStateEnums::PATH, true);
return found;
}
@@ -1412,8 +1416,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for foo-config-version.cmake
std::string version_file = version_file_base;
version_file += "-version.cmake";
- if ((haveResult == false) &&
- (cmSystemTools::FileExists(version_file.c_str(), true))) {
+ if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
@@ -1421,14 +1424,13 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for fooConfigVersion.cmake
version_file = version_file_base;
version_file += "Version.cmake";
- if ((haveResult == false) &&
- (cmSystemTools::FileExists(version_file.c_str(), true))) {
+ if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
// If no version was requested a versionless package is acceptable.
- if ((haveResult == false) && (this->Version.empty())) {
+ if (!haveResult && this->Version.empty()) {
result = true;
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 501a5a5..101749e 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -60,8 +60,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "find_package"; }
- cmTypeMacro(cmFindPackageCommand, cmFindCommon);
-
private:
class PathLabel : public cmFindCommon::PathLabel
{
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 35929fe..66dc5d7 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindPathCommand.h"
+#include "cmSystemTools.h"
+
#include <cmsys/Glob.hxx>
cmFindPathCommand::cmFindPathCommand()
@@ -26,7 +28,8 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn,
if (this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->AddCacheDefinition(
this->VariableName, "", this->VariableDocumentation.c_str(),
- (this->IncludeFileInPath ? cmState::FILEPATH : cmState::PATH));
+ (this->IncludeFileInPath ? cmStateEnums::FILEPATH
+ : cmStateEnums::PATH));
}
return true;
}
@@ -35,13 +38,13 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn,
if (!result.empty()) {
this->Makefile->AddCacheDefinition(
this->VariableName, result.c_str(), this->VariableDocumentation.c_str(),
- (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH);
+ (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
return true;
}
this->Makefile->AddCacheDefinition(
this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
this->VariableDocumentation.c_str(),
- (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH);
+ (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
return true;
}
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 58cc0f3..4ba67ed 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -38,7 +38,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "find_path"; }
- cmTypeMacro(cmFindPathCommand, cmFindBase);
bool IncludeFileInPath;
private:
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index a6f2518..d258c3c 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindProgramCommand.h"
+#include "cmSystemTools.h"
+
#include <stdlib.h>
#if defined(__APPLE__)
@@ -90,7 +92,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
if (this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->AddCacheDefinition(this->VariableName, "",
this->VariableDocumentation.c_str(),
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
}
return true;
}
@@ -100,13 +102,13 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
// Save the value in the cache
this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(),
this->VariableDocumentation.c_str(),
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
return true;
}
this->Makefile->AddCacheDefinition(
this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
- this->VariableDocumentation.c_str(), cmState::FILEPATH);
+ this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH);
return true;
}
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 2d88b79..4326124 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -39,8 +39,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "find_program"; }
- cmTypeMacro(cmFindProgramCommand, cmFindBase);
-
private:
std::string FindProgram();
std::string FindNormalProgram();
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 987741b..6fbc93d 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmForEachCommand.h"
+#include "cmSystemTools.h"
+
#include <cm_auto_ptr.hxx>
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 1e3d786..9ba4af0 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -51,8 +51,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "foreach"; }
- cmTypeMacro(cmForEachCommand, cmCommand);
-
private:
bool HandleInMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 99d883a..e9d4496 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFunctionCommand.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmake.h"
// define the class for function commands
@@ -14,12 +16,9 @@ public:
~cmFunctionHelperCommand() CM_OVERRIDE {}
/**
- * This is used to avoid including this command
- * in documentation. This is mainly used by
- * cmMacroHelperCommand and cmFunctionHelperCommand
- * which cannot provide appropriate documentation.
+ * This determines if the command is defined in a cmake script.
*/
- bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; }
+ bool IsUserDefined() const CM_OVERRIDE { return true; }
/**
* This is a virtual constructor for the command.
@@ -58,8 +57,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
- cmTypeMacro(cmFunctionHelperCommand, cmCommand);
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 277708b..7d868b2 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -46,8 +46,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "function"; }
-
- cmTypeMacro(cmFunctionCommand, cmCommand);
};
#endif
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 02717a4..6cdb7f5 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -10,13 +10,21 @@
#include <cm_zlib.h>
#endif
-cmGeneratedFileStream::cmGeneratedFileStream()
+cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
: cmGeneratedFileStreamBase()
, Stream()
{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ if (encoding != codecvt::None) {
+ imbue(std::locale(getloc(), new codecvt(encoding)));
+ }
+#else
+ static_cast<void>(encoding);
+#endif
}
-cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet)
+cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet,
+ Encoding encoding)
: cmGeneratedFileStreamBase(name)
, Stream(TempName.c_str())
{
@@ -26,6 +34,13 @@ cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet)
this->TempName.c_str());
cmSystemTools::ReportLastSystemError("");
}
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ if (encoding != codecvt::None) {
+ imbue(std::locale(getloc(), new codecvt(encoding)));
+ }
+#else
+ static_cast<void>(encoding);
+#endif
}
cmGeneratedFileStream::~cmGeneratedFileStream()
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 515954c..a027b01 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -5,6 +5,7 @@
#include <cmConfigure.h>
+#include <cm_codecvt.hxx>
#include <cmsys/FStream.hxx>
#include <string>
@@ -71,12 +72,13 @@ class cmGeneratedFileStream : private cmGeneratedFileStreamBase,
{
public:
typedef cmsys::ofstream Stream;
+ typedef codecvt::Encoding Encoding;
/**
* This constructor prepares a default stream. The open method must
* be used before writing to the stream.
*/
- cmGeneratedFileStream();
+ cmGeneratedFileStream(Encoding encoding = codecvt::None);
/**
* This constructor takes the name of the file to be generated. It
@@ -84,7 +86,8 @@ public:
* file cannot be opened an error message is produced unless the
* second argument is set to true.
*/
- cmGeneratedFileStream(const char* name, bool quiet = false);
+ cmGeneratedFileStream(const char* name, bool quiet = false,
+ Encoding encoding = codecvt::None);
/**
* The destructor checks the stream status to be sure the temporary
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index aff1ecd..c026631 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -53,8 +53,9 @@ void cmGeneratorExpressionDAGChecker::Initialize()
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
- if (CheckResult == DAG && (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
- TEST_TRANSITIVE_PROPERTY_METHOD) false))
+ if (CheckResult == DAG &&
+ (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
+ TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(clang-tidy)
#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
std::map<std::string, std::set<std::string> >::const_iterator it =
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f866605..3a41712 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -15,7 +15,7 @@
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_auto_ptr.hxx"
@@ -1035,7 +1035,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \
(#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) ||
if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(
- TRANSITIVE_PROPERTY_COMPARE) false) {
+ TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(clang-tidy)
reportError(
context, content->GetOriginalExpression(),
"$<TARGET_PROPERTY:...> expression in link libraries "
@@ -1052,7 +1052,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) dagCheckerParent->METHOD() ||
assert(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
- ASSERT_TRANSITIVE_PROPERTY_METHOD) false);
+ ASSERT_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(clang-tidy)
#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
}
}
@@ -1104,7 +1104,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (!prop) {
if (target->IsImported() ||
- target->GetType() == cmState::INTERFACE_LIBRARY) {
+ target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return linkedTargetsContent;
}
if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
@@ -1224,7 +1224,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
- if (gt->GetType() != cmState::OBJECT_LIBRARY) {
+ if (gt->GetType() != cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not an OBJECT library.";
@@ -1506,7 +1506,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
"for DLL target platforms.");
return std::string();
}
- if (target->GetType() != cmState::SHARED_LIBRARY) {
+ if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
::reportError(context, content->GetOriginalExpression(),
"TARGET_SONAME_FILE is allowed only for "
"SHARED libraries.");
@@ -1542,11 +1542,11 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
return std::string();
}
- cmState::TargetType targetType = target->GetType();
+ cmStateEnums::TargetType targetType = target->GetType();
- if (targetType != cmState::SHARED_LIBRARY &&
- targetType != cmState::MODULE_LIBRARY &&
- targetType != cmState::EXECUTABLE) {
+ if (targetType != cmStateEnums::SHARED_LIBRARY &&
+ targetType != cmStateEnums::MODULE_LIBRARY &&
+ targetType != cmStateEnums::EXECUTABLE) {
::reportError(context, content->GetOriginalExpression(),
"TARGET_PDB_FILE is allowed only for "
"targets with linker created artifacts.");
@@ -1646,8 +1646,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"No target \"" + name + "\"");
return std::string();
}
- if (target->GetType() >= cmState::OBJECT_LIBRARY &&
- target->GetType() != cmState::UNKNOWN_LIBRARY) {
+ if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
+ target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
::reportError(context, content->GetOriginalExpression(), "Target \"" +
name + "\" is not an executable or library.");
return std::string();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e8d66a2..ca056c0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -15,10 +15,13 @@
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
+#include "cmTargetPropertyComputer.h"
#include "cm_auto_ptr.hxx"
+#include "cm_unordered_set.hxx"
#include "cmake.h"
#include <algorithm>
@@ -32,15 +35,27 @@
#include <stdlib.h>
#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
-#define UNORDERED_SET std::set
-#endif
+template <>
+const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, cmMessenger* /* messenger */,
+ cmListFileBacktrace const& /* context */)
+{
+ return tgt->GetSourcesProperty();
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocationForBuild<
+ cmGeneratorTarget>(cmGeneratorTarget const* tgt)
+{
+ return tgt->GetLocation("");
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, const std::string& config)
+{
+ return tgt->GetLocation(config);
+}
class cmGeneratorTarget::TargetPropertyEntry
{
@@ -192,7 +207,7 @@ struct TagVisitor
, Target(target)
, GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator())
, Header(CM_HEADER_REGEX)
- , IsObjLib(target->GetType() == cmState::OBJECT_LIBRARY)
+ , IsObjLib(target->GetType() == cmStateEnums::OBJECT_LIBRARY)
{
}
@@ -207,7 +222,7 @@ struct TagVisitor
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
if (sf->GetCustomCommand()) {
DoAccept<IsSameTag<Tag, CustomCommandsTag>::Result>::Do(this->Data, sf);
- } else if (this->Target->GetType() == cmState::UTILITY) {
+ } else if (this->Target->GetType() == cmStateEnums::UTILITY) {
DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf);
} else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf);
@@ -320,12 +335,32 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->LinkInformation);
}
+const char* cmGeneratorTarget::GetSourcesProperty() const
+{
+ std::vector<std::string> values;
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry *>::const_iterator
+ it = this->SourceEntries.begin(),
+ end = this->SourceEntries.end();
+ it != end; ++it) {
+ values.push_back((*it)->ge->GetInput());
+ }
+ static std::string value;
+ value.clear();
+ value = cmJoin(values, "");
+ return value.c_str();
+}
+
+cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
+{
+ return this->GetLocalGenerator()->GetGlobalGenerator();
+}
+
cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
{
return this->LocalGenerator;
}
-cmState::TargetType cmGeneratorTarget::GetType() const
+cmStateEnums::TargetType cmGeneratorTarget::GetType() const
{
return this->Target->GetType();
}
@@ -354,13 +389,25 @@ std::string cmGeneratorTarget::GetExportName() const
const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
{
+ if (!cmTargetPropertyComputer::PassesWhitelist(
+ this->GetType(), prop, this->Makefile->GetMessenger(),
+ this->GetBacktrace())) {
+ return CM_NULLPTR;
+ }
+ if (const char* result = cmTargetPropertyComputer::GetProperty(
+ this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
+ return result;
+ }
+ if (cmSystemTools::GetFatalErrorOccured()) {
+ return CM_NULLPTR;
+ }
return this->Target->GetProperty(prop);
}
const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
{
switch (this->GetType()) {
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
if (this->IsDLLPlatform()) {
if (implib) {
// A DLL import library is treated as an archive target.
@@ -373,10 +420,10 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
// library targets.
return "LIBRARY";
}
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
// Static libraries are always treated as archive targets.
return "ARCHIVE";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (implib) {
// Module libraries are always treated as library targets.
return "ARCHIVE";
@@ -384,7 +431,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
// Module import libraries are treated as archive targets.
return "LIBRARY";
}
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if (implib) {
// Executable import libraries are treated as archive targets.
return "ARCHIVE";
@@ -790,7 +837,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
bool cmGeneratorTarget::IsSystemIncludeDirectory(
const std::string& dir, const std::string& config) const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
std::string config_upper;
if (!config.empty()) {
config_upper = cmSystemTools::UpperCase(config);
@@ -870,7 +917,7 @@ static void AddInterfaceEntries(
static bool processSources(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& srcs, UNORDERED_SET<std::string>& uniqueSrcs,
+ std::vector<std::string>& srcs, CM_UNORDERED_SET<std::string>& uniqueSrcs,
cmGeneratorExpressionDAGChecker* dagChecker, std::string const& config,
bool debugSources)
{
@@ -951,7 +998,7 @@ static bool processSources(
void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
const std::string& config) const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
// At configure-time, this method can be called as part of getting the
@@ -997,7 +1044,7 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
CM_NULLPTR, CM_NULLPTR);
- UNORDERED_SET<std::string> uniqueSrcs;
+ CM_UNORDERED_SET<std::string> uniqueSrcs;
bool contextDependentDirectSources =
processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker,
config, debugSources);
@@ -1096,7 +1143,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- return ((this->GetType() == cmState::SHARED_LIBRARY) &&
+ return ((this->GetType() == cmStateEnums::SHARED_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
}
@@ -1106,9 +1153,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
- if (this->GetType() != cmState::EXECUTABLE &&
- this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::EXECUTABLE &&
+ this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY) {
return false;
}
@@ -1180,9 +1227,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
{
// Only certain target types have an rpath.
- if (!(this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::EXECUTABLE)) {
+ if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::EXECUTABLE)) {
return false;
}
@@ -1237,7 +1284,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
const std::string& config) const
{
- if (this->IsImported() && this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (cmGeneratorTarget::ImportInfo const* info =
this->GetImportInfo(config)) {
return info->NoSOName;
@@ -1253,7 +1300,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
bool macosx_rpath = false;
if (!this->IsImported()) {
- if (this->GetType() != cmState::SHARED_LIBRARY) {
+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY) {
return false;
}
const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
@@ -1507,17 +1554,17 @@ const cmListFileBacktrace* cmGeneratorTarget::GetUtilityBacktrace(
bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
{
- return this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::EXECUTABLE;
+ return this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::EXECUTABLE;
}
const char* cmGeneratorTarget::GetExportMacro() const
{
// Define the symbol for targets that export symbols.
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->IsExecutableWithExports()) {
if (const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL")) {
this->ExportMacro = custom_export_name;
@@ -1536,7 +1583,7 @@ class cmTargetCollectLinkLanguages
public:
cmTargetCollectLinkLanguages(cmGeneratorTarget const* target,
const std::string& config,
- UNORDERED_SET<std::string>& languages,
+ CM_UNORDERED_SET<std::string>& languages,
cmGeneratorTarget const* head)
: Config(config)
, Languages(languages)
@@ -1603,7 +1650,7 @@ public:
private:
std::string Config;
- UNORDERED_SET<std::string>& Languages;
+ CM_UNORDERED_SET<std::string>& Languages;
cmGeneratorTarget const* HeadTarget;
const cmGeneratorTarget* Target;
std::set<cmGeneratorTarget const*> Visited;
@@ -1675,7 +1722,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
LinkClosure& lc) const
{
// Get languages built in this target.
- UNORDERED_SET<std::string> languages;
+ CM_UNORDERED_SET<std::string> languages;
cmLinkImplementation const* impl = this->GetLinkImplementation(config);
assert(impl);
for (std::vector<std::string>::const_iterator li = impl->Languages.begin();
@@ -1692,7 +1739,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Store the transitive closure of languages.
- for (UNORDERED_SET<std::string>::const_iterator li = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator li = languages.begin();
li != languages.end(); ++li) {
lc.Languages.push_back(*li);
}
@@ -1713,7 +1760,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Now consider languages that propagate from linked targets.
- for (UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
sit != languages.end(); ++sit) {
std::string propagates =
"CMAKE_" + *sit + "_LINKER_PREFERENCE_PROPAGATES";
@@ -1767,6 +1814,22 @@ std::string cmGeneratorTarget::GetMacContentDirectory(
return fpath;
}
+std::string cmGeneratorTarget::GetEffectiveFolderName() const
+{
+ std::string effectiveFolder;
+
+ if (!this->GlobalGenerator->UseFolderProperty()) {
+ return effectiveFolder;
+ }
+
+ const char* targetFolder = this->GetProperty("FOLDER");
+ if (targetFolder) {
+ effectiveFolder += targetFolder;
+ }
+
+ return effectiveFolder;
+}
+
cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
const std::string& config) const
{
@@ -1775,7 +1838,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
return CM_NULLPTR;
}
- if (this->GetType() > cmState::OBJECT_LIBRARY) {
+ if (this->GetType() > cmStateEnums::OBJECT_LIBRARY) {
std::string msg = "cmTarget::GetCompileInfo called for ";
msg += this->GetName();
msg += " which has type ";
@@ -1952,7 +2015,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
this->CurrentEntry = CM_NULLPTR;
// Queue all the source files already specified for the target.
- if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
if (configs.empty()) {
@@ -2087,8 +2150,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
// then make sure it was not a full path to something else, and
// the fact that the name matched a target was just a coincidence.
if (cmSystemTools::FileIsFullPath(dep.c_str())) {
- if (t->GetType() >= cmState::EXECUTABLE &&
- t->GetType() <= cmState::MODULE_LIBRARY) {
+ if (t->GetType() >= cmStateEnums::EXECUTABLE &&
+ t->GetType() <= cmStateEnums::MODULE_LIBRARY) {
// This is really only for compatibility so we do not need to
// worry about configuration names and output names.
std::string tLocation = t->GetLocationForBuild();
@@ -2128,7 +2191,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for a target with this name.
if (cmGeneratorTarget* t =
this->LocalGenerator->FindGeneratorTargetToUse(command)) {
- if (t->GetType() == cmState::EXECUTABLE) {
+ if (t->GetType() == cmStateEnums::EXECUTABLE) {
// The command refers to an executable target built in
// this project. Add the target-level dependency to make
// sure the executable is up to date before this custom
@@ -2202,7 +2265,7 @@ void cmGeneratorTarget::TraceDependencies()
// would find nothing anyway, but when building CMake itself the "install"
// target command ends up referencing the "cmake" target but we do not
// really want the dependency because "install" depend on "all" anyway.
- if (this->GetType() == cmState::GLOBAL_TARGET) {
+ if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
return;
}
@@ -2241,7 +2304,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
std::string const& lang, std::string const& config) const
{
switch (this->GetType()) {
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
std::string varIPO = var + "_IPO";
@@ -2251,11 +2314,11 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
}
return var;
}
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_MODULE";
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "CMAKE_" + lang + "_LINK_EXECUTABLE";
default:
break;
@@ -2266,7 +2329,7 @@ static void processIncludeDirectories(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
std::vector<std::string>& includes,
- UNORDERED_SET<std::string>& uniqueIncludes,
+ CM_UNORDERED_SET<std::string>& uniqueIncludes,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugIncludes, const std::string& language)
{
@@ -2379,7 +2442,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
const std::string& config, const std::string& lang) const
{
std::vector<std::string> includes;
- UNORDERED_SET<std::string> uniqueIncludes;
+ CM_UNORDERED_SET<std::string> uniqueIncludes;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
@@ -2456,7 +2519,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
static void processCompileOptionsInternal(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, const char* logName, std::string const& language)
{
@@ -2493,7 +2557,8 @@ static void processCompileOptionsInternal(
static void processCompileOptions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2506,7 +2571,7 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
@@ -2546,7 +2611,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
static void processCompileFeatures(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions)
{
@@ -2558,7 +2624,7 @@ static void processCompileFeatures(
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
const std::string& config) const
{
- UNORDERED_SET<std::string> uniqueFeatures;
+ CM_UNORDERED_SET<std::string> uniqueFeatures;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
@@ -2595,7 +2661,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
static void processCompileDefinitions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2608,7 +2675,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
std::vector<std::string>& list, const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
@@ -2682,11 +2749,11 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
std::string realName;
std::string impName;
std::string pdbName;
- if (this->GetType() == cmState::EXECUTABLE) {
+ if (this->GetType() == cmStateEnums::EXECUTABLE) {
this->GetExecutableNames(name, realName, impName, pdbName, config);
- } else if (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
} else {
return;
@@ -2772,7 +2839,7 @@ std::string cmGeneratorTarget::NormalGetRealName(
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
}
- if (this->GetType() == cmState::EXECUTABLE) {
+ if (this->GetType() == cmStateEnums::EXECUTABLE) {
// Compute the real name that will be built.
std::string name;
std::string realName;
@@ -2855,8 +2922,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
}
// The import library name.
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
impName = this->GetFullNameInternal(config, true);
} else {
impName = "";
@@ -2888,7 +2955,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
#else
// Check for executable version properties.
const char* version = this->GetProperty("VERSION");
- if (this->GetType() != cmState::EXECUTABLE ||
+ if (this->GetType() != cmStateEnums::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
version = CM_NULLPTR;
}
@@ -2957,10 +3024,10 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
std::string& outSuffix) const
{
// Use just the target name for non-main target types.
- if (this->GetType() != cmState::STATIC_LIBRARY &&
- this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY &&
- this->GetType() != cmState::EXECUTABLE) {
+ if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GetType() != cmStateEnums::EXECUTABLE) {
outPrefix = "";
outBase = this->GetName();
outSuffix = "";
@@ -2979,9 +3046,9 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
- if (this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY &&
- this->GetType() != cmState::EXECUTABLE) {
+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GetType() != cmStateEnums::EXECUTABLE) {
implib = false;
}
@@ -3059,7 +3126,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// Name shared libraries with their version number on some platforms.
if (const char* soversion = this->GetProperty("SOVERSION")) {
- if (this->GetType() == cmState::SHARED_LIBRARY && !implib &&
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY && !implib &&
this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) {
outBase += "-";
outBase += soversion;
@@ -3225,8 +3292,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0;
@@ -3235,8 +3302,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0;
@@ -3245,8 +3312,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0;
@@ -3255,8 +3322,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
@@ -3850,7 +3917,7 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
minor = 0;
patch = 0;
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
// Look for a VERSION or SOVERSION property.
const char* prop = soversion ? "SOVERSION" : "VERSION";
@@ -3922,7 +3989,7 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory(
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) {
return fversion;
@@ -3950,7 +4017,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
{
- cmPropertyMap propsObject = this->Target->GetProperties();
+ cmPropertyMap const& propsObject = this->Target->GetProperties();
std::vector<std::string> props;
props.reserve(propsObject.size());
for (cmPropertyMap::const_iterator it = propsObject.begin();
@@ -4038,7 +4105,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
// Link interfaces are not supported for executables that do not
// export symbols.
- if (this->GetType() == cmState::EXECUTABLE &&
+ if (this->GetType() == cmStateEnums::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return CM_NULLPTR;
}
@@ -4072,18 +4139,18 @@ void cmGeneratorTarget::ComputeLinkInterface(
cmGeneratorTarget const* headTarget) const
{
if (iface.ExplicitLibraries) {
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
- UNORDERED_SET<std::string> emitted;
+ CM_UNORDERED_SET<std::string> emitted;
for (std::vector<cmLinkItem>::const_iterator li =
iface.Libraries.begin();
li != iface.Libraries.end(); ++li) {
emitted.insert(*li);
}
- if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl = this->GetLinkImplementation(config);
for (std::vector<cmLinkImplItem>::const_iterator li =
impl->Libraries.begin();
@@ -4091,7 +4158,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
if (emitted.insert(*li).second) {
if (li->Target) {
// This is a runtime dependency on another shared library.
- if (li->Target->GetType() == cmState::SHARED_LIBRARY) {
+ if (li->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(*li);
}
} else {
@@ -4121,7 +4188,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
}
}
- if (this->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
// Construct the property name suffix for this configuration.
std::string suffix = "_";
if (!config.empty()) {
@@ -4154,7 +4221,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
// Link interfaces are not supported for executables that do not
// export symbols.
- if (this->GetType() == cmState::EXECUTABLE &&
+ if (this->GetType() == cmStateEnums::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return CM_NULLPTR;
}
@@ -4301,12 +4368,12 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (out != outdir) {
conf = "";
}
- } else if (this->GetType() == cmState::EXECUTABLE) {
+ } else if (this->GetType() == cmStateEnums::EXECUTABLE) {
// Lookup the output path for executables.
out = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
- } else if (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
// Lookup the output path for libraries.
out = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
}
@@ -4415,7 +4482,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
explicitLibraries = this->GetProperty(linkIfaceProp);
- } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+ } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
// shared lib or executable.
@@ -4460,8 +4527,9 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
- if (!explicitLibraries && (this->GetType() == cmState::EXECUTABLE ||
- (this->GetType() == cmState::MODULE_LIBRARY))) {
+ if (!explicitLibraries &&
+ (this->GetType() == cmStateEnums::EXECUTABLE ||
+ (this->GetType() == cmStateEnums::MODULE_LIBRARY))) {
return;
}
iface.Exists = true;
@@ -4590,7 +4658,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
i = this->ImportInfoMap.insert(entry).first;
}
- if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return &i->second;
}
// If the location is empty then the target is not available for
@@ -4625,7 +4693,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
std::string linkProp = "INTERFACE_LINK_LIBRARIES";
const char* propertyLibs = this->GetProperty(linkProp);
- if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (!propertyLibs) {
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
linkProp += suffix;
@@ -4642,7 +4710,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
info.Libraries = propertyLibs;
}
}
- if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
@@ -4663,7 +4731,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the soname.
- if (this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = "IMPORTED_SONAME";
soProp += suffix;
if (const char* config_soname = this->GetProperty(soProp)) {
@@ -4674,7 +4742,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the "no-soname" mark.
- if (this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = "IMPORTED_NO_SONAME";
soProp += suffix;
if (const char* config_no_soname = this->GetProperty(soProp)) {
@@ -4688,7 +4756,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
// Get the import library.
if (imp) {
info.ImportLibrary = imp;
- } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+ } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
@@ -4724,7 +4792,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the cyclic repetition count.
- if (this->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
linkProp += suffix;
if (const char* config_reps = this->GetProperty(linkProp)) {
@@ -4965,6 +5033,9 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
return false;
}
+ if (this->GetProperty("BUILD_RPATH")) {
+ return true;
+ }
if (cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config)) {
return !impl->Libraries.empty();
@@ -5117,12 +5188,12 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
- if (tgt && tgt->GetType() == cmState::EXECUTABLE &&
+ if (tgt && tgt->GetType() == cmStateEnums::EXECUTABLE &&
!tgt->IsExecutableWithExports()) {
tgt = CM_NULLPTR;
}
- if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
+ if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to "
"OBJECT library \""
@@ -5168,14 +5239,14 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
bool cmGeneratorTarget::IsExecutableWithExports() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->GetPropertyAsBool("ENABLE_EXPORTS"));
}
bool cmGeneratorTarget::HasImportLibrary() const
{
return (this->IsDLLPlatform() &&
- (this->GetType() == cmState::SHARED_LIBRARY ||
+ (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()));
}
@@ -5195,24 +5266,24 @@ std::string cmGeneratorTarget::GetSupportDirectory() const
bool cmGeneratorTarget::IsLinkable() const
{
- return (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::UNKNOWN_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY ||
+ return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::UNKNOWN_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
bool cmGeneratorTarget::IsFrameworkOnApple() const
{
- return (this->GetType() == cmState::SHARED_LIBRARY &&
+ return (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("FRAMEWORK"));
}
bool cmGeneratorTarget::IsAppBundleOnApple() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}
@@ -5224,6 +5295,6 @@ bool cmGeneratorTarget::IsXCTestOnApple() const
bool cmGeneratorTarget::IsCFBundleOnApple() const
{
- return (this->GetType() == cmState::MODULE_LIBRARY &&
+ return (this->GetType() == cmStateEnums::MODULE_LIBRARY &&
this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE"));
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 68ffd5c..3805bfc 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -8,7 +8,7 @@
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <map>
#include <set>
@@ -32,6 +32,8 @@ public:
cmLocalGenerator* GetLocalGenerator() const;
+ cmGlobalGenerator* GetGlobalGenerator() const;
+
bool IsImported() const;
bool IsImportedGloballyVisible() const;
const char* GetLocation(const std::string& config) const;
@@ -58,7 +60,7 @@ public:
cmComputeLinkInformation* GetLinkInformation(
const std::string& config) const;
- cmState::TargetType GetType() const;
+ cmStateEnums::TargetType GetType() const;
const std::string& GetName() const;
std::string GetExportName() const;
@@ -196,7 +198,7 @@ public:
bool LinkLanguagePropagatesToDependents() const
{
- return this->GetType() == cmState::STATIC_LIBRARY;
+ return this->GetType() == cmStateEnums::STATIC_LIBRARY;
}
/** Get the macro to define when building sources in this target.
@@ -220,6 +222,9 @@ public:
std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR,
bool implib = false) const;
+ /** @return folder prefix for IDEs. */
+ std::string GetEffectiveFolderName() const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
@@ -530,6 +535,8 @@ public:
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
+ const char* GetSourcesProperty() const;
+
private:
void AddSourceCommon(const std::string& src);
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 11373b7..01b41e8 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmGlobalGenerator.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmake.h"
// cmGetCMakePropertyCommand
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 644db33..30bc2d8 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -26,8 +26,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
-
- cmTypeMacro(cmGetCMakePropertyCommand, cmCommand);
};
#endif
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 8ebad4e..0670d31 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetDirectoryPropertyCommand.h"
+#include "cmGlobalGenerator.h"
+#include "cmSystemTools.h"
#include "cmake.h"
// cmGetDirectoryPropertyCommand
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index c6d9329..625adb0 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -27,8 +27,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
- cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand);
-
private:
void StoreResult(const std::string& variable, const char* prop);
};
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 05dbfb4..c183947 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -88,13 +88,13 @@ bool cmGetFilenameComponentCommand::InitialPass(
if (args.size() >= 4 && args[args.size() - 1] == "CACHE") {
if (!programArgs.empty() && !storeArgs.empty()) {
- this->Makefile->AddCacheDefinition(storeArgs, programArgs.c_str(), "",
- args[2] == "PATH" ? cmState::FILEPATH
- : cmState::STRING);
+ this->Makefile->AddCacheDefinition(
+ storeArgs, programArgs.c_str(), "",
+ args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
}
- this->Makefile->AddCacheDefinition(args[0], result.c_str(), "",
- args[2] == "PATH" ? cmState::FILEPATH
- : cmState::STRING);
+ this->Makefile->AddCacheDefinition(
+ args[0], result.c_str(), "",
+ args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
} else {
if (!programArgs.empty() && !storeArgs.empty()) {
this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index 32096d1..68bf31f 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -35,8 +35,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
-
- cmTypeMacro(cmGetFilenameComponentCommand, cmCommand);
};
#endif
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index ba03568..1852eab 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -6,6 +6,8 @@
#include "cmPropertyDefinition.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
+#include "cmTargetPropertyComputer.h"
#include "cmTest.h"
#include "cmake.h"
@@ -246,8 +248,18 @@ bool cmGetPropertyCommand::HandleTargetMode()
}
return this->StoreResult(CM_NULLPTR);
}
- return this->StoreResult(
- target->GetProperty(this->PropertyName, this->Makefile));
+ const char* prop_cstr = CM_NULLPTR;
+ cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+ cmMessenger* messenger = this->Makefile->GetMessenger();
+ if (cmTargetPropertyComputer::PassesWhitelist(
+ target->GetType(), this->PropertyName, messenger, bt)) {
+ prop_cstr =
+ target->GetComputedProperty(this->PropertyName, messenger, bt);
+ if (!prop_cstr) {
+ prop_cstr = target->GetProperty(this->PropertyName);
+ }
+ }
+ return this->StoreResult(prop_cstr);
}
std::ostringstream e;
e << "could not find TARGET " << this->Name
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index ee61416..20268b4 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -29,8 +29,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "get_property"; }
- cmTypeMacro(cmGetPropertyCommand, cmCommand);
-
private:
enum OutType
{
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 184b3ce..1edc392 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -24,8 +24,6 @@ public:
{
return "get_source_file_property";
}
-
- cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand);
};
#endif
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index fe09442..e78f780 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetTargetPropertyCommand.h"
+#include "cmTargetPropertyComputer.h"
+
// cmSetTargetPropertyCommand
bool cmGetTargetPropertyCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -22,7 +24,16 @@ bool cmGetTargetPropertyCommand::InitialPass(
prop_exists = true;
}
} else if (!args[2].empty()) {
- const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile);
+ const char* prop_cstr = CM_NULLPTR;
+ cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+ cmMessenger* messenger = this->Makefile->GetMessenger();
+ if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
+ messenger, bt)) {
+ prop_cstr = tgt->GetComputedProperty(args[2], messenger, bt);
+ if (!prop_cstr) {
+ prop_cstr = tgt->GetProperty(args[2]);
+ }
+ }
if (prop_cstr) {
prop = prop_cstr;
prop_exists = true;
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index f16dea7..f36cc48 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -21,8 +21,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_target_property"; }
-
- cmTypeMacro(cmGetTargetPropertyCommand, cmCommand);
};
#endif
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 527ee1a..5dc89bd 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -21,8 +21,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_test_property"; }
-
- cmTypeMacro(cmGetTestPropertyCommand, cmCommand);
};
#endif
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 959dfdb..ba623d5 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -5,6 +5,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGhsMultiGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
@@ -43,9 +44,7 @@ cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
std::string cmGhsMultiTargetGenerator::GetRelBuildFilePath(
const cmGeneratorTarget* target)
{
- std::string output;
- char const* folderProp = target->GetProperty("FOLDER");
- output = NULL == folderProp ? "" : folderProp;
+ std::string output = target->GetEffectiveFolderName();
cmSystemTools::ConvertToUnixSlashes(output);
if (!output.empty()) {
output += "/";
@@ -131,7 +130,7 @@ void cmGhsMultiTargetGenerator::Generate()
this->WriteCompilerFlags(config, language);
this->WriteCompilerDefinitions(config, language);
this->WriteIncludes(config, language);
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
this->WriteTargetLinkLibraries(config, language);
}
this->WriteCustomCommands();
@@ -175,7 +174,7 @@ GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(
GhsMultiGpj::Types output;
if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) {
output = GhsMultiGpj::INTERGRITY_APPLICATION;
- } else if (target->GetType() == cmState::STATIC_LIBRARY) {
+ } else if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
output = GhsMultiGpj::LIBRARY;
} else {
output = GhsMultiGpj::PROGRAM;
@@ -196,13 +195,13 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config,
std::string outputDir(this->GetOutputDirectory(config));
std::string outputFilename(this->GetOutputFilename(config));
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
std::string const static_library_suffix =
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
*this->GetFolderBuildStreams() << " -o \"" << outputDir
<< outputFilename << static_library_suffix
<< "\"" << std::endl;
- } else if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (notKernel && !this->IsTargetGroup()) {
*this->GetFolderBuildStreams() << " -relprog" << std::endl;
}
@@ -244,7 +243,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
flags, this->GeneratorTarget, lang);
// Append old-style preprocessor definition flags.
- if (std::string(" ") != std::string(this->Makefile->GetDefineFlags())) {
+ if (this->Makefile->GetDefineFlags() != " ") {
this->LocalGenerator->AppendFlags(flags,
this->Makefile->GetDefineFlags());
}
@@ -362,9 +361,15 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
this->GeneratorTarget->GetCreateRuleVariable(language, config);
bool useWatcomQuote =
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->GetGlobalGenerator()->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+
this->LocalGenerator->GetTargetFlags(
- config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
- this->GeneratorTarget, useWatcomQuote);
+ linkLineComputer.get(), config, linkLibraries, flags, linkFlags,
+ frameworkPath, linkPath, this->GeneratorTarget);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
if (!linkPath.empty()) {
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 5a2150d..a0a33ea 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmake.h"
cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 7132ade..cf51c6a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -20,13 +20,16 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmInstallGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
+#include "cmMSVC60LinkLineComputer.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmQtAutoGeneratorInitializer.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -266,12 +269,13 @@ bool cmGlobalGenerator::IsExportedTargetsFile(
}
// Find the make program for the generator, required for try compiles
-void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
if (this->FindMakeProgramFile.empty()) {
cmSystemTools::Error(
"Generator implementation error, "
"all generators must specify this->FindMakeProgramFile");
+ return false;
}
if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") ||
cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
@@ -289,7 +293,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
<< "probably need to select a different build tool.";
cmSystemTools::Error(err.str().c_str());
cmSystemTools::SetFatalErrorOccured();
- return;
+ return false;
}
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
// if there are spaces in the make program use short path
@@ -306,8 +310,9 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
makeProgram += "/";
makeProgram += saveFile;
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
- "make program", cmState::FILEPATH);
+ "make program", cmStateEnums::FILEPATH);
}
+ return true;
}
bool cmGlobalGenerator::CheckLanguages(
@@ -423,7 +428,9 @@ void cmGlobalGenerator::EnableLanguage(
mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR", rootBin.c_str());
// find and make sure CMAKE_MAKE_PROGRAM is defined
- this->FindMakeProgram(mf);
+ if (!this->FindMakeProgram(mf)) {
+ return;
+ }
if (!this->CheckLanguages(languages, mf)) {
return;
@@ -1060,7 +1067,7 @@ void cmGlobalGenerator::Configure()
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
- cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
this->CMakeInstance->GetHomeDirectory());
@@ -1101,7 +1108,7 @@ void cmGlobalGenerator::Configure()
sprintf(num, "%d", static_cast<int>(this->Makefiles.size()));
this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num,
"number of local generators",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
@@ -1369,14 +1376,14 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
filteredTargets.reserve(targets.size());
for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) {
- if ((*ti)->GetType() == cmState::GLOBAL_TARGET) {
+ if ((*ti)->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
- if ((*ti)->GetType() != cmState::EXECUTABLE &&
- (*ti)->GetType() != cmState::STATIC_LIBRARY &&
- (*ti)->GetType() != cmState::SHARED_LIBRARY &&
- (*ti)->GetType() != cmState::MODULE_LIBRARY &&
- (*ti)->GetType() != cmState::OBJECT_LIBRARY) {
+ if ((*ti)->GetType() != cmStateEnums::EXECUTABLE &&
+ (*ti)->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ (*ti)->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ (*ti)->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ (*ti)->GetType() != cmStateEnums::OBJECT_LIBRARY) {
continue;
}
if ((!(*ti)->GetPropertyAsBool("AUTOMOC") &&
@@ -1412,6 +1419,18 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
return autogenTargets;
}
+cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
+{
+ return new cmLinkLineComputer(outputConverter, stateDir);
+}
+
+cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
+{
+ return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
+}
+
void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
std::vector<std::string> const langs =
@@ -1429,13 +1448,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
cmTargets& targets = mf->GetTargets();
for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) {
cmTarget* t = &ti->second;
- if (t->GetType() == cmState::GLOBAL_TARGET) {
+ if (t->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
t->AppendBuildInterfaceIncludes();
- if (t->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
@@ -1561,7 +1580,7 @@ void cmGlobalGenerator::CheckTargetProperties()
this->Makefiles[i]->ConfigureFinalPass();
cmTargets& targets = this->Makefiles[i]->GetTargets();
for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) {
- if (l->second.GetType() == cmState::INTERFACE_LIBRARY) {
+ if (l->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
const cmTarget::LinkLibraryVectorType& libs =
@@ -1872,8 +1891,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen,
this->TryCompileOuterMakefile = mf;
const char* make =
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
- this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
- "make program", cmState::FILEPATH);
+ this->GetCMakeInstance()->AddCacheEntry(
+ "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH);
// copy the enabled languages
this->GetCMakeInstance()->GetState()->SetEnabledLanguages(
gen->GetCMakeInstance()->GetState()->GetEnabledLanguages());
@@ -1895,10 +1914,10 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
}
}
-bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
- cmState::Snapshot const& snp_) const
+bool cmGlobalGenerator::IsExcluded(cmStateSnapshot const& rootSnp,
+ cmStateSnapshot const& snp_) const
{
- cmState::Snapshot snp = snp_;
+ cmStateSnapshot snp = snp_;
while (snp.IsValid()) {
if (snp == rootSnp) {
// No directory excludes itself.
@@ -1919,8 +1938,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
{
assert(gen);
- cmState::Snapshot rootSnp = root->GetStateSnapshot();
- cmState::Snapshot snp = gen->GetStateSnapshot();
+ cmStateSnapshot rootSnp = root->GetStateSnapshot();
+ cmStateSnapshot snp = gen->GetStateSnapshot();
return this->IsExcluded(rootSnp, snp);
}
@@ -1928,7 +1947,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
cmGeneratorTarget* target) const
{
- if (target->GetType() == cmState::INTERFACE_LIBRARY ||
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
// This target is excluded from its directory.
return true;
@@ -1960,7 +1979,7 @@ void cmGlobalGenerator::FillProjectMap()
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i) {
// for each local generator add all projects
- cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
+ cmStateSnapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
std::string name;
do {
std::string snpProjName = snp.GetProjectName();
@@ -2363,7 +2382,7 @@ const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
return "CMakePredefinedTargets";
}
-bool cmGlobalGenerator::UseFolderProperty()
+bool cmGlobalGenerator::UseFolderProperty() const
{
const char* prop =
this->GetCMakeInstance()->GetState()->GetGlobalProperty("USE_FOLDERS");
@@ -2384,8 +2403,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
cmMakefile* mf)
{
// Package
- cmTarget target(gti.Name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal,
- mf);
+ cmTarget target(gti.Name, cmStateEnums::GLOBAL_TARGET,
+ cmTarget::VisibilityNormal, mf);
target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
std::vector<std::string> no_outputs;
@@ -2530,7 +2549,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
bool cmGlobalGenerator::IsRootOnlyTarget(cmGeneratorTarget* target) const
{
- return (target->GetType() == cmState::GLOBAL_TARGET ||
+ return (target->GetType() == cmStateEnums::GLOBAL_TARGET ||
target->GetName() == this->GetAllTargetName());
}
@@ -2715,7 +2734,7 @@ void cmGlobalGenerator::WriteSummary()
this->LocalGenerators[i]->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
it != tgts.end(); ++it) {
- if ((*it)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*it)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
this->WriteSummary(*it);
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index add2b92..4bf4bd1 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -6,10 +6,13 @@
#include <cmConfigure.h>
#include "cmExportSetMap.h"
-#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
+#include "cm_codecvt.hxx"
+#include "cm_unordered_map.hxx"
#include <iosfwd>
#include <map>
@@ -20,11 +23,6 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmFileLockPool.h"
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-#include <unordered_map>
-#else
-#include <cmsys/hash_map.hxx>
-#endif
#endif
class cmCustomCommandLines;
@@ -33,7 +31,9 @@ class cmExportBuildFileGenerator;
class cmExternalMakefileProjectGenerator;
class cmGeneratorTarget;
class cmLocalGenerator;
+class cmLinkLineComputer;
class cmMakefile;
+class cmOutputConverter;
class cmake;
/** \class cmGlobalGenerator
@@ -60,6 +60,12 @@ public:
return this->GetName() == name;
}
+ /** Get encoding used by generator for makefile files */
+ virtual codecvt::Encoding GetMakefileEncoding() const
+ {
+ return codecvt::None;
+ }
+
/** Tell the generator about the target system. */
virtual bool SetSystemName(std::string const&, cmMakefile*) { return true; }
@@ -98,6 +104,12 @@ public:
*/
virtual void Generate();
+ virtual cmLinkLineComputer* CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
+
+ cmLinkLineComputer* CreateMSVC60LinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
+
/**
* Set/Get and Clear the enabled languages.
*/
@@ -234,7 +246,7 @@ public:
/*
* Determine what program to use for building the project.
*/
- virtual void FindMakeProgram(cmMakefile*);
+ virtual bool FindMakeProgram(cmMakefile*);
///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const std::string& name,
@@ -319,6 +331,8 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() const { return false; }
+ virtual bool UseFolderProperty() const;
+
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
/** Generate an <output>.rule file path for a given command output. */
@@ -393,8 +407,8 @@ protected:
// has been populated.
void FillProjectMap();
void CheckTargetProperties();
- bool IsExcluded(cmState::Snapshot const& root,
- cmState::Snapshot const& snp) const;
+ bool IsExcluded(cmStateSnapshot const& root,
+ cmStateSnapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
virtual void InitializeProgressMarks() {}
@@ -448,25 +462,11 @@ protected:
std::string const& name) const;
const char* GetPredefinedTargetsFolder();
- virtual bool UseFolderProperty();
private:
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- typedef std::unordered_map<std::string, cmTarget*> TargetMap;
- typedef std::unordered_map<std::string, cmGeneratorTarget*>
- GeneratorTargetMap;
- typedef std::unordered_map<std::string, cmMakefile*> MakefileMap;
-#else
- typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
- typedef cmsys::hash_map<std::string, cmGeneratorTarget*> GeneratorTargetMap;
- typedef cmsys::hash_map<std::string, cmMakefile*> MakefileMap;
-#endif
-#else
- typedef std::map<std::string, cmTarget*> TargetMap;
- typedef std::map<std::string, cmGeneratorTarget*> GeneratorTargetMap;
- typedef std::map<std::string, cmMakefile*> MakefileMap;
-#endif
+ typedef CM_UNORDERED_MAP<std::string, cmTarget*> TargetMap;
+ typedef CM_UNORDERED_MAP<std::string, cmGeneratorTarget*> GeneratorTargetMap;
+ typedef CM_UNORDERED_MAP<std::string, cmMakefile*> MakefileMap;
// Map efficiently from target name to cmTarget instance.
// Do not use this structure for looping over all targets.
// It contains both normal and globally visible imported targets.
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 0eac338..6bbfed5 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -73,7 +73,7 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
}
-void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf)
{
// The GHS generator knows how to lookup its build tool
// directly instead of needing a helper module to do it, so we
@@ -82,6 +82,7 @@ void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf)
mf->AddDefinition("CMAKE_MAKE_PROGRAM",
this->GetGhsBuildCommand().c_str());
}
+ return true;
}
std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand()
@@ -439,11 +440,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
tgtsI != tgts.end(); ++tgtsI) {
const cmGeneratorTarget* tgt = *tgtsI;
if (IsTgtForBuild(tgt)) {
- char const* rawFolderName = tgt->GetProperty("FOLDER");
- if (NULL == rawFolderName) {
- rawFolderName = "";
- }
- std::string folderName(rawFolderName);
+ std::string folderName = tgt->GetEffectiveFolderName();
if (this->TargetFolderBuildStreams.end() ==
this->TargetFolderBuildStreams.find(folderName)) {
this->AddFilesUpToPath(
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 27a40ba..7b3eebb 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -57,7 +57,7 @@ public:
/*
* Determine what program to use for building the project.
*/
- virtual void FindMakeProgram(cmMakefile*);
+ bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
cmGeneratedFileStream* GetBuildFileStream()
{
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index a846773..78bf5bd 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmState.h"
cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 57d9aca..75209c3 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmXMLWriter.h"
@@ -74,7 +74,7 @@ void cmGlobalKdevelopGenerator::Generate()
for (std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin();
ti != targets.end(); ti++) {
- if ((*ti)->GetType() == cmState::EXECUTABLE) {
+ if ((*ti)->GetType() == cmStateEnums::EXECUTABLE) {
executable = (*ti)->GetLocation("");
break;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 6d314d6..f17b915 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmake.h"
#include <cmsys/FStream.hxx>
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index d5decfb..255c0f5 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmState.h"
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 48798fb..06aba73 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmState.h"
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index f169e76..6eb2124 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -26,6 +26,12 @@ public:
}
static std::string GetActualName() { return "NMake Makefiles"; }
+ /** Get encoding used by generator for makefile files */
+ codecvt::Encoding GetMakefileEncoding() const CM_OVERRIDE
+ {
+ return codecvt::ANSI;
+ }
+
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 5e6036d..ee594b0 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -11,8 +11,9 @@
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
+#include "cmNinjaLinkLineComputer.h"
#include "cmOutputConverter.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -64,6 +65,14 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
os << "# " << comment.substr(lpos) << "\n\n";
}
+cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory /* stateDir */) const
+{
+ return new cmNinjaLinkLineComputer(
+ outputConverter,
+ this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this);
+}
+
std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
{
// Ninja rule names must match "[a-zA-Z0-9_.-]+". Use ".xx" to encode
@@ -487,6 +496,18 @@ cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
return new cmLocalNinjaGenerator(this, mf);
}
+codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const
+{
+#ifdef _WIN32
+ // Ninja on Windows does not support non-ANSI characters.
+ // https://github.com/ninja-build/ninja/issues/1195
+ return codecvt::ANSI;
+#else
+ // No encoding conversion needed on other platforms.
+ return codecvt::None;
+#endif
+}
+
void cmGlobalNinjaGenerator::GetDocumentation(cmDocumentationEntry& entry)
{
entry.Name = cmGlobalNinjaGenerator::GetActualName();
@@ -544,20 +565,32 @@ void cmGlobalNinjaGenerator::Generate()
this->CloseBuildFileStream();
}
-void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
{
- this->cmGlobalGenerator::FindMakeProgram(mf);
+ if (!this->cmGlobalGenerator::FindMakeProgram(mf)) {
+ return false;
+ }
if (const char* ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM")) {
this->NinjaCommand = ninjaCommand;
std::vector<std::string> command;
command.push_back(this->NinjaCommand);
command.push_back("--version");
std::string version;
- cmSystemTools::RunSingleCommand(command, &version, CM_NULLPTR, CM_NULLPTR,
- CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
+ std::string error;
+ if (!cmSystemTools::RunSingleCommand(command, &version, &error, CM_NULLPTR,
+ CM_NULLPTR,
+ cmSystemTools::OUTPUT_NONE)) {
+ mf->IssueMessage(cmake::FATAL_ERROR, "Running\n '" +
+ cmJoin(command, "' '") + "'\n"
+ "failed with:\n " +
+ error);
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
this->NinjaVersion = cmSystemTools::TrimWhitespace(version);
this->CheckNinjaFeatures();
}
+ return true;
}
void cmGlobalNinjaGenerator::CheckNinjaFeatures()
@@ -745,7 +778,8 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream()
// Get a stream where to generate things.
if (!this->BuildFileStream) {
- this->BuildFileStream = new cmGeneratedFileStream(buildFilePath.c_str());
+ this->BuildFileStream = new cmGeneratedFileStream(
+ buildFilePath.c_str(), false, this->GetMakefileEncoding());
if (!this->BuildFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.
@@ -782,7 +816,8 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream()
// Get a stream where to generate things.
if (!this->RulesFileStream) {
- this->RulesFileStream = new cmGeneratedFileStream(rulesFilePath.c_str());
+ this->RulesFileStream = new cmGeneratedFileStream(
+ rulesFilePath.c_str(), false, this->GetMakefileEncoding());
if (!this->RulesFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.
@@ -830,7 +865,8 @@ static void EnsureTrailingSlash(std::string& path)
#endif
}
-std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
+std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(
+ const std::string& path) const
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
@@ -932,17 +968,17 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
bool realname = target->IsFrameworkOnApple();
switch (target->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::SHARED_LIBRARY:
- case cmState::STATIC_LIBRARY:
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY: {
outputs.push_back(this->ConvertToNinjaPath(
target->GetFullPath(configName, false, realname)));
break;
}
- case cmState::OBJECT_LIBRARY:
- case cmState::GLOBAL_TARGET:
- case cmState::UTILITY: {
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY: {
std::string path =
target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
std::string("/") + target->GetName();
@@ -958,7 +994,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
void cmGlobalNinjaGenerator::AppendTargetDepends(
cmGeneratorTarget const* target, cmNinjaDeps& outputs)
{
- if (target->GetType() == cmState::GLOBAL_TARGET) {
+ if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
// These depend only on other CMake-provided targets, e.g. "all".
std::set<std::string> const& utils = target->GetUtilities();
for (std::set<std::string>::const_iterator i = utils.begin();
@@ -973,7 +1009,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i) {
- if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
this->AppendTargetOutputs(*i, outs);
@@ -1010,7 +1046,7 @@ void cmGlobalNinjaGenerator::ComputeTargetDependsClosure(
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i) {
- if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
if (depends.insert(*i).second) {
@@ -1078,11 +1114,13 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
lg->GetGeneratorTargets().begin();
ti != lg->GetGeneratorTargets().end(); ++ti) {
cmGeneratorTarget const* gt = *ti;
- cmState::TargetType const type = gt->GetType();
- if ((type == cmState::EXECUTABLE || type == cmState::STATIC_LIBRARY ||
- type == cmState::SHARED_LIBRARY ||
- type == cmState::MODULE_LIBRARY ||
- type == cmState::OBJECT_LIBRARY || type == cmState::UTILITY) &&
+ cmStateEnums::TargetType const type = gt->GetType();
+ if ((type == cmStateEnums::EXECUTABLE ||
+ type == cmStateEnums::STATIC_LIBRARY ||
+ type == cmStateEnums::SHARED_LIBRARY ||
+ type == cmStateEnums::MODULE_LIBRARY ||
+ type == cmStateEnums::OBJECT_LIBRARY ||
+ type == cmStateEnums::UTILITY) &&
!gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
targetsPerFolder[currentBinaryFolder].push_back(gt->GetName());
}
@@ -1090,9 +1128,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- std::vector<cmState::Snapshot> const& children =
+ std::vector<cmStateSnapshot> const& children =
lg->GetStateSnapshot().GetChildren();
- for (std::vector<cmState::Snapshot>::const_iterator stateIt =
+ for (std::vector<cmStateSnapshot>::const_iterator stateIt =
children.begin();
stateIt != children.end(); ++stateIt) {
std::string const currentBinaryDir =
@@ -1409,7 +1447,8 @@ void cmGlobalNinjaGenerator::InitOutputPathPrefix()
EnsureTrailingSlash(this->OutputPathPrefix);
}
-std::string cmGlobalNinjaGenerator::NinjaOutputPath(std::string const& path)
+std::string cmGlobalNinjaGenerator::NinjaOutputPath(
+ std::string const& path) const
{
if (!this->HasOutputPathPrefix() || cmSystemTools::FileIsFullPath(path)) {
return path;
@@ -1642,8 +1681,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
{
// Setup path conversions.
{
- cmState::Snapshot snapshot =
- this->GetCMakeInstance()->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->GetCMakeInstance()->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(dir_cur_src);
snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
snapshot.GetDirectory().SetRelativePathTopSource(dir_top_src.c_str());
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 2ce3c80..81ec3eb 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -70,6 +70,10 @@ public:
std::string EncodePath(const std::string& path);
static std::string EncodeDepfileSpace(const std::string& path);
+ cmLinkLineComputer* CreateLinkLineComputer(
+ cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir) const CM_OVERRIDE;
+
/**
* Write the given @a comment to the output stream @a os. It
* handles new line character properly.
@@ -182,6 +186,9 @@ public:
static std::string GetActualName() { return "Ninja"; }
+ /** Get encoding used by generator for ninja files */
+ codecvt::Encoding GetMakefileEncoding() const CM_OVERRIDE;
+
static void GetDocumentation(cmDocumentationEntry& entry);
void EnableLanguage(std::vector<std::string> const& languages,
@@ -233,7 +240,7 @@ public:
return this->RulesFileStream;
}
- std::string ConvertToNinjaPath(const std::string& path);
+ std::string ConvertToNinjaPath(const std::string& path) const;
struct MapToNinjaPathImpl
{
@@ -332,7 +339,7 @@ public:
bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
- std::string NinjaOutputPath(std::string const& path);
+ std::string NinjaOutputPath(std::string const& path) const;
bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
@@ -352,7 +359,7 @@ protected:
private:
std::string GetEditCacheCommand() const CM_OVERRIDE;
- void FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
+ bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
void CheckNinjaFeatures();
bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const CM_OVERRIDE;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4a5cc77..17d49e8 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -12,6 +12,8 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -93,7 +95,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
if (!editCacheCommand.empty()) {
cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
"Path to cache edit program executable.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
}
const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
@@ -201,7 +203,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += cmake::GetCMakeFilesDirectory();
makefileName += "/Makefile2";
- cmGeneratedFileStream makefileStream(makefileName.c_str());
+ cmGeneratedFileStream makefileStream(makefileName.c_str(), false,
+ this->GetMakefileEncoding());
if (!makefileStream) {
return;
}
@@ -306,16 +309,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// reset lg to the first makefile
lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[0]);
- // Build the path to the cache file.
- std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
- cache += "/CMakeCache.txt";
-
std::string currentBinDir = lg->GetCurrentBinaryDirectory();
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n";
+ << " \"CMakeCache.txt\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i)
@@ -385,12 +384,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) {
- if (((*l)->GetType() == cmState::EXECUTABLE) ||
- ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
- ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
- ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
- ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
- ((*l)->GetType() == cmState::UTILITY)) {
+ if (((*l)->GetType() == cmStateEnums::EXECUTABLE) ||
+ ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::MODULE_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::UTILITY)) {
cmGeneratorTarget* gt = *l;
std::string tname = lg->GetRelativeTargetDirectory(gt);
tname += "/DependInfo.cmake";
@@ -419,10 +418,12 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
l != targets.end(); ++l) {
cmGeneratorTarget* gtarget = *l;
int type = gtarget->GetType();
- if ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY)) {
+ if ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY)) {
// Add this to the list of depends rules in this directory.
if ((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
@@ -437,9 +438,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- std::vector<cmState::Snapshot> children =
- lg->GetStateSnapshot().GetChildren();
- for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+ std::vector<cmStateSnapshot> children = lg->GetStateSnapshot().GetChildren();
+ for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
ci != children.end(); ++ci) {
std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/";
@@ -508,7 +508,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
if (!this->Makefiles.empty()) {
mf = this->Makefiles[0];
} else {
- cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
this->CMakeInstance->GetHomeDirectory());
snapshot.GetDirectory().SetCurrentBinary(
@@ -557,11 +557,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
if (!name.empty() && emitted.insert(name).second &&
// Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis.
- ((type == cmState::EXECUTABLE) ||
- (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+ ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY))) {
// Add a rule to build the target by name.
lg->WriteDivider(ruleFileStream);
ruleFileStream << "# Target rules for targets named " << name
@@ -633,11 +634,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
cmGeneratorTarget* gtarget = *t;
int type = gtarget->GetType();
std::string name = gtarget->GetName();
- if (!name.empty() &&
- ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+ if (!name.empty() && ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY))) {
std::string makefileName;
// Add a rule to build the target by name.
localName = lg->GetRelativeTargetDirectory(gtarget);
@@ -811,13 +813,13 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
cmLocalGenerator* tlg = gt->GetLocalGenerator();
- if (gt->GetType() == cmState::INTERFACE_LIBRARY ||
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
continue;
}
- cmState::Snapshot csnp = lg->GetStateSnapshot();
- cmState::Snapshot tsnp = tlg->GetStateSnapshot();
+ cmStateSnapshot csnp = lg->GetStateSnapshot();
+ cmStateSnapshot tsnp = tlg->GetStateSnapshot();
// Consider the directory containing the target and all its
// parents until something excludes the target.
@@ -850,7 +852,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget(
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
for (TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) {
- if ((*di)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*di)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
count += this->CountProgressMarksInTarget(*di, emitted);
@@ -911,7 +913,7 @@ void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends(
i != depends_set.end(); ++i) {
// Create the target-level dependency.
cmGeneratorTarget const* dep = *i;
- if (dep->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (dep->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
cmLocalUnixMakefileGenerator3* lg3 =
@@ -953,13 +955,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
cmGeneratorTarget* target = *t;
- cmState::TargetType type = target->GetType();
- if ((type == cmState::EXECUTABLE) ||
- (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) ||
- (type == cmState::GLOBAL_TARGET) || (type == cmState::UTILITY)) {
+ cmStateEnums::TargetType type = target->GetType();
+ if ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::GLOBAL_TARGET) ||
+ (type == cmStateEnums::UTILITY)) {
std::string name = target->GetName();
if (emittedTargets.insert(name).second) {
path = "... ";
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 1019d86..843e5dc 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -8,7 +8,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
#include "cmGlobalGeneratorFactory.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <iosfwd>
#include <map>
@@ -248,8 +248,8 @@ private:
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>
+ std::map<cmStateSnapshot, std::set<cmGeneratorTarget const*>,
+ cmStateSnapshot::StrictWeakOrder>
DirectoryTargetsMap;
void InitializeProgressMarks() CM_OVERRIDE;
};
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index caaac87..7af971e 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -145,10 +145,36 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
return false;
}
- this->GeneratorToolset = ts;
+ if (!this->ParseGeneratorToolset(ts, mf)) {
+ return false;
+ }
if (const char* toolset = this->GetPlatformToolset()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset);
}
+ if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) {
+ mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch);
+ }
+ return true;
+}
+
+bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
+ std::string const& ts, cmMakefile* mf)
+{
+ if (ts.find_first_of(",=") != ts.npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not recognize the toolset\n"
+ " " << ts << "\n"
+ "that was specified.";
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+
+ this->GeneratorToolset = ts;
return true;
}
@@ -322,11 +348,23 @@ const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
return 0;
}
-void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
+const char*
+cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const
+{
+ if (!this->GeneratorToolsetHostArchitecture.empty()) {
+ return this->GeneratorToolsetHostArchitecture.c_str();
+ }
+ return CM_NULLPTR;
+}
+
+bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
{
- this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
+ if (!this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf)) {
+ return false;
+ }
mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
this->GetMSBuildCommand().c_str());
+ return true;
}
std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 19c60aa..62b8661 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -22,6 +22,7 @@ public:
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
+ virtual bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string& makeProgram,
@@ -48,6 +49,9 @@ public:
/** The toolset name for the target platform. */
const char* GetPlatformToolset() const;
+ /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */
+ const char* GetPlatformToolsetHostArchitecture() const;
+
/** Return the CMAKE_SYSTEM_NAME. */
std::string const& GetSystemName() const { return this->SystemName; }
@@ -80,7 +84,7 @@ public:
virtual const char* GetToolsVersion() { return "4.0"; }
- virtual void FindMakeProgram(cmMakefile*);
+ bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
static std::string GetInstalledNsightTegraVersion();
@@ -101,6 +105,7 @@ protected:
std::string const& GetMSBuildCommand();
std::string GeneratorToolset;
+ std::string GeneratorToolsetHostArchitecture;
std::string DefaultPlatformToolset;
std::string WindowsTargetPlatformVersion;
std::string SystemName;
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 5d9a02b..f120762 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -230,9 +230,10 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs()
}
bool cmGlobalVisualStudio11Generator::NeedsDeploy(
- cmState::TargetType type) const
+ cmStateEnums::TargetType type) const
{
- if ((type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY) &&
+ if ((type == cmStateEnums::EXECUTABLE ||
+ type == cmStateEnums::SHARED_LIBRARY) &&
(this->SystemIsWindowsPhone || this->SystemIsWindowsStore)) {
return true;
}
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index 0c03b0a..be78544 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -37,7 +37,7 @@ protected:
static std::set<std::string> GetInstalledWindowsCESDKs();
/** Return true if the configuration needs to be deployed */
- virtual bool NeedsDeploy(cmState::TargetType type) const;
+ virtual bool NeedsDeploy(cmStateEnums::TargetType type) const;
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 5fdeec7..ec7916c 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -96,6 +96,21 @@ bool cmGlobalVisualStudio12Generator::MatchesGeneratorName(
return false;
}
+bool cmGlobalVisualStudio12Generator::ParseGeneratorToolset(
+ std::string const& ts, cmMakefile* mf)
+{
+ std::string::size_type ts_end = ts.size();
+ if (cmHasLiteralSuffix(ts, ",host=x64")) {
+ this->GeneratorToolsetHostArchitecture = "x64";
+ ts_end -= 9;
+ } else if (ts == "host=x64") {
+ this->GeneratorToolsetHostArchitecture = "x64";
+ ts_end = 0;
+ }
+ return this->cmGlobalVisualStudio11Generator::ParseGeneratorToolset(
+ ts.substr(0, ts_end), mf);
+}
+
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) {
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index 78bb637..cdda512 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -22,6 +22,9 @@ public:
// version number
virtual const char* GetToolsVersion() { return "12.0"; }
protected:
+ bool ParseGeneratorToolset(std::string const& ts,
+ cmMakefile* mf) CM_OVERRIDE;
+
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index 4d62f2b..a833a5f 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -79,7 +79,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;"
"ProductDir",
vc15Express, cmSystemTools::KeyWOW64_32);
- this->DefaultPlatformToolset = "v140";
+ this->DefaultPlatformToolset = "v141";
this->Version = VS15;
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index ffd87e2..8af0512 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -159,6 +159,10 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
ext = ".vfproj";
project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \"";
}
+ if (this->TargetIsCSharpOnly(t)) {
+ ext = ".csproj";
+ project = "Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"";
+ }
const char* targetExt = t->GetProperty("GENERATOR_FILE_NAME_EXT");
if (targetExt) {
ext = targetExt;
@@ -246,7 +250,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject(
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmState::TargetType,
+ std::ostream& fout, const std::string& name, cmStateEnums::TargetType,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
std::string const& platformMapping)
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index eb65bcb..9953047 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -56,7 +56,7 @@ protected:
const char* path,
cmGeneratorTarget const* t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmState::TargetType type,
+ std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "");
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 3637fed..773f8a0 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -8,6 +8,7 @@
#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmUuid.h"
#include "cmake.h"
#include <cmsys/Encoding.hxx>
@@ -101,7 +102,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
- cmState::STRING);
+ cmStateEnums::STRING);
}
// Create list of configurations requested by user's cache, if any.
@@ -118,15 +119,18 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
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);
+ cmStateEnums::STATIC);
}
}
-void cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
{
- this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf);
+ if (!this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf)) {
+ return false;
+ }
mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND",
this->GetDevEnvCommand().c_str());
+ return true;
}
std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
@@ -345,7 +349,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
tt != projectTargets.end(); ++tt) {
cmGeneratorTarget const* target = *tt;
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
@@ -377,7 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
tt != projectTargets.end(); ++tt) {
cmGeneratorTarget const* target = *tt;
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
bool written = false;
@@ -409,8 +413,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
// Create "solution folder" information from FOLDER target property
//
if (written && this->UseFolderProperty()) {
- const char* targetFolder = target->GetProperty("FOLDER");
- if (targetFolder) {
+ const std::string targetFolder = target->GetEffectiveFolderName();
+ if (!targetFolder.empty()) {
std::vector<cmsys::String> tokens =
cmSystemTools::SplitString(targetFolder, '/', false);
@@ -446,7 +450,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
tt != projectTargets.end(); ++tt) {
cmGeneratorTarget const* target = *tt;
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
const char* vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
@@ -676,7 +680,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
// if it is a utilitiy target then only make it part of the
// default build if another target depends on it
int type = target->GetType();
- if (type == cmState::GLOBAL_TARGET) {
+ if (type == cmStateEnums::GLOBAL_TARGET) {
// check if INSTALL target is part of default build
if (target->GetName() == "INSTALL") {
// inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties
@@ -696,7 +700,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
}
return activeConfigs;
}
- if (type == cmState::UTILITY &&
+ if (type == cmStateEnums::UTILITY &&
!this->IsDependedOn(projectTargets, target)) {
return activeConfigs;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 3c6ce11..62194c3 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -91,7 +91,7 @@ public:
const char* GetIntelProjectVersion();
- virtual void FindMakeProgram(cmMakefile*);
+ bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
/** Is the Microsoft Assembler enabled? */
bool IsMasmEnabled() const { return this->MasmEnabled; }
@@ -120,7 +120,7 @@ protected:
const char* path,
cmGeneratorTarget const* t) = 0;
virtual void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmState::TargetType type,
+ std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "") = 0;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 2ce0098..64808c9 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -347,7 +347,7 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations(
}
void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmState::TargetType type,
+ std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
std::string const& platformMapping)
@@ -380,10 +380,10 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
}
bool cmGlobalVisualStudio8Generator::NeedsDeploy(
- cmState::TargetType type) const
+ cmStateEnums::TargetType type) const
{
bool needsDeploy =
- (type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY);
+ (type == cmStateEnums::EXECUTABLE || type == cmStateEnums::SHARED_LIBRARY);
return this->TargetsWindowsCE() && needsDeploy;
}
@@ -402,7 +402,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
OrderedTargetDependSet depends(unordered, std::string());
for (OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i) {
- if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
std::string guid = this->GetGUID((*i)->GetName().c_str());
@@ -419,7 +419,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
ui != target->GetUtilities().end(); ++ui) {
if (cmGeneratorTarget* depTarget =
target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) {
- if (depTarget->GetType() != cmState::INTERFACE_LIBRARY &&
+ if (depTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
depTarget->GetProperty("EXTERNAL_MSPROJECT")) {
// This utility dependency names an external .vcproj target.
// We use LinkLibraryDependencies="true" to link to it without
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 2543ec1..b149c9d 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -72,14 +72,14 @@ protected:
bool AddCheckTarget();
/** Return true if the configuration needs to be deployed */
- virtual bool NeedsDeploy(cmState::TargetType type) const;
+ virtual bool NeedsDeploy(cmStateEnums::TargetType type) const;
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const std::string& name, cmState::TargetType type,
+ std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "");
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6296dd2..354ada9 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -10,6 +10,7 @@
#include "cmLocalVisualStudioGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmState.h"
#include "cmTarget.h"
#include <cmsys/Encoding.hxx>
@@ -81,7 +82,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
cmGeneratorTarget* tgt = *t;
- if (tgt->GetType() == cmState::GLOBAL_TARGET || tgt->IsImported()) {
+ if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
+ tgt->IsImported()) {
continue;
}
if (!this->IsExcluded(gen[0], tgt)) {
@@ -265,11 +267,11 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
const cmGeneratorTarget* target, std::set<const cmGeneratorTarget*>& linked)
{
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
if (linked.insert(target).second &&
- target->GetType() == cmState::STATIC_LIBRARY) {
+ target->GetType() == cmStateEnums::STATIC_LIBRARY) {
// Static library targets do not list their link dependencies so
// we must follow them transitively now.
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -304,7 +306,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
static bool VSLinkable(cmGeneratorTarget const* t)
{
- return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
+ return t->IsLinkable() || t->GetType() == cmStateEnums::OBJECT_LIBRARY;
}
void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
@@ -333,10 +335,10 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// leaving them out for the static library itself but following them
// transitively for other targets.
- bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY &&
- target->GetType() != cmState::SHARED_LIBRARY &&
- target->GetType() != cmState::MODULE_LIBRARY &&
- target->GetType() != cmState::EXECUTABLE);
+ bool allowLinkable = (target->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ target->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ target->GetType() != cmStateEnums::EXECUTABLE);
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -344,7 +346,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// Static libraries cannot depend on their link implementation
// due to behavior (2), but they do not really need to.
std::set<cmGeneratorTarget const*> linkDepends;
- if (target->GetType() != cmState::STATIC_LIBRARY) {
+ if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
for (TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) {
cmTargetDepend dep = *di;
@@ -367,7 +369,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// Collect all targets linked by this target so we can avoid
// intermediate targets below.
TargetSet linked;
- if (target->GetType() != cmState::STATIC_LIBRARY) {
+ if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
linked = this->GetTargetLinkClosure(target);
}
@@ -393,7 +395,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
}
}
-void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
{
// Visual Studio generators know how to lookup their build tool
// directly instead of needing a helper module to do it, so we
@@ -401,6 +403,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram().c_str());
}
+ return true;
}
std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(
@@ -734,6 +737,27 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
return false;
}
+bool cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(
+ cmGeneratorTarget const* gt)
+{
+ // check to see if this is a C# build
+ std::set<std::string> languages;
+ {
+ // Issue diagnostic if the source files depend on the config.
+ std::vector<cmSourceFile*> sources;
+ if (!gt->GetConfigCommonSourceFiles(sources)) {
+ return false;
+ }
+ }
+ gt->GetLanguages(languages, "");
+ if (languages.size() == 1) {
+ if (*languages.begin() == "CSharp") {
+ return true;
+ }
+ }
+ return false;
+}
+
bool cmGlobalVisualStudioGenerator::TargetCompare::operator()(
cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
{
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index a774d96..0e88bce 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -69,6 +69,9 @@ public:
// return true if target is fortran only
bool TargetIsFortranOnly(const cmGeneratorTarget* gt);
+ // return true if target is C# only
+ static bool TargetIsCSharpOnly(cmGeneratorTarget const* gt);
+
/** Get the top-level registry key for this VS version. */
std::string GetRegistryBase();
@@ -99,7 +102,7 @@ public:
};
class OrderedTargetDependSet;
- virtual void FindMakeProgram(cmMakefile*);
+ bool FindMakeProgram(cmMakefile*) CM_OVERRIDE;
virtual std::string ExpandCFGIntDir(const std::string& str,
const std::string& config) const;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 94cdb38..0900797 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -5,6 +5,7 @@
#include "cmDocumentationEntry.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmake.h"
cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4ff612d..8424ded 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -182,7 +182,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
#endif
}
-void cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
{
// The Xcode generator knows how to lookup its build tool
// directly instead of needing a helper module to do it, so we
@@ -191,6 +191,7 @@ void cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
mf->AddDefinition("CMAKE_MAKE_PROGRAM",
this->GetXcodeBuildCommand().c_str());
}
+ return true;
}
std::string const& cmGlobalXCodeGenerator::GetXcodeBuildCommand()
@@ -220,6 +221,19 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
if (this->XcodeVersion >= 30) {
+ if (ts.find_first_of(",=") != ts.npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not recognize the toolset\n"
+ " " << ts << "\n"
+ "that was specified.";
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
@@ -244,7 +258,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
- cmState::STRING);
+ cmStateEnums::STRING);
}
}
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
@@ -431,7 +445,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
l != tgts.end(); l++) {
cmGeneratorTarget* target = *l;
- if (target->GetType() == cmState::GLOBAL_TARGET) {
+ if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
@@ -446,12 +460,12 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// this will make sure that when the next target is built
// things are up-to-date
if (!makeHelper.empty() &&
- (target->GetType() == cmState::EXECUTABLE ||
+ (target->GetType() == cmStateEnums::EXECUTABLE ||
// Nope - no post-build for OBJECT_LIRBRARY
- // target->GetType() == cmState::OBJECT_LIBRARY ||
- target->GetType() == cmState::STATIC_LIBRARY ||
- target->GetType() == cmState::SHARED_LIBRARY ||
- target->GetType() == cmState::MODULE_LIBRARY)) {
+ // target->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ target->GetType() == cmStateEnums::MODULE_LIBRARY)) {
makeHelper[makeHelper.size() - 1] = // fill placeholder
this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
cmCustomCommandLines commandLines;
@@ -462,7 +476,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str());
}
- if (target->GetType() != cmState::INTERFACE_LIBRARY &&
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
!target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
allbuild->AddUtility(target->GetName());
}
@@ -942,12 +956,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
continue;
}
- if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
- if (gtgt->GetType() == cmState::UTILITY ||
- gtgt->GetType() == cmState::GLOBAL_TARGET) {
+ if (gtgt->GetType() == cmStateEnums::UTILITY ||
+ gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
if (!t) {
return false;
@@ -1175,9 +1189,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages()
void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
{
// This matters only for targets that link.
- if (gtgt->GetType() != cmState::EXECUTABLE &&
- gtgt->GetType() != cmState::SHARED_LIBRARY &&
- gtgt->GetType() != cmState::MODULE_LIBRARY) {
+ if (gtgt->GetType() != cmStateEnums::EXECUTABLE &&
+ gtgt->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ gtgt->GetType() != cmStateEnums::MODULE_LIBRARY) {
return;
}
@@ -1255,7 +1269,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
std::vector<cmCustomCommand> const& prelink = gtgt->GetPreLinkCommands();
std::vector<cmCustomCommand> postbuild = gtgt->GetPostBuildCommands();
- if (gtgt->GetType() == cmState::SHARED_LIBRARY &&
+ if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
!gtgt->IsFrameworkOnApple()) {
cmCustomCommandLines cmd;
cmd.resize(1);
@@ -1577,16 +1591,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
cmXCodeObject* buildSettings,
const std::string& configName)
{
- if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
std::string defFlags;
- bool shared = ((gtgt->GetType() == cmState::SHARED_LIBRARY) ||
- (gtgt->GetType() == cmState::MODULE_LIBRARY));
- bool binary = ((gtgt->GetType() == cmState::OBJECT_LIBRARY) ||
- (gtgt->GetType() == cmState::STATIC_LIBRARY) ||
- (gtgt->GetType() == cmState::EXECUTABLE) || shared);
+ bool shared = ((gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+ (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY));
+ bool binary = ((gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+ (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+ (gtgt->GetType() == cmStateEnums::EXECUTABLE) || shared);
// Compute the compilation flags for each language.
std::set<std::string> languages;
@@ -1640,11 +1654,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string extraLinkOptionsVar;
std::string extraLinkOptions;
- if (gtgt->GetType() == cmState::EXECUTABLE) {
+ if (gtgt->GetType() == cmStateEnums::EXECUTABLE) {
extraLinkOptionsVar = "CMAKE_EXE_LINKER_FLAGS";
- } else if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+ } else if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
extraLinkOptionsVar = "CMAKE_SHARED_LINKER_FLAGS";
- } else if (gtgt->GetType() == cmState::MODULE_LIBRARY) {
+ } else if (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY) {
extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS";
}
if (!extraLinkOptionsVar.empty()) {
@@ -1652,8 +1666,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions, extraLinkOptionsVar, configName);
}
- if (gtgt->GetType() == cmState::OBJECT_LIBRARY ||
- gtgt->GetType() == cmState::STATIC_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
this->CurrentLocalGenerator->GetStaticLibraryFlags(
extraLinkOptions, cmSystemTools::UpperCase(configName), gtgt);
} else {
@@ -1723,10 +1737,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Set attributes to specify the proper name for the target.
std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
- if (gtgt->GetType() == cmState::STATIC_LIBRARY ||
- gtgt->GetType() == cmState::SHARED_LIBRARY ||
- gtgt->GetType() == cmState::MODULE_LIBRARY ||
- gtgt->GetType() == cmState::EXECUTABLE) {
+ if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ gtgt->GetType() == cmStateEnums::EXECUTABLE) {
if (this->XcodeVersion >= 21) {
if (!gtgt->UsesDefaultOutputDir(configName, false)) {
std::string pncdir = gtgt->GetDirectory(configName);
@@ -1746,7 +1760,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString(pnprefix));
buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
this->CreateString(pnsuffix));
- } else if (gtgt->GetType() == cmState::OBJECT_LIBRARY) {
+ } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
pnprefix = "lib";
pnbase = gtgt->GetName();
pnsuffix = ".a";
@@ -1769,14 +1783,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Handle settings for each target type.
switch (gtgt->GetType()) {
- case cmState::OBJECT_LIBRARY:
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY: {
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("STATIC"));
break;
}
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::MODULE_LIBRARY: {
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE"));
if (gtgt->IsCFBundleOnApple()) {
@@ -1826,7 +1840,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
break;
}
- case cmState::SHARED_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY: {
if (gtgt->GetPropertyAsBool("FRAMEWORK")) {
std::string fw_version = gtgt->GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION",
@@ -1859,7 +1873,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString("DYNAMIC"));
break;
}
- case cmState::EXECUTABLE: {
+ case cmStateEnums::EXECUTABLE: {
// Add the flags to create an executable.
std::string createFlags =
this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
@@ -2038,7 +2052,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Create the INSTALL_PATH attribute.
std::string install_name_dir;
- if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
// Get the install_name directory for the build tree.
install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
// Xcode doesn't create the correct install_name in some cases.
@@ -2111,7 +2125,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
// Runtime version information.
- if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
int major;
int minor;
int patch;
@@ -2206,7 +2220,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
this->XCodeObjectMap[gtgt] = target;
// Add source files without build rules for editing convenience.
- if (gtgt->GetType() == cmState::UTILITY) {
+ if (gtgt->GetType() == cmStateEnums::UTILITY) {
std::vector<cmSourceFile*> sources;
if (!gtgt->GetConfigCommonSourceFiles(sources)) {
return 0;
@@ -2272,8 +2286,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
cmGeneratorTarget const* target) const
{
if (this->XcodeVersion >= 60 &&
- (target->GetType() == cmState::STATIC_LIBRARY ||
- target->GetType() == cmState::OBJECT_LIBRARY)) {
+ (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
return "OTHER_LIBTOOLFLAGS";
} else {
return "OTHER_LDFLAGS";
@@ -2284,10 +2298,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
cmGeneratorTarget* target)
{
switch (target->GetType()) {
- case cmState::OBJECT_LIBRARY:
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "archive.ar";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (target->IsXCTestOnApple())
return "wrapper.cfbundle";
else if (target->IsCFBundleOnApple())
@@ -2295,11 +2309,11 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
else
return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable"
: "compiled.mach-o.dylib");
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework"
: "compiled.mach-o.dylib");
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "compiled.mach-o.executable";
default:
break;
@@ -2311,10 +2325,10 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
cmGeneratorTarget* target)
{
switch (target->GetType()) {
- case cmState::OBJECT_LIBRARY:
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "com.apple.product-type.library.static";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (target->IsXCTestOnApple())
return "com.apple.product-type.bundle.unit-test";
else if (target->IsCFBundleOnApple())
@@ -2323,11 +2337,11 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
return ((this->XcodeVersion >= 22)
? "com.apple.product-type.tool"
: "com.apple.product-type.library.dynamic");
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework"
: "com.apple.product-type.library.dynamic");
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return (target->GetPropertyAsBool("MACOSX_BUNDLE")
? "com.apple.product-type.application"
: "com.apple.product-type.tool");
@@ -2340,7 +2354,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
cmGeneratorTarget* gtgt, cmXCodeObject* buildPhases)
{
- if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return 0;
}
cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXNativeTarget);
@@ -2367,7 +2381,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
}
std::string fullName;
- if (gtgt->GetType() == cmState::OBJECT_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
fullName = "lib";
fullName += gtgt->GetName();
fullName += ".a";
@@ -2419,8 +2433,9 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
return storedGUID;
}
- this->CMakeInstance->AddCacheEntry(
- guidStoreName, id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL);
+ this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(),
+ "Stored Xcode object GUID",
+ cmStateEnums::INTERNAL);
return id;
}
@@ -2514,7 +2529,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
cmSystemTools::Error("Error no target on xobject\n");
return;
}
- if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
@@ -2551,8 +2566,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
// Skip link information for object libraries.
- if (gt->GetType() == cmState::OBJECT_LIBRARY ||
- gt->GetType() == cmState::STATIC_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ gt->GetType() == cmStateEnums::STATIC_LIBRARY) {
continue;
}
@@ -2607,7 +2622,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
if (li->IsPath) {
linkLibs += this->XCodeEscapePath(li->Value);
} else if (!li->Target ||
- li->Target->GetType() != cmState::INTERFACE_LIBRARY) {
+ li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
linkLibs += li->Value;
}
if (li->Target && !li->Target->IsImported()) {
@@ -2636,10 +2651,10 @@ bool cmGlobalXCodeGenerator::CreateGroups(
// end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
// groups:
//
- if (gtgt->GetType() == cmState::GLOBAL_TARGET) {
+ if (gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
- if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
@@ -2710,8 +2725,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
{
std::string s;
std::string target;
- const char* targetFolder = gtgt->GetProperty("FOLDER");
- if (targetFolder) {
+ const std::string targetFolder = gtgt->GetEffectiveFolderName();
+ if (!targetFolder.empty()) {
target = targetFolder;
target += "/";
}
@@ -3136,20 +3151,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
cmXCodeObject* target = *i;
cmGeneratorTarget* gt = target->GetTarget();
- if (gt->GetType() == cmState::EXECUTABLE ||
+ if (gt->GetType() == cmStateEnums::EXECUTABLE ||
// Nope - no post-build for OBJECT_LIRBRARY
- // gt->GetType() == cmState::OBJECT_LIBRARY ||
- gt->GetType() == cmState::STATIC_LIBRARY ||
- gt->GetType() == cmState::SHARED_LIBRARY ||
- gt->GetType() == cmState::MODULE_LIBRARY) {
+ // gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
// Declare an entry point for the target post-build phase.
makefileStream << this->PostBuildMakeTarget(gt->GetName(), *ct)
<< ":\n";
}
- if (gt->GetType() == cmState::EXECUTABLE ||
- gt->GetType() == cmState::SHARED_LIBRARY ||
- gt->GetType() == cmState::MODULE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::EXECUTABLE ||
+ gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
std::string tfull = gt->GetFullPath(configName);
std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
@@ -3325,14 +3340,14 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p)
{
// We force conversion because Xcode breakpoints do not work unless
// they are in a file named relative to the source tree.
- return this->CurrentLocalGenerator->ConvertToRelativePath(
- this->ProjectSourceDirectoryComponents, p, true);
+ return cmOutputConverter::ForceToRelativePath(
+ cmSystemTools::JoinPath(this->ProjectSourceDirectoryComponents), p);
}
std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
{
return this->CurrentLocalGenerator->ConvertToRelativePath(
- this->ProjectOutputDirectoryComponents, p);
+ cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p);
}
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index dbd5205..ded8073 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -58,7 +58,7 @@ public:
const std::string& suffix,
std::string& dir);
- virtual void FindMakeProgram(cmMakefile*);
+ bool FindMakeProgram(cmMakefile*) CM_OVERRIDE;
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGIntDir() const;
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index db11bd3..6b32f73 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -24,13 +24,13 @@ static const char* getShapeForTarget(const cmGeneratorTarget* target)
}
switch (target->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "house";
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "diamond";
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return "polygon";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return "octagon";
default:
break;
@@ -495,16 +495,16 @@ bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name)
}
bool cmGraphVizWriter::GenerateForTargetType(
- cmState::TargetType targetType) const
+ cmStateEnums::TargetType targetType) const
{
switch (targetType) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return this->GenerateForExecutables;
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return this->GenerateForStaticLibs;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return this->GenerateForSharedLibs;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return this->GenerateForModuleLibs;
default:
break;
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 0efe2b7..1ff07ab 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -5,7 +5,7 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmState.h"
+#include "cmStateTypes.h"
#include <cmsys/RegularExpression.hxx>
#include <map>
@@ -60,7 +60,7 @@ protected:
bool IgnoreThisTarget(const std::string& name);
- bool GenerateForTargetType(cmState::TargetType targetType) const;
+ bool GenerateForTargetType(cmStateEnums::TargetType targetType) const;
std::string GraphType;
std::string GraphName;
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index e121ece..db855d2 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmHexFileConverter.h"
+#include "cmSystemTools.h"
+
#include <stdio.h>
#include <string.h>
@@ -204,7 +206,7 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
} else if (type == IntelHex) {
success = ConvertIntelHexLine(buf, outFile);
}
- if (success == false) {
+ if (!success) {
break;
}
}
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index a2dec55..eb85b16 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -4,6 +4,7 @@
#include "cmOutputConverter.h"
#include "cmStringCommand.h"
+#include "cmSystemTools.h"
#include "cmConditionEvaluator.h"
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index f449023..e071acb 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -66,8 +66,6 @@ public:
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
const cmMakefile* mf, cmExpandedCommandArgument const& argument);
-
- cmTypeMacro(cmIfCommand, cmCommand);
};
#endif
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index acf51a7..e89641f 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeCommand.h"
+#include "cmGlobalGenerator.h"
+#include "cmSystemTools.h"
+
// cmIncludeCommand
bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 7ff7b9d..9065ef7 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -35,8 +35,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "include"; }
-
- cmTypeMacro(cmIncludeCommand, cmCommand);
};
#endif
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index f37f1ca..2260366 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeDirectoryCommand.h"
+#include "cmSystemTools.h"
+
// cmIncludeDirectoryCommand
bool cmIncludeDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 46e433a..d0a20b3 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -31,8 +31,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "include_directories"; }
- cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
-
protected:
// used internally
void GetIncludes(const std::string& arg, std::vector<std::string>& incs);
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index 166bc7c..e7e9402 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -2,6 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeExternalMSProjectCommand.h"
+#ifdef _WIN32
+#include "cmSystemTools.h"
+#endif
+
+class cmExecutionStatus;
+
// cmIncludeExternalMSProjectCommand
bool cmIncludeExternalMSProjectCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -66,12 +72,12 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(
std::string guidVariable = utility_name + "_GUID_CMAKE";
this->Makefile->GetCMakeInstance()->AddCacheEntry(
guidVariable.c_str(), customGuid.c_str(), "Stored GUID",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
// Create a target instance for this utility.
- cmTarget* target =
- this->Makefile->AddNewTarget(cmState::UTILITY, utility_name.c_str());
+ cmTarget* target = this->Makefile->AddNewTarget(cmStateEnums::UTILITY,
+ utility_name.c_str());
target->SetProperty("GENERATOR_FILE_NAME", utility_name.c_str());
target->SetProperty("EXTERNAL_MSPROJECT", path.c_str());
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 9401016..9fcf467 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -3,8 +3,14 @@
#ifndef cmIncludeExternalMSProjectCommand_h
#define cmIncludeExternalMSProjectCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmIncludeExternalMSProjectCommand
* \brief Specify an external MS project file for inclusion in the workspace.
*
@@ -37,8 +43,6 @@ public:
{
return "include_external_msproject";
}
-
- cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
};
#endif
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index 648bce2..b7c937d 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -36,8 +36,6 @@ public:
{
return "include_regular_expression";
}
-
- cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand);
};
#endif
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index f040a4e..476755a 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -3,12 +3,14 @@
#include "cmInstallCommand.h"
#include "cmExportSet.h"
+#include "cmGlobalGenerator.h"
#include "cmInstallCommandArguments.h"
#include "cmInstallDirectoryGenerator.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.h"
+#include "cmSystemTools.h"
#include "cmTargetExport.h"
#include <cmsys/Glob.hxx>
@@ -327,19 +329,19 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if (cmTarget* target =
this->Makefile->FindLocalNonAliasTarget(*targetIt)) {
// Found the target. Check its type.
- if (target->GetType() != cmState::EXECUTABLE &&
- target->GetType() != cmState::STATIC_LIBRARY &&
- target->GetType() != cmState::SHARED_LIBRARY &&
- target->GetType() != cmState::MODULE_LIBRARY &&
- target->GetType() != cmState::OBJECT_LIBRARY &&
- target->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() != cmStateEnums::EXECUTABLE &&
+ target->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ target->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ target->GetType() != cmStateEnums::OBJECT_LIBRARY &&
+ target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "TARGETS given target \"" << (*targetIt)
<< "\" which is not an executable, library, or module.";
this->SetError(e.str());
return false;
}
- if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "TARGETS given OBJECT library \"" << (*targetIt)
<< "\" which may not be installed.";
@@ -387,7 +389,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
bool namelinkOnly = false;
switch (target.GetType()) {
- case cmState::SHARED_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY: {
// Shared libraries are handled differently on DLL and non-DLL
// platforms. All windows platforms are DLL platforms including
// cygwin. Currently no other platform is a DLL platform.
@@ -454,7 +456,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
}
} break;
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
// Static libraries use ARCHIVE properties.
if (!archiveArgs.GetDestination().empty()) {
archiveGenerator =
@@ -468,7 +470,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false;
}
} break;
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::MODULE_LIBRARY: {
// Modules use LIBRARY properties.
if (!libraryArgs.GetDestination().empty()) {
libraryGenerator =
@@ -484,7 +486,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false;
}
} break;
- case cmState::EXECUTABLE: {
+ case cmStateEnums::EXECUTABLE: {
if (target.IsAppBundleOnApple()) {
// Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty()) {
@@ -534,7 +536,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
CreateInstallTargetGenerator(target, archiveArgs, true, true);
}
} break;
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
// Nothing to do. An INTERFACE_LIBRARY can be installed, but the
// only effect of that is to make it exportable. It installs no
// other files itself.
@@ -553,7 +555,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
bool createInstallGeneratorsForTargetFileSets = true;
if (target.IsFrameworkOnApple() ||
- target.GetType() == cmState::INTERFACE_LIBRARY) {
+ target.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
createInstallGeneratorsForTargetFileSets = false;
}
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 6f785ae..b350330 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -31,8 +31,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "install"; }
- cmTypeMacro(cmInstallCommand, cmCommand);
-
private:
bool HandleScriptMode(std::vector<std::string> const& args);
bool HandleTargetsMode(std::vector<std::string> const& args);
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index f072ff5..50f97e9 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,7 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
+#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
+#include "cmSystemTools.h"
// cmExecutableCommand
bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index a80184a..da09fae 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -40,8 +40,6 @@ public:
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE { return !this->IsFilesForm; }
- cmTypeMacro(cmInstallFilesCommand, cmCommand);
-
protected:
void CreateInstallGenerator() const;
std::string FindInstallSource(const char* name) const;
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index bb2b61f..5ee81fb 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -2,7 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
+#include "cmGeneratorExpression.h"
+#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
+#include "cmInstallGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmExecutableCommand
bool cmInstallProgramsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index cb85cce..ca07a2f 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -3,8 +3,14 @@
#ifndef cmInstallProgramsCommand_h
#define cmInstallProgramsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmInstallProgramsCommand
* \brief Specifies where to install some programs
*
@@ -41,8 +47,6 @@ public:
bool HasFinalPass() const CM_OVERRIDE { return true; }
- cmTypeMacro(cmInstallProgramsCommand, cmCommand);
-
protected:
std::string FindInstallSource(const char* name) const;
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 70ae204..f1df073 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmInstallType.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_auto_ptr.hxx"
@@ -80,36 +80,36 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
std::vector<std::string> filesFrom;
std::vector<std::string> filesTo;
std::string literal_args;
- cmState::TargetType targetType = this->Target->GetType();
+ cmStateEnums::TargetType targetType = this->Target->GetType();
cmInstallType type = cmInstallType();
switch (targetType) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
type = cmInstallType_EXECUTABLE;
break;
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
type = cmInstallType_STATIC_LIBRARY;
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
type = cmInstallType_SHARED_LIBRARY;
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
type = cmInstallType_MODULE_LIBRARY;
break;
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
// Not reachable. We never create a cmInstallTargetGenerator for
// an INTERFACE_LIBRARY.
assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
break;
- case cmState::OBJECT_LIBRARY:
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::UNKNOWN_LIBRARY:
this->Target->GetLocalGenerator()->IssueMessage(
cmake::INTERNAL_ERROR,
"cmInstallTargetGenerator created with non-installable target.");
return;
}
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);
@@ -337,7 +337,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
{
std::string fname;
// Compute the name of the library.
- if (target->GetType() == cmState::EXECUTABLE) {
+ if (target->GetType() == cmStateEnums::EXECUTABLE) {
std::string targetName;
std::string targetNameReal;
std::string targetNameImport;
@@ -471,9 +471,9 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
std::string const& toDestDirPath)
{
if (this->ImportLibrary ||
- !(this->Target->GetType() == cmState::SHARED_LIBRARY ||
- this->Target->GetType() == cmState::MODULE_LIBRARY ||
- this->Target->GetType() == cmState::EXECUTABLE)) {
+ !(this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->Target->GetType() == cmStateEnums::EXECUTABLE)) {
return;
}
@@ -527,7 +527,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
// Edit the install_name of the target itself if necessary.
std::string new_id;
- if (this->Target->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string for_build =
this->Target->GetInstallNameDirForBuildTree(config);
std::string for_install = this->Target->GetInstallNameDirForInstallTree();
@@ -704,7 +704,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
// don't strip static and import libraries, because it removes the only
// symbol table they have so you can't link to them anymore
- if (this->Target->GetType() == cmState::STATIC_LIBRARY ||
+ if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->ImportLibrary) {
return;
}
@@ -731,7 +731,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
const std::string& toDestDirPath)
{
// Static libraries need ranlib on this platform.
- if (this->Target->GetType() != cmState::STATIC_LIBRARY) {
+ if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
return;
}
@@ -767,10 +767,10 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
}
switch (this->Target->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
break;
default:
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index fca0bf1..07f990d 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallTargetsCommand.h"
+#include "cmGlobalGenerator.h"
+
// cmExecutableCommand
bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 2ddeaf0..0625722 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -31,8 +31,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "install_targets"; }
-
- cmTypeMacro(cmInstallTargetsCommand, cmCommand);
};
#endif
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index fc6bf29..3a18a43 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkDirectoriesCommand.h"
+#include "cmSystemTools.h"
+
// cmLinkDirectoriesCommand
bool cmLinkDirectoriesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index cd6d2de..ba0313b 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -33,8 +33,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "link_directories"; }
- cmTypeMacro(cmLinkDirectoriesCommand, cmCommand);
-
private:
void AddLinkDir(std::string const& dir);
};
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index bb0e27b..708ec8c 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkLibrariesCommand.h"
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
// cmLinkLibrariesCommand
bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -20,7 +24,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
"a library");
return false;
}
- this->Makefile->AddLinkLibrary(*i, DEBUG_LibraryType);
+ this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
} else if (*i == "optimized") {
++i;
if (i == args.end()) {
@@ -28,10 +32,9 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
"a library");
return false;
}
- this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType);
- } else {
- this->Makefile->AddLinkLibrary(*i);
+ this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
}
+ this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
}
return true;
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index b4943b6..66d7ec4 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -3,8 +3,14 @@
#ifndef cmLinkLibrariesCommand_h
#define cmLinkLibrariesCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmLinkLibrariesCommand
* \brief Specify a list of libraries to link into executables.
*
@@ -31,8 +37,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "link_libraries"; }
-
- cmTypeMacro(cmLinkLibrariesCommand, cmCommand);
};
#endif
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
new file mode 100644
index 0000000..c271246
--- /dev/null
+++ b/Source/cmLinkLineComputer.cxx
@@ -0,0 +1,181 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmLinkLineComputer.h"
+#include "cmComputeLinkInformation.h"
+#include "cmGeneratorTarget.h"
+#include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
+
+cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir)
+ : StateDir(stateDir)
+ , OutputConverter(outputConverter)
+ , ForResponse(false)
+ , UseWatcomQuote(false)
+ , Relink(false)
+{
+}
+
+cmLinkLineComputer::~cmLinkLineComputer()
+{
+}
+
+void cmLinkLineComputer::SetUseWatcomQuote(bool useWatcomQuote)
+{
+ this->UseWatcomQuote = useWatcomQuote;
+}
+
+void cmLinkLineComputer::SetForResponse(bool forResponse)
+{
+ this->ForResponse = forResponse;
+}
+
+void cmLinkLineComputer::SetRelink(bool relink)
+{
+ this->Relink = relink;
+}
+
+std::string cmLinkLineComputer::ConvertToLinkReference(
+ std::string const& lib) const
+{
+ std::string relLib = lib;
+
+ if (cmOutputConverter::ContainedInDirectory(
+ this->StateDir.GetCurrentBinary(), lib, this->StateDir)) {
+ relLib = cmOutputConverter::ForceToRelativePath(
+ this->StateDir.GetCurrentBinary(), lib);
+ }
+ return relLib;
+}
+
+std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
+{
+ std::string linkLibs;
+ typedef cmComputeLinkInformation::ItemVector ItemVector;
+ ItemVector const& items = cli.GetItems();
+ for (ItemVector::const_iterator li = items.begin(); li != items.end();
+ ++li) {
+ if (li->Target &&
+ li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ continue;
+ }
+ if (li->IsPath) {
+ linkLibs +=
+ this->ConvertToOutputFormat(this->ConvertToLinkReference(li->Value));
+ } else {
+ linkLibs += li->Value;
+ }
+ linkLibs += " ";
+ }
+ return linkLibs;
+}
+
+std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
+{
+ cmOutputConverter::OutputFormat shellFormat = (this->ForResponse)
+ ? cmOutputConverter::RESPONSE
+ : ((this->UseWatcomQuote) ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL);
+
+ return this->OutputConverter->ConvertToOutputFormat(input, shellFormat);
+}
+
+std::string cmLinkLineComputer::ConvertToOutputForExisting(
+ std::string const& input)
+{
+ cmOutputConverter::OutputFormat shellFormat = (this->ForResponse)
+ ? cmOutputConverter::RESPONSE
+ : ((this->UseWatcomQuote) ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL);
+
+ return this->OutputConverter->ConvertToOutputForExisting(input, shellFormat);
+}
+
+std::string cmLinkLineComputer::ComputeLinkPath(
+ cmComputeLinkInformation& cli, std::string const& libPathFlag,
+ std::string const& libPathTerminator)
+{
+ std::string linkPath;
+ std::vector<std::string> const& libDirs = cli.GetDirectories();
+ for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
+ libDir != libDirs.end(); ++libDir) {
+ std::string libpath = this->ConvertToOutputForExisting(*libDir);
+ linkPath += " " + libPathFlag;
+ linkPath += libpath;
+ linkPath += libPathTerminator;
+ linkPath += " ";
+ }
+ return linkPath;
+}
+
+std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli)
+{
+ std::string rpath;
+ // Check what kind of rpath flags to use.
+ if (cli.GetRuntimeSep().empty()) {
+ // Each rpath entry gets its own option ("-R a -R b -R c")
+ std::vector<std::string> runtimeDirs;
+ cli.GetRPath(runtimeDirs, this->Relink);
+
+ for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
+ ri != runtimeDirs.end(); ++ri) {
+ rpath += cli.GetRuntimeFlag();
+ rpath += this->ConvertToOutputFormat(*ri);
+ rpath += " ";
+ }
+ } else {
+ // All rpath entries are combined ("-Wl,-rpath,a:b:c").
+ std::string rpathString = cli.GetRPathString(this->Relink);
+
+ // Store the rpath option in the stream.
+ if (!rpathString.empty()) {
+ rpath += cli.GetRuntimeFlag();
+ rpath +=
+ this->OutputConverter->EscapeForShell(rpathString, !this->ForResponse);
+ rpath += " ";
+ }
+ }
+ return rpath;
+}
+
+std::string cmLinkLineComputer::ComputeFrameworkPath(
+ cmComputeLinkInformation& cli, std::string const& fwSearchFlag)
+{
+ std::string frameworkPath;
+ if (!fwSearchFlag.empty()) {
+ std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
+ for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+ fdi != fwDirs.end(); ++fdi) {
+ frameworkPath += fwSearchFlag;
+ frameworkPath += this->ConvertToOutputFormat(*fdi);
+ frameworkPath += " ";
+ }
+ }
+ return frameworkPath;
+}
+
+std::string cmLinkLineComputer::ComputeLinkLibraries(
+ cmComputeLinkInformation& cli, std::string const& stdLibString)
+{
+ std::ostringstream fout;
+ fout << this->ComputeRPath(cli);
+
+ // Write the library flags to the build rule.
+ fout << this->ComputeLinkLibs(cli);
+
+ // Add the linker runtime search path if any.
+ std::string rpath_link = cli.GetRPathLinkString();
+ if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
+ fout << cli.GetRPathLinkFlag();
+ fout << this->OutputConverter->EscapeForShell(rpath_link,
+ !this->ForResponse);
+ fout << " ";
+ }
+
+ if (!stdLibString.empty()) {
+ fout << stdLibString << " ";
+ }
+
+ return fout.str();
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
new file mode 100644
index 0000000..6bbb69e
--- /dev/null
+++ b/Source/cmLinkLineComputer.h
@@ -0,0 +1,50 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmLinkLineComputer_h
+#define cmLinkLineComputer_h
+
+#include "cmStateDirectory.h"
+
+class cmComputeLinkInformation;
+class cmOutputConverter;
+
+class cmLinkLineComputer
+{
+public:
+ cmLinkLineComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir);
+ virtual ~cmLinkLineComputer();
+
+ void SetUseWatcomQuote(bool useWatcomQuote);
+ void SetForResponse(bool forResponse);
+ void SetRelink(bool relink);
+
+ virtual std::string ConvertToLinkReference(std::string const& input) const;
+
+ std::string ComputeLinkPath(cmComputeLinkInformation& cli,
+ std::string const& libPathFlag,
+ std::string const& libPathTerminator);
+
+ std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
+ std::string const& fwSearchFlag);
+
+ std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
+ std::string const& stdLibString);
+
+private:
+ std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
+ std::string ComputeRPath(cmComputeLinkInformation& cli);
+
+ std::string ConvertToOutputFormat(std::string const& input);
+ std::string ConvertToOutputForExisting(std::string const& input);
+
+ cmStateDirectory StateDir;
+ cmOutputConverter* OutputConverter;
+
+ bool ForResponse;
+ bool UseWatcomQuote;
+ bool Relink;
+};
+
+#endif
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 98f3aa3..6cc9590 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -3,6 +3,7 @@
#include "cmListCommand.h"
#include "cmAlgorithms.h"
+#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index b6b0a47..43a482c 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -34,8 +34,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "list"; }
- cmTypeMacro(cmListCommand, cmCommand);
-
protected:
bool HandleLengthCommand(std::vector<std::string> const& args);
bool HandleGetCommand(std::vector<std::string> const& args);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 5e6273c..b1cd889 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -5,6 +5,7 @@
#include "cmListFileLexer.h"
#include "cmMessenger.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -298,7 +299,7 @@ struct cmListFileBacktrace::Entry : public cmListFileContext
unsigned int RefCount;
};
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
cmListFileContext const& lfc)
: Bottom(bottom)
, Cur(new Entry(lfc, up))
@@ -307,7 +308,7 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
this->Cur->Ref();
}
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur)
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur)
: Bottom(bottom)
, Cur(cur)
{
@@ -323,7 +324,7 @@ cmListFileBacktrace::cmListFileBacktrace()
{
}
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot)
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot snapshot)
: Bottom(snapshot.GetCallStackBottom())
, Cur(CM_NULLPTR)
{
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 4dacee0..1a30f29 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include "cmState.h"
+#include "cmStateSnapshot.h"
/** \class cmListFileCache
* \brief A class to cache list file contents.
@@ -113,13 +113,15 @@ public:
// Construct an empty backtrace whose bottom sits in the directory
// indicated by the given valid snapshot.
- cmListFileBacktrace(cmState::Snapshot snapshot);
+ cmListFileBacktrace(cmStateSnapshot snapshot);
// Backtraces may be copied and assigned as values.
cmListFileBacktrace(cmListFileBacktrace const& r);
cmListFileBacktrace& operator=(cmListFileBacktrace const& r);
~cmListFileBacktrace();
+ cmStateSnapshot GetBottom() const { return this->Bottom; }
+
// Get a backtrace with the given file scope added to the top.
// May not be called until after construction with a valid snapshot.
cmListFileBacktrace Push(std::string const& file) const;
@@ -145,11 +147,11 @@ public:
private:
struct Entry;
- cmState::Snapshot Bottom;
+ cmStateSnapshot Bottom;
Entry* Cur;
- cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
+ cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
cmListFileContext const& lfc);
- cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur);
+ cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur);
};
struct cmListFile
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 3428a6c..2a06cb4 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -3,7 +3,13 @@
#include "cmLoadCacheCommand.h"
#include <cmsys/FStream.hxx>
-#include <cmsys/RegularExpression.hxx>
+
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
// cmLoadCacheCommand
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args,
@@ -140,7 +146,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// Check one line of the cache file.
std::string var;
std::string value;
- cmState::CacheEntryType type = cmState::UNINITIALIZED;
+ cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
if (cmake::ParseCacheEntry(line, var, value, type)) {
// Found a real entry. See if this one was requested.
if (this->VariablesToRead.find(var) != this->VariablesToRead.end()) {
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 57f64cd..539c74e 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -3,8 +3,15 @@
#ifndef cmLoadCacheCommand_h
#define cmLoadCacheCommand_h
+#include <cmConfigure.h>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmLoadCacheCommand
* \brief load a cache file
*
@@ -30,8 +37,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "load_cache"; }
- cmTypeMacro(cmLoadCacheCommand, cmCommand);
-
protected:
std::set<std::string> VariablesToRead;
std::string Prefix;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index bcfec79..e042b07 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -5,16 +5,23 @@
#include "cmCPluginAPI.cxx"
#include "cmCPluginAPI.h"
#include "cmDynamicLoader.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
-#include <cmsys/DynamicLoader.hxx>
+class cmExecutionStatus;
+#include <signal.h>
+#include <sstream>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#ifdef __QNX__
#include <malloc.h> /* for malloc/free on QNX */
#endif
-#include <signal.h>
extern "C" void TrapsForSignalsCFunction(int sig);
// a class for loadabple commands
@@ -57,7 +64,7 @@ public:
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE
{
- return this->info.FinalPass ? true : false;
+ return this->info.FinalPass != CM_NULLPTR;
}
/**
@@ -93,8 +100,6 @@ public:
}
}
- cmTypeMacro(cmLoadedCommand, cmCommand);
-
cmLoadedCommandInfo info;
};
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index e42d46a..d16dfea 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -3,8 +3,14 @@
#ifndef cmLoadCommandCommand_h
#define cmLoadCommandCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmLoadCommandCommand : public cmCommand
{
public:
@@ -12,7 +18,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
std::string GetName() const CM_OVERRIDE { return "load_command"; }
- cmTypeMacro(cmLoadCommandCommand, cmCommand);
};
#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f24b717..4aecb1d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -12,8 +12,12 @@
#include "cmInstallGenerator.h"
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmMakefile.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTestGenerator.h"
@@ -39,6 +43,28 @@
#include <StorageDefs.h>
#endif
+// List of variables that are replaced when
+// rules are expanced. These variables are
+// replaced in the form <var> with GetSafeDefinition(var).
+// ${LANG} is replaced in the variable first with all enabled
+// languages.
+static const char* ruleReplaceVars[] = {
+ "CMAKE_${LANG}_COMPILER",
+ "CMAKE_SHARED_LIBRARY_CREATE_${LANG}_FLAGS",
+ "CMAKE_SHARED_MODULE_CREATE_${LANG}_FLAGS",
+ "CMAKE_SHARED_MODULE_${LANG}_FLAGS",
+ "CMAKE_SHARED_LIBRARY_${LANG}_FLAGS",
+ "CMAKE_${LANG}_LINK_FLAGS",
+ "CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG",
+ "CMAKE_${LANG}_ARCHIVE",
+ "CMAKE_AR",
+ "CMAKE_CURRENT_SOURCE_DIR",
+ "CMAKE_CURRENT_BINARY_DIR",
+ "CMAKE_RANLIB",
+ "CMAKE_LINKER",
+ "CMAKE_CL_SHOWINCLUDES_PREFIX"
+};
+
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
: cmOutputConverter(makefile->GetStateSnapshot())
, StateSnapshot(makefile->GetStateSnapshot())
@@ -55,6 +81,65 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
this->BackwardsCompatibilityFinal = false;
this->ComputeObjectMaxPath();
+
+ std::vector<std::string> enabledLanguages =
+ this->GetState()->GetEnabledLanguages();
+
+ this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+
+ for (std::vector<std::string>::iterator i = enabledLanguages.begin();
+ i != enabledLanguages.end(); ++i) {
+ std::string const& lang = *i;
+ if (lang == "NONE") {
+ continue;
+ }
+ this->Compilers["CMAKE_" + lang + "_COMPILER"] = lang;
+
+ this->VariableMappings["CMAKE_" + lang + "_COMPILER"] =
+ this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER");
+
+ std::string const& compilerArg1 = "CMAKE_" + lang + "_COMPILER_ARG1";
+ std::string const& compilerTarget = "CMAKE_" + lang + "_COMPILER_TARGET";
+ std::string const& compilerOptionTarget =
+ "CMAKE_" + lang + "_COMPILE_OPTIONS_TARGET";
+ std::string const& compilerExternalToolchain =
+ "CMAKE_" + lang + "_COMPILER_EXTERNAL_TOOLCHAIN";
+ std::string const& compilerOptionExternalToolchain =
+ "CMAKE_" + lang + "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN";
+ std::string const& compilerOptionSysroot =
+ "CMAKE_" + lang + "_COMPILE_OPTIONS_SYSROOT";
+
+ this->VariableMappings[compilerArg1] =
+ this->Makefile->GetSafeDefinition(compilerArg1);
+ this->VariableMappings[compilerTarget] =
+ this->Makefile->GetSafeDefinition(compilerTarget);
+ this->VariableMappings[compilerOptionTarget] =
+ this->Makefile->GetSafeDefinition(compilerOptionTarget);
+ this->VariableMappings[compilerExternalToolchain] =
+ this->Makefile->GetSafeDefinition(compilerExternalToolchain);
+ this->VariableMappings[compilerOptionExternalToolchain] =
+ this->Makefile->GetSafeDefinition(compilerOptionExternalToolchain);
+ this->VariableMappings[compilerOptionSysroot] =
+ this->Makefile->GetSafeDefinition(compilerOptionSysroot);
+
+ for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
+ replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
+ std::string actualReplace = *replaceIter;
+ if (actualReplace.find("${LANG}") != actualReplace.npos) {
+ cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
+ }
+
+ this->VariableMappings[actualReplace] =
+ this->Makefile->GetSafeDefinition(actualReplace);
+ }
+ }
+}
+
+cmRulePlaceholderExpander* cmLocalGenerator::CreateRulePlaceholderExpander()
+ const
+{
+ return new cmRulePlaceholderExpander(this->Compilers, this->VariableMappings,
+ this->CompilerSysroot);
}
cmLocalGenerator::~cmLocalGenerator()
@@ -116,7 +201,7 @@ void cmLocalGenerator::TraceDependencies()
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
- if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
(*t)->TraceDependencies();
@@ -166,7 +251,7 @@ void cmLocalGenerator::GenerateTestFiles()
(*gi)->Compute(this);
(*gi)->Generate(fout, config, configurationTypes);
}
- typedef std::vector<cmState::Snapshot> vec_t;
+ typedef std::vector<cmStateSnapshot> vec_t;
vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren();
std::string parentBinDir = this->GetCurrentBinaryDirectory();
for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) {
@@ -363,12 +448,12 @@ void cmLocalGenerator::GenerateInstallRules()
this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories.
- std::vector<cmState::Snapshot> children =
+ std::vector<cmStateSnapshot> children =
this->Makefile->GetStateSnapshot().GetChildren();
if (!children.empty()) {
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
- for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+ for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
ci != children.end(); ++ci) {
if (!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
std::string odir = ci->GetDirectory().GetCurrentBinary();
@@ -459,7 +544,7 @@ void cmLocalGenerator::ComputeTargetManifest()
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
cmGeneratorTarget* target = *t;
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
for (std::vector<std::string>::iterator ci = configNames.begin();
@@ -480,330 +565,11 @@ cmState* cmLocalGenerator::GetState() const
return this->GlobalGenerator->GetCMakeInstance()->GetState();
}
-cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
+cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
{
return this->Makefile->GetStateSnapshot();
}
-// List of variables that are replaced when
-// rules are expanced. These variables are
-// replaced in the form <var> with GetSafeDefinition(var).
-// ${LANG} is replaced in the variable first with all enabled
-// languages.
-static const char* ruleReplaceVars[] = {
- "CMAKE_${LANG}_COMPILER",
- "CMAKE_SHARED_LIBRARY_CREATE_${LANG}_FLAGS",
- "CMAKE_SHARED_MODULE_CREATE_${LANG}_FLAGS",
- "CMAKE_SHARED_MODULE_${LANG}_FLAGS",
- "CMAKE_SHARED_LIBRARY_${LANG}_FLAGS",
- "CMAKE_${LANG}_LINK_FLAGS",
- "CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG",
- "CMAKE_${LANG}_ARCHIVE",
- "CMAKE_AR",
- "CMAKE_CURRENT_SOURCE_DIR",
- "CMAKE_CURRENT_BINARY_DIR",
- "CMAKE_RANLIB",
- "CMAKE_LINKER",
- "CMAKE_CL_SHOWINCLUDES_PREFIX",
- CM_NULLPTR
-};
-
-std::string cmLocalGenerator::ExpandRuleVariable(
- std::string const& variable, const RuleVariables& replaceValues)
-{
- if (replaceValues.LinkFlags) {
- if (variable == "LINK_FLAGS") {
- return replaceValues.LinkFlags;
- }
- }
- if (replaceValues.Manifests) {
- if (variable == "MANIFESTS") {
- return replaceValues.Manifests;
- }
- }
- if (replaceValues.Flags) {
- if (variable == "FLAGS") {
- return replaceValues.Flags;
- }
- }
-
- if (replaceValues.Source) {
- if (variable == "SOURCE") {
- return replaceValues.Source;
- }
- }
- if (replaceValues.PreprocessedSource) {
- if (variable == "PREPROCESSED_SOURCE") {
- return replaceValues.PreprocessedSource;
- }
- }
- if (replaceValues.AssemblySource) {
- if (variable == "ASSEMBLY_SOURCE") {
- return replaceValues.AssemblySource;
- }
- }
- if (replaceValues.Object) {
- if (variable == "OBJECT") {
- return replaceValues.Object;
- }
- }
- if (replaceValues.ObjectDir) {
- if (variable == "OBJECT_DIR") {
- return replaceValues.ObjectDir;
- }
- }
- if (replaceValues.ObjectFileDir) {
- if (variable == "OBJECT_FILE_DIR") {
- return replaceValues.ObjectFileDir;
- }
- }
- if (replaceValues.Objects) {
- if (variable == "OBJECTS") {
- return replaceValues.Objects;
- }
- }
- if (replaceValues.ObjectsQuoted) {
- if (variable == "OBJECTS_QUOTED") {
- return replaceValues.ObjectsQuoted;
- }
- }
- if (replaceValues.Defines && variable == "DEFINES") {
- return replaceValues.Defines;
- }
- if (replaceValues.Includes && variable == "INCLUDES") {
- return replaceValues.Includes;
- }
- if (replaceValues.TargetPDB) {
- if (variable == "TARGET_PDB") {
- return replaceValues.TargetPDB;
- }
- }
- if (replaceValues.TargetCompilePDB) {
- if (variable == "TARGET_COMPILE_PDB") {
- return replaceValues.TargetCompilePDB;
- }
- }
- if (replaceValues.DependencyFile) {
- if (variable == "DEP_FILE") {
- return replaceValues.DependencyFile;
- }
- }
-
- if (replaceValues.Target) {
- if (variable == "TARGET_QUOTED") {
- std::string targetQuoted = replaceValues.Target;
- if (!targetQuoted.empty() && targetQuoted[0] != '\"') {
- targetQuoted = '\"';
- targetQuoted += replaceValues.Target;
- targetQuoted += '\"';
- }
- return targetQuoted;
- }
- if (variable == "TARGET_UNQUOTED") {
- std::string unquoted = replaceValues.Target;
- std::string::size_type sz = unquoted.size();
- if (sz > 2 && unquoted[0] == '\"' && unquoted[sz - 1] == '\"') {
- unquoted = unquoted.substr(1, sz - 2);
- }
- return unquoted;
- }
- if (replaceValues.LanguageCompileFlags) {
- if (variable == "LANGUAGE_COMPILE_FLAGS") {
- return replaceValues.LanguageCompileFlags;
- }
- }
- if (replaceValues.Target) {
- if (variable == "TARGET") {
- return replaceValues.Target;
- }
- }
- if (variable == "TARGET_IMPLIB") {
- return this->TargetImplib;
- }
- if (variable == "TARGET_VERSION_MAJOR") {
- if (replaceValues.TargetVersionMajor) {
- return replaceValues.TargetVersionMajor;
- }
- return "0";
- }
- if (variable == "TARGET_VERSION_MINOR") {
- if (replaceValues.TargetVersionMinor) {
- return replaceValues.TargetVersionMinor;
- }
- return "0";
- }
- if (replaceValues.Target) {
- if (variable == "TARGET_BASE") {
- // Strip the last extension off the target name.
- std::string targetBase = replaceValues.Target;
- std::string::size_type pos = targetBase.rfind('.');
- if (pos != targetBase.npos) {
- return targetBase.substr(0, pos);
- }
- return targetBase;
- }
- }
- }
- if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
- variable == "TARGET_INSTALLNAME_DIR") {
- // All these variables depend on TargetSOName
- if (replaceValues.TargetSOName) {
- if (variable == "TARGET_SONAME") {
- return replaceValues.TargetSOName;
- }
- if (variable == "SONAME_FLAG" && replaceValues.SONameFlag) {
- return replaceValues.SONameFlag;
- }
- if (replaceValues.TargetInstallNameDir &&
- variable == "TARGET_INSTALLNAME_DIR") {
- return replaceValues.TargetInstallNameDir;
- }
- }
- return "";
- }
- if (replaceValues.LinkLibraries) {
- if (variable == "LINK_LIBRARIES") {
- return replaceValues.LinkLibraries;
- }
- }
- if (replaceValues.Language) {
- if (variable == "LANGUAGE") {
- return replaceValues.Language;
- }
- }
- if (replaceValues.CMTarget) {
- if (variable == "TARGET_NAME") {
- return replaceValues.CMTarget->GetName();
- }
- if (variable == "TARGET_TYPE") {
- return cmState::GetTargetTypeName(replaceValues.CMTarget->GetType());
- }
- }
- if (replaceValues.Output) {
- if (variable == "OUTPUT") {
- return replaceValues.Output;
- }
- }
- if (variable == "CMAKE_COMMAND") {
- return this->ConvertToOutputFormat(
- cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
- SHELL);
- }
- std::vector<std::string> enabledLanguages =
- this->GetState()->GetEnabledLanguages();
- // loop over language specific replace variables
- int pos = 0;
- while (ruleReplaceVars[pos]) {
- for (std::vector<std::string>::iterator i = enabledLanguages.begin();
- i != enabledLanguages.end(); ++i) {
- const char* lang = i->c_str();
- 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 = 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);
- compilerArg1 = this->Makefile->GetDefinition(arg1);
- compilerTarget = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang + "_COMPILER_TARGET");
- compilerOptionTarget = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang + "_COMPILE_OPTIONS_TARGET");
- compilerExternalToolchain = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang + "_COMPILER_EXTERNAL_TOOLCHAIN");
- compilerOptionExternalToolchain =
- this->Makefile->GetDefinition(std::string("CMAKE_") + lang +
- "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN");
- compilerSysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
- compilerOptionSysroot = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang + "_COMPILE_OPTIONS_SYSROOT");
- }
- if (actualReplace.find("${LANG}") != actualReplace.npos) {
- cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
- }
- if (actualReplace == variable) {
- std::string replace = this->Makefile->GetSafeDefinition(variable);
- // if the variable is not a FLAG then treat it like a path
- if (variable.find("_FLAG") == variable.npos) {
- std::string ret = this->ConvertToOutputForExisting(replace);
- // if there is a required first argument to the compiler add it
- // to the compiler string
- if (compilerArg1) {
- ret += " ";
- ret += compilerArg1;
- }
- if (compilerTarget && compilerOptionTarget) {
- ret += " ";
- ret += compilerOptionTarget;
- ret += compilerTarget;
- }
- if (compilerExternalToolchain && compilerOptionExternalToolchain) {
- ret += " ";
- ret += compilerOptionExternalToolchain;
- ret += this->EscapeForShell(compilerExternalToolchain, true);
- }
- if (compilerSysroot && compilerOptionSysroot) {
- ret += " ";
- ret += compilerOptionSysroot;
- ret += this->EscapeForShell(compilerSysroot, true);
- }
- return ret;
- }
- return replace;
- }
- }
- pos++;
- }
- return variable;
-}
-
-void cmLocalGenerator::ExpandRuleVariables(std::string& s,
- const RuleVariables& replaceValues)
-{
- if (replaceValues.RuleLauncher) {
- this->InsertRuleLauncher(s, replaceValues.CMTarget,
- replaceValues.RuleLauncher);
- }
- std::string::size_type start = s.find('<');
- // no variables to expand
- if (start == s.npos) {
- return;
- }
- std::string::size_type pos = 0;
- std::string expandedInput;
- while (start != s.npos && start < s.size() - 2) {
- std::string::size_type end = s.find('>', start);
- // if we find a < with no > we are done
- if (end == s.npos) {
- return;
- }
- char c = s[start + 1];
- // if the next char after the < is not A-Za-z then
- // skip it and try to find the next < in the string
- if (!isalpha(c)) {
- start = s.find('<', start + 1);
- } else {
- // extract the var
- std::string var = s.substr(start + 1, end - start - 1);
- std::string replace = this->ExpandRuleVariable(var, replaceValues);
- expandedInput += s.substr(pos, start - pos);
- expandedInput += replace;
- // move to next one
- start = s.find('<', start + var.size() + 2);
- pos = end + 1;
- }
- }
- // add the rest of the input
- expandedInput += s.substr(pos, s.size() - pos);
- s = expandedInput;
-}
-
const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop)
{
@@ -813,17 +579,6 @@ const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
return this->Makefile->GetProperty(prop);
}
-void cmLocalGenerator::InsertRuleLauncher(std::string& s,
- cmGeneratorTarget* target,
- const std::string& prop)
-{
- if (const char* val = this->GetRuleLauncher(target, prop)) {
- std::ostringstream wrapped;
- wrapped << val << " " << s;
- s = wrapped.str();
- }
-}
-
std::string cmLocalGenerator::ConvertToIncludeReference(
std::string const& path, OutputFormat format, bool forceFullPaths)
{
@@ -1148,21 +903,22 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
}
void cmLocalGenerator::GetTargetFlags(
- const std::string& config, std::string& linkLibs, std::string& flags,
- std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
- cmGeneratorTarget* target, bool useWatcomQuote)
+ cmLinkLineComputer* linkLineComputer, const std::string& config,
+ std::string& linkLibs, std::string& flags, std::string& linkFlags,
+ std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target)
{
const std::string buildType = cmSystemTools::UpperCase(config);
+ cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
switch (target->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, target);
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
- case cmState::SHARED_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY: {
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
if (!buildType.empty()) {
@@ -1176,12 +932,13 @@ void cmLocalGenerator::GetTargetFlags(
!(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) {
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, buildType);
+ std::string defFlag =
+ this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
for (std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i) {
cmSourceFile* sf = *i;
if (sf->GetExtension() == "def") {
- linkFlags +=
- this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
+ linkFlags += defFlag;
linkFlags += this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL);
linkFlags += " ";
@@ -1202,10 +959,12 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
}
- this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
- false, false, useWatcomQuote);
+ if (pcli) {
+ this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath);
+ }
} break;
- case cmState::EXECUTABLE: {
+ case cmStateEnums::EXECUTABLE: {
linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if (!buildType.empty()) {
@@ -1222,8 +981,10 @@ void cmLocalGenerator::GetTargetFlags(
return;
}
this->AddLanguageFlags(flags, linkLanguage, buildType);
- this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
- false, false, useWatcomQuote);
+ if (pcli) {
+ this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath);
+ }
if (cmSystemTools::IsOn(
this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
@@ -1248,6 +1009,14 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar);
linkFlags += " ";
}
+
+ std::string cmp0065Flags =
+ this->GetLinkLibsCMP0065(linkLanguage, *target);
+ if (!cmp0065Flags.empty()) {
+ linkFlags += cmp0065Flags;
+ linkFlags += " ";
+ }
+
const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
linkFlags += targetLinkFlags;
@@ -1374,63 +1143,18 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
return std::string();
}
-std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
- OutputFormat format)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
- // Work-ardound command line parsing limitations in MSVC 6.0
- if (this->Makefile->IsOn("MSVC60")) {
- // Search for the last space.
- std::string::size_type pos = lib.rfind(' ');
- if (pos != lib.npos) {
- // Find the slash after the last space, if any.
- pos = lib.find('/', pos);
-
- // Convert the portion of the path with a space to a short path.
- std::string sp;
- if (cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) {
- // Append the rest of the path with no space.
- sp += lib.substr(pos);
-
- // Convert to an output path.
- return this->ConvertToOutputFormat(sp.c_str(), format);
- }
- }
- }
-#endif
-
- // Normal behavior.
- return this->ConvertToOutputFormat(
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib),
- format);
-}
-
/**
* Output the linking rules on a command line. For executables,
* targetLibrary should be a NULL pointer. For libraries, it should point
* to the name of the library. This will not link a library against itself.
*/
-void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
- std::string& frameworkPath,
- std::string& linkPath,
- cmGeneratorTarget& tgt, bool relink,
- bool forResponseFile,
- bool useWatcomQuote)
-{
- OutputFormat shellFormat =
- (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
- bool escapeAllowMakeVars = !forResponseFile;
- std::ostringstream fout;
- std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
- if (!pcli) {
- return;
- }
+void cmLocalGenerator::OutputLinkLibraries(
+ cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
+ std::string& linkLibraries, std::string& frameworkPath,
+ std::string& linkPath)
+{
cmComputeLinkInformation& cli = *pcli;
- // Collect library linking flags command line options.
- std::string linkLibs;
-
std::string linkLanguage = cli.GetLinkLanguage();
std::string libPathFlag =
@@ -1438,8 +1162,36 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
std::string libPathTerminator =
this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
+ // Add standard libraries for this language.
+ std::string standardLibsVar = "CMAKE_";
+ standardLibsVar += cli.GetLinkLanguage();
+ standardLibsVar += "_STANDARD_LIBRARIES";
+ std::string stdLibString;
+ if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
+ stdLibString = stdLibs;
+ }
+
+ // Append the framework search path flags.
+ std::string fwSearchFlagVar = "CMAKE_";
+ fwSearchFlagVar += linkLanguage;
+ fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
+ std::string fwSearchFlag =
+ this->Makefile->GetSafeDefinition(fwSearchFlagVar);
+
+ frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag);
+ linkPath =
+ linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator);
+
+ linkLibraries = linkLineComputer->ComputeLinkLibraries(cli, stdLibString);
+}
+
+std::string cmLocalGenerator::GetLinkLibsCMP0065(
+ std::string const& linkLanguage, cmGeneratorTarget& tgt) const
+{
+ std::string linkFlags;
+
// Flags to link an executable to shared libraries.
- if (tgt.GetType() == cmState::EXECUTABLE &&
+ if (tgt.GetType() == cmStateEnums::EXECUTABLE &&
this->StateSnapshot.GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS")) {
bool add_shlib_flags = false;
@@ -1476,100 +1228,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
linkFlagsVar += linkLanguage;
linkFlagsVar += "_FLAGS";
- linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar);
- linkLibs += " ";
- }
- }
-
- // Append the framework search path flags.
- std::string fwSearchFlagVar = "CMAKE_";
- fwSearchFlagVar += linkLanguage;
- fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
- if (fwSearchFlag && *fwSearchFlag) {
- std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
- for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
- fdi != fwDirs.end(); ++fdi) {
- frameworkPath += fwSearchFlag;
- frameworkPath += this->ConvertToOutputFormat(*fdi, shellFormat);
- frameworkPath += " ";
- }
- }
-
- // Append the library search path flags.
- std::vector<std::string> const& libDirs = cli.GetDirectories();
- for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
- libDir != libDirs.end(); ++libDir) {
- std::string libpath =
- this->ConvertToOutputForExisting(*libDir, shellFormat);
- linkPath += " " + libPathFlag;
- linkPath += libpath;
- linkPath += libPathTerminator;
- linkPath += " ";
- }
-
- // Append the link items.
- typedef cmComputeLinkInformation::ItemVector ItemVector;
- ItemVector const& items = cli.GetItems();
- for (ItemVector::const_iterator li = items.begin(); li != items.end();
- ++li) {
- if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
- continue;
+ linkFlags = this->Makefile->GetSafeDefinition(linkFlagsVar);
}
- if (li->IsPath) {
- linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
- } else {
- linkLibs += li->Value;
- }
- linkLibs += " ";
}
-
- // Check what kind of rpath flags to use.
- if (cli.GetRuntimeSep().empty()) {
- // Each rpath entry gets its own option ("-R a -R b -R c")
- std::vector<std::string> runtimeDirs;
- cli.GetRPath(runtimeDirs, relink);
-
- std::string rpath;
- for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
- ri != runtimeDirs.end(); ++ri) {
- rpath += cli.GetRuntimeFlag();
- rpath += this->ConvertToOutputFormat(*ri, shellFormat);
- rpath += " ";
- }
- fout << rpath;
- } else {
- // All rpath entries are combined ("-Wl,-rpath,a:b:c").
- std::string rpath = cli.GetRPathString(relink);
-
- // Store the rpath option in the stream.
- if (!rpath.empty()) {
- fout << cli.GetRuntimeFlag();
- fout << this->EscapeForShell(rpath, escapeAllowMakeVars);
- fout << " ";
- }
- }
-
- // Write the library flags to the build rule.
- fout << linkLibs;
-
- // Add the linker runtime search path if any.
- std::string rpath_link = cli.GetRPathLinkString();
- if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
- fout << cli.GetRPathLinkFlag();
- fout << this->EscapeForShell(rpath_link, escapeAllowMakeVars);
- fout << " ";
- }
-
- // Add standard libraries for this language.
- std::string standardLibsVar = "CMAKE_";
- standardLibsVar += cli.GetLinkLanguage();
- standardLibsVar += "_STANDARD_LIBRARIES";
- if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
- fout << stdLibs << " ";
- }
-
- linkLibraries = fout.str();
+ return linkFlags;
}
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
@@ -1674,8 +1336,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// found is part of the inName
if (cmSystemTools::FileIsFullPath(inName.c_str())) {
std::string tLocation;
- if (target->GetType() >= cmState::EXECUTABLE &&
- target->GetType() <= cmState::MODULE_LIBRARY) {
+ if (target->GetType() >= cmStateEnums::EXECUTABLE &&
+ target->GetType() <= cmStateEnums::MODULE_LIBRARY) {
tLocation = target->GetLocation(config);
tLocation = cmSystemTools::GetFilenamePath(tLocation);
tLocation = cmSystemTools::CollapseFullPath(tLocation);
@@ -1692,23 +1354,23 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
}
}
switch (target->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
dep = target->GetLocation(config);
return true;
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
// An object library has no single file on which to depend.
// This was listed to get the target-level dependency.
return false;
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
// An interface library has no file on which to depend.
// This was listed to get the target-level dependency.
return false;
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
// A utility target has no file on which to depend. This was listed
// only to get the target-level dependency.
return false;
@@ -1924,8 +1586,8 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
std::string warnCMP0063;
std::string* pWarnCMP0063 = CM_NULLPTR;
- if (target->GetType() != cmState::SHARED_LIBRARY &&
- target->GetType() != cmState::MODULE_LIBRARY &&
+ if (target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ target->GetType() != cmStateEnums::MODULE_LIBRARY &&
!target->IsExecutableWithExports()) {
switch (target->GetPolicyStatusCMP0063()) {
case cmPolicies::OLD:
@@ -1967,13 +1629,13 @@ void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
{
int targetType = target->GetType();
- bool shared = ((targetType == cmState::SHARED_LIBRARY) ||
- (targetType == cmState::MODULE_LIBRARY));
+ bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) ||
+ (targetType == cmStateEnums::MODULE_LIBRARY));
if (this->GetShouldUseOldFlags(shared, lang)) {
this->AddSharedFlags(flags, lang, shared);
} else {
- if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) {
this->AddPositionIndependentFlags(flags, lang, targetType);
}
@@ -2036,7 +1698,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
{
const char* picFlags = CM_NULLPTR;
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
std::string flagsVar = "CMAKE_";
flagsVar += lang;
flagsVar += "_COMPILE_OPTIONS_PIE";
@@ -2208,7 +1870,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
featureName += "_";
featureName += cmSystemTools::UpperCase(config);
}
- cmState::Snapshot snp = this->StateSnapshot;
+ cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) {
if (const char* value = snp.GetDirectory().GetProperty(featureName)) {
return value;
@@ -2273,7 +1935,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l) {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
@@ -2296,15 +1958,15 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Generate the proper install generator for this target type.
switch ((*l)->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::STATIC_LIBRARY:
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY: {
// Use a target install generator.
cmInstallTargetGeneratorLocal g(this, (*l)->GetName(),
destination.c_str(), false);
g.Generate(os, config, configurationTypes);
} break;
- case cmState::SHARED_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY: {
#if defined(_WIN32) || defined(__CYGWIN__)
// Special code to handle DLL. Install the import library
// to the normal destination and the DLL to the runtime
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 19469be..6314aff 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -8,7 +8,8 @@
#include "cmListFileCache.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmRulePlaceholderExpander.h"
+#include "cmStateTypes.h"
#include "cmake.h"
#include <cm_kwiml.h>
@@ -19,11 +20,14 @@
#include <string>
#include <vector>
+class cmComputeLinkInformation;
class cmCustomCommandGenerator;
class cmGeneratorTarget;
class cmGlobalGenerator;
+class cmRulePlaceholderExpander;
class cmMakefile;
class cmSourceFile;
+class cmLinkLineComputer;
/** \class cmLocalGenerator
* \brief Create required build files for a directory.
@@ -82,8 +86,13 @@ public:
return this->GlobalGenerator;
}
+ virtual cmRulePlaceholderExpander* CreateRulePlaceholderExpander() const;
+
+ std::string GetLinkLibsCMP0065(std::string const& linkLanguage,
+ cmGeneratorTarget& tgt) const;
+
cmState* GetState() const;
- cmState::Snapshot GetStateSnapshot() const;
+ cmStateSnapshot GetStateSnapshot() const;
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
@@ -212,42 +221,6 @@ public:
// preprocessed files and assembly files.
void GetIndividualFileTargets(std::vector<std::string>&) {}
- // Create a struct to hold the varibles passed into
- // ExpandRuleVariables
- struct RuleVariables
- {
- RuleVariables() { memset(this, 0, sizeof(*this)); }
- cmGeneratorTarget* CMTarget;
- const char* TargetPDB;
- const char* TargetCompilePDB;
- const char* TargetVersionMajor;
- const char* TargetVersionMinor;
- const char* Language;
- const char* Objects;
- const char* Target;
- const char* LinkLibraries;
- const char* Source;
- const char* AssemblySource;
- const char* PreprocessedSource;
- const char* Output;
- const char* Object;
- const char* ObjectDir;
- const char* ObjectFileDir;
- const char* Flags;
- const char* ObjectsQuoted;
- const char* SONameFlag;
- const char* TargetSOName;
- const char* TargetInstallNameDir;
- const char* LinkFlags;
- const char* Manifests;
- const char* LanguageCompileFlags;
- const char* Defines;
- const char* Includes;
- const char* RuleLauncher;
- const char* DependencyFile;
- const char* FilterPrefix;
- };
-
/**
* Get the relative path from the generator output directory to a
* per-target support directory.
@@ -309,10 +282,11 @@ public:
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
- void GetTargetFlags(const std::string& config, std::string& linkLibs,
+ void GetTargetFlags(cmLinkLineComputer* linkLineComputer,
+ const std::string& config, std::string& linkLibs,
std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath,
- cmGeneratorTarget* target, bool useWatcomQuote);
+ cmGeneratorTarget* target);
void GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config, std::string const& lang,
std::set<std::string>& defines) const;
@@ -340,24 +314,15 @@ public:
void CreateEvaluationFileOutputs(const std::string& config);
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
-protected:
- ///! put all the libraries for a target on into the given stream
- void OutputLinkLibraries(std::string& linkLibraries,
- std::string& frameworkPath, std::string& linkPath,
- cmGeneratorTarget&, bool relink,
- bool forResponseFile, bool useWatcomQuote);
-
- // Expand rule variables in CMake of the type found in language rules
- void ExpandRuleVariables(std::string& string,
- const RuleVariables& replaceValues);
- // Expand rule variables in a single string
- std::string ExpandRuleVariable(std::string const& variable,
- const RuleVariables& replaceValues);
-
const char* GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop);
- void InsertRuleLauncher(std::string& s, cmGeneratorTarget* target,
- const std::string& prop);
+
+protected:
+ ///! put all the libraries for a target on into the given stream
+ void OutputLinkLibraries(cmComputeLinkInformation* pcli,
+ cmLinkLineComputer* linkLineComputer,
+ std::string& linkLibraries,
+ std::string& frameworkPath, std::string& linkPath);
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
@@ -367,16 +332,12 @@ protected:
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
- virtual std::string ConvertToLinkReference(
- std::string const& lib,
- cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
-
/** Check whether the native build system supports the given
definition. Issues a warning. */
virtual bool CheckDefinition(std::string const& define) const;
cmMakefile* Makefile;
- cmState::Snapshot StateSnapshot;
+ cmStateSnapshot StateSnapshot;
cmListFileBacktrace DirectoryBacktrace;
cmGlobalGenerator* GlobalGenerator;
std::map<std::string, std::string> UniqueObjectNamesMap;
@@ -389,11 +350,11 @@ protected:
std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;
- bool EmitUniversalBinaryFlags;
+ std::map<std::string, std::string> Compilers;
+ std::map<std::string, std::string> VariableMappings;
+ std::string CompilerSysroot;
- // Hack for ExpandRuleVariable until object-oriented version is
- // committed.
- std::string TargetImplib;
+ bool EmitUniversalBinaryFlags;
KWIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 157b32e..5f37af5 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -24,7 +24,7 @@ void cmLocalGhsMultiGenerator::Generate()
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l) {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
cmGhsMultiTargetGenerator tg(*l);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 11b87e3..cd9af54 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -10,8 +10,10 @@
#include "cmGlobalNinjaGenerator.h"
#include "cmMakefile.h"
#include "cmNinjaTargetGenerator.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -27,11 +29,19 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
: cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory())
, HomeRelativeOutputPath("")
{
- this->TargetImplib = "$TARGET_IMPLIB";
}
// Virtual public methods.
+cmRulePlaceholderExpander*
+cmLocalNinjaGenerator::CreateRulePlaceholderExpander() const
+{
+ cmRulePlaceholderExpander* ret = new cmRulePlaceholderExpander(
+ this->Compilers, this->VariableMappings, this->CompilerSysroot);
+ ret->SetTargetImpLib("$TARGET_IMPLIB");
+ return ret;
+}
+
cmLocalNinjaGenerator::~cmLocalNinjaGenerator()
{
}
@@ -72,7 +82,7 @@ void cmLocalNinjaGenerator::Generate()
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
- if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t);
@@ -120,13 +130,6 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
-std::string cmLocalNinjaGenerator::ConvertToLinkReference(
- std::string const& lib, cmOutputConverter::OutputFormat format)
-{
- std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
- return this->ConvertToOutputFormat(path, format);
-}
-
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
std::string const& path, cmOutputConverter::OutputFormat format,
bool forceFullPaths)
@@ -475,8 +478,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
std::string cmLocalNinjaGenerator::MakeCustomLauncher(
cmCustomCommandGenerator const& ccg)
{
- const char* property = "RULE_LAUNCH_CUSTOM";
- const char* property_value = this->Makefile->GetProperty(property);
+ const char* property_value =
+ this->Makefile->GetProperty("RULE_LAUNCH_CUSTOM");
if (!property_value || !*property_value) {
return std::string();
@@ -484,25 +487,27 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
// Expand rules in the empty string. It may insert the launcher and
// perform replacements.
- RuleVariables vars;
- vars.RuleLauncher = property;
+ cmRulePlaceholderExpander::RuleVariables vars;
+
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
+ output = outputs[0];
if (ccg.GetWorkingDirectory().empty()) {
- output = this->ConvertToOutputFormat(
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
- outputs[0]),
- cmOutputConverter::SHELL);
- } else {
output =
- this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL);
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), output);
}
+ output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
- std::string launcher;
- this->ExpandRuleVariables(launcher, vars);
+ std::string launcher = property_value;
+ launcher += " ";
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->CreateRulePlaceholderExpander());
+
+ rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) {
launcher += " ";
}
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 875f8c6..95d8eb8 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -42,6 +42,8 @@ public:
void Generate() CM_OVERRIDE;
+ cmRulePlaceholderExpander* CreateRulePlaceholderExpander() const CM_OVERRIDE;
+
std::string GetTargetDirectory(cmGeneratorTarget const* target) const
CM_OVERRIDE;
@@ -58,12 +60,6 @@ public:
return this->HomeRelativeOutputPath;
}
- void ExpandRuleVariables(std::string& string,
- const RuleVariables& replaceValues)
- {
- cmLocalGenerator::ExpandRuleVariables(string, replaceValues);
- }
-
std::string BuildCommandLine(const std::vector<std::string>& cmdLines);
void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs);
@@ -76,10 +72,6 @@ public:
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
cmNinjaDeps& ninjaDeps);
- std::string ConvertToLinkReference(std::string const& lib,
- cmOutputConverter::OutputFormat format =
- cmOutputConverter::SHELL) CM_OVERRIDE;
-
void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8825b46..4f81ef1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -14,8 +14,11 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -119,7 +122,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
- if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
CM_AUTO_PTR<cmMakefileTargetGenerator> tg(
@@ -141,7 +144,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath = this->ConvertToRelativePath(
+ this->HomeRelativeOutputPath = this->MaybeConvertToRelativePath(
this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
@@ -171,7 +174,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) {
cmGeneratorTarget* gt = *ti;
- if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
std::vector<cmSourceFile const*> objectSources;
@@ -230,7 +233,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// Open the rule file. This should be copy-if-different because the
// rules may depend on this file itself.
std::string ruleFileNameFull = this->ConvertToFullPath(ruleFileName);
- cmGeneratedFileStream ruleFileStream(ruleFileNameFull.c_str());
+ cmGeneratedFileStream ruleFileStream(
+ ruleFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
if (!ruleFileStream) {
return;
}
@@ -379,12 +384,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
std::string localName;
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
- if (((*t)->GetType() == cmState::EXECUTABLE) ||
- ((*t)->GetType() == cmState::STATIC_LIBRARY) ||
- ((*t)->GetType() == cmState::SHARED_LIBRARY) ||
- ((*t)->GetType() == cmState::MODULE_LIBRARY) ||
- ((*t)->GetType() == cmState::OBJECT_LIBRARY) ||
- ((*t)->GetType() == cmState::UTILITY)) {
+ if (((*t)->GetType() == cmStateEnums::EXECUTABLE) ||
+ ((*t)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+ ((*t)->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+ ((*t)->GetType() == cmStateEnums::MODULE_LIBRARY) ||
+ ((*t)->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+ ((*t)->GetType() == cmStateEnums::UTILITY)) {
emitted.insert((*t)->GetName());
// for subdirs add a rule to build this specific target by name.
@@ -548,7 +553,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
// Construct the left hand side of the rule.
std::string tgt = cmSystemTools::ConvertToOutputPath(
- this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str());
+ this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target)
+ .c_str());
const char* space = "";
if (tgt.size() == 1) {
@@ -577,7 +583,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
dep != depends.end(); ++dep) {
replace = *dep;
replace = cmSystemTools::ConvertToOutputPath(
- this->ConvertToRelativePath(binDir, replace).c_str());
+ this->MaybeConvertToRelativePath(binDir, replace).c_str());
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -942,6 +948,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
*content << dir;
}
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->CreateRulePlaceholderExpander());
+
// Add each command line to the set of commands.
std::vector<std::string> commands1;
std::string currentBinDir = this->GetCurrentBinaryDirectory();
@@ -969,7 +978,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != cmd.npos;
if (workingDir.empty()) {
- cmd = this->ConvertToRelativePath(currentBinDir, cmd);
+ cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
}
bool has_slash = cmd.find('/') != cmd.npos;
if (had_slash && !has_slash) {
@@ -981,31 +990,29 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::string launcher;
// Short-circuit if there is no launcher.
- const char* prop = "RULE_LAUNCH_CUSTOM";
- const char* val = this->GetRuleLauncher(target, prop);
+ const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM");
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;
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.CMTargetName = target->GetName().c_str();
+ vars.CMTargetType = cmState::GetTargetTypeName(target->GetType());
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
+ output = outputs[0];
if (workingDir.empty()) {
- output = this->ConvertToOutputFormat(
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
- outputs[0]),
- cmOutputConverter::SHELL);
-
- } else {
- output = this->ConvertToOutputFormat(outputs[0],
- cmOutputConverter::SHELL);
+ output = this->MaybeConvertToRelativePath(
+ this->GetCurrentBinaryDirectory(), output);
}
+ output =
+ this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
- this->ExpandRuleVariables(launcher, vars);
+ launcher = val;
+ launcher += " ";
+ rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) {
launcher += " ";
}
@@ -1082,14 +1089,15 @@ 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->ConvertToRelativePath(currentBinDir, *f);
+ std::string fc = this->MaybeConvertToRelativePath(currentBinDir, *f);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
std::string remove = "$(CMAKE_COMMAND) -P ";
remove += this->ConvertToOutputFormat(
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile),
+ this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+ cleanfile),
cmOutputConverter::SHELL);
commands.push_back(remove);
@@ -1415,7 +1423,9 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// because the make tool may try to reload it needlessly otherwise.
std::string ruleFileNameFull = dir;
ruleFileNameFull += "/depend.make";
- cmGeneratedFileStream ruleFileStream(ruleFileNameFull.c_str());
+ cmGeneratedFileStream ruleFileStream(
+ ruleFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
ruleFileStream.SetCopyIfDifferent(true);
if (!ruleFileStream) {
return false;
@@ -1427,7 +1437,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
std::string internalRuleFileNameFull = dir;
internalRuleFileNameFull += "/depend.internal";
cmGeneratedFileStream internalRuleFileStream(
- internalRuleFileNameFull.c_str());
+ internalRuleFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
if (!internalRuleFileStream) {
return false;
}
@@ -1549,7 +1560,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
std::vector<cmGeneratorTarget*>::iterator glIt;
for (glIt = targets.begin(); glIt != targets.end(); ++glIt) {
- if ((*glIt)->GetType() == cmState::GLOBAL_TARGET) {
+ if ((*glIt)->GetType() == cmStateEnums::GLOBAL_TARGET) {
std::string targetString =
"Special rule for the target " + (*glIt)->GetName();
std::vector<std::string> commands;
@@ -1858,7 +1869,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
}
for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) {
- cmakefileStream << " \"" << this->ConvertToRelativePath(binaryDir, *i)
+ cmakefileStream << " \""
+ << this->MaybeConvertToRelativePath(binaryDir, *i)
<< "\"\n";
}
cmakefileStream << " )\n";
@@ -1923,7 +1935,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
if (!tgt.empty()) {
// The make target is always relative to the top of the build tree.
std::string tgt2 =
- this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt);
+ this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), tgt);
// The target may have been written with windows paths.
cmSystemTools::ConvertToOutputSlashes(tgt2);
@@ -2095,3 +2107,13 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
std::bind1st(std::plus<std::string>(), prefix));
}
}
+
+std::string cmLocalUnixMakefileGenerator3::MaybeConvertToRelativePath(
+ std::string const& base, std::string const& path)
+{
+ if (!cmOutputConverter::ContainedInDirectory(
+ base, path, this->GetStateSnapshot().GetDirectory())) {
+ return path;
+ }
+ return cmOutputConverter::ForceToRelativePath(base, path);
+}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index fc5c8e7..c3ecda4 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -184,6 +184,9 @@ public:
// Eclipse generator.
void GetIndividualFileTargets(std::vector<std::string>& targets);
+ std::string MaybeConvertToRelativePath(std::string const& base,
+ std::string const& path);
+
protected:
void WriteLocalMakefile();
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 6f9f009..0516bdf 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -63,7 +63,7 @@ void cmLocalVisualStudio10Generator::Generate()
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l) {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
@@ -95,7 +95,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID(
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a4b28b5..7c32e6c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -64,7 +64,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l) {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT");
@@ -93,7 +93,7 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l) {
- if ((*l)->GetType() == cmState::GLOBAL_TARGET) {
+ if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
if ((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
@@ -112,7 +112,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) {
- if ((*l)->GetType() == cmState::GLOBAL_TARGET) {
+ if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) {
std::vector<std::string> no_depends;
cmCustomCommandLine force_command;
force_command.push_back("cd");
@@ -154,7 +154,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
// Create the project file for each target.
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
@@ -615,22 +615,22 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
bool targetBuilds = true;
switch (target->GetType()) {
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
targetBuilds = false; // no manifest tool for object library
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
projectType = "typeStaticLibrary";
configType = "4";
break;
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
projectType = "typeDynamicLibrary";
configType = "2";
break;
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
configType = "1";
break;
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
configType = "10";
default:
targetBuilds = false;
@@ -725,8 +725,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
intermediateDir += "/";
intermediateDir += configName;
- if (target->GetType() < cmState::UTILITY) {
- std::string const& outDir = target->GetType() == cmState::OBJECT_LIBRARY
+ if (target->GetType() < cmStateEnums::UTILITY) {
+ std::string const& outDir =
+ target->GetType() == cmStateEnums::OBJECT_LIBRARY
? intermediateDir
: target->GetDirectory(configName);
/* clang-format off */
@@ -810,7 +811,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
targetOptions.OutputFlagMap(fout, "\t\t\t\t");
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX");
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
- if (target->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
// Specify the compiler program database file if configured.
std::string pdb = target->GetCompilePDBPath(configName);
if (!pdb.empty()) {
@@ -959,19 +960,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
std::string temp;
std::string extraLinkOptions;
- if (target->GetType() == cmState::EXECUTABLE) {
+ if (target->GetType() == cmStateEnums::EXECUTABLE) {
extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") +
std::string(" ") +
GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName);
}
- if (target->GetType() == cmState::SHARED_LIBRARY) {
+ if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") +
std::string(" ") +
GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName);
}
- if (target->GetType() == cmState::MODULE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::MODULE_LIBRARY) {
extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") +
std::string(" ") +
@@ -1004,7 +1005,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
- if ((target->GetType() == cmState::SHARED_LIBRARY ||
+ if ((target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
@@ -1012,9 +1013,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
switch (target->GetType()) {
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
break;
- case cmState::OBJECT_LIBRARY: {
+ case cmStateEnums::OBJECT_LIBRARY: {
std::string libpath = this->GetTargetDirectory(target);
libpath += "/";
libpath += configName;
@@ -1029,7 +1030,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n";
break;
}
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
std::string targetNameFull = target->GetFullName(configName);
std::string libpath = target->GetDirectory(configName);
libpath += "/";
@@ -1059,8 +1060,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n";
break;
}
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY: {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY: {
std::string targetName;
std::string targetNameSO;
std::string targetNameFull;
@@ -1145,7 +1146,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
fout << "/>\n";
} break;
- case cmState::EXECUTABLE: {
+ case cmStateEnums::EXECUTABLE: {
std::string targetName;
std::string targetNameFull;
std::string targetNameImport;
@@ -1241,9 +1242,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
break;
}
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::INTERFACE_LIBRARY:
break;
}
}
@@ -1296,7 +1297,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
lg->ConvertToRelativePath(currentBinDir, l->Value.c_str());
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
- l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
+ l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
fout << l->Value << " ";
}
}
@@ -1607,8 +1608,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
std::string source = (*sf)->GetFullPath();
FCInfo fcinfo(this, target, *(*sf), configs);
- if (source != libName || target->GetType() == cmState::UTILITY ||
- target->GetType() == cmState::GLOBAL_TARGET) {
+ if (source != libName || target->GetType() == cmStateEnums::UTILITY ||
+ target->GetType() == cmStateEnums::GLOBAL_TARGET) {
fout << "\t\t\t<File\n";
std::string d = this->ConvertToXMLOutputPathSingle(source.c_str());
// Tell MS-Dev what the source is. If the compiler knows how to
@@ -1812,7 +1813,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
std::ostream& fout, const std::string& configName, cmGeneratorTarget* target,
const std::string& /*libName*/)
{
- if (target->GetType() > cmState::GLOBAL_TARGET) {
+ if (target->GetType() > cmStateEnums::GLOBAL_TARGET) {
return;
}
EventWriter event(this, configName, fout);
@@ -1828,7 +1829,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
tool = this->FortranProject ? "VFPreLinkEventTool" : "VCPreLinkEventTool";
event.Start(tool);
bool addedPrelink = false;
- if ((target->GetType() == cmState::SHARED_LIBRARY ||
+ if ((target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
@@ -1900,27 +1901,27 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
}
const char* projectType = 0;
switch (target->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
projectType = "typeStaticLibrary";
if (keyword) {
keyword = "Static Library";
}
break;
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
projectType = "typeDynamicLibrary";
if (!keyword) {
keyword = "Dll";
}
break;
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if (!keyword) {
keyword = "Console Application";
}
projectType = 0;
break;
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
default:
break;
}
@@ -2117,7 +2118,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
std::string cmLocalVisualStudio7Generator::GetTargetDirectory(
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index e2b3cd2..e20fe50 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -76,8 +76,8 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
// If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory.
// The Intel Fortran plugin always forgets to the directory.
- if (target->GetType() != cmState::EXECUTABLE &&
- !(isFortran && target->GetType() == cmState::SHARED_LIBRARY)) {
+ if (target->GetType() != cmStateEnums::EXECUTABLE &&
+ !(isFortran && target->GetType() == cmStateEnums::SHARED_LIBRARY)) {
return pcc;
}
std::string outDir = target->GetDirectory(config, false);
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
new file mode 100644
index 0000000..9308d91
--- /dev/null
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -0,0 +1,36 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmMSVC60LinkLineComputer.h"
+
+#include "cmSystemTools.h"
+
+cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir)
+ : cmLinkLineComputer(outputConverter, stateDir)
+{
+}
+
+std::string cmMSVC60LinkLineComputer::ConvertToLinkReference(
+ std::string const& lib) const
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // Work-ardound command line parsing limitations in MSVC 6.0
+ // Search for the last space.
+ std::string::size_type pos = lib.rfind(' ');
+ if (pos != lib.npos) {
+ // Find the slash after the last space, if any.
+ pos = lib.find('/', pos);
+
+ // Convert the portion of the path with a space to a short path.
+ std::string sp;
+ if (cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) {
+ // Append the rest of the path with no space.
+ sp += lib.substr(pos);
+ return sp;
+ }
+ }
+#endif
+
+ return cmLinkLineComputer::ConvertToLinkReference(lib);
+}
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
new file mode 100644
index 0000000..381b8a2
--- /dev/null
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -0,0 +1,19 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmMSVC60LinkLineComputer_h
+#define cmMSVC60LinkLineComputer_h
+
+#include "cmLinkLineComputer.h"
+
+class cmMSVC60LinkLineComputer : public cmLinkLineComputer
+{
+public:
+ cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir);
+
+ std::string ConvertToLinkReference(std::string const& input) const
+ CM_OVERRIDE;
+};
+
+#endif
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 9917394..9bfc70b 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -3,6 +3,8 @@
#include "cmMacroCommand.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmake.h"
// define the class for macro commands
@@ -15,12 +17,9 @@ public:
~cmMacroHelperCommand() CM_OVERRIDE {}
/**
- * This is used to avoid including this command
- * in documentation. This is mainly used by
- * cmMacroHelperCommand and cmFunctionHelperCommand
- * which cannot provide appropriate documentation.
+ * This determines if the command is defined in a cmake script.
*/
- bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; }
+ bool IsUserDefined() const CM_OVERRIDE { return true; }
/**
* This is a virtual constructor for the command.
@@ -59,8 +58,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
- cmTypeMacro(cmMacroHelperCommand, cmCommand);
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 362d272..8e3cd95 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -46,8 +46,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "macro"; }
-
- cmTypeMacro(cmMacroCommand, cmCommand);
};
#endif
diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx
index e0011bd..fda9eea 100644
--- a/Source/cmMakeDirectoryCommand.cxx
+++ b/Source/cmMakeDirectoryCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakeDirectoryCommand.h"
+#include "cmSystemTools.h"
+
// cmMakeDirectoryCommand
bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 2117fae..74b4a63 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -38,8 +38,6 @@ public:
* This determines if the command is invoked when in script mode.
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
-
- cmTypeMacro(cmMakeDirectoryCommand, cmCommand);
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index df993ce..741ffb8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -18,6 +18,8 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTest.h"
#include "cmVersion.h"
@@ -45,7 +47,7 @@ class cmMessenger;
// default is not to be building executables
cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
- cmState::Snapshot const& snapshot)
+ cmStateSnapshot const& snapshot)
: GlobalGenerator(globalGenerator)
, StateSnapshot(snapshot)
, Backtrace(snapshot)
@@ -264,7 +266,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
pcmd->SetMakefile(this);
// Decide whether to invoke the command.
- if (pcmd->GetEnabled() && !cmSystemTools::GetFatalErrorOccured() &&
+ if (!cmSystemTools::GetFatalErrorOccured() &&
(this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE ||
pcmd->IsScriptable()))
@@ -730,7 +732,7 @@ void cmMakefile::AddCustomCommandToTarget(
return;
}
- if (ti->second.GetType() == cmState::OBJECT_LIBRARY) {
+ if (ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Target \"" << target
<< "\" is an OBJECT library "
@@ -738,7 +740,7 @@ void cmMakefile::AddCustomCommandToTarget(
this->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
- if (ti->second.GetType() == cmState::INTERFACE_LIBRARY) {
+ if (ti->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "Target \"" << target
<< "\" is an INTERFACE library "
@@ -1032,7 +1034,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
const char* comment, bool uses_terminal)
{
// Create a target instance for this utility.
- cmTarget* target = this->AddNewTarget(cmState::UTILITY, utilityName);
+ cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName);
if (excludeFromAll) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
@@ -1207,71 +1209,6 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return true;
}
-void cmMakefile::AddLinkLibrary(const std::string& lib,
- cmTargetLinkLibraryType llt)
-{
- cmTarget::LibraryID tmp;
- tmp.first = lib;
- tmp.second = llt;
- this->LinkLibraries.push_back(tmp);
-}
-
-void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
- const std::string& lib,
- cmTargetLinkLibraryType llt)
-{
- cmTargets::iterator i = this->Targets.find(target);
- if (i != this->Targets.end()) {
- cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib);
- if (tgt) {
- // if it is not a static or shared library then you can not link to it
- if (!((tgt->GetType() == cmState::STATIC_LIBRARY) ||
- (tgt->GetType() == cmState::SHARED_LIBRARY) ||
- (tgt->GetType() == cmState::INTERFACE_LIBRARY) ||
- tgt->IsExecutableWithExports())) {
- std::ostringstream e;
- e << "Target \"" << lib << "\" of type "
- << cmState::GetTargetTypeName(tgt->GetType())
- << " may not be linked into another target. "
- << "One may link only to STATIC or SHARED libraries, or "
- << "to executables with the ENABLE_EXPORTS property set.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
- }
- i->second.AddLinkLibrary(*this, target, lib, llt);
- } else {
- std::ostringstream e;
- e << "Attempt to add link library \"" << lib << "\" to target \"" << target
- << "\" which is not built in this directory.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
-}
-
-void cmMakefile::AddLinkDirectoryForTarget(const std::string& target,
- const std::string& d)
-{
- cmTargets::iterator i = this->Targets.find(target);
- if (i != this->Targets.end()) {
- if (this->IsAlias(target)) {
- std::ostringstream e;
- e << "ALIAS target \"" << target << "\" "
- << "may not be linked into another target.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
- }
- i->second.AddLinkDirectory(d);
- } else {
- cmSystemTools::Error(
- "Attempt to add link directories to non-existent target: ",
- target.c_str(), " for directory ", d.c_str());
- }
-}
-
-void cmMakefile::AddLinkLibrary(const std::string& lib)
-{
- this->AddLinkLibrary(lib, GENERAL_LibraryType);
-}
-
void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
@@ -1303,7 +1240,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
}
// link libraries
- this->LinkLibraries = parent->LinkLibraries;
+ this->SetProperty("LINK_LIBRARIES", parent->GetProperty("LINK_LIBRARIES"));
// link directories
this->SetProperty("LINK_DIRECTORIES",
@@ -1421,7 +1358,7 @@ private:
cmMakefile* Makefile;
cmGlobalGenerator* GG;
cmMakefile* CurrentMakefile;
- cmState::Snapshot Snapshot;
+ cmStateSnapshot Snapshot;
bool ReportError;
};
@@ -1603,7 +1540,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
return;
}
- cmState::Snapshot newSnapshot =
+ cmStateSnapshot newSnapshot =
this->GetState()->CreateBuildsystemDirectorySnapshot(this->StateSnapshot);
newSnapshot.GetDirectory().SetCurrentSource(srcPath);
@@ -1708,20 +1645,21 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
- cmState::CacheEntryType type, bool force)
+ cmStateEnums::CacheEntryType type,
+ bool force)
{
const char* existingValue = this->GetState()->GetInitializedCacheValue(name);
// must be outside the following if() to keep it alive long enough
std::string nvalue;
- if (existingValue &&
- (this->GetState()->GetCacheEntryType(name) == cmState::UNINITIALIZED)) {
+ if (existingValue && (this->GetState()->GetCacheEntryType(name) ==
+ cmStateEnums::UNINITIALIZED)) {
// if this is not a force, then use the value from the cache
// if it is a force, then use the value being passed in
if (!force) {
value = existingValue;
}
- if (type == cmState::PATH || type == cmState::FILEPATH) {
+ if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
std::vector<std::string>::size_type cc;
std::vector<std::string> files;
nvalue = value ? value : "";
@@ -1835,14 +1773,13 @@ void cmMakefile::SetProjectName(std::string const& p)
this->StateSnapshot.SetProjectName(p);
}
-void cmMakefile::AddGlobalLinkInformation(const std::string& name,
- cmTarget& target)
+void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
{
// for these targets do not add anything
switch (target.GetType()) {
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::INTERFACE_LIBRARY:
return;
default:;
}
@@ -1857,13 +1794,34 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
if (*j->rbegin() == '/') {
newdir = j->substr(0, j->size() - 1);
}
- if (std::find(this->LinkDirectories.begin(), this->LinkDirectories.end(),
- newdir) == this->LinkDirectories.end()) {
- target.AddLinkDirectory(*j);
+ target.AddLinkDirectory(*j);
+ }
+ }
+
+ if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs;
+ cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+
+ for (std::vector<std::string>::iterator j = linkLibs.begin();
+ j != linkLibs.end(); ++j) {
+ std::string libraryName = *j;
+ cmTargetLinkLibraryType libType = GENERAL_LibraryType;
+ if (libraryName == "optimized") {
+ libType = OPTIMIZED_LibraryType;
+ ++j;
+ libraryName = *j;
+ } else if (libraryName == "debug") {
+ libType = DEBUG_LibraryType;
+ ++j;
+ libraryName = *j;
}
+ // This is equivalent to the target_link_libraries plain signature.
+ target.AddLinkLibrary(*this, libraryName, libType);
+ target.AppendProperty(
+ "INTERFACE_LINK_LIBRARIES",
+ target.GetDebugGeneratorExpressions(libraryName, libType).c_str());
}
}
- target.MergeLinkLibraries(*this, name, this->LinkLibraries);
}
void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName)
@@ -1873,18 +1831,15 @@ void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName)
}
cmTarget* cmMakefile::AddLibrary(const std::string& lname,
- cmState::TargetType type,
+ cmStateEnums::TargetType type,
const std::vector<std::string>& srcs,
bool excludeFromAll)
{
- // wrong type ? default to STATIC
- if ((type != cmState::STATIC_LIBRARY) && (type != cmState::SHARED_LIBRARY) &&
- (type != cmState::MODULE_LIBRARY) && (type != cmState::OBJECT_LIBRARY) &&
- (type != cmState::INTERFACE_LIBRARY)) {
- this->IssueMessage(cmake::INTERNAL_ERROR,
- "cmMakefile::AddLibrary given invalid target type.");
- type = cmState::STATIC_LIBRARY;
- }
+ assert(type == cmStateEnums::STATIC_LIBRARY ||
+ type == cmStateEnums::SHARED_LIBRARY ||
+ type == cmStateEnums::MODULE_LIBRARY ||
+ type == cmStateEnums::OBJECT_LIBRARY ||
+ type == cmStateEnums::INTERFACE_LIBRARY);
cmTarget* target = this->AddNewTarget(type, lname);
// Clear its dependencies. Otherwise, dependencies might persist
@@ -1895,7 +1850,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
target->AddSources(srcs);
- this->AddGlobalLinkInformation(lname, *target);
+ this->AddGlobalLinkInformation(*target);
return target;
}
@@ -1903,16 +1858,16 @@ cmTarget* cmMakefile::AddExecutable(const char* exeName,
const std::vector<std::string>& srcs,
bool excludeFromAll)
{
- cmTarget* target = this->AddNewTarget(cmState::EXECUTABLE, exeName);
+ cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName);
if (excludeFromAll) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
target->AddSources(srcs);
- this->AddGlobalLinkInformation(exeName, *target);
+ this->AddGlobalLinkInformation(*target);
return target;
}
-cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type,
+cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
const std::string& name)
{
cmTargets::iterator it =
@@ -2090,8 +2045,8 @@ void cmMakefile::ExpandVariablesCMP0019()
for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end();
++l) {
cmTarget& t = l->second;
- if (t.GetType() == cmState::INTERFACE_LIBRARY ||
- t.GetType() == cmState::GLOBAL_TARGET) {
+ if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY ||
+ t.GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
@@ -2125,19 +2080,32 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
}
- for (cmTarget::LinkLibraryVectorType::iterator l =
- this->LinkLibraries.begin();
- l != this->LinkLibraries.end(); ++l) {
- if (mightExpandVariablesCMP0019(l->first.c_str())) {
- std::string orig = l->first;
- this->ExpandVariablesInString(l->first, true, true);
- if (pol == cmPolicies::WARN && l->first != orig) {
- /* clang-format off */
+
+ if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs;
+ cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+
+ for (std::vector<std::string>::iterator l = linkLibs.begin();
+ l != linkLibs.end(); ++l) {
+ std::string libName = *l;
+ if (libName == "optimized") {
+ ++l;
+ libName = *l;
+ } else if (libName == "debug") {
+ ++l;
+ libName = *l;
+ }
+ if (mightExpandVariablesCMP0019(libName.c_str())) {
+ std::string orig = libName;
+ this->ExpandVariablesInString(libName, true, true);
+ if (pol == cmPolicies::WARN && libName != orig) {
+ /* clang-format off */
w << "Evaluated link library\n"
<< " " << orig << "\n"
<< "as\n"
- << " " << l->first << "\n";
- /* clang-format on */
+ << " " << libName << "\n";
+ /* clang-format on */
+ }
}
}
}
@@ -3212,7 +3180,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// Add this before the user-provided CMake arguments in case
// one of the arguments is -DCMAKE_BUILD_TYPE=...
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, "Build configuration",
- cmState::STRING);
+ cmStateEnums::STRING);
}
}
// if cmake args were provided then pass them in
@@ -3248,10 +3216,10 @@ int cmMakefile::TryCompile(const std::string& srcdir,
gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this);
if (this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
} else {
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
if (cm.Configure() != 0) {
cmSystemTools::Error(
@@ -3655,7 +3623,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
std::string cmMakefile::FormatListFileStack() const
{
std::vector<std::string> listFiles;
- cmState::Snapshot snp = this->StateSnapshot;
+ cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) {
listFiles.push_back(snp.GetExecutionListFile());
snp = snp.GetCallStackParent();
@@ -3718,7 +3686,8 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
}
cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
- cmState::TargetType type, bool global)
+ cmStateEnums::TargetType type,
+ bool global)
{
// Create the target.
CM_AUTO_PTR<cmTarget> target(
@@ -3804,7 +3773,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
// 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 &&
+ if (isCustom && existing->GetType() == cmStateEnums::UTILITY &&
this != existing->GetMakefile() &&
cm->GetState()->GetGlobalPropertyAsBool(
"ALLOW_DUPLICATE_CUSTOM_TARGETS")) {
@@ -3818,22 +3787,22 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
<< "\" because another target with the same name already exists. "
<< "The existing target is ";
switch (existing->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
e << "an executable ";
break;
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
e << "a static library ";
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
e << "a shared library ";
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
e << "a module library ";
break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
e << "a custom target ";
break;
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
e << "an interface library ";
break;
default:
@@ -3951,7 +3920,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
this->MarkVariableAsUsed(nMatchesVariable);
}
-cmState::Snapshot cmMakefile::GetStateSnapshot() const
+cmStateSnapshot cmMakefile::GetStateSnapshot() const
{
return this->StateSnapshot;
}
@@ -3970,10 +3939,8 @@ cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(
bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var)
{
// Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting.
- if (!var.empty()) {
- if (const char* val = this->GetDefinition(var)) {
- return cmSystemTools::IsOn(val);
- }
+ if (const char* val = this->GetDefinition(var)) {
+ return cmSystemTools::IsOn(val);
}
// Enable optional policy warnings with --debug-output, --trace,
// or --trace-expand.
@@ -4034,7 +4001,7 @@ void cmMakefile::PopPolicy()
void cmMakefile::PopSnapshot(bool reportError)
{
- // cmState::Snapshot manages nested policy scopes within it.
+ // cmStateSnapshot manages nested policy scopes within it.
// Since the scope corresponding to the snapshot is closing,
// reject any still-open nested policy scopes with an error.
while (!this->StateSnapshot.CanPopPolicyScope()) {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 40344ce..3067f2c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -9,9 +9,10 @@
#include "cmListFileCache.h"
#include "cmNewLineStyle.h"
#include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
+#include "cm_unordered_map.hxx"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -27,14 +28,6 @@
#include <string>
#include <vector>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-#include <unordered_map>
-#else
-#include <cmsys/hash_map.hxx>
-#endif
-#endif
-
class cmCommand;
class cmCompiledGeneratorExpression;
class cmCustomCommandLines;
@@ -70,7 +63,7 @@ public:
* Construct an empty makefile.
*/
cmMakefile(cmGlobalGenerator* globalGenerator,
- const cmState::Snapshot& snapshot);
+ const cmStateSnapshot& snapshot);
/**
* Destructor.
@@ -163,9 +156,10 @@ public:
/** Create a new imported target with the name and type given. */
cmTarget* AddImportedTarget(const std::string& name,
- cmState::TargetType type, bool global);
+ cmStateEnums::TargetType type, bool global);
- cmTarget* AddNewTarget(cmState::TargetType type, const std::string& name);
+ cmTarget* AddNewTarget(cmStateEnums::TargetType type,
+ const std::string& name);
/**
* Add an executable to the build.
@@ -197,15 +191,6 @@ public:
const char* comment = CM_NULLPTR, bool uses_terminal = false);
/**
- * Add a link library to the build.
- */
- void AddLinkLibrary(const std::string&);
- void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type);
- void AddLinkLibraryForTarget(const std::string& tgt, const std::string&,
- cmTargetLinkLibraryType type);
- void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d);
-
- /**
* Add a subdirectory to the build.
*/
void AddSubDirectory(const std::string& fullSrcDir,
@@ -232,7 +217,7 @@ public:
void AddDefinition(const std::string& name, const char* value);
///! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const std::string& name, const char* value,
- const char* doc, cmState::CacheEntryType type,
+ const char* doc, cmStateEnums::CacheEntryType type,
bool force = false);
/**
@@ -260,7 +245,8 @@ public:
/**
* Set the name of the library.
*/
- cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type,
+ cmTarget* AddLibrary(const std::string& libname,
+ cmStateEnums::TargetType type,
const std::vector<std::string>& srcs,
bool excludeFromAll = false);
void AddAlias(const std::string& libname, const std::string& tgt);
@@ -447,7 +433,7 @@ public:
/**
* Get a list of preprocessor define flags.
*/
- const char* GetDefineFlags() const { return this->DefineFlags.c_str(); }
+ std::string GetDefineFlags() const { return this->DefineFlags; }
/**
* Make sure CMake can write this file
@@ -760,7 +746,7 @@ public:
void ClearMatches();
void StoreMatches(cmsys::RegularExpression& re);
- cmState::Snapshot GetStateSnapshot() const;
+ cmStateSnapshot GetStateSnapshot() const;
const char* GetDefineFlagsCMP0059() const;
@@ -781,7 +767,7 @@ public:
protected:
// add link libraries and directories to the target
- void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
+ void AddGlobalLinkInformation(cmTarget& target);
// Check for a an unused variable
void LogUnused(const char* reason, const std::string& name) const;
@@ -790,24 +776,12 @@ protected:
// libraries, classes, and executables
mutable cmTargets Targets;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- typedef std::unordered_map<std::string, cmTarget*> TargetMap;
-#else
- typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
-#endif
-#else
- typedef std::map<std::string, cmTarget*> TargetMap;
-#endif
std::map<std::string, std::string> AliasTargets;
std::vector<cmSourceFile*> SourceFiles;
// Tests
std::map<std::string, cmTest*> Tests;
- // The link-library paths. Order matters, use std::vector (not std::set).
- std::vector<std::string> LinkDirectories;
-
// The set of include directories that are marked as system include
// directories.
std::set<std::string> SystemIncludeDirectories;
@@ -815,8 +789,6 @@ protected:
std::vector<std::string> ListFiles;
std::vector<std::string> OutputFiles;
- cmTarget::LinkLibraryVectorType LinkLibraries;
-
std::vector<cmInstallGenerator*> InstallGenerators;
std::vector<cmTestGenerator*> TestGenerators;
@@ -841,7 +813,7 @@ private:
cmMakefile(const cmMakefile& mf);
cmMakefile& operator=(const cmMakefile& mf);
- cmState::Snapshot StateSnapshot;
+ cmStateSnapshot StateSnapshot;
cmListFileBacktrace Backtrace;
void ReadListFile(cmListFile const& listFile,
@@ -875,6 +847,7 @@ private:
friend class cmParseFileScope;
std::vector<cmTarget*> ImportedTargetsOwned;
+ typedef CM_UNORDERED_MAP<std::string, cmTarget*> TargetMap;
TargetMap ImportedTargets;
// Internal policy stack management.
@@ -911,16 +884,8 @@ private:
*/
cmSourceFile* LinearGetSourceFileWithOutput(const std::string& cname) const;
-// A map for fast output to input look up.
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
- typedef std::unordered_map<std::string, cmSourceFile*> OutputToSourceMap;
-#else
- typedef cmsys::hash_map<std::string, cmSourceFile*> OutputToSourceMap;
-#endif
-#else
- typedef std::map<std::string, cmSourceFile*> OutputToSourceMap;
-#endif
+ // A map for fast output to input look up.
+ typedef CM_UNORDERED_MAP<std::string, cmSourceFile*> OutputToSourceMap;
OutputToSourceMap OutputToSource;
void UpdateOutputToSourceMap(std::vector<std::string> const& outputs,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 4a6990e..cbbd2e6 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -5,11 +5,14 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -130,16 +133,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
targetFullPathPDB, cmOutputConverter::SHELL);
// Convert to the output path to use in constructing commands.
std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
cmOutputConverter::SHELL);
std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
cmOutputConverter::SHELL);
std::string targetOutPathImport =
this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport),
cmOutputConverter::SHELL);
@@ -192,6 +195,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition(export_flag_var));
}
+
+ this->LocalGenerator->AppendFlags(linkFlags,
+ this->LocalGenerator->GetLinkLibsCMP0065(
+ linkLanguage, *this->GeneratorTarget));
+
if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
this->LocalGenerator->AppendFlags(linkFlags, " -Wl,--no-as-needed");
}
@@ -210,32 +218,39 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->AppendFlags(
linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
- this->AddModuleDefinitionFlag(linkFlags);
+ {
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
+ }
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
- exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
- exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
(targetFullPath + ".manifest").c_str()));
#endif
if (targetNameReal != targetName) {
- exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
}
if (!targetNameImport.empty()) {
- exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
}
}
@@ -243,7 +258,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// 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->LocalGenerator->ConvertToRelativePath(
+ this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
// Add the pre-build and pre-link rules building but not when relinking.
@@ -291,10 +306,18 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+ linkLineComputer->SetRelink(relink);
+
// Collect up flags to link in needed libraries.
std::string linkLibs;
- this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
- useWatcomQuote);
+ this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
+ useResponseFileForLibs, depends);
// Construct object file lists that may be needed to expand the
// rule.
@@ -310,15 +333,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string manifests = this->GetManifests();
- cmLocalGenerator::RuleVariables vars;
- vars.RuleLauncher = "RULE_LAUNCH_LINK";
- vars.CMTarget = this->GeneratorTarget;
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
@@ -326,7 +350,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
? cmOutputConverter::WATCOMQUOTE
: cmOutputConverter::SHELL;
std::string target = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
output);
vars.Target = target.c_str();
@@ -362,13 +386,26 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
real_link_commands.push_back(cmakeCommand);
}
+ std::string launcher;
+
+ const char* val = this->LocalGenerator->GetRuleLauncher(
+ this->GeneratorTarget, "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->LocalGenerator->CreateRulePlaceholderExpander());
+
// Expand placeholders in the commands.
- this->LocalGenerator->TargetImplib = targetOutPathImport;
+ rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport);
for (std::vector<std::string>::iterator i = real_link_commands.begin();
i != real_link_commands.end(); ++i) {
- this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i,
+ vars);
}
- this->LocalGenerator->TargetImplib = "";
// Restore path conversion to normal shells.
this->LocalGenerator->SetLinkScriptShell(false);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2b1d7cc..a249efd 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -5,12 +5,15 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -22,7 +25,7 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
: cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnDepends;
- if (this->GeneratorTarget->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
this->GeneratorTarget->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
@@ -55,24 +58,24 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
// write the link rules
// Write the rule for this target type.
switch (this->GeneratorTarget->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
this->WriteStaticLibraryRules();
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
this->WriteSharedLibraryRules(false);
if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
// Write rules to link an installable version of the target.
this->WriteSharedLibraryRules(true);
}
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
this->WriteModuleLibraryRules(false);
if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
// Write rules to link an installable version of the target.
this->WriteModuleLibraryRules(true);
}
break;
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
this->WriteObjectLibraryRules();
break;
default:
@@ -159,7 +162,13 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
- this->AddModuleDefinitionFlag(extraFlags);
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
@@ -184,7 +193,13 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
- this->AddModuleDefinitionFlag(extraFlags);
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
@@ -237,8 +252,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
// Add OSX version flags, if any.
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true);
this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false);
}
@@ -305,20 +320,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
targetFullPathPDB, cmOutputConverter::SHELL);
std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
cmOutputConverter::SHELL);
std::string targetOutPathSO = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO),
cmOutputConverter::SHELL);
std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
cmOutputConverter::SHELL);
std::string targetOutPathImport =
this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport),
cmOutputConverter::SHELL);
@@ -331,13 +346,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string buildEcho = "Linking ";
buildEcho += linkLanguage;
switch (this->GeneratorTarget->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
buildEcho += " static library ";
break;
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
buildEcho += " shared library ";
break;
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (this->GeneratorTarget->IsCFBundleOnApple()) {
buildEcho += " CFBundle";
}
@@ -352,38 +367,26 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
- const char* forbiddenFlagVar = CM_NULLPTR;
- switch (this->GeneratorTarget->GetType()) {
- case cmState::SHARED_LIBRARY:
- forbiddenFlagVar = "_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS";
- break;
- case cmState::MODULE_LIBRARY:
- forbiddenFlagVar = "_CREATE_SHARED_MODULE_FORBIDDEN_FLAGS";
- break;
- default:
- break;
- }
-
// Clean files associated with this library.
std::vector<std::string> libCleanFiles;
- libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
if (targetNameReal != targetName) {
- libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
}
if (targetNameSO != targetName && targetNameSO != targetNameReal) {
- libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO));
}
if (!targetNameImport.empty()) {
- libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
}
}
@@ -391,14 +394,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// 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->LocalGenerator->ConvertToRelativePath(
+ this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
#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->LocalGenerator->ConvertToRelativePath(
+ if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
(targetFullPath + ".manifest").c_str()));
}
@@ -407,7 +410,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> commands1;
// Add a command to remove any existing files for this library.
// for static libs only
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
this->GeneratorTarget, "target");
this->LocalGenerator->CreateCDCommand(
@@ -441,7 +444,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> archiveAppendCommands;
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar);
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
@@ -490,9 +493,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Collect up flags to link in needed libraries.
std::string linkLibs;
- if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
- this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
- useWatcomQuote);
+ if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+ linkLineComputer->SetRelink(relink);
+
+ this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
+ useResponseFileForLibs, depends);
}
// Construct object file lists that may be needed to expand the
@@ -503,14 +515,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
useWatcomQuote);
// maybe create .def file from list of objects
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
+ if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
this->GenDefFile(real_link_commands, linkFlags);
}
std::string manifests = this->GetManifests();
- cmLocalGenerator::RuleVariables vars;
+ cmRulePlaceholderExpander::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
// Setup the target version.
@@ -530,14 +542,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
- vars.RuleLauncher = "RULE_LAUNCH_LINK";
- vars.CMTarget = this->GeneratorTarget;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
cmOutputConverter::SHELL);
@@ -546,7 +559,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
? cmOutputConverter::WATCOMQUOTE
: cmOutputConverter::SHELL;
std::string target = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
output);
vars.Target = target.c_str();
@@ -562,7 +575,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Compute the directory portion of the install_name setting.
std::string install_name_dir;
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY) {
// Get the install_name directory for the build tree.
install_name_dir =
this->GeneratorTarget->GetInstallNameDirForBuildTree(this->ConfigName);
@@ -585,15 +598,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->LocalGenerator->AddArchitectureFlags(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
- // remove any language flags that might not work with the
- // particular os
- if (forbiddenFlagVar) {
- this->RemoveForbiddenFlags(forbiddenFlagVar, linkLanguage, langFlags);
- }
vars.LanguageCompileFlags = langFlags.c_str();
+ std::string launcher;
+ const char* val = this->LocalGenerator->GetRuleLauncher(
+ this->GeneratorTarget, "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->LocalGenerator->CreateRulePlaceholderExpander());
// Construct the main link rule and expand placeholders.
- this->LocalGenerator->TargetImplib = targetOutPathImport;
+ rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport);
if (useArchiveRules) {
// Construct the individual object list strings.
std::vector<std::string> object_strings;
@@ -606,8 +624,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
for (std::vector<std::string>::const_iterator i =
archiveCreateCommands.begin();
i != archiveCreateCommands.end(); ++i) {
- std::string cmd = *i;
- this->LocalGenerator->ExpandRuleVariables(cmd, vars);
+ std::string cmd = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
+ cmd, vars);
real_link_commands.push_back(cmd);
}
}
@@ -617,8 +636,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
for (std::vector<std::string>::const_iterator i =
archiveAppendCommands.begin();
i != archiveAppendCommands.end(); ++i) {
- std::string cmd = *i;
- this->LocalGenerator->ExpandRuleVariables(cmd, vars);
+ std::string cmd = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
+ cmd, vars);
real_link_commands.push_back(cmd);
}
}
@@ -627,8 +647,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
for (std::vector<std::string>::const_iterator i =
archiveFinishCommands.begin();
i != archiveFinishCommands.end(); ++i) {
- std::string cmd = *i;
- this->LocalGenerator->ExpandRuleVariables(cmd, vars);
+ std::string cmd = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd,
+ vars);
// If there is no ranlib the command will be ":". Skip it.
if (!cmd.empty() && cmd[0] != ':') {
real_link_commands.push_back(cmd);
@@ -639,7 +660,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string linkRule = this->GetLinkRule(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
- (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY)) {
+ (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) {
std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
cmakeCommand += " -E __run_iwyu --lwyu=";
@@ -650,10 +671,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Expand placeholders.
for (std::vector<std::string>::iterator i = real_link_commands.begin();
i != real_link_commands.end(); ++i) {
- this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i,
+ vars);
}
}
- this->LocalGenerator->TargetImplib = "";
// Restore path conversion to normal shells.
this->LocalGenerator->SetLinkScriptShell(false);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e70f09e..68c166e 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -10,6 +10,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
@@ -17,8 +18,10 @@
#include "cmMakefileLibraryTargetGenerator.h"
#include "cmMakefileUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
@@ -66,16 +69,16 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New(
cmMakefileTargetGenerator* result = CM_NULLPTR;
switch (tgt->GetType()) {
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
result = new cmMakefileExecutableTargetGenerator(tgt);
break;
- case cmState::STATIC_LIBRARY:
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
result = new cmMakefileLibraryTargetGenerator(tgt);
break;
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
result = new cmMakefileUtilityTargetGenerator(tgt);
break;
default:
@@ -110,7 +113,8 @@ void cmMakefileTargetGenerator::CreateRuleFile()
// Open the rule file. This should be copy-if-different because the
// rules may depend on this file itself.
this->BuildFileStream =
- new cmGeneratedFileStream(this->BuildFileNameFull.c_str());
+ new cmGeneratedFileStream(this->BuildFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
this->BuildFileStream->SetCopyIfDifferent(true);
if (!this->BuildFileStream) {
return;
@@ -166,7 +170,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
this->CleanFiles.push_back(
- this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o));
+ this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *o));
}
}
}
@@ -209,8 +213,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
- dependFileNameFull)
+ ->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull)
.c_str())
<< "\n\n";
@@ -221,7 +225,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(
+ ->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(),
this->ProgressFileNameFull)
.c_str())
@@ -231,7 +235,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
// make sure the depend file exists
if (!cmSystemTools::FileExists(dependFileNameFull.c_str())) {
// Write an empty dependency file.
- cmGeneratedFileStream depFileStream(dependFileNameFull.c_str());
+ cmGeneratedFileStream depFileStream(
+ dependFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
depFileStream << "# Empty dependencies file for "
<< this->GeneratorTarget->GetName() << ".\n"
<< "# This may be replaced when dependencies are built."
@@ -243,7 +249,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
this->FlagFileNameFull = this->TargetBuildDirectoryFull;
this->FlagFileNameFull += "/flags.make";
this->FlagFileStream =
- new cmGeneratedFileStream(this->FlagFileNameFull.c_str());
+ new cmGeneratedFileStream(this->FlagFileNameFull.c_str(), false,
+ this->GlobalGenerator->GetMakefileEncoding());
this->FlagFileStream->SetCopyIfDifferent(true);
if (!this->FlagFileStream) {
return;
@@ -256,8 +263,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
- this->FlagFileNameFull)
+ ->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->FlagFileNameFull)
.c_str())
<< "\n\n";
}
@@ -314,9 +322,9 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
output += "/";
output += cmSystemTools::GetFilenameName(input);
this->Generator->CleanFiles.push_back(
- this->Generator->LocalGenerator->ConvertToRelativePath(
+ this->Generator->LocalGenerator->MaybeConvertToRelativePath(
this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output));
- output = this->Generator->LocalGenerator->ConvertToRelativePath(
+ output = this->Generator->LocalGenerator->MaybeConvertToRelativePath(
this->Generator->LocalGenerator->GetBinaryDirectory(), output);
// Create a rule to copy the content into the bundle.
@@ -497,10 +505,10 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::string targetFullPathReal;
std::string targetFullPathPDB;
std::string targetFullPathCompilePDB;
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE ||
- this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
+ this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
targetFullPathReal =
this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB =
@@ -508,7 +516,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
targetFullPathPDB += "/";
targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName);
}
- if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
targetFullPathCompilePDB =
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if (targetFullPathCompilePDB.empty()) {
@@ -518,13 +526,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
cmOutputConverter::SHELL);
targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathCompilePDB),
cmOutputConverter::SHELL);
@@ -537,9 +545,11 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
targetOutPathCompilePDB[targetOutPathCompilePDB.size() - 1] = '/';
}
}
- cmLocalGenerator::RuleVariables vars;
+ cmRulePlaceholderExpander::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
- vars.CMTarget = this->GeneratorTarget;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = lang.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
@@ -550,13 +560,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
vars.Object = shellObj.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
objectFileDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir),
cmOutputConverter::SHELL);
vars.ObjectFileDir = objectFileDir.c_str();
@@ -581,6 +591,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->LocalGenerator->CreateRulePlaceholderExpander());
+
// Construct the compile rules.
{
std::string compileRuleVar = "CMAKE_";
@@ -594,7 +607,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
lang_can_export_cmds && compileCommands.size() == 1) {
std::string compileCommand = compileCommands[0];
- this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
+
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
+ compileCommand, vars);
std::string workingDirectory = cmSystemTools::CollapseFullPath(
this->LocalGenerator->GetCurrentBinaryDirectory());
compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
@@ -653,7 +668,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Expand placeholders in the commands.
for (std::vector<std::string>::iterator i = compileCommands.begin();
i != compileCommands.end(); ++i) {
- this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i,
+ vars);
}
// Change the command working directory to the local build tree.
@@ -716,7 +732,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Expand placeholders in the commands.
for (std::vector<std::string>::iterator i = preprocessCommands.begin();
i != preprocessCommands.end(); ++i) {
- this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
+ *i, vars);
}
this->LocalGenerator->CreateCDCommand(
@@ -763,7 +780,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Expand placeholders in the commands.
for (std::vector<std::string>::iterator i = assemblyCommands.begin();
i != assemblyCommands.end(); ++i) {
- this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
+ *i, vars);
}
this->LocalGenerator->CreateCDCommand(
@@ -904,7 +922,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
// Touch the extra output so "make" knows that it was updated,
// but only if the output was acually created.
std::string const out = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(binDir, *o),
+ this->LocalGenerator->MaybeConvertToRelativePath(binDir, *o),
cmOutputConverter::SHELL);
std::vector<std::string> output_commands;
@@ -1200,10 +1218,9 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i);
- *this->BuildFileStream << " " << lineContinue << "\n"
- << this->Makefile->GetSafeDefinition(
- "CMAKE_OBJECT_NAME");
+ object =
+ this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *i);
+ *this->BuildFileStream << " " << lineContinue << "\n";
*this->BuildFileStream << this->LocalGenerator->ConvertToQuotedOutputPath(
i->c_str(), useWatcomQuote);
}
@@ -1211,21 +1228,16 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< "\n";
}
-void cmMakefileTargetGenerator::WriteObjectsString(std::string& buildObjs)
-{
- std::vector<std::string> objStrings;
- this->WriteObjectsStrings(objStrings);
- buildObjs = objStrings[0];
-}
-
class cmMakefileTargetGeneratorObjectStrings
{
public:
cmMakefileTargetGeneratorObjectStrings(std::vector<std::string>& strings,
- cmLocalUnixMakefileGenerator3* lg,
+ cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir,
std::string::size_type limit)
: Strings(strings)
- , LocalGenerator(lg)
+ , OutputConverter(outputConverter)
+ , StateDir(stateDir)
, LengthLimit(limit)
{
this->Space = "";
@@ -1233,10 +1245,8 @@ public:
void Feed(std::string const& obj)
{
// Construct the name of the next object.
- this->NextObject = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), obj),
- cmOutputConverter::RESPONSE);
+ this->NextObject = this->OutputConverter->ConvertToOutputFormat(
+ this->MaybeConvertToRelativePath(obj), cmOutputConverter::RESPONSE);
// Roll over to next string if the limit will be exceeded.
if (this->LengthLimit != std::string::npos &&
@@ -1256,8 +1266,19 @@ public:
}
void Done() { this->Strings.push_back(this->CurrentString); }
private:
+ std::string MaybeConvertToRelativePath(std::string const& obj)
+ {
+ if (!cmOutputConverter::ContainedInDirectory(
+ this->StateDir.GetCurrentBinary(), obj, this->StateDir)) {
+ return obj;
+ }
+ return cmOutputConverter::ForceToRelativePath(
+ this->StateDir.GetCurrentBinary(), obj);
+ }
+
std::vector<std::string>& Strings;
- cmLocalUnixMakefileGenerator3* LocalGenerator;
+ cmOutputConverter* OutputConverter;
+ cmStateDirectory StateDir;
std::string::size_type LengthLimit;
std::string CurrentString;
std::string NextObject;
@@ -1267,8 +1288,9 @@ private:
void cmMakefileTargetGenerator::WriteObjectsStrings(
std::vector<std::string>& objStrings, std::string::size_type limit)
{
- cmMakefileTargetGeneratorObjectStrings helper(objStrings,
- this->LocalGenerator, limit);
+ cmMakefileTargetGeneratorObjectStrings helper(
+ objStrings, this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory(), limit);
for (std::vector<std::string>::const_iterator i = this->Objects.begin();
i != this->Objects.end(); ++i) {
helper.Feed(*i);
@@ -1289,7 +1311,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
- buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
+ buildTargetRuleName = this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName);
// Build the list of target outputs to drive.
@@ -1325,7 +1347,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
std::vector<std::string>& depends)
{
// Static libraries never depend on anything for linking.
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
return;
}
@@ -1410,52 +1432,6 @@ void cmMakefileTargetGenerator::CloseFileStreams()
delete this->FlagFileStream;
}
-void cmMakefileTargetGenerator::RemoveForbiddenFlags(
- const char* flagVar, const std::string& linkLang, std::string& linkFlags)
-{
- // check for language flags that are not allowed at link time, and
- // remove them, -w on darwin for gcc -w -dynamiclib sends -w to libtool
- // which fails, there may be more]
-
- std::string removeFlags = "CMAKE_";
- removeFlags += linkLang;
- removeFlags += flagVar;
- std::string removeflags = this->Makefile->GetSafeDefinition(removeFlags);
- std::vector<std::string> removeList;
- cmSystemTools::ExpandListArgument(removeflags, removeList);
-
- for (std::vector<std::string>::iterator i = removeList.begin();
- i != removeList.end(); ++i) {
- std::string tmp;
- std::string::size_type lastPosition = 0;
-
- for (;;) {
- std::string::size_type position = linkFlags.find(*i, lastPosition);
-
- if (position == std::string::npos) {
- tmp += linkFlags.substr(lastPosition);
- break;
- } else {
- std::string::size_type prefixLength = position - lastPosition;
- tmp += linkFlags.substr(lastPosition, prefixLength);
- lastPosition = position + i->length();
-
- bool validFlagStart =
- position == 0 || isspace(linkFlags[position - 1]);
-
- bool validFlagEnd =
- lastPosition == linkFlags.size() || isspace(linkFlags[lastPosition]);
-
- if (!validFlagStart || !validFlagEnd) {
- tmp += *i;
- }
- }
- }
-
- linkFlags = tmp;
- }
-}
-
void cmMakefileTargetGenerator::CreateLinkScript(
const char* name, std::vector<std::string> const& link_commands,
std::vector<std::string>& makefile_commands,
@@ -1479,7 +1455,7 @@ void cmMakefileTargetGenerator::CreateLinkScript(
// Create the makefile command to invoke the link script.
std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script ";
link_command += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName),
cmOutputConverter::SHELL);
link_command += " --verbose=$(VERBOSE)";
@@ -1577,15 +1553,28 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
return responseFileName;
}
+cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir)
+{
+ if (this->Makefile->IsOn("MSVC60")) {
+ return this->GlobalGenerator->CreateMSVC60LinkLineComputer(outputConverter,
+ stateDir);
+ }
+ return this->GlobalGenerator->CreateLinkLineComputer(outputConverter,
+ stateDir);
+}
+
void cmMakefileTargetGenerator::CreateLinkLibs(
- std::string& linkLibs, bool relink, bool useResponseFile,
- std::vector<std::string>& makefile_depends, bool useWatcomQuote)
+ cmLinkLineComputer* linkLineComputer, std::string& linkLibs,
+ bool useResponseFile, std::vector<std::string>& makefile_depends)
{
std::string frameworkPath;
std::string linkPath;
- this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *this->GeneratorTarget, relink,
- useResponseFile, useWatcomQuote);
+ std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ cmComputeLinkInformation* pcli =
+ this->GeneratorTarget->GetLinkInformation(config);
+ this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath);
linkLibs = frameworkPath + linkPath + linkLibs;
if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
@@ -1659,7 +1648,9 @@ void cmMakefileTargetGenerator::CreateObjectLists(
}
} else if (useLinkScript) {
if (!useArchiveRules) {
- this->WriteObjectsString(buildObjs);
+ std::vector<std::string> objStrings;
+ this->WriteObjectsStrings(objStrings);
+ buildObjs = objStrings[0];
}
} else {
buildObjs = "$(";
@@ -1716,14 +1707,14 @@ void cmMakefileTargetGenerator::GenDefFile(
cmd, cmOutputConverter::SHELL);
cmd += " -E __create_def ";
cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
cmOutputConverter::SHELL);
cmd += " ";
std::string objlist_file = name_of_def_file;
objlist_file += ".objs";
cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
cmOutputConverter::SHELL);
real_link_commands.insert(real_link_commands.begin(), cmd);
@@ -1744,7 +1735,7 @@ void cmMakefileTargetGenerator::GenDefFile(
linkFlags += " ";
linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
cmOutputConverter::SHELL);
linkFlags += " ";
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index df7b6aa..e44f64a 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -20,6 +20,7 @@ class cmGeneratedFileStream;
class cmGeneratorTarget;
class cmGlobalUnixMakefileGenerator3;
class cmSourceFile;
+class cmLinkLineComputer;
/** \class cmMakefileTargetGenerator
* \brief Support Routines for writing makefiles
@@ -112,7 +113,6 @@ protected:
void WriteObjectsVariable(std::string& variableName,
std::string& variableNameExternal,
bool useWatcomQuote);
- void WriteObjectsString(std::string& buildObjs);
void WriteObjectsStrings(std::vector<std::string>& objStrings,
std::string::size_type limit = std::string::npos);
@@ -140,6 +140,9 @@ protected:
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
+ cmLinkLineComputer* CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir);
+
/** Create a response file with the given set of options. Returns
the relative path from the target build working directory to the
response file name. */
@@ -150,9 +153,9 @@ protected:
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,
- bool useWatcomQuote);
+ void CreateLinkLibs(cmLinkLineComputer* linkLineComputer,
+ std::string& linkLibs, bool useResponseFile,
+ std::vector<std::string>& makefile_depends);
/** Create lists of object files for linking and cleaning. */
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
@@ -168,8 +171,6 @@ protected:
const std::string& lang) CM_OVERRIDE;
virtual void CloseFileStreams();
- void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
- std::string& linkFlags);
cmLocalUnixMakefileGenerator3* LocalGenerator;
cmGlobalUnixMakefileGenerator3* GlobalGenerator;
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index f40c8fa..ecb29cb 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -46,7 +46,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(
+ ->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(),
this->ProgressFileNameFull)
.c_str())
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 5ec1620..7297193 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMarkAsAdvancedCommand.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+
// cmMarkAsAdvancedCommand
bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -26,7 +29,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
cmState* state = this->Makefile->GetState();
if (!state->GetCacheEntryValue(variable)) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
- variable, CM_NULLPTR, CM_NULLPTR, cmState::UNINITIALIZED);
+ variable, CM_NULLPTR, CM_NULLPTR, cmStateEnums::UNINITIALIZED);
overwrite = true;
}
if (!state->GetCacheEntryValue(variable)) {
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 54fa78a..0f5270c 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -37,8 +37,6 @@ public:
* FindUnixMake.cmake used by the CTEST_BUILD command.
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
-
- cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand);
};
#endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 6fa7389..17a1575 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -31,8 +31,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "math"; }
- cmTypeMacro(cmMathCommand, cmCommand);
-
protected:
bool HandleExprCommand(std::vector<std::string> const& args);
};
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 9a83cd9..83d847a 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -3,6 +3,7 @@
#include "cmMessageCommand.h"
#include "cmMessenger.h"
+#include "cmSystemTools.h"
// cmLibraryCommand
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index a67d52b..cd16ffa 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -33,8 +33,6 @@ public:
* This determines if the command is invoked when in script mode.
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
-
- cmTypeMacro(cmMessageCommand, cmCommand);
};
#endif
diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx
new file mode 100644
index 0000000..fa9df6d
--- /dev/null
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -0,0 +1,19 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmNinjaLinkLineComputer.h"
+#include "cmGlobalNinjaGenerator.h"
+
+cmNinjaLinkLineComputer::cmNinjaLinkLineComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir,
+ cmGlobalNinjaGenerator const* gg)
+ : cmLinkLineComputer(outputConverter, stateDir)
+ , GG(gg)
+{
+}
+
+std::string cmNinjaLinkLineComputer::ConvertToLinkReference(
+ std::string const& lib) const
+{
+ return GG->ConvertToNinjaPath(lib);
+}
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
new file mode 100644
index 0000000..daecea4
--- /dev/null
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -0,0 +1,26 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmNinjaLinkLineComputer_h
+#define cmNinjaLinkLineComputer_h
+
+#include "cmLinkLineComputer.h"
+#include "cmState.h"
+
+class cmGlobalNinjaGenerator;
+
+class cmNinjaLinkLineComputer : public cmLinkLineComputer
+{
+public:
+ cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir,
+ cmGlobalNinjaGenerator const* gg);
+
+ std::string ConvertToLinkReference(std::string const& input) const
+ CM_OVERRIDE;
+
+private:
+ cmGlobalNinjaGenerator const* GG;
+};
+
+#endif
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index cd6dd1a..11773f9 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -8,14 +8,17 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
#include "cmNinjaTypes.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -43,7 +46,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
, TargetLinkLanguage("")
{
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
- if (target->GetType() == cmState::EXECUTABLE) {
+ if (target->GetType() == cmStateEnums::EXECUTABLE) {
this->GetGeneratorTarget()->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, GetLocalGenerator()->GetConfigName());
@@ -54,7 +57,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
GetLocalGenerator()->GetConfigName());
}
- if (target->GetType() != cmState::OBJECT_LIBRARY) {
+ if (target->GetType() != cmStateEnums::OBJECT_LIBRARY) {
// on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test)
EnsureDirectoryExists(target->GetDirectory(this->GetConfigName()));
@@ -85,7 +88,7 @@ void cmNinjaNormalTargetGenerator::Generate()
// Write the build statements
this->WriteObjectBuildStatements();
- if (this->GetGeneratorTarget()->GetType() == cmState::OBJECT_LIBRARY) {
+ if (this->GetGeneratorTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
this->WriteObjectLibStatement();
} else {
this->WriteLinkStatement();
@@ -104,10 +107,11 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
// Write rules for languages compiled in this target.
std::set<std::string> languages;
- std::vector<cmSourceFile*> sourceFiles;
- this->GetGeneratorTarget()->GetSourceFiles(
+ std::vector<cmSourceFile const*> sourceFiles;
+ this->GetGeneratorTarget()->GetObjectSources(
sourceFiles, this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
- for (std::vector<cmSourceFile*>::const_iterator i = sourceFiles.begin();
+ for (std::vector<cmSourceFile const*>::const_iterator i =
+ sourceFiles.begin();
i != sourceFiles.end(); ++i) {
const std::string& lang = (*i)->GetLanguage();
if (!lang.empty()) {
@@ -123,17 +127,17 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
{
switch (this->GetGeneratorTarget()->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "static library";
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return "shared library";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (this->GetGeneratorTarget()->IsCFBundleOnApple()) {
return "CFBundle shared module";
} else {
return "shared module";
}
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "executable";
default:
return CM_NULLPTR;
@@ -158,7 +162,7 @@ struct cmNinjaRemoveNoOpCommands
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
{
- cmState::TargetType targetType = this->GetGeneratorTarget()->GetType();
+ cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
std::string ruleName = this->LanguageLinkerRule();
// Select whether to use a response file for objects.
@@ -166,9 +170,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
std::string rspcontent;
if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
- cmLocalGenerator::RuleVariables vars;
- vars.RuleLauncher = "RULE_LAUNCH_LINK";
- vars.CMTarget = this->GetGeneratorTarget();
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
+
vars.Language = this->TargetLinkLanguage.c_str();
std::string responseFlag;
@@ -232,16 +238,29 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
vars.Manifests = "$MANIFESTS";
std::string langFlags;
- if (targetType != cmState::EXECUTABLE) {
+ if (targetType != cmStateEnums::EXECUTABLE) {
langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str();
}
+ std::string launcher;
+ const char* val = this->GetLocalGenerator()->GetRuleLauncher(
+ this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander());
+
// Rule for linking library/executable.
std::vector<std::string> linkCmds = this->ComputeLinkCmd();
for (std::vector<std::string>::iterator i = linkCmds.begin();
i != linkCmds.end(); ++i) {
- this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
+ *i, vars);
}
{
// If there is no ranlib the command will be ":". Skip it.
@@ -275,7 +294,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_EXECUTABLE",
cmakeCommand + " -E cmake_symlink_executable"
@@ -335,7 +354,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
}
}
switch (this->GetGeneratorTarget()->GetType()) {
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
// We have archive link commands set. First, delete the existing archive.
{
std::string cmakeCommand =
@@ -360,9 +379,9 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
}
return linkCmds;
}
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
break;
default:
assert(0 && "Unexpected target type");
@@ -435,7 +454,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
- const cmState::TargetType targetType = gt.GetType();
+ const cmStateEnums::TargetType targetType = gt.GetType();
this->GetBuildFileStream() << "# Link build statements for "
<< cmState::GetTargetTypeName(targetType)
<< " target " << this->GetTargetName() << "\n\n";
@@ -470,11 +489,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
- localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
- vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
- linkPath, &genTarget, useWatcomQuote);
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->GetGlobalGenerator()->CreateLinkLineComputer(
+ this->GetLocalGenerator(),
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+
+ localGen.GetTargetFlags(
+ linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
+ vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
- (gt.GetType() == cmState::SHARED_LIBRARY ||
+ (gt.GetType() == cmStateEnums::SHARED_LIBRARY ||
gt.IsExecutableWithExports())) {
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
std::string name_of_def_file = gt.GetSupportDirectory();
@@ -487,8 +512,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
// Add OS X version flags, if any.
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage,
"COMPATIBILITY", true);
this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage,
@@ -497,7 +522,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
- this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]);
vars["LINK_FLAGS"] =
cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]);
@@ -512,7 +537,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
// code between the Makefile executable and library generators.
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
std::string t = vars["FLAGS"];
localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
t += lwyuFlags;
@@ -529,7 +554,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;
- if (targetType == cmState::SHARED_LIBRARY) {
+ if (targetType == cmStateEnums::SHARED_LIBRARY) {
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
if (!install_dir.empty()) {
@@ -602,7 +627,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
// maybe create .def file from list of objects
- if ((gt.GetType() == cmState::SHARED_LIBRARY ||
+ if ((gt.GetType() == cmStateEnums::SHARED_LIBRARY ||
gt.IsExecutableWithExports()) &&
this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
@@ -690,7 +715,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->WriteLinkRule(usedResponseFile);
if (symlinkNeeded) {
- if (targetType == cmState::EXECUTABLE) {
+ if (targetType == cmStateEnums::EXECUTABLE) {
globalGen.WriteBuild(
this->GetBuildFileStream(),
"Create executable symlink " + targetOutput,
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 46a6161..b48387c 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -14,8 +14,10 @@
#include "cmNinjaNormalTargetGenerator.h"
#include "cmNinjaUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -30,15 +32,15 @@
cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
{
switch (target->GetType()) {
- case cmState::EXECUTABLE:
- case cmState::SHARED_LIBRARY:
- case cmState::STATIC_LIBRARY:
- case cmState::MODULE_LIBRARY:
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
return new cmNinjaNormalTargetGenerator(target);
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
return new cmNinjaUtilityTargetGenerator(target);
default:
@@ -185,8 +187,8 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
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) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::OBJECT_LIBRARY) {
return cmNinjaDeps();
}
@@ -273,8 +275,9 @@ std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
objName.substr(0, objName.size() - objExt.size()) + "-pp." + ppExt;
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
path += ppName;
@@ -285,8 +288,9 @@ std::string cmNinjaTargetGenerator::GetDyndepFilePath(
std::string const& lang) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
path += lang;
@@ -334,15 +338,15 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) {
std::string pdbPath;
std::string compilePdbPath;
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE ||
- this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
+ this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
pdbPath = this->GeneratorTarget->GetPDBDirectory(this->GetConfigName());
pdbPath += "/";
pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName());
}
- if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
compilePdbPath =
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
if (compilePdbPath.empty()) {
@@ -373,9 +377,10 @@ void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language)
void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
{
- cmLocalGenerator::RuleVariables vars;
- vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
- vars.CMTarget = this->GetGeneratorTarget();
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
vars.Language = lang.c_str();
vars.Source = "$IN_ABS";
vars.Object = "$out";
@@ -452,10 +457,21 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.Flags = flags.c_str();
vars.DependencyFile = depfile.c_str();
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander());
+
std::string const tdi = this->GetLocalGenerator()->ConvertToOutputFormat(
ConvertToNinjaPath(this->GetTargetDependInfoPath(lang)),
cmLocalGenerator::SHELL);
+ std::string launcher;
+ const char* val = this->GetLocalGenerator()->GetRuleLauncher(
+ this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
if (explicitPP) {
// Lookup the explicit preprocessing rule.
std::string const ppVar = "CMAKE_" + lang + "_PREPROCESS_SOURCE";
@@ -466,9 +482,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string const ppDeptype = ""; // no deps= for multiple outputs
std::string const ppDepfile = "$DEP_FILE";
- cmLocalGenerator::RuleVariables ppVars;
- ppVars.RuleLauncher = vars.RuleLauncher;
- ppVars.CMTarget = vars.CMTarget;
+ cmRulePlaceholderExpander::RuleVariables ppVars;
+ ppVars.CMTargetName = vars.CMTargetName;
+ ppVars.CMTargetType = vars.CMTargetType;
ppVars.Language = vars.Language;
ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE
ppVars.PreprocessedSource = "$out";
@@ -496,7 +512,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
for (std::vector<std::string>::iterator i = ppCmds.begin();
i != ppCmds.end(); ++i) {
- this->GetLocalGenerator()->ExpandRuleVariables(*i, ppVars);
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
+ *i, ppVars);
}
// Run CMake dependency scanner on preprocessed output.
@@ -608,7 +626,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
for (std::vector<std::string>::iterator i = compileCmds.begin();
i != compileCmds.end(); ++i) {
- this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i,
+ vars);
}
std::string cmdLine =
@@ -961,7 +981,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
return;
}
- cmLocalGenerator::RuleVariables compileObjectVars;
+ cmRulePlaceholderExpander::RuleVariables compileObjectVars;
compileObjectVars.Language = language.c_str();
std::string escapedSourceFileName = sourceFileName;
@@ -993,9 +1013,13 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
std::vector<std::string> compileCmds;
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander());
+
for (std::vector<std::string>::iterator i = compileCmds.begin();
i != compileCmds.end(); ++i) {
- this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars);
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i,
+ compileObjectVars);
}
std::string cmdLine =
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 17e35e5..500ff4a 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -12,7 +12,7 @@
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -151,7 +151,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
// 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) {
+ if (this->GetGeneratorTarget()->GetType() != cmStateEnums::GLOBAL_TARGET) {
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
this->GetGeneratorTarget());
}
diff --git a/Source/cmObject.h b/Source/cmObject.h
deleted file mode 100644
index 621a06f..0000000
--- a/Source/cmObject.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmObject_h
-#define cmObject_h
-
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
-
-/** \class cmObject
- * \brief Superclass for all commands and other classes in CMake.
- *
- * cmObject is the base class for all classes in CMake. It defines some
- * methods such as GetNameOfClass, IsA, SafeDownCast.
- */
-class cmObject
-{
-public:
- /**
- * Need virtual destructor to destroy real command type.
- */
- virtual ~cmObject() {}
-
- /**
- * The class name of the command.
- */
- virtual const char* GetNameOfClass() = 0;
-
- /**
- * Returns true if this class is the given class, or a subclass of it.
- */
- static bool IsTypeOf(const char* type) { return !strcmp("cmObject", type); }
-
- /**
- * Returns true if this object is an instance of the given class or
- * a subclass of it.
- */
- virtual bool IsA(const char* type) { return cmObject::IsTypeOf(type); }
-};
-
-#endif
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 946a543..d6efa2c 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmOptionCommand.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+
// cmOptionCommand
bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -32,7 +35,7 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
cmState* state = this->Makefile->GetState();
const char* existingValue = state->GetCacheEntryValue(args[0]);
if (existingValue) {
- if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED) {
+ if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) {
state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
return true;
}
@@ -43,6 +46,6 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
}
bool init = cmSystemTools::IsOn(initialValue.c_str());
this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF",
- args[1].c_str(), cmState::BOOL);
+ args[1].c_str(), cmStateEnums::BOOL);
return true;
}
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 3ca62d7..d77215a 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -34,8 +34,6 @@ public:
* This determines if the command is invoked when in script mode.
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
-
- cmTypeMacro(cmOptionCommand, cmCommand);
};
#endif
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 2ef603b..445ad0b 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -3,6 +3,8 @@
#include "cmOutputConverter.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include <algorithm>
@@ -11,7 +13,7 @@
#include <set>
#include <sstream>
-cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
+cmOutputConverter::cmOutputConverter(cmStateSnapshot snapshot)
: StateSnapshot(snapshot)
, LinkScriptShell(false)
{
@@ -76,44 +78,35 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b)
cmSystemTools::IsSubDirectory(a, b));
}
-std::string cmOutputConverter::ConvertToRelativePath(
- const std::vector<std::string>& local, const std::string& in_remote,
- bool force) const
+bool cmOutputConverter::ContainedInDirectory(std::string const& local_path,
+ std::string const& remote_path,
+ cmStateDirectory directory)
{
- std::string local_path = cmSystemTools::JoinPath(local);
- return force ? this->ForceToRelativePath(local_path, in_remote)
- : this->ConvertToRelativePath(local_path, in_remote);
+ const std::string relativePathTopBinary =
+ directory.GetRelativePathTopBinary();
+ const std::string relativePathTopSource =
+ directory.GetRelativePathTopSource();
+
+ const bool bothInBinary =
+ cmOutputConverterNotAbove(local_path.c_str(),
+ relativePathTopBinary.c_str()) &&
+ cmOutputConverterNotAbove(remote_path.c_str(),
+ relativePathTopBinary.c_str());
+
+ const bool bothInSource =
+ cmOutputConverterNotAbove(local_path.c_str(),
+ relativePathTopSource.c_str()) &&
+ cmOutputConverterNotAbove(remote_path.c_str(),
+ relativePathTopSource.c_str());
+
+ return bothInSource || bothInBinary;
}
std::string cmOutputConverter::ConvertToRelativePath(
std::string const& local_path, std::string const& remote_path) const
{
- // The paths should never be quoted.
- assert(local_path[0] != '\"');
- assert(remote_path[0] != '\"');
-
- // The local path should never have a trailing slash.
- assert(local_path.empty() || local_path[local_path.size() - 1] != '/');
-
- // If the path is already relative then just return the path.
- if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) {
- return remote_path;
- }
-
- // Skip conversion if the path and local are not both in the source
- // or both in the binary tree.
- if (!((cmOutputConverterNotAbove(
- local_path.c_str(),
- this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) &&
- cmOutputConverterNotAbove(
- remote_path.c_str(),
- this->StateSnapshot.GetDirectory().GetRelativePathTopBinary())) ||
- (cmOutputConverterNotAbove(
- local_path.c_str(),
- this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) &&
- cmOutputConverterNotAbove(
- remote_path.c_str(),
- this->StateSnapshot.GetDirectory().GetRelativePathTopSource())))) {
+ if (!ContainedInDirectory(local_path, remote_path,
+ this->StateSnapshot.GetDirectory())) {
return remote_path;
}
@@ -248,10 +241,11 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str,
if (this->GetState()->UseNMake()) {
flags |= Shell_Flag_NMake;
}
+ if (!this->GetState()->UseWindowsShell()) {
+ flags |= Shell_Flag_IsUnix;
+ }
- return this->GetState()->UseWindowsShell()
- ? Shell_GetArgumentForWindows(str.c_str(), flags)
- : Shell_GetArgumentForUnix(str.c_str(), flags);
+ return Shell__GetArgument(str.c_str(), flags);
}
std::string cmOutputConverter::EscapeForCMake(const std::string& str)
@@ -280,7 +274,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str)
std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg,
int shell_flags)
{
- return Shell_GetArgumentForWindows(arg, shell_flags);
+ return Shell__GetArgument(arg, shell_flags);
}
cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
@@ -366,10 +360,10 @@ int cmOutputConverter::Shell__CharNeedsQuotesOnWindows(char c)
(c == '>') || (c == '|') || (c == '^'));
}
-int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags)
+int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
{
/* On Windows the built-in command shell echo never needs quotes. */
- if (!isUnix && (flags & Shell_Flag_EchoWindows)) {
+ if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) {
return 0;
}
@@ -378,7 +372,7 @@ int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags)
return 1;
}
- if (isUnix) {
+ if (flags & Shell_Flag_IsUnix) {
/* On UNIX several special characters need quotes to preserve them. */
if (Shell__CharNeedsQuotesOnUnix(c)) {
return 1;
@@ -436,8 +430,7 @@ flag later when we understand applications of this better.
*/
#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
-int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
- int flags)
+int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
{
/* The empty string needs quotes. */
if (!*in) {
@@ -469,14 +462,14 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
}
/* Check whether this character needs quotes. */
- if (Shell__CharNeedsQuotes(*c, isUnix, flags)) {
+ if (Shell__CharNeedsQuotes(*c, flags)) {
return 1;
}
}
}
/* On Windows some single character arguments need quotes. */
- if (!isUnix && *in && !*(in + 1)) {
+ if (flags & Shell_Flag_IsUnix && *in && !*(in + 1)) {
char c = *in;
if ((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) {
return 1;
@@ -486,8 +479,7 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
return 0;
}
-std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
- int flags)
+std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
{
std::ostringstream out;
@@ -498,11 +490,11 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
int windows_backslashes = 0;
/* Whether the argument must be quoted. */
- int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags);
+ int needQuotes = Shell__ArgumentNeedsQuotes(in, flags);
if (needQuotes) {
/* Add the opening quote for this argument. */
if (flags & Shell_Flag_WatcomQuote) {
- if (isUnix) {
+ if (flags & Shell_Flag_IsUnix) {
out << '"';
}
out << '\'';
@@ -534,7 +526,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
}
/* Check whether this character needs escaping for the shell. */
- if (isUnix) {
+ if (flags & Shell_Flag_IsUnix) {
/* On Unix a few special characters need escaping even inside a
quoted argument. */
if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') {
@@ -631,7 +623,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
/* Add the closing quote for this argument. */
if (flags & Shell_Flag_WatcomQuote) {
out << '\'';
- if (isUnix) {
+ if (flags & Shell_Flag_IsUnix) {
out << '"';
}
} else {
@@ -641,15 +633,3 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
return out.str();
}
-
-std::string cmOutputConverter::Shell_GetArgumentForWindows(const char* in,
- int flags)
-{
- return Shell__GetArgument(in, 0, flags);
-}
-
-std::string cmOutputConverter::Shell_GetArgumentForUnix(const char* in,
- int flags)
-{
- return Shell__GetArgument(in, 1, flags);
-}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 5979eaa..dabb091 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -5,7 +5,7 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmState.h"
+#include "cmStateSnapshot.h"
#include <string>
#include <vector>
@@ -13,7 +13,7 @@
class cmOutputConverter
{
public:
- cmOutputConverter(cmState::Snapshot snapshot);
+ cmOutputConverter(cmStateSnapshot snapshot);
enum OutputFormat
{
@@ -33,8 +33,7 @@ public:
void SetLinkScriptShell(bool linkScriptShell);
/**
- * Flags to pass to Shell_GetArgumentForWindows or
- * Shell_GetArgumentForUnix. These modify the generated
+ * Flags to pass to Shell_GetArgument. These modify the generated
* quoting and escape sequences to work under alternative
* environments.
*/
@@ -67,18 +66,10 @@ public:
Shell_Flag_AllowMakeVariables = (1 << 6),
/** The target shell quoting uses extra single Quotes for Watcom tools. */
- Shell_Flag_WatcomQuote = (1 << 7)
- };
+ Shell_Flag_WatcomQuote = (1 << 7),
- /**
- * Transform the given command line argument for use in a Windows or
- * Unix shell. Returns a pointer to the end of the command line
- * argument in the provided output buffer. Flags may be passed to
- * modify the generated quoting and escape sequences to work under
- * alternative environments.
- */
- static std::string Shell_GetArgumentForWindows(const char* in, int flags);
- static std::string Shell_GetArgumentForUnix(const char* in, int flags);
+ Shell_Flag_IsUnix = (1 << 8)
+ };
std::string EscapeForShell(const std::string& str, bool makeVars = false,
bool forEcho = false,
@@ -99,16 +90,9 @@ public:
};
static FortranFormat GetFortranFormat(const char* value);
- /**
- * Convert the given remote path to a relative path with respect to
- * the given local path. The local path must be given in component
- * form (see SystemTools::SplitPath) without a trailing slash. The
- * remote path must use forward slashes and not already be escaped
- * or quoted.
- */
- std::string ConvertToRelativePath(const std::vector<std::string>& local,
- const std::string& in_remote,
- bool force = false) const;
+ static bool ContainedInDirectory(std::string const& local_path,
+ std::string const& remote_path,
+ cmStateDirectory directory);
/**
* Convert the given remote path to a relative path with respect to
@@ -134,14 +118,14 @@ private:
static int Shell__CharIsWhitespace(char c);
static int Shell__CharNeedsQuotesOnUnix(char c);
static int Shell__CharNeedsQuotesOnWindows(char c);
- static int Shell__CharNeedsQuotes(char c, int isUnix, int flags);
+ static int Shell__CharNeedsQuotes(char c, int flags);
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 std::string Shell__GetArgument(const char* in, int isUnix, int flags);
+ static int Shell__ArgumentNeedsQuotes(const char* in, int flags);
+ static std::string Shell__GetArgument(const char* in, int flags);
private:
- cmState::Snapshot StateSnapshot;
+ cmStateSnapshot StateSnapshot;
bool LinkScriptShell;
};
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 8b629fe..6ecd942 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -2,8 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmOutputRequiredFilesCommand.h"
-#include "cmAlgorithms.h"
#include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
+
+#include "cmAlgorithms.h"
+#include "cmGeneratorExpression.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+
+class cmExecutionStatus;
/** \class cmDependInformation
* \brief Store dependency information for a single source file.
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index 7a81a76..c4ce680 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -3,14 +3,20 @@
#ifndef cmOutputRequiredFilesCommand_h
#define cmOutputRequiredFilesCommand_h
+#include <cmConfigure.h>
+#include <set>
+#include <stdio.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
class cmDependInformation;
+class cmExecutionStatus;
class cmOutputRequiredFilesCommand : public cmCommand
{
public:
- cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 55d71ea..e45e3a5 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -3,6 +3,7 @@
#include "cmParseArgumentsCommand.h"
#include "cmAlgorithms.h"
+#include "cmSystemTools.h"
static std::string escape_arg(const std::string& arg)
{
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index fbeb3df..af87d81 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -32,8 +32,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
-
- cmTypeMacro(cmParseArgumentsCommand, cmCommand);
};
#endif
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3402191..6339e11 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -3,6 +3,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -233,7 +234,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version)
"For backwards compatibility, what version of CMake "
"commands and "
"syntax should this version of CMake try to support.",
- cmState::STRING);
+ cmStateEnums::STRING);
}
}
}
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index c34a94b..4188661 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmProjectCommand.h"
+#include "cmSystemTools.h"
+
// cmProjectCommand
bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -19,10 +21,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddCacheDefinition(
bindir, this->Makefile->GetCurrentBinaryDirectory(),
- "Value Computed by CMake", cmState::STATIC);
+ "Value Computed by CMake", cmStateEnums::STATIC);
this->Makefile->AddCacheDefinition(
srcdir, this->Makefile->GetCurrentSourceDirectory(),
- "Value Computed by CMake", cmState::STATIC);
+ "Value Computed by CMake", cmStateEnums::STATIC);
bindir = "PROJECT_BINARY_DIR";
srcdir = "PROJECT_SOURCE_DIR";
@@ -45,7 +47,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(),
"Value Computed by CMake",
- cmState::STATIC);
+ cmStateEnums::STATIC);
}
bool haveVersion = false;
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index c9c2549..ef554f3 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -32,8 +32,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "project"; }
-
- cmTypeMacro(cmProjectCommand, cmCommand);
};
#endif
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 3a721da..b0ff68d 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -2,6 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapCPPCommand.h"
+#include "cmCustomCommandLines.h"
+#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmQTWrapCPPCommand
bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 3567fb6..8eb5ff9 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -3,9 +3,13 @@
#ifndef cmQTWrapCPPCommand_h
#define cmQTWrapCPPCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
-#include "cmSourceFile.h"
+class cmExecutionStatus;
/** \class cmQTWrapCPPCommand
* \brief Create moc file rules for Qt classes
@@ -16,8 +20,6 @@
class cmQTWrapCPPCommand : public cmCommand
{
public:
- cmTypeMacro(cmQTWrapCPPCommand, cmCommand);
-
/**
* This is a virtual constructor for the command.
*/
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 3b0f083..052e633 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -2,6 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapUICommand.h"
+#include "cmCustomCommandLines.h"
+#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmQTWrapUICommand
bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 84b88a8..876ddd5 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -3,9 +3,13 @@
#ifndef cmQTWrapUICommand_h
#define cmQTWrapUICommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
-#include "cmSourceFile.h"
+class cmExecutionStatus;
/** \class cmQTWrapUICommand
* \brief Create .h and .cxx files rules for Qt user interfaces files
@@ -15,7 +19,6 @@
class cmQTWrapUICommand : public cmCommand
{
public:
- cmTypeMacro(cmQTWrapUICommand, cmCommand);
/**
* This is a virtual constructor for the command.
*/
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 5246a67..f0373a1 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -13,6 +13,7 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index b66257c..f56f575 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -8,6 +8,8 @@
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
@@ -165,7 +167,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
snapshot.GetDirectory().SetCurrentSource(targetDirectory);
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index 540f37f..5a52927 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmRemoveCommand.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmRemoveCommand
bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index bf33de0..c935f28 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -3,8 +3,14 @@
#ifndef cmRemoveCommand_h
#define cmRemoveCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmRemoveCommand
* \brief remove command
*
@@ -34,8 +40,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "remove"; }
-
- cmTypeMacro(cmRemoveCommand, cmCommand);
};
#endif
diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx
index cae5072..f5fe2df 100644
--- a/Source/cmRemoveDefinitionsCommand.cxx
+++ b/Source/cmRemoveDefinitionsCommand.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmRemoveDefinitionsCommand.h"
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
// cmRemoveDefinitionsCommand
bool cmRemoveDefinitionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 016f5fd..2bcc12d 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -3,8 +3,14 @@
#ifndef cmRemoveDefinitionsCommand_h
#define cmRemoveDefinitionsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmRemoveDefinitionsCommand
* \brief Specify a list of compiler defines
*
@@ -31,8 +37,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "remove_definitions"; }
-
- cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand);
};
#endif
diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx
index aa056c3..f8b3129 100644
--- a/Source/cmReturnCommand.cxx
+++ b/Source/cmReturnCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmReturnCommand.h"
+#include "cmExecutionStatus.h"
+
// cmReturnCommand
bool cmReturnCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus& status)
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index 1159e78..06b91bc 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "return"; }
-
- cmTypeMacro(cmReturnCommand, cmCommand);
};
#endif
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
new file mode 100644
index 0000000..361321e
--- /dev/null
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -0,0 +1,304 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmRulePlaceholderExpander.h"
+
+#include "cmOutputConverter.h"
+#include "cmSystemTools.h"
+
+cmRulePlaceholderExpander::cmRulePlaceholderExpander(
+ std::map<std::string, std::string> const& compilers,
+ std::map<std::string, std::string> const& variableMappings,
+ std::string const& compilerSysroot)
+ : Compilers(compilers)
+ , VariableMappings(variableMappings)
+ , CompilerSysroot(compilerSysroot)
+{
+}
+
+cmRulePlaceholderExpander::RuleVariables::RuleVariables()
+{
+ memset(this, 0, sizeof(*this));
+}
+
+std::string cmRulePlaceholderExpander::ExpandRuleVariable(
+ cmOutputConverter* outputConverter, std::string const& variable,
+ const RuleVariables& replaceValues)
+{
+ if (replaceValues.LinkFlags) {
+ if (variable == "LINK_FLAGS") {
+ return replaceValues.LinkFlags;
+ }
+ }
+ if (replaceValues.Manifests) {
+ if (variable == "MANIFESTS") {
+ return replaceValues.Manifests;
+ }
+ }
+ if (replaceValues.Flags) {
+ if (variable == "FLAGS") {
+ return replaceValues.Flags;
+ }
+ }
+
+ if (replaceValues.Source) {
+ if (variable == "SOURCE") {
+ return replaceValues.Source;
+ }
+ }
+ if (replaceValues.PreprocessedSource) {
+ if (variable == "PREPROCESSED_SOURCE") {
+ return replaceValues.PreprocessedSource;
+ }
+ }
+ if (replaceValues.AssemblySource) {
+ if (variable == "ASSEMBLY_SOURCE") {
+ return replaceValues.AssemblySource;
+ }
+ }
+ if (replaceValues.Object) {
+ if (variable == "OBJECT") {
+ return replaceValues.Object;
+ }
+ }
+ if (replaceValues.ObjectDir) {
+ if (variable == "OBJECT_DIR") {
+ return replaceValues.ObjectDir;
+ }
+ }
+ if (replaceValues.ObjectFileDir) {
+ if (variable == "OBJECT_FILE_DIR") {
+ return replaceValues.ObjectFileDir;
+ }
+ }
+ if (replaceValues.Objects) {
+ if (variable == "OBJECTS") {
+ return replaceValues.Objects;
+ }
+ }
+ if (replaceValues.ObjectsQuoted) {
+ if (variable == "OBJECTS_QUOTED") {
+ return replaceValues.ObjectsQuoted;
+ }
+ }
+ if (replaceValues.Defines && variable == "DEFINES") {
+ return replaceValues.Defines;
+ }
+ if (replaceValues.Includes && variable == "INCLUDES") {
+ return replaceValues.Includes;
+ }
+ if (replaceValues.TargetPDB) {
+ if (variable == "TARGET_PDB") {
+ return replaceValues.TargetPDB;
+ }
+ }
+ if (replaceValues.TargetCompilePDB) {
+ if (variable == "TARGET_COMPILE_PDB") {
+ return replaceValues.TargetCompilePDB;
+ }
+ }
+ if (replaceValues.DependencyFile) {
+ if (variable == "DEP_FILE") {
+ return replaceValues.DependencyFile;
+ }
+ }
+
+ if (replaceValues.Target) {
+ if (variable == "TARGET_QUOTED") {
+ std::string targetQuoted = replaceValues.Target;
+ if (!targetQuoted.empty() && targetQuoted[0] != '\"') {
+ targetQuoted = '\"';
+ targetQuoted += replaceValues.Target;
+ targetQuoted += '\"';
+ }
+ return targetQuoted;
+ }
+ if (variable == "TARGET_UNQUOTED") {
+ std::string unquoted = replaceValues.Target;
+ std::string::size_type sz = unquoted.size();
+ if (sz > 2 && unquoted[0] == '\"' && unquoted[sz - 1] == '\"') {
+ unquoted = unquoted.substr(1, sz - 2);
+ }
+ return unquoted;
+ }
+ if (replaceValues.LanguageCompileFlags) {
+ if (variable == "LANGUAGE_COMPILE_FLAGS") {
+ return replaceValues.LanguageCompileFlags;
+ }
+ }
+ if (replaceValues.Target) {
+ if (variable == "TARGET") {
+ return replaceValues.Target;
+ }
+ }
+ if (variable == "TARGET_IMPLIB") {
+ return this->TargetImpLib;
+ }
+ if (variable == "TARGET_VERSION_MAJOR") {
+ if (replaceValues.TargetVersionMajor) {
+ return replaceValues.TargetVersionMajor;
+ }
+ return "0";
+ }
+ if (variable == "TARGET_VERSION_MINOR") {
+ if (replaceValues.TargetVersionMinor) {
+ return replaceValues.TargetVersionMinor;
+ }
+ return "0";
+ }
+ if (replaceValues.Target) {
+ if (variable == "TARGET_BASE") {
+ // Strip the last extension off the target name.
+ std::string targetBase = replaceValues.Target;
+ std::string::size_type pos = targetBase.rfind('.');
+ if (pos != targetBase.npos) {
+ return targetBase.substr(0, pos);
+ }
+ return targetBase;
+ }
+ }
+ }
+ if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
+ variable == "TARGET_INSTALLNAME_DIR") {
+ // All these variables depend on TargetSOName
+ if (replaceValues.TargetSOName) {
+ if (variable == "TARGET_SONAME") {
+ return replaceValues.TargetSOName;
+ }
+ if (variable == "SONAME_FLAG" && replaceValues.SONameFlag) {
+ return replaceValues.SONameFlag;
+ }
+ if (replaceValues.TargetInstallNameDir &&
+ variable == "TARGET_INSTALLNAME_DIR") {
+ return replaceValues.TargetInstallNameDir;
+ }
+ }
+ return "";
+ }
+ if (replaceValues.LinkLibraries) {
+ if (variable == "LINK_LIBRARIES") {
+ return replaceValues.LinkLibraries;
+ }
+ }
+ if (replaceValues.Language) {
+ if (variable == "LANGUAGE") {
+ return replaceValues.Language;
+ }
+ }
+ if (replaceValues.CMTargetName) {
+ if (variable == "TARGET_NAME") {
+ return replaceValues.CMTargetName;
+ }
+ }
+ if (replaceValues.CMTargetType) {
+ if (variable == "TARGET_TYPE") {
+ return replaceValues.CMTargetType;
+ }
+ }
+ if (replaceValues.Output) {
+ if (variable == "OUTPUT") {
+ return replaceValues.Output;
+ }
+ }
+ if (variable == "CMAKE_COMMAND") {
+ return outputConverter->ConvertToOutputFormat(
+ cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
+ cmOutputConverter::SHELL);
+ }
+
+ std::map<std::string, std::string>::iterator compIt =
+ this->Compilers.find(variable);
+
+ if (compIt != this->Compilers.end()) {
+ std::string ret = outputConverter->ConvertToOutputForExisting(
+ this->VariableMappings["CMAKE_" + compIt->second + "_COMPILER"]);
+ std::string const& compilerArg1 =
+ this->VariableMappings[compIt->first + "_COMPILER_ARG1"];
+ std::string const& compilerTarget =
+ this->VariableMappings["CMAKE_" + compIt->second + "_COMPILER_TARGET"];
+ std::string const& compilerOptionTarget =
+ this->VariableMappings["CMAKE_" + compIt->second +
+ "_COMPILE_OPTIONS_TARGET"];
+ std::string const& compilerExternalToolchain =
+ this->VariableMappings["CMAKE_" + compIt->second +
+ "_COMPILER_EXTERNAL_TOOLCHAIN"];
+ std::string const& compilerOptionExternalToolchain =
+ this->VariableMappings["CMAKE_" + compIt->second +
+ "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN"];
+ std::string const& compilerOptionSysroot =
+ this->VariableMappings["CMAKE_" + compIt->second +
+ "_COMPILE_OPTIONS_SYSROOT"];
+
+ // if there is a required first argument to the compiler add it
+ // to the compiler string
+ if (!compilerArg1.empty()) {
+ ret += " ";
+ ret += compilerArg1;
+ }
+ if (!compilerTarget.empty() && !compilerOptionTarget.empty()) {
+ ret += " ";
+ ret += compilerOptionTarget;
+ ret += compilerTarget;
+ }
+ if (!compilerExternalToolchain.empty() &&
+ !compilerOptionExternalToolchain.empty()) {
+ ret += " ";
+ ret += compilerOptionExternalToolchain;
+ ret += outputConverter->EscapeForShell(compilerExternalToolchain, true);
+ }
+ if (!this->CompilerSysroot.empty() && !compilerOptionSysroot.empty()) {
+ ret += " ";
+ ret += compilerOptionSysroot;
+ ret += outputConverter->EscapeForShell(this->CompilerSysroot, true);
+ }
+ return ret;
+ }
+
+ std::map<std::string, std::string>::iterator mapIt =
+ this->VariableMappings.find(variable);
+ if (mapIt != this->VariableMappings.end()) {
+ if (variable.find("_FLAG") == variable.npos) {
+ return outputConverter->ConvertToOutputForExisting(mapIt->second);
+ }
+ return mapIt->second;
+ }
+ return variable;
+}
+
+void cmRulePlaceholderExpander::ExpandRuleVariables(
+ cmOutputConverter* outputConverter, std::string& s,
+ const RuleVariables& replaceValues)
+{
+ std::string::size_type start = s.find('<');
+ // no variables to expand
+ if (start == s.npos) {
+ return;
+ }
+ std::string::size_type pos = 0;
+ std::string expandedInput;
+ while (start != s.npos && start < s.size() - 2) {
+ std::string::size_type end = s.find('>', start);
+ // if we find a < with no > we are done
+ if (end == s.npos) {
+ return;
+ }
+ char c = s[start + 1];
+ // if the next char after the < is not A-Za-z then
+ // skip it and try to find the next < in the string
+ if (!isalpha(c)) {
+ start = s.find('<', start + 1);
+ } else {
+ // extract the var
+ std::string var = s.substr(start + 1, end - start - 1);
+ std::string replace =
+ this->ExpandRuleVariable(outputConverter, var, replaceValues);
+ expandedInput += s.substr(pos, start - pos);
+ expandedInput += replace;
+ // move to next one
+ start = s.find('<', start + var.size() + 2);
+ pos = end + 1;
+ }
+ }
+ // add the rest of the input
+ expandedInput += s.substr(pos, s.size() - pos);
+ s = expandedInput;
+}
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
new file mode 100644
index 0000000..444419c
--- /dev/null
+++ b/Source/cmRulePlaceholderExpander.h
@@ -0,0 +1,83 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmRulePlaceholderExpander_h
+#define cmRulePlaceholderExpander_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
+
+class cmGeneratorTarget;
+class cmOutputConverter;
+
+class cmRulePlaceholderExpander
+{
+public:
+ cmRulePlaceholderExpander(
+ std::map<std::string, std::string> const& compilers,
+ std::map<std::string, std::string> const& variableMappings,
+ std::string const& compilerSysroot);
+
+ void SetTargetImpLib(std::string const& targetImpLib)
+ {
+ this->TargetImpLib = targetImpLib;
+ }
+
+ // Create a struct to hold the varibles passed into
+ // ExpandRuleVariables
+ struct RuleVariables
+ {
+ RuleVariables();
+ const char* CMTargetName;
+ const char* CMTargetType;
+ const char* TargetPDB;
+ const char* TargetCompilePDB;
+ const char* TargetVersionMajor;
+ const char* TargetVersionMinor;
+ const char* Language;
+ const char* Objects;
+ const char* Target;
+ const char* LinkLibraries;
+ const char* Source;
+ const char* AssemblySource;
+ const char* PreprocessedSource;
+ const char* Output;
+ const char* Object;
+ const char* ObjectDir;
+ const char* ObjectFileDir;
+ const char* Flags;
+ const char* ObjectsQuoted;
+ const char* SONameFlag;
+ const char* TargetSOName;
+ const char* TargetInstallNameDir;
+ const char* LinkFlags;
+ const char* Manifests;
+ const char* LanguageCompileFlags;
+ const char* Defines;
+ const char* Includes;
+ const char* RuleLauncher;
+ const char* DependencyFile;
+ const char* FilterPrefix;
+ };
+
+ // Expand rule variables in CMake of the type found in language rules
+ void ExpandRuleVariables(cmOutputConverter* outputConverter,
+ std::string& string,
+ const RuleVariables& replaceValues);
+
+ // Expand rule variables in a single string
+ std::string ExpandRuleVariable(cmOutputConverter* outputConverter,
+ std::string const& variable,
+ const RuleVariables& replaceValues);
+
+private:
+ std::string TargetImpLib;
+
+ std::map<std::string, std::string> Compilers;
+ std::map<std::string, std::string> VariableMappings;
+ std::string CompilerSysroot;
+};
+
+#endif
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index c34028e..fd3d482 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmFindCommon.h"
+#include "cmSystemTools.h"
cmSearchPath::cmSearchPath(cmFindCommon* findCmd)
: FC(findCmd)
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index b5c3186..77546a3 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSeparateArgumentsCommand.h"
+#include "cmSystemTools.h"
+
// cmSeparateArgumentsCommand
bool cmSeparateArgumentsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 66fbef7..d80d043 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
-
- cmTypeMacro(cmSeparateArgumentsCommand, cmCommand);
};
#endif
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index a2bdf49..e50878b 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -2,11 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerProtocol.h"
-#include "cmCacheManager.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -41,8 +41,9 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
}
makefiles[0]->GetConfigurations(configurations);
- if (configurations.empty())
+ if (configurations.empty()) {
configurations.push_back("");
+ }
return configurations;
}
@@ -95,20 +96,24 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
if (!sourceDir.empty()) {
const std::string& relative =
cmSystemTools::RelativePath(sourceDir.c_str(), jt->c_str());
- if (toAdd.size() > relative.size())
+ if (toAdd.size() > relative.size()) {
toAdd = relative;
+ }
}
if (isInternal) {
- if (internalFiles)
+ if (internalFiles) {
internalFiles->push_back(toAdd);
+ }
} else {
if (isTemporary) {
- if (tmpFiles)
+ if (tmpFiles) {
tmpFiles->push_back(toAdd);
+ }
} else {
- if (explicitFiles)
+ if (explicitFiles) {
explicitFiles->push_back(toAdd);
+ }
}
}
}
@@ -671,8 +676,9 @@ static Json::Value DumpSourceFilesList(
Json::Value result = Json::arrayValue;
for (auto it = fileGroups.begin(); it != fileGroups.end(); ++it) {
Json::Value group = DumpSourceFileGroup(it->first, it->second, baseDir);
- if (!group.isNull())
+ if (!group.isNull()) {
result.append(group);
+ }
}
return result;
@@ -684,7 +690,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
cmLocalGenerator* lg = target->GetLocalGenerator();
const cmState* state = lg->GetState();
- const cmState::TargetType type = target->GetType();
+ const cmStateEnums::TargetType type = target->GetType();
const std::string typeName = state->GetTargetTypeName(type);
Json::Value ttl = Json::arrayValue;
@@ -728,8 +734,10 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
std::string linkLanguageFlags;
std::string frameworkPath;
std::string linkPath;
- lg->GetTargetFlags(config, linkLibs, linkLanguageFlags, linkFlags,
- frameworkPath, linkPath, target, false);
+ cmLinkLineComputer linkLineComputer(lg,
+ lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags,
+ linkFlags, frameworkPath, linkPath, target);
linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
@@ -818,8 +826,8 @@ static Json::Value DumpProjectList(const cmake* cm, const std::string config)
Json::Value pObj = Json::objectValue;
pObj[kNAME_KEY] = projectIt.first;
- assert(projectIt.second.size() >
- 0); // All Projects must have at least one local generator
+ // All Projects must have at least one local generator
+ assert(!projectIt.second.empty());
const cmLocalGenerator* lg = projectIt.second.at(0);
// Project structure information:
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 8ce0b18..9f59db4 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetCommand.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+
// cmSetCommand
bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -64,8 +67,9 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
bool cache = false; // optional
bool force = false; // optional
bool parentScope = false;
- cmState::CacheEntryType type = cmState::STRING; // required if cache
- const char* docstring = CM_NULLPTR; // required if cache
+ cmStateEnums::CacheEntryType type =
+ cmStateEnums::STRING; // required if cache
+ const char* docstring = CM_NULLPTR; // required if cache
unsigned int ignoreLastArgs = 0;
// look for PARENT_SCOPE argument
@@ -115,12 +119,12 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
cmState* state = this->Makefile->GetState();
const char* existingValue = state->GetCacheEntryValue(variable);
if (existingValue &&
- (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED)) {
+ (state->GetCacheEntryType(variable) != cmStateEnums::UNINITIALIZED)) {
// if the set is trying to CACHE the value but the value
// is already in the cache and the type is not internal
// then leave now without setting any definitions in the cache
// or the makefile
- if (cache && type != cmState::INTERNAL && !force) {
+ if (cache && type != cmStateEnums::INTERNAL && !force) {
return true;
}
}
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 94f7cf0..6fa3865 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "set"; }
-
- cmTypeMacro(cmSetCommand, cmCommand);
};
#endif
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 9abefda..9608742 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -40,8 +40,6 @@ public:
std::vector<std::string>::const_iterator ait,
std::vector<std::string>::const_iterator aitend,
std::string& errors);
-
- cmTypeMacro(cmSetDirectoryPropertiesCommand, cmCommand);
};
#endif
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 2a4101f..552f918 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -2,9 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetPropertyCommand.h"
+#include "cmGlobalGenerator.h"
#include "cmSetSourceFilesPropertiesCommand.h"
#include "cmSetTargetPropertiesCommand.h"
#include "cmSetTestsPropertiesCommand.h"
+#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmTest.h"
cmSetPropertyCommand::cmSetPropertyCommand()
{
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 01295c1..b4dff76 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -29,8 +29,6 @@ public:
*/
bool IsScriptable() const CM_OVERRIDE { return true; }
- cmTypeMacro(cmSetPropertyCommand, cmCommand);
-
private:
std::set<std::string> Names;
std::string PropertyName;
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index 0021589..6a87d6d 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -3,6 +3,7 @@
#include "cmSetSourceFilesPropertiesCommand.h"
#include "cmSourceFile.h"
+#include "cmSystemTools.h"
// cmSetSourceFilesPropertiesCommand
bool cmSetSourceFilesPropertiesCommand::InitialPass(
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index c683ac0..62cc404 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -28,8 +28,6 @@ public:
return "set_source_files_properties";
}
- cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand);
-
static bool RunCommand(cmMakefile* mf,
std::vector<std::string>::const_iterator filebeg,
std::vector<std::string>::const_iterator fileend,
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 6e2a242..ed02fa8 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -28,8 +28,6 @@ public:
static bool SetOneTarget(const std::string& tname,
std::vector<std::string>& propertyPairs,
cmMakefile* mf);
-
- cmTypeMacro(cmSetTargetPropertiesCommand, cmCommand);
};
#endif
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 3f5ce21..04ba76e 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -22,8 +22,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
- cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);
-
static bool SetOneTest(const std::string& tname,
std::vector<std::string>& propertyPairs,
cmMakefile* mf, std::string& errors);
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index dbd3ed9..18c2a3e 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSiteNameCommand.h"
+#include "cmSystemTools.h"
+
#include <cmsys/RegularExpression.hxx>
// cmSiteNameCommand
@@ -68,7 +70,8 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args,
#endif
this->Makefile->AddCacheDefinition(
args[0], siteName.c_str(),
- "Name of the computer/site where compile is being run", cmState::STRING);
+ "Name of the computer/site where compile is being run",
+ cmStateEnums::STRING);
return true;
}
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 5578b03..48d1035 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "site_name"; }
-
- cmTypeMacro(cmSiteNameCommand, cmCommand);
};
#endif
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5d37578..6f29b18 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -7,6 +7,7 @@
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 2b176b5..ff3ec7f 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,6 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmSourceGroup.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmSourceGroupCommand
bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index e3639df..f533be1 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -3,8 +3,14 @@
#ifndef cmSourceGroupCommand_h
#define cmSourceGroupCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmSourceGroupCommand
* \brief Adds a cmSourceGroup to the cmMakefile.
*
@@ -30,8 +36,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "source_group"; }
-
- cmTypeMacro(cmSourceGroupCommand, cmCommand);
};
#endif
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 0aab6d9..a2047af 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -49,6 +49,5 @@ extern void operator<<(std::ostream&, const std::ostringstream&);
#include "cmCustomCommandLines.h"
#include "cmDocumentationEntry.h"
#include "cmTargetLinkLibraryType.h"
-#include "cmTypeMacro.h"
#endif
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 0e73879..db1e542 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -2,14 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmState.h"
+#include "cmStatePrivate.h"
+
#include "cmAlgorithms.h"
#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>
@@ -20,85 +20,6 @@
#include <string.h>
#include <utility>
-static std::string const kBINARY_DIR = "BINARY_DIR";
-static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS";
-static std::string const kSOURCE_DIR = "SOURCE_DIR";
-static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES";
-
-struct cmState::SnapshotDataType
-{
- cmState::PositionType ScopeParent;
- cmState::PositionType DirectoryParent;
- cmLinkedTree<cmState::PolicyStackEntry>::iterator Policies;
- cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyRoot;
- cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyScope;
- cmState::SnapshotType SnapshotType;
- bool Keep;
- cmLinkedTree<std::string>::iterator ExecutionListFile;
- cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
- BuildSystemDirectory;
- cmLinkedTree<cmDefinitions>::iterator Vars;
- cmLinkedTree<cmDefinitions>::iterator Root;
- cmLinkedTree<cmDefinitions>::iterator Parent;
- std::vector<std::string>::size_type IncludeDirectoryPosition;
- std::vector<std::string>::size_type CompileDefinitionsPosition;
- std::vector<std::string>::size_type CompileOptionsPosition;
-};
-
-struct cmState::PolicyStackEntry : public cmPolicies::PolicyMap
-{
- typedef cmPolicies::PolicyMap derived;
- PolicyStackEntry(bool w = false)
- : derived()
- , Weak(w)
- {
- }
- PolicyStackEntry(derived const& d, bool w)
- : derived(d)
- , Weak(w)
- {
- }
- PolicyStackEntry(PolicyStackEntry const& r)
- : derived(r)
- , Weak(r.Weak)
- {
- }
- bool Weak;
-};
-
-struct cmState::BuildsystemDirectoryStateType
-{
- cmState::PositionType DirectoryEnd;
-
- std::string Location;
- std::string OutputLocation;
-
- // The top-most directories for relative path conversion. Both the
- // source and destination location of a relative path conversion
- // must be underneath one of these directories (both under source or
- // both under binary) in order for the relative path to be evaluated
- // safely by the build tools.
- std::string RelativePathTopSource;
- std::string RelativePathTopBinary;
-
- std::vector<std::string> IncludeDirectories;
- std::vector<cmListFileBacktrace> IncludeDirectoryBacktraces;
-
- std::vector<std::string> CompileDefinitions;
- std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
-
- std::vector<std::string> CompileOptions;
- std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
-
- std::vector<std::string> NormalTargetNames;
-
- std::string ProjectName;
-
- cmPropertyMap Properties;
-
- std::vector<cmState::Snapshot> Children;
-};
-
cmState::cmState()
: IsInTryCompile(false)
, WindowsShell(false)
@@ -117,26 +38,26 @@ cmState::~cmState()
cmDeleteAll(this->Commands);
}
-const char* cmState::GetTargetTypeName(cmState::TargetType targetType)
+const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
{
switch (targetType) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "STATIC_LIBRARY";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return "MODULE_LIBRARY";
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return "SHARED_LIBRARY";
- case cmState::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
return "OBJECT_LIBRARY";
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "EXECUTABLE";
- case cmState::UTILITY:
+ case cmStateEnums::UTILITY:
return "UTILITY";
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::GLOBAL_TARGET:
return "GLOBAL_TARGET";
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
return "INTERFACE_LIBRARY";
- case cmState::UNKNOWN_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
return "UNKNOWN_LIBRARY";
}
assert(0 && "Unexpected target type");
@@ -147,7 +68,7 @@ const char* cmCacheEntryTypes[] = { "BOOL", "PATH", "FILEPATH",
"STRING", "INTERNAL", "STATIC",
"UNINITIALIZED", CM_NULLPTR };
-const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
+const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type)
{
if (type > 6) {
return cmCacheEntryTypes[6];
@@ -155,16 +76,16 @@ const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
return cmCacheEntryTypes[type];
}
-cmState::CacheEntryType cmState::StringToCacheEntryType(const char* s)
+cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s)
{
int i = 0;
while (cmCacheEntryTypes[i]) {
if (strcmp(s, cmCacheEntryTypes[i]) == 0) {
- return static_cast<cmState::CacheEntryType>(i);
+ return static_cast<cmStateEnums::CacheEntryType>(i);
}
++i;
}
- return STRING;
+ return cmStateEnums::STRING;
}
bool cmState::IsCacheEntryType(std::string const& key)
@@ -219,7 +140,7 @@ const char* cmState::GetInitializedCacheValue(std::string const& key) const
return this->CacheManager->GetInitializedCacheValue(key);
}
-cmState::CacheEntryType cmState::GetCacheEntryType(
+cmStateEnums::CacheEntryType cmState::GetCacheEntryType(
std::string const& key) const
{
cmCacheManager::CacheIterator it =
@@ -279,7 +200,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
void cmState::AddCacheEntry(const std::string& key, const char* value,
const char* helpString,
- cmState::CacheEntryType type)
+ cmStateEnums::CacheEntryType type)
{
this->CacheManager->AddCacheEntry(key, value, helpString, type);
}
@@ -304,16 +225,16 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
.SetProperty(propertyName, (void*)CM_NULLPTR);
}
-cmState::Snapshot cmState::Reset()
+cmStateSnapshot cmState::Reset()
{
this->GlobalProperties.clear();
this->PropertyDefinitions.clear();
- PositionType pos = this->SnapshotData.Truncate();
+ cmStateDetail::PositionType pos = this->SnapshotData.Truncate();
this->ExecutionListFiles.Truncate();
{
- cmLinkedTree<BuildsystemDirectoryStateType>::iterator it =
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator it =
this->BuildsystemDirectory.Truncate();
it->IncludeDirectories.clear();
it->IncludeDirectoryBacktraces.clear();
@@ -360,7 +281,7 @@ cmState::Snapshot cmState::Reset()
this->DefineProperty("RULE_LAUNCH_LINK", cmProperty::TARGET, "", "", true);
this->DefineProperty("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, "", "", true);
- return Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
void cmState::DefineProperty(const std::string& name,
@@ -524,8 +445,7 @@ void cmState::RemoveUserDefinedCommands()
std::vector<cmCommand*> renamedCommands;
for (std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
j != this->Commands.end();) {
- if (j->second->IsA("cmMacroHelperCommand") ||
- j->second->IsA("cmFunctionHelperCommand")) {
+ if (j->second->IsUserDefined()) {
delete j->second;
this->Commands.erase(j++);
} else if (j->first != j->second->GetName()) {
@@ -676,78 +596,13 @@ const char* cmState::GetBinaryDirectory() const
return this->BinaryDirectory.c_str();
}
-void cmState::Directory::ComputeRelativePathTopSource()
-{
- // Relative path conversion inside the source tree is not used to
- // construct relative paths passed to build tools so it is safe to use
- // even when the source is a network path.
-
- cmState::Snapshot snapshot = this->Snapshot_;
- std::vector<cmState::Snapshot> snapshots;
- snapshots.push_back(snapshot);
- while (true) {
- snapshot = snapshot.GetBuildsystemDirectoryParent();
- if (snapshot.IsValid()) {
- snapshots.push_back(snapshot);
- } else {
- break;
- }
- }
-
- std::string result = snapshots.front().GetDirectory().GetCurrentSource();
-
- for (std::vector<cmState::Snapshot>::const_iterator it =
- snapshots.begin() + 1;
- it != snapshots.end(); ++it) {
- std::string currentSource = it->GetDirectory().GetCurrentSource();
- if (cmSystemTools::IsSubDirectory(result, currentSource)) {
- result = currentSource;
- }
- }
- this->DirectoryState->RelativePathTopSource = result;
-}
-
-void cmState::Directory::ComputeRelativePathTopBinary()
-{
- cmState::Snapshot snapshot = this->Snapshot_;
- std::vector<cmState::Snapshot> snapshots;
- snapshots.push_back(snapshot);
- while (true) {
- snapshot = snapshot.GetBuildsystemDirectoryParent();
- if (snapshot.IsValid()) {
- snapshots.push_back(snapshot);
- } else {
- break;
- }
- }
-
- std::string result = snapshots.front().GetDirectory().GetCurrentBinary();
-
- for (std::vector<cmState::Snapshot>::const_iterator it =
- snapshots.begin() + 1;
- it != snapshots.end(); ++it) {
- std::string currentBinary = it->GetDirectory().GetCurrentBinary();
- if (cmSystemTools::IsSubDirectory(result, currentBinary)) {
- result = currentBinary;
- }
- }
-
- // The current working directory on Windows cannot be a network
- // path. Therefore relative paths cannot work when the binary tree
- // is a network path.
- if (result.size() < 2 || result.substr(0, 2) != "//") {
- this->DirectoryState->RelativePathTopBinary = result;
- } else {
- this->DirectoryState->RelativePathTopBinary = "";
- }
-}
-
-cmState::Snapshot cmState::CreateBaseSnapshot()
+cmStateSnapshot cmState::CreateBaseSnapshot()
{
- PositionType pos = this->SnapshotData.Push(this->SnapshotData.Root());
+ cmStateDetail::PositionType pos =
+ this->SnapshotData.Push(this->SnapshotData.Root());
pos->DirectoryParent = this->SnapshotData.Root();
pos->ScopeParent = this->SnapshotData.Root();
- pos->SnapshotType = BaseType;
+ pos->SnapshotType = cmStateEnums::BaseType;
pos->Keep = true;
pos->BuildSystemDirectory =
this->BuildsystemDirectory.Push(this->BuildsystemDirectory.Root());
@@ -766,17 +621,18 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
assert(pos->Vars.IsValid());
pos->Parent = this->VarTree.Root();
pos->Root = this->VarTree.Root();
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot(
- Snapshot originSnapshot)
+cmStateSnapshot cmState::CreateBuildsystemDirectorySnapshot(
+ cmStateSnapshot originSnapshot)
{
assert(originSnapshot.IsValid());
- PositionType pos = this->SnapshotData.Push(originSnapshot.Position);
+ cmStateDetail::PositionType pos =
+ this->SnapshotData.Push(originSnapshot.Position);
pos->DirectoryParent = originSnapshot.Position;
pos->ScopeParent = originSnapshot.Position;
- pos->SnapshotType = BuildsystemDirectoryType;
+ pos->SnapshotType = cmStateEnums::BuildsystemDirectoryType;
pos->Keep = true;
pos->BuildSystemDirectory = this->BuildsystemDirectory.Push(
originSnapshot.Position->BuildSystemDirectory);
@@ -794,7 +650,7 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot(
pos->Root = origin;
pos->Vars = this->VarTree.Push(origin);
- cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
+ cmStateSnapshot snapshot = cmStateSnapshot(this, pos);
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
snapshot.SetDefaultDefinitions();
snapshot.InitializeFromParent();
@@ -802,13 +658,13 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot(
return snapshot;
}
-cmState::Snapshot cmState::CreateFunctionCallSnapshot(
- cmState::Snapshot originSnapshot, std::string const& fileName)
+cmStateSnapshot cmState::CreateFunctionCallSnapshot(
+ cmStateSnapshot originSnapshot, std::string const& fileName)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
pos->ScopeParent = originSnapshot.Position;
- pos->SnapshotType = FunctionCallType;
+ pos->SnapshotType = cmStateEnums::FunctionCallType;
pos->Keep = false;
pos->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
@@ -818,46 +674,46 @@ cmState::Snapshot cmState::CreateFunctionCallSnapshot(
cmLinkedTree<cmDefinitions>::iterator origin = originSnapshot.Position->Vars;
pos->Parent = origin;
pos->Vars = this->VarTree.Push(origin);
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreateMacroCallSnapshot(
- cmState::Snapshot originSnapshot, std::string const& fileName)
+cmStateSnapshot cmState::CreateMacroCallSnapshot(
+ cmStateSnapshot originSnapshot, std::string const& fileName)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
- pos->SnapshotType = MacroCallType;
+ pos->SnapshotType = cmStateEnums::MacroCallType;
pos->Keep = false;
pos->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreateIncludeFileSnapshot(
- cmState::Snapshot originSnapshot, const std::string& fileName)
+cmStateSnapshot cmState::CreateIncludeFileSnapshot(
+ cmStateSnapshot originSnapshot, const std::string& fileName)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
- pos->SnapshotType = IncludeFileType;
+ pos->SnapshotType = cmStateEnums::IncludeFileType;
pos->Keep = true;
pos->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreateVariableScopeSnapshot(
- cmState::Snapshot originSnapshot)
+cmStateSnapshot cmState::CreateVariableScopeSnapshot(
+ cmStateSnapshot originSnapshot)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
pos->ScopeParent = originSnapshot.Position;
- pos->SnapshotType = VariableScopeType;
+ pos->SnapshotType = cmStateEnums::VariableScopeType;
pos->Keep = false;
pos->PolicyScope = originSnapshot.Position->Policies;
assert(originSnapshot.Position->Vars.IsValid());
@@ -866,39 +722,39 @@ cmState::Snapshot cmState::CreateVariableScopeSnapshot(
pos->Parent = origin;
pos->Vars = this->VarTree.Push(origin);
assert(pos->Vars.IsValid());
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreateInlineListFileSnapshot(
- cmState::Snapshot originSnapshot, const std::string& fileName)
+cmStateSnapshot cmState::CreateInlineListFileSnapshot(
+ cmStateSnapshot originSnapshot, const std::string& fileName)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
- pos->SnapshotType = InlineListFileType;
+ pos->SnapshotType = cmStateEnums::InlineListFileType;
pos->Keep = true;
pos->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::CreatePolicyScopeSnapshot(
- cmState::Snapshot originSnapshot)
+cmStateSnapshot cmState::CreatePolicyScopeSnapshot(
+ cmStateSnapshot originSnapshot)
{
- PositionType pos =
+ cmStateDetail::PositionType pos =
this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position);
- pos->SnapshotType = PolicyScopeType;
+ pos->SnapshotType = cmStateEnums::PolicyScopeType;
pos->Keep = false;
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
- return cmState::Snapshot(this, pos);
+ return cmStateSnapshot(this, pos);
}
-cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
+cmStateSnapshot cmState::Pop(cmStateSnapshot originSnapshot)
{
- PositionType pos = originSnapshot.Position;
- PositionType prevPos = pos;
+ cmStateDetail::PositionType pos = originSnapshot.Position;
+ cmStateDetail::PositionType prevPos = pos;
++prevPos;
prevPos->IncludeDirectoryPosition =
prevPos->BuildSystemDirectory->IncludeDirectories.size();
@@ -920,855 +776,7 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
this->SnapshotData.Pop(pos);
}
- return Snapshot(this, prevPos);
-}
-
-cmState::Snapshot::Snapshot(cmState* state)
- : State(state)
- , Position()
-{
-}
-
-std::vector<cmState::Snapshot> cmState::Snapshot::GetChildren()
-{
- return this->Position->BuildSystemDirectory->Children;
-}
-
-cmState::Snapshot::Snapshot(cmState* state, PositionType position)
- : State(state)
- , Position(position)
-{
-}
-
-cmState::SnapshotType cmState::Snapshot::GetType() const
-{
- return this->Position->SnapshotType;
-}
-
-const char* cmState::Directory::GetCurrentSource() const
-{
- return this->DirectoryState->Location.c_str();
-}
-
-void cmState::Directory::SetCurrentSource(std::string const& dir)
-{
- std::string& loc = this->DirectoryState->Location;
- loc = dir;
- cmSystemTools::ConvertToUnixSlashes(loc);
- loc = cmSystemTools::CollapseFullPath(loc);
-
- this->ComputeRelativePathTopSource();
-
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
-}
-
-const char* cmState::Directory::GetCurrentBinary() const
-{
- return this->DirectoryState->OutputLocation.c_str();
-}
-
-void cmState::Directory::SetCurrentBinary(std::string const& dir)
-{
- std::string& loc = this->DirectoryState->OutputLocation;
- loc = dir;
- cmSystemTools::ConvertToUnixSlashes(loc);
- loc = cmSystemTools::CollapseFullPath(loc);
-
- this->ComputeRelativePathTopBinary();
-
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
-}
-
-void cmState::Snapshot::SetListFile(const std::string& listfile)
-{
- *this->Position->ExecutionListFile = listfile;
-}
-
-const char* cmState::Directory::GetRelativePathTopSource() const
-{
- return this->DirectoryState->RelativePathTopSource.c_str();
-}
-
-const char* cmState::Directory::GetRelativePathTopBinary() const
-{
- return this->DirectoryState->RelativePathTopBinary.c_str();
-}
-
-void cmState::Directory::SetRelativePathTopSource(const char* dir)
-{
- this->DirectoryState->RelativePathTopSource = dir;
-}
-
-void cmState::Directory::SetRelativePathTopBinary(const char* dir)
-{
- this->DirectoryState->RelativePathTopBinary = dir;
-}
-
-std::string cmState::Snapshot::GetExecutionListFile() const
-{
- return *this->Position->ExecutionListFile;
-}
-
-bool cmState::Snapshot::IsValid() const
-{
- return this->State && this->Position.IsValid()
- ? this->Position != this->State->SnapshotData.Root()
- : false;
-}
-
-cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
-{
- Snapshot snapshot;
- if (!this->State || this->Position == this->State->SnapshotData.Root()) {
- return snapshot;
- }
- PositionType parentPos = this->Position->DirectoryParent;
- if (parentPos != this->State->SnapshotData.Root()) {
- snapshot =
- Snapshot(this->State, parentPos->BuildSystemDirectory->DirectoryEnd);
- }
-
- return snapshot;
-}
-
-cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
-{
- assert(this->State);
- assert(this->Position != this->State->SnapshotData.Root());
-
- Snapshot snapshot;
- PositionType parentPos = this->Position;
- while (parentPos->SnapshotType == cmState::PolicyScopeType ||
- parentPos->SnapshotType == cmState::VariableScopeType) {
- ++parentPos;
- }
- if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType ||
- parentPos->SnapshotType == cmState::BaseType) {
- return snapshot;
- }
-
- ++parentPos;
- while (parentPos->SnapshotType == cmState::PolicyScopeType ||
- parentPos->SnapshotType == cmState::VariableScopeType) {
- ++parentPos;
- }
-
- if (parentPos == this->State->SnapshotData.Root()) {
- return snapshot;
- }
-
- snapshot = Snapshot(this->State, parentPos);
- return snapshot;
-}
-
-cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const
-{
- assert(this->State);
- assert(this->Position != this->State->SnapshotData.Root());
-
- PositionType pos = this->Position;
- while (pos->SnapshotType != cmState::BaseType &&
- pos->SnapshotType != cmState::BuildsystemDirectoryType &&
- pos != this->State->SnapshotData.Root()) {
- ++pos;
- }
- return Snapshot(this->State, pos);
-}
-
-void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
-{
- PositionType pos = this->Position;
- pos->Policies = this->State->PolicyStack.Push(pos->Policies,
- PolicyStackEntry(entry, weak));
-}
-
-bool cmState::Snapshot::PopPolicy()
-{
- PositionType pos = this->Position;
- if (pos->Policies == pos->PolicyScope) {
- return false;
- }
- pos->Policies = this->State->PolicyStack.Pop(pos->Policies);
- return true;
-}
-
-bool cmState::Snapshot::CanPopPolicyScope()
-{
- return this->Position->Policies == this->Position->PolicyScope;
-}
-
-void cmState::Snapshot::SetPolicy(cmPolicies::PolicyID id,
- cmPolicies::PolicyStatus status)
-{
- // Update the policy stack from the top to the top-most strong entry.
- bool previous_was_weak = true;
- for (cmLinkedTree<PolicyStackEntry>::iterator psi = this->Position->Policies;
- previous_was_weak && psi != this->Position->PolicyRoot; ++psi) {
- psi->Set(id, status);
- previous_was_weak = psi->Weak;
- }
-}
-
-cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy(
- cmPolicies::PolicyID id) const
-{
- cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
-
- if (status == cmPolicies::REQUIRED_ALWAYS ||
- status == cmPolicies::REQUIRED_IF_USED) {
- return status;
- }
-
- cmLinkedTree<BuildsystemDirectoryStateType>::iterator dir =
- this->Position->BuildSystemDirectory;
-
- while (true) {
- assert(dir.IsValid());
- cmLinkedTree<PolicyStackEntry>::iterator leaf =
- dir->DirectoryEnd->Policies;
- cmLinkedTree<PolicyStackEntry>::iterator root =
- dir->DirectoryEnd->PolicyRoot;
- for (; leaf != root; ++leaf) {
- if (leaf->IsDefined(id)) {
- status = leaf->Get(id);
- return status;
- }
- }
- cmState::PositionType e = dir->DirectoryEnd;
- cmState::PositionType p = e->DirectoryParent;
- if (p == this->State->SnapshotData.Root()) {
- break;
- }
- dir = p->BuildSystemDirectory;
- }
- return status;
-}
-
-bool cmState::Snapshot::HasDefinedPolicyCMP0011()
-{
- return !this->Position->Policies->IsEmpty();
-}
-
-const char* cmState::Snapshot::GetDefinition(std::string const& name) const
-{
- assert(this->Position->Vars.IsValid());
- return cmDefinitions::Get(name, this->Position->Vars, this->Position->Root);
-}
-
-bool cmState::Snapshot::IsInitialized(std::string const& name) const
-{
- return cmDefinitions::HasKey(name, this->Position->Vars,
- this->Position->Root);
-}
-
-void cmState::Snapshot::SetDefinition(std::string const& name,
- std::string const& value)
-{
- this->Position->Vars->Set(name, value.c_str());
-}
-
-void cmState::Snapshot::RemoveDefinition(std::string const& name)
-{
- this->Position->Vars->Set(name, CM_NULLPTR);
-}
-
-std::vector<std::string> cmState::Snapshot::UnusedKeys() const
-{
- return this->Position->Vars->UnusedKeys();
-}
-
-std::vector<std::string> cmState::Snapshot::ClosureKeys() const
-{
- return cmDefinitions::ClosureKeys(this->Position->Vars,
- this->Position->Root);
-}
-
-bool cmState::Snapshot::RaiseScope(std::string const& var, const char* varDef)
-{
- if (this->Position->ScopeParent == this->Position->DirectoryParent) {
- Snapshot parentDir = this->GetBuildsystemDirectoryParent();
- if (!parentDir.IsValid()) {
- return false;
- }
- // Update the definition in the parent directory top scope. This
- // directory's scope was initialized by the closure of the parent
- // scope, so we do not need to localize the definition first.
- if (varDef) {
- parentDir.SetDefinition(var, varDef);
- } else {
- parentDir.RemoveDefinition(var);
- }
- return true;
- }
- // First localize the definition in the current scope.
- cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root);
-
- // Now update the definition in the parent scope.
- this->Position->Parent->Set(var, varDef);
- return true;
-}
-
-static const std::string cmPropertySentinal = std::string();
-
-template <typename T, typename U, typename V>
-void InitializeContentFromParent(T& parentContent, T& thisContent,
- U& parentBacktraces, U& thisBacktraces,
- V& contentEndPosition)
-{
- std::vector<std::string>::const_iterator parentBegin = parentContent.begin();
- std::vector<std::string>::const_iterator parentEnd = parentContent.end();
-
- std::vector<std::string>::const_reverse_iterator parentRbegin =
- cmMakeReverseIterator(parentEnd);
- std::vector<std::string>::const_reverse_iterator parentRend =
- parentContent.rend();
- parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
- std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
-
- thisContent = std::vector<std::string>(parentIt, parentEnd);
-
- std::vector<cmListFileBacktrace>::const_iterator btIt =
- parentBacktraces.begin() + std::distance(parentBegin, parentIt);
- std::vector<cmListFileBacktrace>::const_iterator btEnd =
- parentBacktraces.end();
-
- thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
-
- contentEndPosition = thisContent.size();
-}
-
-void cmState::Snapshot::SetDefaultDefinitions()
-{
-/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
- With CMake must separate between target and host platform. In most cases
- the tests for WIN32, UNIX and APPLE will be for the target system, so an
- additional set of variables for the host system is required ->
- CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
- WIN32, UNIX and APPLE are now set in the platform files in
- Modules/Platforms/.
- To keep cmake scripts (-P) and custom language and compiler modules
- working, these variables are still also set here in this place, but they
- will be reset in CMakeSystemSpecificInformation.cmake before the platform
- files are executed. */
-#if defined(_WIN32)
- this->SetDefinition("WIN32", "1");
- this->SetDefinition("CMAKE_HOST_WIN32", "1");
-#else
- this->SetDefinition("UNIX", "1");
- this->SetDefinition("CMAKE_HOST_UNIX", "1");
-#endif
-#if defined(__CYGWIN__)
- 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");
- }
-#endif
-#if defined(__APPLE__)
- this->SetDefinition("APPLE", "1");
- this->SetDefinition("CMAKE_HOST_APPLE", "1");
-#endif
-#if defined(__sun__)
- this->SetDefinition("CMAKE_HOST_SOLARIS", "1");
-#endif
-
- char temp[1024];
- sprintf(temp, "%d", cmVersion::GetMinorVersion());
- this->SetDefinition("CMAKE_MINOR_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetMajorVersion());
- this->SetDefinition("CMAKE_MAJOR_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetPatchVersion());
- this->SetDefinition("CMAKE_PATCH_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetTweakVersion());
- this->SetDefinition("CMAKE_TWEAK_VERSION", temp);
- this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion());
-
- this->SetDefinition("CMAKE_FILES_DIRECTORY",
- cmake::GetCMakeFilesDirectory());
-
- // Setup the default include file regular expression (match everything).
- this->Position->BuildSystemDirectory->Properties.SetProperty(
- "INCLUDE_REGULAR_EXPRESSION", "^.*$");
-}
-
-void cmState::Snapshot::SetDirectoryDefinitions()
-{
- this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
- this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
- this->State->GetSourceDirectory());
- this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
- this->SetDefinition("CMAKE_CURRENT_BINARY_DIR",
- this->State->GetBinaryDirectory());
-}
-
-void cmState::Snapshot::InitializeFromParent()
-{
- PositionType parent = this->Position->DirectoryParent;
- assert(this->Position->Vars.IsValid());
- assert(parent->Vars.IsValid());
-
- *this->Position->Vars =
- cmDefinitions::MakeClosure(parent->Vars, parent->Root);
-
- InitializeContentFromParent(
- parent->BuildSystemDirectory->IncludeDirectories,
- this->Position->BuildSystemDirectory->IncludeDirectories,
- parent->BuildSystemDirectory->IncludeDirectoryBacktraces,
- this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces,
- this->Position->IncludeDirectoryPosition);
-
- InitializeContentFromParent(
- parent->BuildSystemDirectory->CompileDefinitions,
- this->Position->BuildSystemDirectory->CompileDefinitions,
- parent->BuildSystemDirectory->CompileDefinitionsBacktraces,
- this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces,
- this->Position->CompileDefinitionsPosition);
-
- InitializeContentFromParent(
- parent->BuildSystemDirectory->CompileOptions,
- this->Position->BuildSystemDirectory->CompileOptions,
- parent->BuildSystemDirectory->CompileOptionsBacktraces,
- this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
- this->Position->CompileOptionsPosition);
-}
-
-cmState* cmState::Snapshot::GetState() const
-{
- return this->State;
-}
-
-cmState::Directory cmState::Snapshot::GetDirectory() const
-{
- return Directory(this->Position->BuildSystemDirectory, *this);
-}
-
-void cmState::Snapshot::SetProjectName(const std::string& name)
-{
- this->Position->BuildSystemDirectory->ProjectName = name;
-}
-
-std::string cmState::Snapshot::GetProjectName() const
-{
- return this->Position->BuildSystemDirectory->ProjectName;
-}
-
-void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand()
-{
- std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR");
- std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR");
- this->InitializeFromParent();
- this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
- this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
-
- this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir);
- this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir);
-}
-
-cmState::Directory::Directory(
- cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
- const cmState::Snapshot& snapshot)
- : DirectoryState(iter)
- , Snapshot_(snapshot)
-{
-}
-
-template <typename T, typename U>
-cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
-{
- std::vector<std::string>::const_iterator end =
- content.begin() + contentEndPosition;
-
- std::vector<std::string>::const_reverse_iterator rbegin =
- cmMakeReverseIterator(end);
- rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
-
- return cmMakeRange(rbegin.base(), end);
-}
-
-template <typename T, typename U, typename V>
-cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces,
- V contentEndPosition)
-{
- std::vector<std::string>::const_iterator entryEnd =
- content.begin() + contentEndPosition;
-
- std::vector<std::string>::const_reverse_iterator rbegin =
- cmMakeReverseIterator(entryEnd);
- rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
-
- std::vector<cmListFileBacktrace>::const_iterator it =
- backtraces.begin() + std::distance(content.begin(), rbegin.base());
-
- std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
- return cmMakeRange(it, end);
-}
-
-template <typename T, typename U, typename V>
-void AppendEntry(T& content, U& backtraces, V& endContentPosition,
- const std::string& value, const cmListFileBacktrace& lfbt)
-{
- if (value.empty()) {
- return;
- }
-
- assert(endContentPosition == content.size());
-
- content.push_back(value);
- backtraces.push_back(lfbt);
-
- endContentPosition = content.size();
-}
-
-template <typename T, typename U, typename V>
-void SetContent(T& content, U& backtraces, V& endContentPosition,
- const std::string& vec, const cmListFileBacktrace& lfbt)
-{
- assert(endContentPosition == content.size());
-
- content.resize(content.size() + 2);
- backtraces.resize(backtraces.size() + 2);
-
- content.back() = vec;
- backtraces.back() = lfbt;
-
- endContentPosition = content.size();
-}
-
-template <typename T, typename U, typename V>
-void ClearContent(T& content, U& backtraces, V& endContentPosition)
-{
- assert(endContentPosition == content.size());
-
- content.resize(content.size() + 1);
- backtraces.resize(backtraces.size() + 1);
-
- endContentPosition = content.size();
-}
-
-cmStringRange cmState::Directory::GetIncludeDirectoriesEntries() const
-{
- return GetPropertyContent(
- this->DirectoryState->IncludeDirectories,
- this->Snapshot_.Position->IncludeDirectoryPosition);
-}
-
-cmBacktraceRange cmState::Directory::GetIncludeDirectoriesEntryBacktraces()
- const
-{
- return GetPropertyBacktraces(
- this->DirectoryState->IncludeDirectories,
- this->DirectoryState->IncludeDirectoryBacktraces,
- this->Snapshot_.Position->IncludeDirectoryPosition);
-}
-
-void cmState::Directory::AppendIncludeDirectoriesEntry(
- const std::string& vec, const cmListFileBacktrace& lfbt)
-{
- AppendEntry(this->DirectoryState->IncludeDirectories,
- this->DirectoryState->IncludeDirectoryBacktraces,
- this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt);
-}
-
-void cmState::Directory::PrependIncludeDirectoriesEntry(
- const std::string& vec, const cmListFileBacktrace& lfbt)
-{
- std::vector<std::string>::iterator entryEnd =
- this->DirectoryState->IncludeDirectories.begin() +
- this->Snapshot_.Position->IncludeDirectoryPosition;
-
- std::vector<std::string>::reverse_iterator rend =
- this->DirectoryState->IncludeDirectories.rend();
- std::vector<std::string>::reverse_iterator rbegin =
- cmMakeReverseIterator(entryEnd);
- rbegin = std::find(rbegin, rend, cmPropertySentinal);
-
- std::vector<std::string>::iterator entryIt = rbegin.base();
- std::vector<std::string>::iterator entryBegin =
- this->DirectoryState->IncludeDirectories.begin();
-
- std::vector<cmListFileBacktrace>::iterator btIt =
- this->DirectoryState->IncludeDirectoryBacktraces.begin() +
- std::distance(entryBegin, entryIt);
-
- this->DirectoryState->IncludeDirectories.insert(entryIt, vec);
- this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt);
-
- this->Snapshot_.Position->IncludeDirectoryPosition =
- this->DirectoryState->IncludeDirectories.size();
-}
-
-void cmState::Directory::SetIncludeDirectories(const std::string& vec,
- const cmListFileBacktrace& lfbt)
-{
- SetContent(this->DirectoryState->IncludeDirectories,
- this->DirectoryState->IncludeDirectoryBacktraces,
- this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt);
-}
-
-void cmState::Directory::ClearIncludeDirectories()
-{
- ClearContent(this->DirectoryState->IncludeDirectories,
- this->DirectoryState->IncludeDirectoryBacktraces,
- this->Snapshot_.Position->IncludeDirectoryPosition);
-}
-
-cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const
-{
- return GetPropertyContent(
- this->DirectoryState->CompileDefinitions,
- this->Snapshot_.Position->CompileDefinitionsPosition);
-}
-
-cmBacktraceRange cmState::Directory::GetCompileDefinitionsEntryBacktraces()
- const
-{
- return GetPropertyBacktraces(
- this->DirectoryState->CompileDefinitions,
- this->DirectoryState->CompileDefinitionsBacktraces,
- this->Snapshot_.Position->CompileDefinitionsPosition);
-}
-
-void cmState::Directory::AppendCompileDefinitionsEntry(
- const std::string& vec, const cmListFileBacktrace& lfbt)
-{
- AppendEntry(this->DirectoryState->CompileDefinitions,
- this->DirectoryState->CompileDefinitionsBacktraces,
- this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt);
-}
-
-void cmState::Directory::SetCompileDefinitions(const std::string& vec,
- const cmListFileBacktrace& lfbt)
-{
- SetContent(this->DirectoryState->CompileDefinitions,
- this->DirectoryState->CompileDefinitionsBacktraces,
- this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt);
-}
-
-void cmState::Directory::ClearCompileDefinitions()
-{
- ClearContent(this->DirectoryState->CompileDefinitions,
- this->DirectoryState->CompileDefinitionsBacktraces,
- this->Snapshot_.Position->CompileDefinitionsPosition);
-}
-
-cmStringRange cmState::Directory::GetCompileOptionsEntries() const
-{
- return GetPropertyContent(this->DirectoryState->CompileOptions,
- this->Snapshot_.Position->CompileOptionsPosition);
-}
-
-cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const
-{
- return GetPropertyBacktraces(
- this->DirectoryState->CompileOptions,
- this->DirectoryState->CompileOptionsBacktraces,
- this->Snapshot_.Position->CompileOptionsPosition);
-}
-
-void cmState::Directory::AppendCompileOptionsEntry(
- const std::string& vec, const cmListFileBacktrace& lfbt)
-{
- AppendEntry(this->DirectoryState->CompileOptions,
- this->DirectoryState->CompileOptionsBacktraces,
- this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt);
-}
-
-void cmState::Directory::SetCompileOptions(const std::string& vec,
- const cmListFileBacktrace& lfbt)
-{
- SetContent(this->DirectoryState->CompileOptions,
- this->DirectoryState->CompileOptionsBacktraces,
- this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt);
-}
-
-void cmState::Directory::ClearCompileOptions()
-{
- ClearContent(this->DirectoryState->CompileOptions,
- this->DirectoryState->CompileOptionsBacktraces,
- this->Snapshot_.Position->CompileOptionsPosition);
-}
-
-bool cmState::Snapshot::StrictWeakOrder::operator()(
- const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) const
-{
- return lhs.Position.StrictWeakOrdered(rhs.Position);
-}
-
-void cmState::Directory::SetProperty(const std::string& prop,
- const char* value,
- cmListFileBacktrace const& lfbt)
-{
- if (prop == "INCLUDE_DIRECTORIES") {
- if (!value) {
- this->ClearIncludeDirectories();
- return;
- }
- this->SetIncludeDirectories(value, lfbt);
- return;
- }
- if (prop == "COMPILE_OPTIONS") {
- if (!value) {
- this->ClearCompileOptions();
- return;
- }
- this->SetCompileOptions(value, lfbt);
- return;
- }
- if (prop == "COMPILE_DEFINITIONS") {
- if (!value) {
- this->ClearCompileDefinitions();
- return;
- }
- this->SetCompileDefinitions(value, lfbt);
- return;
- }
-
- this->DirectoryState->Properties.SetProperty(prop, value);
-}
-
-void cmState::Directory::AppendProperty(const std::string& prop,
- const char* value, bool asString,
- cmListFileBacktrace const& lfbt)
-{
- if (prop == "INCLUDE_DIRECTORIES") {
- this->AppendIncludeDirectoriesEntry(value, lfbt);
- return;
- }
- if (prop == "COMPILE_OPTIONS") {
- this->AppendCompileOptionsEntry(value, lfbt);
- return;
- }
- if (prop == "COMPILE_DEFINITIONS") {
- this->AppendCompileDefinitionsEntry(value, lfbt);
- return;
- }
-
- this->DirectoryState->Properties.AppendProperty(prop, value, asString);
-}
-
-const char* cmState::Directory::GetProperty(const std::string& prop) const
-{
- const bool chain =
- this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY);
- return this->GetProperty(prop, chain);
-}
-
-const char* cmState::Directory::GetProperty(const std::string& prop,
- bool chain) const
-{
- static std::string output;
- output = "";
- if (prop == "PARENT_DIRECTORY") {
- cmState::Snapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent();
- if (parent.IsValid()) {
- return parent.GetDirectory().GetCurrentSource();
- }
- return "";
- }
- if (prop == kBINARY_DIR) {
- output = this->GetCurrentBinary();
- return output.c_str();
- }
- if (prop == kSOURCE_DIR) {
- output = this->GetCurrentSource();
- return output.c_str();
- }
- if (prop == kSUBDIRECTORIES) {
- std::vector<std::string> child_dirs;
- std::vector<cmState::Snapshot> const& children =
- this->DirectoryState->Children;
- for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
- ci != children.end(); ++ci) {
- child_dirs.push_back(ci->GetDirectory().GetCurrentSource());
- }
- output = cmJoin(child_dirs, ";");
- return output.c_str();
- }
- if (prop == kBUILDSYSTEM_TARGETS) {
- output = cmJoin(this->DirectoryState->NormalTargetNames, ";");
- return output.c_str();
- }
-
- if (prop == "LISTFILE_STACK") {
- std::vector<std::string> listFiles;
- cmState::Snapshot snp = this->Snapshot_;
- while (snp.IsValid()) {
- listFiles.push_back(snp.GetExecutionListFile());
- snp = snp.GetCallStackParent();
- }
- std::reverse(listFiles.begin(), listFiles.end());
- output = cmJoin(listFiles, ";");
- return output.c_str();
- }
- if (prop == "CACHE_VARIABLES") {
- output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
- return output.c_str();
- }
- if (prop == "VARIABLES") {
- std::vector<std::string> res = this->Snapshot_.ClosureKeys();
- std::vector<std::string> cacheKeys =
- this->Snapshot_.State->GetCacheEntryKeys();
- res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
- std::sort(res.begin(), res.end());
- output = cmJoin(res, ";");
- return output.c_str();
- }
- if (prop == "INCLUDE_DIRECTORIES") {
- output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
- return output.c_str();
- }
- if (prop == "COMPILE_OPTIONS") {
- output = cmJoin(this->GetCompileOptionsEntries(), ";");
- return output.c_str();
- }
- if (prop == "COMPILE_DEFINITIONS") {
- output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
- return output.c_str();
- }
-
- const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
- if (!retVal && chain) {
- Snapshot parentSnapshot = this->Snapshot_.GetBuildsystemDirectoryParent();
- if (parentSnapshot.IsValid()) {
- return parentSnapshot.GetDirectory().GetProperty(prop, chain);
- }
- return this->Snapshot_.State->GetGlobalProperty(prop);
- }
-
- return retVal;
-}
-
-bool cmState::Directory::GetPropertyAsBool(const std::string& prop) const
-{
- return cmSystemTools::IsOn(this->GetProperty(prop));
-}
-
-std::vector<std::string> cmState::Directory::GetPropertyKeys() const
-{
- std::vector<std::string> keys;
- keys.reserve(this->DirectoryState->Properties.size());
- for (cmPropertyMap::const_iterator it =
- this->DirectoryState->Properties.begin();
- it != this->DirectoryState->Properties.end(); ++it) {
- keys.push_back(it->first);
- }
- return keys;
-}
-
-void cmState::Directory::AddNormalTargetName(std::string const& name)
-{
- this->DirectoryState->NormalTargetNames.push_back(name);
-}
-
-bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
-{
- return lhs.Position == rhs.Position;
-}
-
-bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
-{
- return lhs.Position != rhs.Position;
+ return cmStateSnapshot(this, prevPos);
}
static bool ParseEntryWithoutType(const std::string& entry, std::string& var,
@@ -1802,7 +810,8 @@ static bool ParseEntryWithoutType(const std::string& entry, std::string& var,
}
bool cmState::ParseCacheEntry(const std::string& entry, std::string& var,
- std::string& value, CacheEntryType& type)
+ std::string& value,
+ cmStateEnums::CacheEntryType& type)
{
// input line is: key:type=value
static cmsys::RegularExpression reg(
diff --git a/Source/cmState.h b/Source/cmState.h
index feed1c7..6d74815 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -8,10 +8,10 @@
#include "cmAlgorithms.h"
#include "cmDefinitions.h"
#include "cmLinkedTree.h"
-#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
+#include "cmStateTypes.h"
#include <map>
#include <set>
@@ -23,202 +23,36 @@ class cmCommand;
class cmListFileBacktrace;
class cmPropertyDefinition;
+class cmStateDirectory;
+class cmStateSnapshot;
+
class cmState
{
- struct SnapshotDataType;
- struct PolicyStackEntry;
- struct BuildsystemDirectoryStateType;
- typedef cmLinkedTree<SnapshotDataType>::iterator PositionType;
- friend class Snapshot;
+ friend class cmStateSnapshot;
public:
cmState();
~cmState();
- enum SnapshotType
- {
- BaseType,
- BuildsystemDirectoryType,
- FunctionCallType,
- MacroCallType,
- IncludeFileType,
- InlineListFileType,
- PolicyScopeType,
- VariableScopeType
- };
-
- class Directory;
-
- class Snapshot
- {
- public:
- Snapshot(cmState* state = CM_NULLPTR);
- Snapshot(cmState* state, PositionType position);
-
- const char* GetDefinition(std::string const& name) const;
- bool IsInitialized(std::string const& name) const;
- void SetDefinition(std::string const& name, std::string const& value);
- void RemoveDefinition(std::string const& name);
- std::vector<std::string> UnusedKeys() const;
- std::vector<std::string> ClosureKeys() const;
- bool RaiseScope(std::string const& var, const char* varDef);
-
- void SetListFile(std::string const& listfile);
-
- std::string GetExecutionListFile() const;
-
- std::vector<Snapshot> GetChildren();
-
- bool IsValid() const;
- Snapshot GetBuildsystemDirectoryParent() const;
- Snapshot GetCallStackParent() const;
- Snapshot GetCallStackBottom() const;
- SnapshotType GetType() const;
-
- void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
- cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const;
- bool HasDefinedPolicyCMP0011();
- void PushPolicy(cmPolicies::PolicyMap entry, bool weak);
- bool PopPolicy();
- bool CanPopPolicyScope();
-
- cmState* GetState() const;
-
- Directory GetDirectory() const;
-
- void SetProjectName(std::string const& name);
- std::string GetProjectName() const;
-
- void InitializeFromParent_ForSubdirsCommand();
-
- struct StrictWeakOrder
- {
- bool operator()(const cmState::Snapshot& lhs,
- const cmState::Snapshot& rhs) const;
- };
-
- void SetDirectoryDefinitions();
- void SetDefaultDefinitions();
-
- private:
- friend bool operator==(const cmState::Snapshot& lhs,
- const cmState::Snapshot& rhs);
- friend bool operator!=(const cmState::Snapshot& lhs,
- const cmState::Snapshot& rhs);
- friend class cmState;
- friend class Directory;
- friend struct StrictWeakOrder;
-
- void InitializeFromParent();
-
- cmState* State;
- cmState::PositionType Position;
- };
-
- class Directory
- {
- Directory(cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
- Snapshot const& snapshot);
-
- public:
- const char* GetCurrentSource() const;
- void SetCurrentSource(std::string const& dir);
- const char* GetCurrentBinary() const;
- void SetCurrentBinary(std::string const& dir);
-
- const char* GetRelativePathTopSource() const;
- const char* GetRelativePathTopBinary() const;
- void SetRelativePathTopSource(const char* dir);
- void SetRelativePathTopBinary(const char* dir);
-
- cmStringRange GetIncludeDirectoriesEntries() const;
- cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const;
- void AppendIncludeDirectoriesEntry(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void PrependIncludeDirectoriesEntry(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void SetIncludeDirectories(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void ClearIncludeDirectories();
-
- cmStringRange GetCompileDefinitionsEntries() const;
- cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const;
- void AppendCompileDefinitionsEntry(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void SetCompileDefinitions(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void ClearCompileDefinitions();
-
- cmStringRange GetCompileOptionsEntries() const;
- cmBacktraceRange GetCompileOptionsEntryBacktraces() const;
- void AppendCompileOptionsEntry(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void SetCompileOptions(std::string const& vec,
- cmListFileBacktrace const& lfbt);
- void ClearCompileOptions();
-
- void SetProperty(const std::string& prop, const char* value,
- cmListFileBacktrace const& lfbt);
- void AppendProperty(const std::string& prop, const char* value,
- bool asString, cmListFileBacktrace const& lfbt);
- const char* GetProperty(const std::string& prop) const;
- const char* GetProperty(const std::string& prop, bool chain) const;
- bool GetPropertyAsBool(const std::string& prop) const;
- std::vector<std::string> GetPropertyKeys() const;
-
- void AddNormalTargetName(std::string const& name);
-
- private:
- void ComputeRelativePathTopSource();
- void ComputeRelativePathTopBinary();
-
- private:
- cmLinkedTree<BuildsystemDirectoryStateType>::iterator DirectoryState;
- Snapshot Snapshot_;
- friend class Snapshot;
- };
-
- enum TargetType
- {
- EXECUTABLE,
- STATIC_LIBRARY,
- SHARED_LIBRARY,
- MODULE_LIBRARY,
- OBJECT_LIBRARY,
- UTILITY,
- GLOBAL_TARGET,
- INTERFACE_LIBRARY,
- UNKNOWN_LIBRARY
- };
-
- static const char* GetTargetTypeName(cmState::TargetType targetType);
-
- Snapshot CreateBaseSnapshot();
- Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot);
- Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot,
- std::string const& fileName);
- Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot,
- std::string const& fileName);
- Snapshot CreateIncludeFileSnapshot(Snapshot originSnapshot,
- std::string const& fileName);
- Snapshot CreateVariableScopeSnapshot(Snapshot originSnapshot);
- Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot,
- std::string const& fileName);
- Snapshot CreatePolicyScopeSnapshot(Snapshot originSnapshot);
- Snapshot Pop(Snapshot originSnapshot);
-
- enum CacheEntryType
- {
- BOOL = 0,
- PATH,
- FILEPATH,
- STRING,
- INTERNAL,
- STATIC,
- UNINITIALIZED
- };
- static CacheEntryType StringToCacheEntryType(const char*);
- static const char* CacheEntryTypeToString(CacheEntryType);
+ static const char* GetTargetTypeName(cmStateEnums::TargetType targetType);
+
+ cmStateSnapshot CreateBaseSnapshot();
+ cmStateSnapshot CreateBuildsystemDirectorySnapshot(
+ cmStateSnapshot originSnapshot);
+ cmStateSnapshot CreateFunctionCallSnapshot(cmStateSnapshot originSnapshot,
+ std::string const& fileName);
+ cmStateSnapshot CreateMacroCallSnapshot(cmStateSnapshot originSnapshot,
+ std::string const& fileName);
+ cmStateSnapshot CreateIncludeFileSnapshot(cmStateSnapshot originSnapshot,
+ std::string const& fileName);
+ cmStateSnapshot CreateVariableScopeSnapshot(cmStateSnapshot originSnapshot);
+ cmStateSnapshot CreateInlineListFileSnapshot(cmStateSnapshot originSnapshot,
+ std::string const& fileName);
+ cmStateSnapshot CreatePolicyScopeSnapshot(cmStateSnapshot originSnapshot);
+ cmStateSnapshot Pop(cmStateSnapshot originSnapshot);
+
+ static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*);
+ static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType);
static bool IsCacheEntryType(std::string const& key);
bool LoadCache(const std::string& path, bool internal,
@@ -232,7 +66,7 @@ public:
std::vector<std::string> GetCacheEntryKeys() const;
const char* GetCacheEntryValue(std::string const& key) const;
const char* GetInitializedCacheValue(std::string const& key) const;
- CacheEntryType GetCacheEntryType(std::string const& key) const;
+ cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const;
void SetCacheEntryValue(std::string const& key, std::string const& value);
void SetCacheValue(std::string const& key, std::string const& value);
@@ -257,9 +91,10 @@ public:
///! Break up a line like VAR:type="value" into var, type and value
static bool ParseCacheEntry(const std::string& entry, std::string& var,
- std::string& value, CacheEntryType& type);
+ std::string& value,
+ cmStateEnums::CacheEntryType& type);
- Snapshot Reset();
+ cmStateSnapshot Reset();
// Define a property
void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char* ShortDescription,
@@ -321,7 +156,8 @@ public:
private:
friend class cmake;
void AddCacheEntry(const std::string& key, const char* value,
- const char* helpString, CacheEntryType type);
+ const char* helpString,
+ cmStateEnums::CacheEntryType type);
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
@@ -329,12 +165,13 @@ private:
cmPropertyMap GlobalProperties;
cmCacheManager* CacheManager;
- cmLinkedTree<BuildsystemDirectoryStateType> BuildsystemDirectory;
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>
+ BuildsystemDirectory;
cmLinkedTree<std::string> ExecutionListFiles;
- cmLinkedTree<PolicyStackEntry> PolicyStack;
- cmLinkedTree<SnapshotDataType> SnapshotData;
+ cmLinkedTree<cmStateDetail::PolicyStackEntry> PolicyStack;
+ cmLinkedTree<cmStateDetail::SnapshotDataType> SnapshotData;
cmLinkedTree<cmDefinitions> VarTree;
std::string SourceDirectory;
@@ -348,7 +185,4 @@ private:
bool MSYSShell;
};
-bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
-bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
-
#endif
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
new file mode 100644
index 0000000..01e1e7e
--- /dev/null
+++ b/Source/cmStateDirectory.cxx
@@ -0,0 +1,518 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmStateDirectory.h"
+#include "cmState.h"
+#include "cmStatePrivate.h"
+#include "cmSystemTools.h"
+
+static std::string const kBINARY_DIR = "BINARY_DIR";
+static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS";
+static std::string const kSOURCE_DIR = "SOURCE_DIR";
+static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES";
+
+void cmStateDirectory::ComputeRelativePathTopSource()
+{
+ // Relative path conversion inside the source tree is not used to
+ // construct relative paths passed to build tools so it is safe to use
+ // even when the source is a network path.
+
+ cmStateSnapshot snapshot = this->Snapshot_;
+ std::vector<cmStateSnapshot> snapshots;
+ snapshots.push_back(snapshot);
+ while (true) {
+ snapshot = snapshot.GetBuildsystemDirectoryParent();
+ if (snapshot.IsValid()) {
+ snapshots.push_back(snapshot);
+ } else {
+ break;
+ }
+ }
+
+ std::string result = snapshots.front().GetDirectory().GetCurrentSource();
+
+ for (std::vector<cmStateSnapshot>::const_iterator it = snapshots.begin() + 1;
+ it != snapshots.end(); ++it) {
+ std::string currentSource = it->GetDirectory().GetCurrentSource();
+ if (cmSystemTools::IsSubDirectory(result, currentSource)) {
+ result = currentSource;
+ }
+ }
+ this->DirectoryState->RelativePathTopSource = result;
+}
+
+void cmStateDirectory::ComputeRelativePathTopBinary()
+{
+ cmStateSnapshot snapshot = this->Snapshot_;
+ std::vector<cmStateSnapshot> snapshots;
+ snapshots.push_back(snapshot);
+ while (true) {
+ snapshot = snapshot.GetBuildsystemDirectoryParent();
+ if (snapshot.IsValid()) {
+ snapshots.push_back(snapshot);
+ } else {
+ break;
+ }
+ }
+
+ std::string result = snapshots.front().GetDirectory().GetCurrentBinary();
+
+ for (std::vector<cmStateSnapshot>::const_iterator it = snapshots.begin() + 1;
+ it != snapshots.end(); ++it) {
+ std::string currentBinary = it->GetDirectory().GetCurrentBinary();
+ if (cmSystemTools::IsSubDirectory(result, currentBinary)) {
+ result = currentBinary;
+ }
+ }
+
+ // The current working directory on Windows cannot be a network
+ // path. Therefore relative paths cannot work when the binary tree
+ // is a network path.
+ if (result.size() < 2 || result.substr(0, 2) != "//") {
+ this->DirectoryState->RelativePathTopBinary = result;
+ } else {
+ this->DirectoryState->RelativePathTopBinary = "";
+ }
+}
+
+const char* cmStateDirectory::GetCurrentSource() const
+{
+ return this->DirectoryState->Location.c_str();
+}
+
+void cmStateDirectory::SetCurrentSource(std::string const& dir)
+{
+ std::string& loc = this->DirectoryState->Location;
+ loc = dir;
+ cmSystemTools::ConvertToUnixSlashes(loc);
+ loc = cmSystemTools::CollapseFullPath(loc);
+
+ this->ComputeRelativePathTopSource();
+
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
+}
+
+const char* cmStateDirectory::GetCurrentBinary() const
+{
+ return this->DirectoryState->OutputLocation.c_str();
+}
+
+void cmStateDirectory::SetCurrentBinary(std::string const& dir)
+{
+ std::string& loc = this->DirectoryState->OutputLocation;
+ loc = dir;
+ cmSystemTools::ConvertToUnixSlashes(loc);
+ loc = cmSystemTools::CollapseFullPath(loc);
+
+ this->ComputeRelativePathTopBinary();
+
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
+}
+
+const char* cmStateDirectory::GetRelativePathTopSource() const
+{
+ return this->DirectoryState->RelativePathTopSource.c_str();
+}
+
+const char* cmStateDirectory::GetRelativePathTopBinary() const
+{
+ return this->DirectoryState->RelativePathTopBinary.c_str();
+}
+
+void cmStateDirectory::SetRelativePathTopSource(const char* dir)
+{
+ this->DirectoryState->RelativePathTopSource = dir;
+}
+
+void cmStateDirectory::SetRelativePathTopBinary(const char* dir)
+{
+ this->DirectoryState->RelativePathTopBinary = dir;
+}
+
+cmStateDirectory::cmStateDirectory(
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
+ const cmStateSnapshot& snapshot)
+ : DirectoryState(iter)
+ , Snapshot_(snapshot)
+{
+}
+
+template <typename T, typename U>
+cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
+{
+ std::vector<std::string>::const_iterator end =
+ content.begin() + contentEndPosition;
+
+ std::vector<std::string>::const_reverse_iterator rbegin =
+ cmMakeReverseIterator(end);
+ rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
+
+ return cmMakeRange(rbegin.base(), end);
+}
+
+template <typename T, typename U, typename V>
+cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces,
+ V contentEndPosition)
+{
+ std::vector<std::string>::const_iterator entryEnd =
+ content.begin() + contentEndPosition;
+
+ std::vector<std::string>::const_reverse_iterator rbegin =
+ cmMakeReverseIterator(entryEnd);
+ rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
+
+ std::vector<cmListFileBacktrace>::const_iterator it =
+ backtraces.begin() + std::distance(content.begin(), rbegin.base());
+
+ std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
+ return cmMakeRange(it, end);
+}
+
+template <typename T, typename U, typename V>
+void AppendEntry(T& content, U& backtraces, V& endContentPosition,
+ const std::string& value, const cmListFileBacktrace& lfbt)
+{
+ if (value.empty()) {
+ return;
+ }
+
+ assert(endContentPosition == content.size());
+
+ content.push_back(value);
+ backtraces.push_back(lfbt);
+
+ endContentPosition = content.size();
+}
+
+template <typename T, typename U, typename V>
+void SetContent(T& content, U& backtraces, V& endContentPosition,
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ assert(endContentPosition == content.size());
+
+ content.resize(content.size() + 2);
+ backtraces.resize(backtraces.size() + 2);
+
+ content.back() = vec;
+ backtraces.back() = lfbt;
+
+ endContentPosition = content.size();
+}
+
+template <typename T, typename U, typename V>
+void ClearContent(T& content, U& backtraces, V& endContentPosition)
+{
+ assert(endContentPosition == content.size());
+
+ content.resize(content.size() + 1);
+ backtraces.resize(backtraces.size() + 1);
+
+ endContentPosition = content.size();
+}
+
+cmStringRange cmStateDirectory::GetIncludeDirectoriesEntries() const
+{
+ return GetPropertyContent(
+ this->DirectoryState->IncludeDirectories,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+cmBacktraceRange cmStateDirectory::GetIncludeDirectoriesEntryBacktraces() const
+{
+ return GetPropertyBacktraces(
+ this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+void cmStateDirectory::AppendIncludeDirectoriesEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt);
+}
+
+void cmStateDirectory::PrependIncludeDirectoriesEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ std::vector<std::string>::iterator entryEnd =
+ this->DirectoryState->IncludeDirectories.begin() +
+ this->Snapshot_.Position->IncludeDirectoryPosition;
+
+ std::vector<std::string>::reverse_iterator rend =
+ this->DirectoryState->IncludeDirectories.rend();
+ std::vector<std::string>::reverse_iterator rbegin =
+ cmMakeReverseIterator(entryEnd);
+ rbegin = std::find(rbegin, rend, cmPropertySentinal);
+
+ std::vector<std::string>::iterator entryIt = rbegin.base();
+ std::vector<std::string>::iterator entryBegin =
+ this->DirectoryState->IncludeDirectories.begin();
+
+ std::vector<cmListFileBacktrace>::iterator btIt =
+ this->DirectoryState->IncludeDirectoryBacktraces.begin() +
+ std::distance(entryBegin, entryIt);
+
+ this->DirectoryState->IncludeDirectories.insert(entryIt, vec);
+ this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt);
+
+ this->Snapshot_.Position->IncludeDirectoryPosition =
+ this->DirectoryState->IncludeDirectories.size();
+}
+
+void cmStateDirectory::SetIncludeDirectories(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt);
+}
+
+void cmStateDirectory::ClearIncludeDirectories()
+{
+ ClearContent(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+cmStringRange cmStateDirectory::GetCompileDefinitionsEntries() const
+{
+ return GetPropertyContent(
+ this->DirectoryState->CompileDefinitions,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+cmBacktraceRange cmStateDirectory::GetCompileDefinitionsEntryBacktraces() const
+{
+ return GetPropertyBacktraces(
+ this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+void cmStateDirectory::AppendCompileDefinitionsEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::SetCompileDefinitions(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::ClearCompileDefinitions()
+{
+ ClearContent(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+cmStringRange cmStateDirectory::GetCompileOptionsEntries() const
+{
+ return GetPropertyContent(this->DirectoryState->CompileOptions,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
+
+cmBacktraceRange cmStateDirectory::GetCompileOptionsEntryBacktraces() const
+{
+ return GetPropertyBacktraces(
+ this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
+
+void cmStateDirectory::AppendCompileOptionsEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::SetCompileOptions(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::ClearCompileOptions()
+{
+ ClearContent(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
+
+void cmStateDirectory::SetProperty(const std::string& prop, const char* value,
+ cmListFileBacktrace const& lfbt)
+{
+ if (prop == "INCLUDE_DIRECTORIES") {
+ if (!value) {
+ this->ClearIncludeDirectories();
+ return;
+ }
+ this->SetIncludeDirectories(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_OPTIONS") {
+ if (!value) {
+ this->ClearCompileOptions();
+ return;
+ }
+ this->SetCompileOptions(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_DEFINITIONS") {
+ if (!value) {
+ this->ClearCompileDefinitions();
+ return;
+ }
+ this->SetCompileDefinitions(value, lfbt);
+ return;
+ }
+
+ this->DirectoryState->Properties.SetProperty(prop, value);
+}
+
+void cmStateDirectory::AppendProperty(const std::string& prop,
+ const char* value, bool asString,
+ cmListFileBacktrace const& lfbt)
+{
+ if (prop == "INCLUDE_DIRECTORIES") {
+ this->AppendIncludeDirectoriesEntry(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_OPTIONS") {
+ this->AppendCompileOptionsEntry(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_DEFINITIONS") {
+ this->AppendCompileDefinitionsEntry(value, lfbt);
+ return;
+ }
+
+ this->DirectoryState->Properties.AppendProperty(prop, value, asString);
+}
+
+const char* cmStateDirectory::GetProperty(const std::string& prop) const
+{
+ const bool chain =
+ this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY);
+ return this->GetProperty(prop, chain);
+}
+
+const char* cmStateDirectory::GetProperty(const std::string& prop,
+ bool chain) const
+{
+ static std::string output;
+ output = "";
+ if (prop == "PARENT_DIRECTORY") {
+ cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent();
+ if (parent.IsValid()) {
+ return parent.GetDirectory().GetCurrentSource();
+ }
+ return "";
+ }
+ if (prop == kBINARY_DIR) {
+ output = this->GetCurrentBinary();
+ return output.c_str();
+ }
+ if (prop == kSOURCE_DIR) {
+ output = this->GetCurrentSource();
+ return output.c_str();
+ }
+ if (prop == kSUBDIRECTORIES) {
+ std::vector<std::string> child_dirs;
+ std::vector<cmStateSnapshot> const& children =
+ this->DirectoryState->Children;
+ for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
+ ci != children.end(); ++ci) {
+ child_dirs.push_back(ci->GetDirectory().GetCurrentSource());
+ }
+ output = cmJoin(child_dirs, ";");
+ return output.c_str();
+ }
+ if (prop == kBUILDSYSTEM_TARGETS) {
+ output = cmJoin(this->DirectoryState->NormalTargetNames, ";");
+ return output.c_str();
+ }
+
+ if (prop == "LISTFILE_STACK") {
+ std::vector<std::string> listFiles;
+ cmStateSnapshot snp = this->Snapshot_;
+ while (snp.IsValid()) {
+ listFiles.push_back(snp.GetExecutionListFile());
+ snp = snp.GetCallStackParent();
+ }
+ std::reverse(listFiles.begin(), listFiles.end());
+ output = cmJoin(listFiles, ";");
+ return output.c_str();
+ }
+ if (prop == "CACHE_VARIABLES") {
+ output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
+ return output.c_str();
+ }
+ if (prop == "VARIABLES") {
+ std::vector<std::string> res = this->Snapshot_.ClosureKeys();
+ std::vector<std::string> cacheKeys =
+ this->Snapshot_.State->GetCacheEntryKeys();
+ res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
+ std::sort(res.begin(), res.end());
+ output = cmJoin(res, ";");
+ return output.c_str();
+ }
+ if (prop == "INCLUDE_DIRECTORIES") {
+ output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
+ return output.c_str();
+ }
+ if (prop == "COMPILE_OPTIONS") {
+ output = cmJoin(this->GetCompileOptionsEntries(), ";");
+ return output.c_str();
+ }
+ if (prop == "COMPILE_DEFINITIONS") {
+ output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
+ return output.c_str();
+ }
+
+ const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
+ if (!retVal && chain) {
+ cmStateSnapshot parentSnapshot =
+ this->Snapshot_.GetBuildsystemDirectoryParent();
+ if (parentSnapshot.IsValid()) {
+ return parentSnapshot.GetDirectory().GetProperty(prop, chain);
+ }
+ return this->Snapshot_.State->GetGlobalProperty(prop);
+ }
+
+ return retVal;
+}
+
+bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
+{
+ return cmSystemTools::IsOn(this->GetProperty(prop));
+}
+
+std::vector<std::string> cmStateDirectory::GetPropertyKeys() const
+{
+ std::vector<std::string> keys;
+ keys.reserve(this->DirectoryState->Properties.size());
+ for (cmPropertyMap::const_iterator it =
+ this->DirectoryState->Properties.begin();
+ it != this->DirectoryState->Properties.end(); ++it) {
+ keys.push_back(it->first);
+ }
+ return keys;
+}
+
+void cmStateDirectory::AddNormalTargetName(std::string const& name)
+{
+ this->DirectoryState->NormalTargetNames.push_back(name);
+}
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
new file mode 100644
index 0000000..17a89d8
--- /dev/null
+++ b/Source/cmStateDirectory.h
@@ -0,0 +1,82 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmStateDirectory_h
+#define cmStateDirectory_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+#include "cmAlgorithms.h"
+#include "cmListFileCache.h"
+#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
+
+class cmStateDirectory
+{
+ cmStateDirectory(
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
+ cmStateSnapshot const& snapshot);
+
+public:
+ const char* GetCurrentSource() const;
+ void SetCurrentSource(std::string const& dir);
+ const char* GetCurrentBinary() const;
+ void SetCurrentBinary(std::string const& dir);
+
+ const char* GetRelativePathTopSource() const;
+ const char* GetRelativePathTopBinary() const;
+ void SetRelativePathTopSource(const char* dir);
+ void SetRelativePathTopBinary(const char* dir);
+
+ cmStringRange GetIncludeDirectoriesEntries() const;
+ cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const;
+ void AppendIncludeDirectoriesEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void PrependIncludeDirectoriesEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetIncludeDirectories(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearIncludeDirectories();
+
+ cmStringRange GetCompileDefinitionsEntries() const;
+ cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const;
+ void AppendCompileDefinitionsEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetCompileDefinitions(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearCompileDefinitions();
+
+ cmStringRange GetCompileOptionsEntries() const;
+ cmBacktraceRange GetCompileOptionsEntryBacktraces() const;
+ void AppendCompileOptionsEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetCompileOptions(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearCompileOptions();
+
+ void SetProperty(const std::string& prop, const char* value,
+ cmListFileBacktrace const& lfbt);
+ void AppendProperty(const std::string& prop, const char* value,
+ bool asString, cmListFileBacktrace const& lfbt);
+ const char* GetProperty(const std::string& prop) const;
+ const char* GetProperty(const std::string& prop, bool chain) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
+ std::vector<std::string> GetPropertyKeys() const;
+
+ void AddNormalTargetName(std::string const& name);
+
+private:
+ void ComputeRelativePathTopSource();
+ void ComputeRelativePathTopBinary();
+
+private:
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
+ DirectoryState;
+ cmStateSnapshot Snapshot_;
+ friend class cmStateSnapshot;
+};
+
+#endif
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
new file mode 100644
index 0000000..8daa3cf
--- /dev/null
+++ b/Source/cmStatePrivate.h
@@ -0,0 +1,94 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmStatePrivate_h
+#define cmStatePrivate_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+#include "cmDefinitions.h"
+#include "cmLinkedTree.h"
+#include "cmListFileCache.h"
+#include "cmPropertyMap.h"
+#include "cmStateTypes.h"
+
+static const std::string cmPropertySentinal = std::string();
+
+struct cmStateDetail::SnapshotDataType
+{
+ cmStateDetail::PositionType ScopeParent;
+ cmStateDetail::PositionType DirectoryParent;
+ cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator Policies;
+ cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator PolicyRoot;
+ cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator PolicyScope;
+ cmStateEnums::SnapshotType SnapshotType;
+ bool Keep;
+ cmLinkedTree<std::string>::iterator ExecutionListFile;
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
+ BuildSystemDirectory;
+ cmLinkedTree<cmDefinitions>::iterator Vars;
+ cmLinkedTree<cmDefinitions>::iterator Root;
+ cmLinkedTree<cmDefinitions>::iterator Parent;
+ std::vector<std::string>::size_type IncludeDirectoryPosition;
+ std::vector<std::string>::size_type CompileDefinitionsPosition;
+ std::vector<std::string>::size_type CompileOptionsPosition;
+};
+
+struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap
+{
+ typedef cmPolicies::PolicyMap derived;
+ PolicyStackEntry(bool w = false)
+ : derived()
+ , Weak(w)
+ {
+ }
+ PolicyStackEntry(derived const& d, bool w)
+ : derived(d)
+ , Weak(w)
+ {
+ }
+ PolicyStackEntry(PolicyStackEntry const& r)
+ : derived(r)
+ , Weak(r.Weak)
+ {
+ }
+ bool Weak;
+};
+
+struct cmStateDetail::BuildsystemDirectoryStateType
+{
+ cmStateDetail::PositionType DirectoryEnd;
+
+ std::string Location;
+ std::string OutputLocation;
+
+ // The top-most directories for relative path conversion. Both the
+ // source and destination location of a relative path conversion
+ // must be underneath one of these directories (both under source or
+ // both under binary) in order for the relative path to be evaluated
+ // safely by the build tools.
+ std::string RelativePathTopSource;
+ std::string RelativePathTopBinary;
+
+ std::vector<std::string> IncludeDirectories;
+ std::vector<cmListFileBacktrace> IncludeDirectoryBacktraces;
+
+ std::vector<std::string> CompileDefinitions;
+ std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
+
+ std::vector<std::string> CompileOptions;
+ std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
+
+ std::vector<std::string> NormalTargetNames;
+
+ std::string ProjectName;
+
+ cmPropertyMap Properties;
+
+ std::vector<cmStateSnapshot> Children;
+};
+
+#endif
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
new file mode 100644
index 0000000..7f86221
--- /dev/null
+++ b/Source/cmStateSnapshot.cxx
@@ -0,0 +1,415 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmStateSnapshot.h"
+
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStatePrivate.h"
+#include "cmSystemTools.h"
+#include "cmVersion.h"
+#include "cmake.h"
+
+cmStateSnapshot::cmStateSnapshot(cmState* state)
+ : State(state)
+ , Position()
+{
+}
+
+std::vector<cmStateSnapshot> cmStateSnapshot::GetChildren()
+{
+ return this->Position->BuildSystemDirectory->Children;
+}
+
+cmStateSnapshot::cmStateSnapshot(cmState* state,
+ cmStateDetail::PositionType position)
+ : State(state)
+ , Position(position)
+{
+}
+
+cmStateEnums::SnapshotType cmStateSnapshot::GetType() const
+{
+ return this->Position->SnapshotType;
+}
+
+void cmStateSnapshot::SetListFile(const std::string& listfile)
+{
+ *this->Position->ExecutionListFile = listfile;
+}
+
+std::string cmStateSnapshot::GetExecutionListFile() const
+{
+ return *this->Position->ExecutionListFile;
+}
+
+bool cmStateSnapshot::IsValid() const
+{
+ return this->State && this->Position.IsValid()
+ ? this->Position != this->State->SnapshotData.Root()
+ : false;
+}
+
+cmStateSnapshot cmStateSnapshot::GetBuildsystemDirectoryParent() const
+{
+ cmStateSnapshot snapshot;
+ if (!this->State || this->Position == this->State->SnapshotData.Root()) {
+ return snapshot;
+ }
+ cmStateDetail::PositionType parentPos = this->Position->DirectoryParent;
+ if (parentPos != this->State->SnapshotData.Root()) {
+ snapshot = cmStateSnapshot(this->State,
+ parentPos->BuildSystemDirectory->DirectoryEnd);
+ }
+
+ return snapshot;
+}
+
+cmStateSnapshot cmStateSnapshot::GetCallStackParent() const
+{
+ assert(this->State);
+ assert(this->Position != this->State->SnapshotData.Root());
+
+ cmStateSnapshot snapshot;
+ cmStateDetail::PositionType parentPos = this->Position;
+ while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType ||
+ parentPos->SnapshotType == cmStateEnums::VariableScopeType) {
+ ++parentPos;
+ }
+ if (parentPos->SnapshotType == cmStateEnums::BuildsystemDirectoryType ||
+ parentPos->SnapshotType == cmStateEnums::BaseType) {
+ return snapshot;
+ }
+
+ ++parentPos;
+ while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType ||
+ parentPos->SnapshotType == cmStateEnums::VariableScopeType) {
+ ++parentPos;
+ }
+
+ if (parentPos == this->State->SnapshotData.Root()) {
+ return snapshot;
+ }
+
+ snapshot = cmStateSnapshot(this->State, parentPos);
+ return snapshot;
+}
+
+cmStateSnapshot cmStateSnapshot::GetCallStackBottom() const
+{
+ assert(this->State);
+ assert(this->Position != this->State->SnapshotData.Root());
+
+ cmStateDetail::PositionType pos = this->Position;
+ while (pos->SnapshotType != cmStateEnums::BaseType &&
+ pos->SnapshotType != cmStateEnums::BuildsystemDirectoryType &&
+ pos != this->State->SnapshotData.Root()) {
+ ++pos;
+ }
+ return cmStateSnapshot(this->State, pos);
+}
+
+void cmStateSnapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
+{
+ cmStateDetail::PositionType pos = this->Position;
+ pos->Policies = this->State->PolicyStack.Push(
+ pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak));
+}
+
+bool cmStateSnapshot::PopPolicy()
+{
+ cmStateDetail::PositionType pos = this->Position;
+ if (pos->Policies == pos->PolicyScope) {
+ return false;
+ }
+ pos->Policies = this->State->PolicyStack.Pop(pos->Policies);
+ return true;
+}
+
+bool cmStateSnapshot::CanPopPolicyScope()
+{
+ return this->Position->Policies == this->Position->PolicyScope;
+}
+
+void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id,
+ cmPolicies::PolicyStatus status)
+{
+ // Update the policy stack from the top to the top-most strong entry.
+ bool previous_was_weak = true;
+ for (cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator psi =
+ this->Position->Policies;
+ previous_was_weak && psi != this->Position->PolicyRoot; ++psi) {
+ psi->Set(id, status);
+ previous_was_weak = psi->Weak;
+ }
+}
+
+cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(
+ cmPolicies::PolicyID id) const
+{
+ cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
+
+ if (status == cmPolicies::REQUIRED_ALWAYS ||
+ status == cmPolicies::REQUIRED_IF_USED) {
+ return status;
+ }
+
+ cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator dir =
+ this->Position->BuildSystemDirectory;
+
+ while (true) {
+ assert(dir.IsValid());
+ cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator leaf =
+ dir->DirectoryEnd->Policies;
+ cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator root =
+ dir->DirectoryEnd->PolicyRoot;
+ for (; leaf != root; ++leaf) {
+ if (leaf->IsDefined(id)) {
+ status = leaf->Get(id);
+ return status;
+ }
+ }
+ cmStateDetail::PositionType e = dir->DirectoryEnd;
+ cmStateDetail::PositionType p = e->DirectoryParent;
+ if (p == this->State->SnapshotData.Root()) {
+ break;
+ }
+ dir = p->BuildSystemDirectory;
+ }
+ return status;
+}
+
+bool cmStateSnapshot::HasDefinedPolicyCMP0011()
+{
+ return !this->Position->Policies->IsEmpty();
+}
+
+const char* cmStateSnapshot::GetDefinition(std::string const& name) const
+{
+ assert(this->Position->Vars.IsValid());
+ return cmDefinitions::Get(name, this->Position->Vars, this->Position->Root);
+}
+
+bool cmStateSnapshot::IsInitialized(std::string const& name) const
+{
+ return cmDefinitions::HasKey(name, this->Position->Vars,
+ this->Position->Root);
+}
+
+void cmStateSnapshot::SetDefinition(std::string const& name,
+ std::string const& value)
+{
+ this->Position->Vars->Set(name, value.c_str());
+}
+
+void cmStateSnapshot::RemoveDefinition(std::string const& name)
+{
+ this->Position->Vars->Set(name, CM_NULLPTR);
+}
+
+std::vector<std::string> cmStateSnapshot::UnusedKeys() const
+{
+ return this->Position->Vars->UnusedKeys();
+}
+
+std::vector<std::string> cmStateSnapshot::ClosureKeys() const
+{
+ return cmDefinitions::ClosureKeys(this->Position->Vars,
+ this->Position->Root);
+}
+
+bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef)
+{
+ if (this->Position->ScopeParent == this->Position->DirectoryParent) {
+ cmStateSnapshot parentDir = this->GetBuildsystemDirectoryParent();
+ if (!parentDir.IsValid()) {
+ return false;
+ }
+ // Update the definition in the parent directory top scope. This
+ // directory's scope was initialized by the closure of the parent
+ // scope, so we do not need to localize the definition first.
+ if (varDef) {
+ parentDir.SetDefinition(var, varDef);
+ } else {
+ parentDir.RemoveDefinition(var);
+ }
+ return true;
+ }
+ // First localize the definition in the current scope.
+ cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root);
+
+ // Now update the definition in the parent scope.
+ this->Position->Parent->Set(var, varDef);
+ return true;
+}
+
+template <typename T, typename U, typename V>
+void InitializeContentFromParent(T& parentContent, T& thisContent,
+ U& parentBacktraces, U& thisBacktraces,
+ V& contentEndPosition)
+{
+ std::vector<std::string>::const_iterator parentBegin = parentContent.begin();
+ std::vector<std::string>::const_iterator parentEnd = parentContent.end();
+
+ std::vector<std::string>::const_reverse_iterator parentRbegin =
+ cmMakeReverseIterator(parentEnd);
+ std::vector<std::string>::const_reverse_iterator parentRend =
+ parentContent.rend();
+ parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
+ std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
+
+ thisContent = std::vector<std::string>(parentIt, parentEnd);
+
+ std::vector<cmListFileBacktrace>::const_iterator btIt =
+ parentBacktraces.begin() + std::distance(parentBegin, parentIt);
+ std::vector<cmListFileBacktrace>::const_iterator btEnd =
+ parentBacktraces.end();
+
+ thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
+
+ contentEndPosition = thisContent.size();
+}
+
+void cmStateSnapshot::SetDefaultDefinitions()
+{
+/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
+ With CMake must separate between target and host platform. In most cases
+ the tests for WIN32, UNIX and APPLE will be for the target system, so an
+ additional set of variables for the host system is required ->
+ CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
+ WIN32, UNIX and APPLE are now set in the platform files in
+ Modules/Platforms/.
+ To keep cmake scripts (-P) and custom language and compiler modules
+ working, these variables are still also set here in this place, but they
+ will be reset in CMakeSystemSpecificInformation.cmake before the platform
+ files are executed. */
+#if defined(_WIN32)
+ this->SetDefinition("WIN32", "1");
+ this->SetDefinition("CMAKE_HOST_WIN32", "1");
+#else
+ this->SetDefinition("UNIX", "1");
+ this->SetDefinition("CMAKE_HOST_UNIX", "1");
+#endif
+#if defined(__CYGWIN__)
+ 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");
+ }
+#endif
+#if defined(__APPLE__)
+ this->SetDefinition("APPLE", "1");
+ this->SetDefinition("CMAKE_HOST_APPLE", "1");
+#endif
+#if defined(__sun__)
+ this->SetDefinition("CMAKE_HOST_SOLARIS", "1");
+#endif
+
+ char temp[1024];
+ sprintf(temp, "%d", cmVersion::GetMinorVersion());
+ this->SetDefinition("CMAKE_MINOR_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetMajorVersion());
+ this->SetDefinition("CMAKE_MAJOR_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetPatchVersion());
+ this->SetDefinition("CMAKE_PATCH_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetTweakVersion());
+ this->SetDefinition("CMAKE_TWEAK_VERSION", temp);
+ this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion());
+
+ this->SetDefinition("CMAKE_FILES_DIRECTORY",
+ cmake::GetCMakeFilesDirectory());
+
+ // Setup the default include file regular expression (match everything).
+ this->Position->BuildSystemDirectory->Properties.SetProperty(
+ "INCLUDE_REGULAR_EXPRESSION", "^.*$");
+}
+
+void cmStateSnapshot::SetDirectoryDefinitions()
+{
+ this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->State->GetBinaryDirectory());
+}
+
+void cmStateSnapshot::InitializeFromParent()
+{
+ cmStateDetail::PositionType parent = this->Position->DirectoryParent;
+ assert(this->Position->Vars.IsValid());
+ assert(parent->Vars.IsValid());
+
+ *this->Position->Vars =
+ cmDefinitions::MakeClosure(parent->Vars, parent->Root);
+
+ InitializeContentFromParent(
+ parent->BuildSystemDirectory->IncludeDirectories,
+ this->Position->BuildSystemDirectory->IncludeDirectories,
+ parent->BuildSystemDirectory->IncludeDirectoryBacktraces,
+ this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces,
+ this->Position->IncludeDirectoryPosition);
+
+ InitializeContentFromParent(
+ parent->BuildSystemDirectory->CompileDefinitions,
+ this->Position->BuildSystemDirectory->CompileDefinitions,
+ parent->BuildSystemDirectory->CompileDefinitionsBacktraces,
+ this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces,
+ this->Position->CompileDefinitionsPosition);
+
+ InitializeContentFromParent(
+ parent->BuildSystemDirectory->CompileOptions,
+ this->Position->BuildSystemDirectory->CompileOptions,
+ parent->BuildSystemDirectory->CompileOptionsBacktraces,
+ this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
+ this->Position->CompileOptionsPosition);
+}
+
+cmState* cmStateSnapshot::GetState() const
+{
+ return this->State;
+}
+
+cmStateDirectory cmStateSnapshot::GetDirectory() const
+{
+ return cmStateDirectory(this->Position->BuildSystemDirectory, *this);
+}
+
+void cmStateSnapshot::SetProjectName(const std::string& name)
+{
+ this->Position->BuildSystemDirectory->ProjectName = name;
+}
+
+std::string cmStateSnapshot::GetProjectName() const
+{
+ return this->Position->BuildSystemDirectory->ProjectName;
+}
+
+void cmStateSnapshot::InitializeFromParent_ForSubdirsCommand()
+{
+ std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR");
+ std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR");
+ this->InitializeFromParent();
+ this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
+
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir);
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir);
+}
+
+bool cmStateSnapshot::StrictWeakOrder::operator()(
+ const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) const
+{
+ return lhs.Position.StrictWeakOrdered(rhs.Position);
+}
+
+bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs)
+{
+ return lhs.Position == rhs.Position;
+}
+
+bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs)
+{
+ return lhs.Position != rhs.Position;
+}
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
new file mode 100644
index 0000000..63b581d
--- /dev/null
+++ b/Source/cmStateSnapshot.h
@@ -0,0 +1,88 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmStateSnapshot_h
+#define cmStateSnapshot_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "cmPolicies.h"
+#include "cmStateTypes.h"
+
+class cmState;
+class cmStateDirectory;
+
+class cmStateSnapshot
+{
+public:
+ cmStateSnapshot(cmState* state = CM_NULLPTR);
+ cmStateSnapshot(cmState* state, cmStateDetail::PositionType position);
+
+ const char* GetDefinition(std::string const& name) const;
+ bool IsInitialized(std::string const& name) const;
+ void SetDefinition(std::string const& name, std::string const& value);
+ void RemoveDefinition(std::string const& name);
+ std::vector<std::string> UnusedKeys() const;
+ std::vector<std::string> ClosureKeys() const;
+ bool RaiseScope(std::string const& var, const char* varDef);
+
+ void SetListFile(std::string const& listfile);
+
+ std::string GetExecutionListFile() const;
+
+ std::vector<cmStateSnapshot> GetChildren();
+
+ bool IsValid() const;
+ cmStateSnapshot GetBuildsystemDirectoryParent() const;
+ cmStateSnapshot GetCallStackParent() const;
+ cmStateSnapshot GetCallStackBottom() const;
+ cmStateEnums::SnapshotType GetType() const;
+
+ void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
+ cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const;
+ bool HasDefinedPolicyCMP0011();
+ void PushPolicy(cmPolicies::PolicyMap entry, bool weak);
+ bool PopPolicy();
+ bool CanPopPolicyScope();
+
+ cmState* GetState() const;
+
+ cmStateDirectory GetDirectory() const;
+
+ void SetProjectName(std::string const& name);
+ std::string GetProjectName() const;
+
+ void InitializeFromParent_ForSubdirsCommand();
+
+ struct StrictWeakOrder
+ {
+ bool operator()(const cmStateSnapshot& lhs,
+ const cmStateSnapshot& rhs) const;
+ };
+
+ void SetDirectoryDefinitions();
+ void SetDefaultDefinitions();
+
+private:
+ friend bool operator==(const cmStateSnapshot& lhs,
+ const cmStateSnapshot& rhs);
+ friend bool operator!=(const cmStateSnapshot& lhs,
+ const cmStateSnapshot& rhs);
+ friend class cmState;
+ friend class cmStateDirectory;
+ friend struct StrictWeakOrder;
+
+ void InitializeFromParent();
+
+ cmState* State;
+ cmStateDetail::PositionType Position;
+};
+
+bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
+bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
+
+#endif
diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h
new file mode 100644
index 0000000..75f9e60
--- /dev/null
+++ b/Source/cmStateTypes.h
@@ -0,0 +1,55 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmStateTypes_h
+#define cmStateTypes_h
+
+#include "cmLinkedTree.h"
+
+namespace cmStateDetail {
+struct BuildsystemDirectoryStateType;
+struct SnapshotDataType;
+struct PolicyStackEntry;
+typedef cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator PositionType;
+}
+
+namespace cmStateEnums {
+
+enum SnapshotType
+{
+ BaseType,
+ BuildsystemDirectoryType,
+ FunctionCallType,
+ MacroCallType,
+ IncludeFileType,
+ InlineListFileType,
+ PolicyScopeType,
+ VariableScopeType
+};
+
+enum TargetType
+{
+ EXECUTABLE,
+ STATIC_LIBRARY,
+ SHARED_LIBRARY,
+ MODULE_LIBRARY,
+ OBJECT_LIBRARY,
+ UTILITY,
+ GLOBAL_TARGET,
+ INTERFACE_LIBRARY,
+ UNKNOWN_LIBRARY
+};
+
+enum CacheEntryType
+{
+ BOOL = 0,
+ PATH,
+ FILEPATH,
+ STRING,
+ INTERNAL,
+ STATIC,
+ UNINITIALIZED
+};
+}
+
+#endif
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index c73025a..33d22e4 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -3,6 +3,7 @@
#include "cmStringCommand.h"
#include "cmCryptoHash.h"
+#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index edb138d..b928f3c 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -39,8 +39,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "string"; }
- cmTypeMacro(cmStringCommand, cmCommand);
-
protected:
bool HandleConfigureCommand(std::vector<std::string> const& args);
bool HandleAsciiCommand(std::vector<std::string> const& args);
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index fe7f659..d502c5f 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSubdirCommand.h"
+#include "cmSystemTools.h"
+
// cmSubdirCommand
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index c425852..0778638 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -31,8 +31,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "subdirs"; }
-
- cmTypeMacro(cmSubdirCommand, cmCommand);
};
#endif
diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx
index b5b4148..9259836 100644
--- a/Source/cmSubdirDependsCommand.cxx
+++ b/Source/cmSubdirDependsCommand.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSubdirDependsCommand.h"
+#include "cmPolicies.h"
+
+class cmExecutionStatus;
+
bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index 0f3deb6..80ff24f 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -3,8 +3,14 @@
#ifndef cmSubdirDependsCommand_h
#define cmSubdirDependsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmSubdirDependsCommand : public cmCommand
{
public:
@@ -12,7 +18,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
std::string GetName() const CM_OVERRIDE { return "subdir_depends"; }
- cmTypeMacro(cmSubdirDependsCommand, cmCommand);
};
#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3d8fdf5..0a3a1ab 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1499,6 +1499,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
{
fprintf(out, " -> %s", archive_entry_symlink(entry));
}
+ fflush(out);
}
long copy_data(struct archive* ar, struct archive* aw)
@@ -2518,9 +2519,9 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
std::swap(se[0], se[1]);
}
- // Get the size of the dynamic section header.
- unsigned int count = elf.GetDynamicEntryCount();
- if (count == 0) {
+ // Obtain a copy of the dynamic entries
+ cmELF::DynamicEntryList dentries = elf.GetDynamicEntries();
+ if (dentries.empty()) {
// This should happen only for invalid ELF files where a DT_NULL
// appears before the end of the table.
if (emsg) {
@@ -2536,40 +2537,46 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
zeroSize[i] = se[i]->Size;
}
- // Get the range of file positions corresponding to each entry and
- // the rest of the table after them.
- unsigned long entryBegin[3] = { 0, 0, 0 };
- unsigned long entryEnd[2] = { 0, 0 };
- for (int i = 0; i < se_count; ++i) {
- entryBegin[i] = elf.GetDynamicEntryPosition(se[i]->IndexInSection);
- entryEnd[i] = elf.GetDynamicEntryPosition(se[i]->IndexInSection + 1);
- }
- entryBegin[se_count] = elf.GetDynamicEntryPosition(count);
-
- // The data are to be written over the old table entries starting at
- // the first one being removed.
- bytesBegin = entryBegin[0];
- unsigned long bytesEnd = entryBegin[se_count];
+ // Get size of one DYNAMIC entry
+ unsigned long const sizeof_dentry =
+ elf.GetDynamicEntryPosition(1) - elf.GetDynamicEntryPosition(0);
- // Allocate a buffer to hold the part of the file to be written.
- // Initialize it with zeros.
- bytes.resize(bytesEnd - bytesBegin, 0);
-
- // Read the part of the DYNAMIC section header that will move.
- // The remainder of the buffer will be left with zeros which
- // represent a DT_NULL entry.
- char* data = &bytes[0];
- for (int i = 0; i < se_count; ++i) {
- // Read data between the entries being removed.
- unsigned long sz = entryBegin[i + 1] - entryEnd[i];
- if (sz > 0 && !elf.ReadBytes(entryEnd[i], sz, data)) {
- if (emsg) {
- *emsg = "Failed to read DYNAMIC section header.";
+ // Adjust the entry list as necessary to remove the run path
+ unsigned long entriesErased = 0;
+ for (cmELF::DynamicEntryList::iterator it = dentries.begin();
+ it != dentries.end();) {
+ if (it->first == cmELF::TagRPath || it->first == cmELF::TagRunPath) {
+ it = dentries.erase(it);
+ entriesErased++;
+ continue;
+ } else {
+ if (cmELF::TagMipsRldMapRel != 0 &&
+ it->first == cmELF::TagMipsRldMapRel) {
+ // Background: debuggers need to know the "linker map" which contains
+ // the addresses each dynamic object is loaded at. Most arches use
+ // the DT_DEBUG tag which the dynamic linker writes to (directly) and
+ // contain the location of the linker map, however on MIPS the
+ // .dynamic section is always read-only so this is not possible. MIPS
+ // objects instead contain a DT_MIPS_RLD_MAP tag which contains the
+ // address where the dyanmic linker will write to (an indirect
+ // version of DT_DEBUG). Since this doesn't work when using PIE, a
+ // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this
+ // version contains a relative offset, moving it changes the
+ // calculated address. This may cause the dyanmic linker to write
+ // into memory it should not be changing.
+ //
+ // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If
+ // we move it up by n bytes, we add n bytes to the value of this tag.
+ it->second += entriesErased * sizeof_dentry;
}
- return false;
+
+ it++;
}
- data += sz;
}
+
+ // Encode new entries list
+ bytes = elf.EncodeDynamicEntries(dentries);
+ bytesBegin = elf.GetDynamicEntryPosition(0);
}
// Open the file for update.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 54e0bea..25ae339 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -8,11 +8,15 @@
#include "cmGlobalGenerator.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmMessenger.h"
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
+#include "cmState.h"
#include "cmSystemTools.h"
+#include "cmTargetPropertyComputer.h"
+#include "cm_unordered_set.hxx"
#include "cmake.h"
#include <algorithm>
@@ -23,15 +27,133 @@
#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
-#define UNORDERED_SET std::set
-#endif
+template <>
+const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
+ cmTarget const* tgt)
+{
+ static std::string loc;
+ if (tgt->IsImported()) {
+ loc = tgt->ImportedGetFullPath("", false);
+ return loc.c_str();
+ }
+
+ cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
+ cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
+ loc = gt->GetLocationForBuild();
+ return loc.c_str();
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocation<cmTarget>(
+ cmTarget const* tgt, const std::string& config)
+{
+ static std::string loc;
+ if (tgt->IsImported()) {
+ loc = tgt->ImportedGetFullPath(config, false);
+ return loc.c_str();
+ }
+
+ cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
+ cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
+ loc = gt->GetFullPath(config, false);
+ return loc.c_str();
+}
+
+template <>
+const char* cmTargetPropertyComputer::GetSources<cmTarget>(
+ cmTarget const* tgt, cmMessenger* messenger,
+ cmListFileBacktrace const& context)
+{
+ cmStringRange entries = tgt->GetSourceEntries();
+ if (entries.empty()) {
+ return CM_NULLPTR;
+ }
+
+ std::ostringstream ss;
+ const char* sep = "";
+ for (std::vector<std::string>::const_iterator i = entries.begin();
+ i != entries.end(); ++i) {
+ std::string const& entry = *i;
+
+ std::vector<std::string> files;
+ cmSystemTools::ExpandListArgument(entry, files);
+ for (std::vector<std::string>::const_iterator li = files.begin();
+ li != files.end(); ++li) {
+ if (cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
+ (*li)[li->size() - 1] == '>') {
+ std::string objLibName = li->substr(17, li->size() - 18);
+
+ if (cmGeneratorExpression::Find(objLibName) != std::string::npos) {
+ ss << sep;
+ sep = ";";
+ ss << *li;
+ continue;
+ }
+
+ bool addContent = false;
+ bool noMessage = true;
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch (context.GetBottom().GetPolicy(cmPolicies::CMP0051)) {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n";
+ noMessage = false;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ addContent = true;
+ }
+ if (!noMessage) {
+ e << "Target \"" << tgt->GetName()
+ << "\" contains "
+ "$<TARGET_OBJECTS> generator expression in its sources "
+ "list. "
+ "This content was not previously part of the SOURCES "
+ "property "
+ "when that property was read at configure time. Code "
+ "reading "
+ "that property needs to be adapted to ignore the generator "
+ "expression using the string(GENEX_STRIP) command.";
+ messenger->IssueMessage(messageType, e.str(), context);
+ }
+ if (addContent) {
+ ss << sep;
+ sep = ";";
+ ss << *li;
+ }
+ } else if (cmGeneratorExpression::Find(*li) == std::string::npos) {
+ ss << sep;
+ sep = ";";
+ ss << *li;
+ } else {
+ cmSourceFile* sf = tgt->GetMakefile()->GetOrCreateSource(*li);
+ // Construct what is known about this source file location.
+ cmSourceFileLocation const& location = sf->GetLocation();
+ std::string sname = location.GetDirectory();
+ if (!sname.empty()) {
+ sname += "/";
+ }
+ sname += location.GetName();
+
+ ss << sep;
+ sep = ";";
+ // Append this list entry.
+ ss << sname;
+ }
+ }
+ }
+ static std::string srcs;
+ srcs = ss.str();
+ return srcs.c_str();
+}
class cmTargetInternals
{
@@ -50,7 +172,7 @@ public:
std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces;
};
-cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
+cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
Visibility vis, cmMakefile* mf)
{
assert(mf);
@@ -66,8 +188,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
this->BuildInterfaceIncludesAppended = false;
// only add dependency information for library targets
- if (this->TargetTypeValue >= cmState::STATIC_LIBRARY &&
- this->TargetTypeValue <= cmState::MODULE_LIBRARY) {
+ if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY &&
+ this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) {
this->RecordDependencies = true;
} else {
this->RecordDependencies = false;
@@ -84,8 +206,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
"Android") == 0;
// Setup default property values.
- if (this->GetType() != cmState::INTERFACE_LIBRARY &&
- this->GetType() != cmState::UTILITY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
+ this->GetType() != cmStateEnums::UTILITY) {
this->SetPropertyDefault("ANDROID_API", CM_NULLPTR);
this->SetPropertyDefault("ANDROID_API_MIN", CM_NULLPTR);
this->SetPropertyDefault("ANDROID_ARCH", CM_NULLPTR);
@@ -102,6 +224,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", CM_NULLPTR);
this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", CM_NULLPTR);
this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", CM_NULLPTR);
+ this->SetPropertyDefault("BUILD_RPATH", CM_NULLPTR);
this->SetPropertyDefault("INSTALL_NAME_DIR", CM_NULLPTR);
this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
@@ -151,7 +274,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
mf->GetConfigurations(configNames);
// Setup per-configuration property default values.
- if (this->GetType() != cmState::UTILITY) {
+ if (this->GetType() != cmStateEnums::UTILITY) {
const char* configProps[] = {
/* clang-format needs this comment to break after the opening brace */
"ARCHIVE_OUTPUT_DIRECTORY_",
@@ -166,7 +289,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
ci != configNames.end(); ++ci) {
std::string configUpper = cmSystemTools::UpperCase(*ci);
for (const char** p = configProps; *p; ++p) {
- if (this->TargetTypeValue == cmState::INTERFACE_LIBRARY &&
+ if (this->TargetTypeValue == cmStateEnums::INTERFACE_LIBRARY &&
strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) {
continue;
}
@@ -180,8 +303,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
// compatibility with previous CMake versions in which executables
// did not support this variable. Projects may still specify the
// property directly.
- if (this->TargetTypeValue != cmState::EXECUTABLE &&
- this->TargetTypeValue != cmState::INTERFACE_LIBRARY) {
+ if (this->TargetTypeValue != cmStateEnums::EXECUTABLE &&
+ this->TargetTypeValue != cmStateEnums::INTERFACE_LIBRARY) {
std::string property = cmSystemTools::UpperCase(*ci);
property += "_POSTFIX";
this->SetPropertyDefault(property, CM_NULLPTR);
@@ -226,49 +349,55 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
parentOptionsBts.end());
}
- if (this->GetType() != cmState::INTERFACE_LIBRARY &&
- this->GetType() != cmState::UTILITY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
+ this->GetType() != cmStateEnums::UTILITY) {
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) {
+ if (this->TargetTypeValue == cmStateEnums::EXECUTABLE) {
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) {
+ if (this->TargetTypeValue == cmStateEnums::SHARED_LIBRARY ||
+ this->TargetTypeValue == cmStateEnums::MODULE_LIBRARY) {
this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
}
- if (this->TargetTypeValue == cmState::SHARED_LIBRARY ||
- this->TargetTypeValue == cmState::EXECUTABLE) {
+ if (this->TargetTypeValue == cmStateEnums::SHARED_LIBRARY ||
+ this->TargetTypeValue == cmStateEnums::EXECUTABLE) {
this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", CM_NULLPTR);
}
- if (this->GetType() != cmState::INTERFACE_LIBRARY &&
- this->GetType() != cmState::UTILITY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
+ this->GetType() != cmStateEnums::UTILITY) {
this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", CM_NULLPTR);
}
// Record current policies for later use.
this->Makefile->RecordPolicies(this->PolicyMap);
- if (this->TargetTypeValue == cmState::INTERFACE_LIBRARY) {
+ if (this->TargetTypeValue == cmStateEnums::INTERFACE_LIBRARY) {
// This policy is checked in a few conditions. The properties relevant
- // to the policy are always ignored for cmState::INTERFACE_LIBRARY targets,
+ // to the policy are always ignored for cmStateEnums::INTERFACE_LIBRARY
+ // targets,
// so ensure that the conditions don't lead to nonsense.
this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW);
}
- if (this->GetType() != cmState::INTERFACE_LIBRARY &&
- this->GetType() != cmState::UTILITY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
+ this->GetType() != cmStateEnums::UTILITY) {
this->SetPropertyDefault("JOB_POOL_COMPILE", CM_NULLPTR);
this->SetPropertyDefault("JOB_POOL_LINK", CM_NULLPTR);
}
}
+cmGlobalGenerator* cmTarget::GetGlobalGenerator() const
+{
+ return this->GetMakefile()->GetGlobalGenerator();
+}
+
void cmTarget::AddUtility(const std::string& u, cmMakefile* makefile)
{
if (this->Utilities.insert(u).second && makefile) {
@@ -296,26 +425,27 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
bool cmTarget::IsExecutableWithExports() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->GetPropertyAsBool("ENABLE_EXPORTS"));
}
bool cmTarget::HasImportLibrary() const
{
- return (this->DLLPlatform && (this->GetType() == cmState::SHARED_LIBRARY ||
- this->IsExecutableWithExports()));
+ return (this->DLLPlatform &&
+ (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->IsExecutableWithExports()));
}
bool cmTarget::IsFrameworkOnApple() const
{
- return (this->GetType() == cmState::SHARED_LIBRARY &&
+ return (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("FRAMEWORK"));
}
bool cmTarget::IsAppBundleOnApple() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}
@@ -475,23 +605,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
return this->Makefile->GetOrCreateSource(src);
}
-void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname,
- const LinkLibraryVectorType& libs)
-{
- // Only add on libraries we haven't added on before.
- // Assumption: the global link libraries could only grow, never shrink
- LinkLibraryVectorType::const_iterator i = libs.begin();
- i += this->PrevLinkedLibraries.size();
- for (; i != libs.end(); ++i) {
- // This is equivalent to the target_link_libraries plain signature.
- this->AddLinkLibrary(mf, selfname, i->first, i->second);
- this->AppendProperty(
- "INTERFACE_LINK_LIBRARIES",
- this->GetDebugGeneratorExpressions(i->first, i->second).c_str());
- }
- this->PrevLinkedLibraries = libs;
-}
-
void cmTarget::AddLinkDirectory(const std::string& d)
{
// Make sure we don't add unnecessary search directories.
@@ -514,7 +627,7 @@ void cmTarget::ClearDependencyInformation(cmMakefile& mf,
depname += "_LIB_DEPENDS";
if (this->RecordDependencies) {
mf.AddCacheDefinition(depname, "", "Dependencies for target",
- cmState::STATIC);
+ cmStateEnums::STATIC);
} else {
if (mf.GetDefinition(depname)) {
std::string message = "Target ";
@@ -594,8 +707,7 @@ void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const
}
}
-void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target,
- const std::string& lib,
+void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
cmTargetLinkLibraryType llt)
{
cmTarget* tgt = this->Makefile->FindTargetToUse(lib);
@@ -612,8 +724,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target,
}
if (cmGeneratorExpression::Find(lib) != std::string::npos ||
- (tgt && tgt->GetType() == cmState::INTERFACE_LIBRARY) ||
- (target == lib)) {
+ (tgt && tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) ||
+ (this->Name == lib)) {
return;
}
@@ -631,7 +743,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target,
// and we removing one instance will break the link line. Duplicates
// will be appropriately eliminated at emit time.
if (this->RecordDependencies) {
- std::string targetEntry = target;
+ std::string targetEntry = this->Name;
targetEntry += "_LIB_DEPENDS";
std::string dependencies;
const char* old_val = mf.GetDefinition(targetEntry);
@@ -653,7 +765,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target,
dependencies += lib;
dependencies += ";";
mf.AddCacheDefinition(targetEntry, dependencies.c_str(),
- "Dependencies for the target", cmState::STATIC);
+ "Dependencies for the target", cmStateEnums::STATIC);
}
}
@@ -722,51 +834,34 @@ cmBacktraceRange cmTarget::GetLinkImplementationBacktraces() const
return cmMakeRange(this->Internal->LinkImplementationPropertyBacktraces);
}
-static bool whiteListedInterfaceProperty(const std::string& prop)
+void cmTarget::SetProperty(const std::string& prop, const char* value)
{
- if (cmHasLiteralPrefix(prop, "INTERFACE_")) {
- return true;
- }
- static UNORDERED_SET<std::string> builtIns;
- if (builtIns.empty()) {
- builtIns.insert("COMPATIBLE_INTERFACE_BOOL");
- builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
- builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
- builtIns.insert("COMPATIBLE_INTERFACE_STRING");
- builtIns.insert("EXPORT_NAME");
- builtIns.insert("IMPORTED");
- builtIns.insert("NAME");
- builtIns.insert("TYPE");
- }
-
- if (builtIns.count(prop)) {
- return true;
+ if (!cmTargetPropertyComputer::PassesWhitelist(
+ this->GetType(), prop, this->Makefile->GetMessenger(),
+ this->Makefile->GetBacktrace())) {
+ return;
}
-
- if (cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_")) {
- return true;
+ if (prop == "NAME") {
+ std::ostringstream e;
+ e << "NAME property is read-only\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
}
-
- return false;
-}
-
-void cmTarget::SetProperty(const std::string& prop, const char* value)
-{
- if (this->GetType() == cmState::INTERFACE_LIBRARY &&
- !whiteListedInterfaceProperty(prop)) {
+ if (prop == "EXPORT_NAME" && this->IsImported()) {
std::ostringstream e;
- e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
- "The property \""
- << prop << "\" is not allowed.";
+ e << "EXPORT_NAME property can't be set on imported targets (\""
+ << this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
- if (prop == "NAME") {
+ if (prop == "SOURCES" && this->IsImported()) {
std::ostringstream e;
- e << "NAME property is read-only\n";
+ e << "SOURCES property can't be set on imported targets (\"" << this->Name
+ << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
+
if (prop == "INCLUDE_DIRECTORIES") {
this->Internal->IncludeDirectoriesEntries.clear();
this->Internal->IncludeDirectoriesBacktraces.clear();
@@ -799,11 +894,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
- } else if (prop == "EXPORT_NAME" && this->IsImported()) {
- std::ostringstream e;
- e << "EXPORT_NAME property can't be set on imported targets (\""
- << this->Name << "\")\n";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
} else if (prop == "LINK_LIBRARIES") {
this->Internal->LinkImplementationPropertyEntries.clear();
this->Internal->LinkImplementationPropertyBacktraces.clear();
@@ -813,14 +903,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
}
} else if (prop == "SOURCES") {
- if (this->IsImported()) {
- std::ostringstream e;
- e << "SOURCES property can't be set on imported targets (\""
- << this->Name << "\")\n";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
- }
-
this->Internal->SourceEntries.clear();
this->Internal->SourceBacktraces.clear();
if (value) {
@@ -836,13 +918,9 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
void cmTarget::AppendProperty(const std::string& prop, const char* value,
bool asString)
{
- if (this->GetType() == cmState::INTERFACE_LIBRARY &&
- !whiteListedInterfaceProperty(prop)) {
- std::ostringstream e;
- e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
- "The property \""
- << prop << "\" is not allowed.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (!cmTargetPropertyComputer::PassesWhitelist(
+ this->GetType(), prop, this->Makefile->GetMessenger(),
+ this->Makefile->GetBacktrace())) {
return;
}
if (prop == "NAME") {
@@ -851,6 +929,20 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
+ if (prop == "EXPORT_NAME" && this->IsImported()) {
+ std::ostringstream e;
+ e << "EXPORT_NAME property can't be set on imported targets (\""
+ << this->Name << "\")\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+ if (prop == "SOURCES" && this->IsImported()) {
+ std::ostringstream e;
+ e << "SOURCES property can't be set on imported targets (\"" << this->Name
+ << "\")\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
if (prop == "INCLUDE_DIRECTORIES") {
if (value && *value) {
this->Internal->IncludeDirectoriesEntries.push_back(value);
@@ -875,11 +967,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
- } else if (prop == "EXPORT_NAME" && this->IsImported()) {
- std::ostringstream e;
- e << "EXPORT_NAME property can't be set on imported targets (\""
- << this->Name << "\")\n";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
} else if (prop == "LINK_LIBRARIES") {
if (value && *value) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -887,13 +974,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
}
} else if (prop == "SOURCES") {
- if (this->IsImported()) {
- std::ostringstream e;
- e << "SOURCES property can't be set on imported targets (\""
- << this->Name << "\")\n";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
- }
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->SourceEntries.push_back(value);
this->Internal->SourceBacktraces.push_back(lfbt);
@@ -904,10 +984,10 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
void cmTarget::AppendBuildInterfaceIncludes()
{
- if (this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::STATIC_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY &&
- this->GetType() != cmState::INTERFACE_LIBRARY &&
+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
!this->IsExecutableWithExports()) {
return;
}
@@ -1047,137 +1127,16 @@ void cmTarget::CheckProperty(const std::string& prop,
}
}
-bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
+const char* cmTarget::GetComputedProperty(
+ const std::string& prop, cmMessenger* messenger,
+ cmListFileBacktrace const& context) const
{
- if (this->IsImported()) {
- return true;
- }
- std::ostringstream e;
- const char* modal = CM_NULLPTR;
- cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- switch (context->GetPolicyStatus(cmPolicies::CMP0026)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
- modal = "should";
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- modal = "may";
- messageType = cmake::FATAL_ERROR;
- }
-
- if (modal) {
- e << "The LOCATION property " << modal << " not be read from target \""
- << this->GetName()
- << "\". Use the target name directly with "
- "add_custom_command, or use the generator expression $<TARGET_FILE>, "
- "as appropriate.\n";
- context->IssueMessage(messageType, e.str());
- }
-
- return messageType != cmake::FATAL_ERROR;
+ return cmTargetPropertyComputer::GetProperty(this, prop, messenger, context);
}
const char* cmTarget::GetProperty(const std::string& prop) const
{
- return this->GetProperty(prop, this->Makefile);
-}
-
-const char* cmTarget::GetProperty(const std::string& prop,
- cmMakefile* context) const
-{
- if (this->GetType() == cmState::INTERFACE_LIBRARY &&
- !whiteListedInterfaceProperty(prop)) {
- std::ostringstream e;
- e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
- "The property \""
- << prop << "\" is not allowed.";
- context->IssueMessage(cmake::FATAL_ERROR, e.str());
- return CM_NULLPTR;
- }
-
- // Watch for special "computed" properties that are dependent on
- // other properties or variables. Always recompute them.
- if (this->GetType() == cmState::EXECUTABLE ||
- this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::UNKNOWN_LIBRARY) {
- static const std::string propLOCATION = "LOCATION";
- if (prop == propLOCATION) {
- if (!this->HandleLocationPropertyPolicy(context)) {
- return CM_NULLPTR;
- }
-
- // Set the LOCATION property of the target.
- //
- // For an imported target this is the location of an arbitrary
- // available configuration.
- //
- if (this->IsImported()) {
- this->Properties.SetProperty(
- propLOCATION, this->ImportedGetFullPath("", false).c_str());
- } else {
- // For a non-imported target this is deprecated because it
- // cannot take into account the per-configuration name of the
- // target because the configuration type may not be known at
- // CMake time.
- cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- if (!gg->GetConfigureDoneCMP0026()) {
- gg->CreateGenerationObjects();
- }
- cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
- this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild());
- }
-
- }
-
- // Support "LOCATION_<CONFIG>".
- else if (cmHasLiteralPrefix(prop, "LOCATION_")) {
- if (!this->HandleLocationPropertyPolicy(context)) {
- return CM_NULLPTR;
- }
- const char* configName = prop.c_str() + 9;
-
- if (this->IsImported()) {
- this->Properties.SetProperty(
- prop, this->ImportedGetFullPath(configName, false).c_str());
- } else {
- cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- if (!gg->GetConfigureDoneCMP0026()) {
- gg->CreateGenerationObjects();
- }
- cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
- this->Properties.SetProperty(
- prop, gt->GetFullPath(configName, false).c_str());
- }
- }
- // Support "<CONFIG>_LOCATION".
- else if (cmHasLiteralSuffix(prop, "_LOCATION") &&
- !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
- std::string configName(prop.c_str(), prop.size() - 9);
- if (configName != "IMPORTED") {
- if (!this->HandleLocationPropertyPolicy(context)) {
- return CM_NULLPTR;
- }
- if (this->IsImported()) {
- this->Properties.SetProperty(
- prop, this->ImportedGetFullPath(configName, false).c_str());
- } else {
- cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- if (!gg->GetConfigureDoneCMP0026()) {
- gg->CreateGenerationObjects();
- }
- cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
- this->Properties.SetProperty(
- prop, gt->GetFullPath(configName, false).c_str());
- }
- }
- }
- }
- static UNORDERED_SET<std::string> specialProps;
+ static CM_UNORDERED_SET<std::string> specialProps;
#define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP
MAKE_STATIC_PROP(LINK_LIBRARIES);
MAKE_STATIC_PROP(TYPE);
@@ -1261,93 +1220,16 @@ const char* cmTarget::GetProperty(const std::string& prop,
return this->GetName().c_str();
}
if (prop == propBINARY_DIR) {
- return this->GetMakefile()->GetCurrentBinaryDirectory();
+ return this->GetMakefile()
+ ->GetStateSnapshot()
+ .GetDirectory()
+ .GetCurrentBinary();
}
if (prop == propSOURCE_DIR) {
- return this->GetMakefile()->GetCurrentSourceDirectory();
- }
- if (prop == propSOURCES) {
- if (this->Internal->SourceEntries.empty()) {
- return CM_NULLPTR;
- }
-
- std::ostringstream ss;
- const char* sep = "";
- for (std::vector<std::string>::const_iterator i =
- this->Internal->SourceEntries.begin();
- i != this->Internal->SourceEntries.end(); ++i) {
- std::string const& entry = *i;
-
- std::vector<std::string> files;
- cmSystemTools::ExpandListArgument(entry, files);
- for (std::vector<std::string>::const_iterator li = files.begin();
- li != files.end(); ++li) {
- if (cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
- (*li)[li->size() - 1] == '>') {
- std::string objLibName = li->substr(17, li->size() - 18);
-
- if (cmGeneratorExpression::Find(objLibName) != std::string::npos) {
- ss << sep;
- sep = ";";
- ss << *li;
- continue;
- }
-
- bool addContent = false;
- bool noMessage = true;
- std::ostringstream e;
- cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- switch (context->GetPolicyStatus(cmPolicies::CMP0051)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n";
- noMessage = false;
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- addContent = true;
- }
- if (!noMessage) {
- e << "Target \"" << this->Name
- << "\" contains "
- "$<TARGET_OBJECTS> generator expression in its sources "
- "list. "
- "This content was not previously part of the SOURCES "
- "property "
- "when that property was read at configure time. Code "
- "reading "
- "that property needs to be adapted to ignore the generator "
- "expression using the string(GENEX_STRIP) command.";
- context->IssueMessage(messageType, e.str());
- }
- if (addContent) {
- ss << sep;
- sep = ";";
- ss << *li;
- }
- } else if (cmGeneratorExpression::Find(*li) == std::string::npos) {
- ss << sep;
- sep = ";";
- ss << *li;
- } else {
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(*li);
- // Construct what is known about this source file location.
- cmSourceFileLocation const& location = sf->GetLocation();
- std::string sname = location.GetDirectory();
- if (!sname.empty()) {
- sname += "/";
- }
- sname += location.GetName();
-
- ss << sep;
- sep = ";";
- // Append this list entry.
- ss << sname;
- }
- }
- }
- this->Properties.SetProperty("SOURCES", ss.str().c_str());
+ return this->GetMakefile()
+ ->GetStateSnapshot()
+ .GetDirectory()
+ .GetCurrentSource();
}
}
@@ -1356,7 +1238,8 @@ const char* cmTarget::GetProperty(const std::string& prop,
const bool chain = this->GetMakefile()->GetState()->IsPropertyChained(
prop, cmProperty::TARGET);
if (chain) {
- return this->Makefile->GetProperty(prop, chain);
+ return this->Makefile->GetStateSnapshot().GetDirectory().GetProperty(
+ prop, chain);
}
}
return retVal;
@@ -1370,15 +1253,15 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const
const char* cmTarget::GetSuffixVariableInternal(bool implib) const
{
switch (this->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "CMAKE_STATIC_LIBRARY_SUFFIX";
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX"
: "CMAKE_SHARED_LIBRARY_SUFFIX");
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX"
: "CMAKE_SHARED_MODULE_SUFFIX");
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return (implib
? "CMAKE_IMPORT_LIBRARY_SUFFIX"
// Android GUI application packages store the native
@@ -1395,15 +1278,15 @@ const char* cmTarget::GetSuffixVariableInternal(bool implib) const
const char* cmTarget::GetPrefixVariableInternal(bool implib) const
{
switch (this->GetType()) {
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
return "CMAKE_STATIC_LIBRARY_PREFIX";
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return (implib ? "CMAKE_IMPORT_LIBRARY_PREFIX"
: "CMAKE_SHARED_LIBRARY_PREFIX");
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return (implib ? "CMAKE_IMPORT_LIBRARY_PREFIX"
: "CMAKE_SHARED_MODULE_PREFIX");
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return (implib
? "CMAKE_IMPORT_LIBRARY_PREFIX"
// Android GUI application packages store the native
@@ -1437,7 +1320,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config,
const char* imp = CM_NULLPTR;
std::string suffix;
- if (this->GetType() != cmState::INTERFACE_LIBRARY &&
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetMappedConfig(config_upper, &loc, &imp, suffix)) {
if (!pimplib) {
if (loc) {
@@ -1455,7 +1338,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config,
} else {
if (imp) {
result = imp;
- } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+ } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
@@ -1493,9 +1376,10 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
const char** loc, const char** imp,
std::string& suffix) const
{
- if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// This method attempts to find a config-specific LOCATION for the
- // IMPORTED library. In the case of cmState::INTERFACE_LIBRARY, there is no
+ // IMPORTED library. In the case of cmStateEnums::INTERFACE_LIBRARY, there
+ // is no
// LOCATION at all, so leaving *loc and *imp unchanged is the appropriate
// and valid response.
return true;
@@ -1510,7 +1394,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
std::string mapProp = "MAP_IMPORTED_CONFIG_";
mapProp += desired_config;
if (const char* mapValue = this->GetProperty(mapProp)) {
- cmSystemTools::ExpandListArgument(mapValue, mappedConfigs);
+ cmSystemTools::ExpandListArgument(mapValue, mappedConfigs, true);
}
}
@@ -1523,20 +1407,33 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
for (std::vector<std::string>::const_iterator mci = mappedConfigs.begin();
!*loc && !*imp && mci != mappedConfigs.end(); ++mci) {
// Look for this configuration.
- std::string mcUpper = cmSystemTools::UpperCase(*mci);
- std::string locProp = "IMPORTED_LOCATION_";
- locProp += mcUpper;
- *loc = this->GetProperty(locProp);
- if (allowImp) {
- std::string impProp = "IMPORTED_IMPLIB_";
- impProp += mcUpper;
- *imp = this->GetProperty(impProp);
- }
+ if (mci->empty()) {
+ // An empty string in the mapping has a special meaning:
+ // look up the config-less properties.
+ *loc = this->GetProperty("IMPORTED_LOCATION");
+ if (allowImp) {
+ *imp = this->GetProperty("IMPORTED_IMPLIB");
+ }
+ // If it was found, set the suffix.
+ if (*loc || *imp) {
+ suffix = "";
+ }
+ } else {
+ std::string mcUpper = cmSystemTools::UpperCase(*mci);
+ std::string locProp = "IMPORTED_LOCATION_";
+ locProp += mcUpper;
+ *loc = this->GetProperty(locProp);
+ if (allowImp) {
+ std::string impProp = "IMPORTED_IMPLIB_";
+ impProp += mcUpper;
+ *imp = this->GetProperty(impProp);
+ }
- // If it was found, use it for all properties below.
- if (*loc || *imp) {
- suffix = "_";
- suffix += mcUpper;
+ // If it was found, use it for all properties below.
+ if (*loc || *imp) {
+ suffix = "_";
+ suffix += mcUpper;
+ }
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index dd9097a..1f035a1 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -10,8 +10,9 @@
#include "cmListFileCache.h"
#include "cmPolicies.h"
#include "cmPropertyMap.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmTargetLinkLibraryType.h"
+#include "cm_unordered_map.hxx"
#include <iosfwd>
#include <map>
@@ -20,16 +21,9 @@
#include <utility>
#include <vector>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-#include <unordered_map>
-#else
-#include <cmsys/hash_map.hxx>
-#endif
-#endif
-
class cmMakefile;
class cmSourceFile;
+class cmGlobalGenerator;
class cmTargetInternals;
class cmTargetInternalPointer
@@ -61,8 +55,8 @@ public:
VisibilityImportedGlobally
};
- cmTarget(std::string const& name, cmState::TargetType type, Visibility vis,
- cmMakefile* mf);
+ cmTarget(std::string const& name, cmStateEnums::TargetType type,
+ Visibility vis, cmMakefile* mf);
enum CustomCommandType
{
@@ -74,7 +68,9 @@ public:
/**
* Return the type of target.
*/
- cmState::TargetType GetType() const { return this->TargetTypeValue; }
+ cmStateEnums::TargetType GetType() const { return this->TargetTypeValue; }
+
+ cmGlobalGenerator* GetGlobalGenerator() const;
///! Set/Get the name of the target
const std::string& GetName() const { return this->Name; }
@@ -142,8 +138,8 @@ public:
*/
void ClearDependencyInformation(cmMakefile& mf, const std::string& target);
- void AddLinkLibrary(cmMakefile& mf, const std::string& target,
- const std::string& lib, cmTargetLinkLibraryType llt);
+ void AddLinkLibrary(cmMakefile& mf, const std::string& lib,
+ cmTargetLinkLibraryType llt);
enum TLLSignature
{
KeywordTLLSignature,
@@ -153,9 +149,6 @@ public:
cmListFileContext const& lfc);
void GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const;
- void MergeLinkLibraries(cmMakefile& mf, const std::string& selfname,
- const LinkLibraryVectorType& libs);
-
const std::vector<std::string>& GetLinkDirectories() const;
void AddLinkDirectory(const std::string& d);
@@ -200,9 +193,11 @@ public:
void AppendProperty(const std::string& prop, const char* value,
bool asString = false);
const char* GetProperty(const std::string& prop) const;
- const char* GetProperty(const std::string& prop, cmMakefile* context) const;
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
+ const char* GetComputedProperty(const std::string& prop,
+ cmMessenger* messenger,
+ cmListFileBacktrace const& context) const;
bool IsImported() const { return this->IsImportedTarget; }
bool IsImportedGloballyVisible() const
@@ -211,7 +206,7 @@ public:
}
// Get the properties
- cmPropertyMap& GetProperties() const { return this->Properties; }
+ cmPropertyMap const& GetProperties() const { return this->Properties; }
bool GetMappedConfig(std::string const& desired_config, const char** loc,
const char** imp, std::string& suffix) const;
@@ -270,9 +265,10 @@ public:
bool operator()(cmTarget const* t1, cmTarget const* t2) const;
};
-private:
- bool HandleLocationPropertyPolicy(cmMakefile* context) const;
+ std::string ImportedGetFullPath(const std::string& config,
+ bool implib) const;
+private:
const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const;
@@ -281,11 +277,8 @@ private:
void SetPropertyDefault(const std::string& property,
const char* default_value);
- std::string ImportedGetFullPath(const std::string& config,
- bool implib) const;
-
private:
- mutable cmPropertyMap Properties;
+ cmPropertyMap Properties;
std::set<std::string> SystemIncludeDirectories;
std::set<std::string> LinkDirectoriesEmmitted;
std::set<std::string> Utilities;
@@ -299,11 +292,10 @@ private:
std::vector<cmCustomCommand> PreLinkCommands;
std::vector<cmCustomCommand> PostBuildCommands;
std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
- LinkLibraryVectorType PrevLinkedLibraries;
LinkLibraryVectorType OriginalLinkLibraries;
cmMakefile* Makefile;
cmTargetInternalPointer Internal;
- cmState::TargetType TargetTypeValue;
+ cmStateEnums::TargetType TargetTypeValue;
bool HaveInstallRule;
bool RecordDependencies;
bool DLLPlatform;
@@ -325,15 +317,7 @@ private:
cmListFileBacktrace Backtrace;
};
-#ifdef CMAKE_BUILD_WITH_CMAKE
-#ifdef CMake_HAVE_CXX_UNORDERED_MAP
-typedef std::unordered_map<std::string, cmTarget> cmTargets;
-#else
-typedef cmsys::hash_map<std::string, cmTarget> cmTargets;
-#endif
-#else
-typedef std::map<std::string, cmTarget> cmTargets;
-#endif
+typedef CM_UNORDERED_MAP<std::string, cmTarget> cmTargets;
class cmTargetSet : public std::set<std::string>
{
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 9f08ba7..008d1a2 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -2,7 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileDefinitionsCommand.h"
+#include <sstream>
+
#include "cmAlgorithms.h"
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
bool cmTargetCompileDefinitionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index b49f616..caaf23b 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -3,8 +3,16 @@
#ifndef cmTargetCompileDefinitionsCommand_h
#define cmTargetCompileDefinitionsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmTargetPropCommandBase.h"
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
class cmTargetCompileDefinitionsCommand : public cmTargetPropCommandBase
{
public:
@@ -31,8 +39,6 @@ public:
return "target_compile_definitions";
}
- cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase);
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 7636347..a1c9b82 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -2,7 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileFeaturesCommand.h"
+#include <algorithm>
+#include <sstream>
+
#include "cmAlgorithms.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+class cmTarget;
bool cmTargetCompileFeaturesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 8273e02..01f2938 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -3,8 +3,16 @@
#ifndef cmTargetCompileFeaturesCommand_h
#define cmTargetCompileFeaturesCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmTargetPropCommandBase.h"
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
{
cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileFeaturesCommand; }
@@ -14,8 +22,6 @@ class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
std::string GetName() const CM_OVERRIDE { return "target_compile_features"; }
- cmTypeMacro(cmTargetCompileFeaturesCommand, cmTargetPropCommandBase);
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index eb66dd3..a4db55b 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -2,7 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileOptionsCommand.h"
+#include <algorithm>
+#include <sstream>
+
#include "cmAlgorithms.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
bool cmTargetCompileOptionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index f5b4c70..179013b 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -3,8 +3,16 @@
#ifndef cmTargetCompileOptionsCommand_h
#define cmTargetCompileOptionsCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmTargetPropCommandBase.h"
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
class cmTargetCompileOptionsCommand : public cmTargetPropCommandBase
{
public:
@@ -25,8 +33,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "target_compile_options"; }
- cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase);
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 37b9598..65a3149 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -2,7 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetIncludeDirectoriesCommand.h"
+#include <set>
+#include <sstream>
+
#include "cmGeneratorExpression.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
bool cmTargetIncludeDirectoriesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 671627a..bc6cf0d 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -3,8 +3,16 @@
#ifndef cmTargetIncludeDirectoriesCommand_h
#define cmTargetIncludeDirectoriesCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmTargetPropCommandBase.h"
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
class cmTargetIncludeDirectoriesCommand : public cmTargetPropCommandBase
{
public:
@@ -31,8 +39,6 @@ public:
return "target_include_directories";
}
- cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase);
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index e714309..9626992 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -3,6 +3,9 @@
#include "cmTargetLinkLibrariesCommand.h"
#include "cmGeneratorExpression.h"
+#include "cmGlobalGenerator.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
const char* cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[3] = {
"general", "debug", "optimized"
@@ -71,7 +74,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
return true;
}
- if (this->Target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Object library target \"" << args[0] << "\" "
<< "may not link to anything.";
@@ -80,7 +83,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
return true;
}
- if (this->Target->GetType() == cmState::UTILITY) {
+ if (this->Target->GetType() == cmStateEnums::UTILITY) {
std::ostringstream e;
const char* modal = CM_NULLPTR;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
@@ -278,7 +281,7 @@ void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left,
bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
cmTargetLinkLibraryType llt)
{
- if (this->Target->GetType() == cmState::INTERFACE_LIBRARY &&
+ if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
@@ -338,7 +341,35 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// Handle normal case first.
if (this->CurrentProcessingState != ProcessingKeywordLinkInterface &&
this->CurrentProcessingState != ProcessingPlainLinkInterface) {
- this->Makefile->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
+
+ cmTarget* t =
+ this->Makefile->FindLocalNonAliasTarget(this->Target->GetName());
+ if (!t) {
+ std::ostringstream e;
+ e << "Attempt to add link library \"" << lib << "\" to target \""
+ << this->Target->GetName()
+ << "\" which is not built in this directory.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ } else {
+
+ cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib);
+
+ if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
+ (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
+ (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
+ !tgt->IsExecutableWithExports()) {
+ std::ostringstream e;
+ e << "Target \"" << lib << "\" of type "
+ << cmState::GetTargetTypeName(tgt->GetType())
+ << " may not be linked into another target. "
+ << "One may link only to STATIC or SHARED libraries, or "
+ << "to executables with the ENABLE_EXPORTS property set.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+
+ this->Target->AddLinkLibrary(*this->Makefile, lib, llt);
+ }
+
if (this->CurrentProcessingState == ProcessingLinkLibraries) {
this->Target->AppendProperty(
"INTERFACE_LINK_LIBRARIES",
@@ -347,7 +378,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
}
if (this->CurrentProcessingState != ProcessingKeywordPublicInterface &&
this->CurrentProcessingState != ProcessingPlainPublicInterface) {
- if (this->Target->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) {
std::string configLib =
this->Target->GetDebugGeneratorExpressions(lib, llt);
if (cmGeneratorExpression::IsValidTargetName(lib) ||
@@ -375,7 +406,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
return true;
}
- if (this->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return true;
}
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 85888f9..69bb6eb 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -32,8 +32,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "target_link_libraries"; }
- cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
-
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index a00360b..e2e02ad 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -28,12 +28,12 @@ bool cmTargetPropCommandBase::HandleArguments(
this->HandleMissingTarget(args[0]);
return false;
}
- if ((this->Target->GetType() != cmState::SHARED_LIBRARY) &&
- (this->Target->GetType() != cmState::STATIC_LIBRARY) &&
- (this->Target->GetType() != cmState::OBJECT_LIBRARY) &&
- (this->Target->GetType() != cmState::MODULE_LIBRARY) &&
- (this->Target->GetType() != cmState::INTERFACE_LIBRARY) &&
- (this->Target->GetType() != cmState::EXECUTABLE)) {
+ if ((this->Target->GetType() != cmStateEnums::SHARED_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::OBJECT_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::MODULE_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::EXECUTABLE)) {
this->SetError("called with non-compilable target type");
return false;
}
@@ -86,7 +86,7 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
return false;
}
- if (this->Target->GetType() == cmState::INTERFACE_LIBRARY &&
+ if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
scope != "INTERFACE") {
this->SetError("may only be set INTERFACE properties on INTERFACE "
"targets");
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index de0a7d3..485a7f3 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -21,8 +21,6 @@ public:
const std::string& prop,
ArgumentFlags flags = NO_FLAGS);
- cmTypeMacro(cmTargetPropCommandBase, cmCommand);
-
protected:
std::string Property;
cmTarget* Target;
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
new file mode 100644
index 0000000..7cf1fd8
--- /dev/null
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -0,0 +1,90 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmTargetPropertyComputer.h"
+
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmMessenger.h"
+#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
+#include "cmTarget.h"
+#include "cm_unordered_set.hxx"
+
+bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
+ std::string const& tgtName, cmMessenger* messenger,
+ cmListFileBacktrace const& context)
+{
+ std::ostringstream e;
+ const char* modal = CM_NULLPTR;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch (context.GetBottom().GetPolicy(cmPolicies::CMP0026)) {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ modal = "may";
+ messageType = cmake::FATAL_ERROR;
+ }
+
+ if (modal) {
+ e << "The LOCATION property " << modal << " not be read from target \""
+ << tgtName
+ << "\". Use the target name directly with "
+ "add_custom_command, or use the generator expression $<TARGET_FILE>, "
+ "as appropriate.\n";
+ messenger->IssueMessage(messageType, e.str(), context);
+ }
+
+ return messageType != cmake::FATAL_ERROR;
+}
+
+bool cmTargetPropertyComputer::WhiteListedInterfaceProperty(
+ const std::string& prop)
+{
+ if (cmHasLiteralPrefix(prop, "INTERFACE_")) {
+ return true;
+ }
+ static CM_UNORDERED_SET<std::string> builtIns;
+ if (builtIns.empty()) {
+ builtIns.insert("COMPATIBLE_INTERFACE_BOOL");
+ builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
+ builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
+ builtIns.insert("COMPATIBLE_INTERFACE_STRING");
+ builtIns.insert("EXPORT_NAME");
+ builtIns.insert("IMPORTED");
+ builtIns.insert("NAME");
+ builtIns.insert("TYPE");
+ }
+
+ if (builtIns.count(prop)) {
+ return true;
+ }
+
+ if (cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_")) {
+ return true;
+ }
+
+ return false;
+}
+
+bool cmTargetPropertyComputer::PassesWhitelist(
+ cmStateEnums::TargetType tgtType, std::string const& prop,
+ cmMessenger* messenger, cmListFileBacktrace const& context)
+{
+ if (tgtType == cmStateEnums::INTERFACE_LIBRARY &&
+ !WhiteListedInterfaceProperty(prop)) {
+ std::ostringstream e;
+ e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
+ "The property \""
+ << prop << "\" is not allowed.";
+ messenger->IssueMessage(cmake::FATAL_ERROR, e.str(), context);
+ return false;
+ }
+ return true;
+}
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
new file mode 100644
index 0000000..7989589
--- /dev/null
+++ b/Source/cmTargetPropertyComputer.h
@@ -0,0 +1,111 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmTargetPropertyComputer_h
+#define cmTargetPropertyComputer_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include "cmAlgorithms.h"
+#include "cmListFileCache.h"
+#include "cmSystemTools.h"
+
+#include <map>
+#include <string>
+
+class cmTarget;
+class cmMessenger;
+
+class cmTargetPropertyComputer
+{
+public:
+ template <typename Target>
+ static const char* GetProperty(Target const* tgt, const std::string& prop,
+ cmMessenger* messenger,
+ cmListFileBacktrace const& context)
+ {
+ if (const char* loc = GetLocation(tgt, prop, messenger, context)) {
+ return loc;
+ }
+ if (cmSystemTools::GetFatalErrorOccured()) {
+ return CM_NULLPTR;
+ }
+ if (prop == "SOURCES") {
+ return GetSources(tgt, messenger, context);
+ }
+ return CM_NULLPTR;
+ }
+
+ static bool WhiteListedInterfaceProperty(const std::string& prop);
+
+ static bool PassesWhitelist(cmStateEnums::TargetType tgtType,
+ std::string const& prop, cmMessenger* messenger,
+ cmListFileBacktrace const& context);
+
+private:
+ static bool HandleLocationPropertyPolicy(std::string const& tgtName,
+ cmMessenger* messenger,
+ cmListFileBacktrace const& context);
+
+ template <typename Target>
+ static const char* ComputeLocationForBuild(Target const* tgt);
+ template <typename Target>
+ static const char* ComputeLocation(Target const* tgt,
+ std::string const& config);
+
+ template <typename Target>
+ static const char* GetLocation(Target const* tgt, std::string const& prop,
+ cmMessenger* messenger,
+ cmListFileBacktrace const& context)
+
+ {
+ // Watch for special "computed" properties that are dependent on
+ // other properties or variables. Always recompute them.
+ if (tgt->GetType() == cmStateEnums::EXECUTABLE ||
+ tgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ tgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ tgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ tgt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
+ static const std::string propLOCATION = "LOCATION";
+ if (prop == propLOCATION) {
+ if (!tgt->IsImported() &&
+ !HandleLocationPropertyPolicy(tgt->GetName(), messenger,
+ context)) {
+ return CM_NULLPTR;
+ }
+ return ComputeLocationForBuild(tgt);
+ }
+
+ // Support "LOCATION_<CONFIG>".
+ if (cmHasLiteralPrefix(prop, "LOCATION_")) {
+ if (!tgt->IsImported() &&
+ !HandleLocationPropertyPolicy(tgt->GetName(), messenger,
+ context)) {
+ return CM_NULLPTR;
+ }
+ const char* configName = prop.c_str() + 9;
+ return ComputeLocation(tgt, configName);
+ }
+
+ // Support "<CONFIG>_LOCATION".
+ if (cmHasLiteralSuffix(prop, "_LOCATION") &&
+ !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
+ std::string configName(prop.c_str(), prop.size() - 9);
+ if (configName != "IMPORTED") {
+ if (!tgt->IsImported() &&
+ !HandleLocationPropertyPolicy(tgt->GetName(), messenger,
+ context)) {
+ return CM_NULLPTR;
+ }
+ return ComputeLocation(tgt, configName);
+ }
+ }
+ }
+ return CM_NULLPTR;
+ }
+
+ template <typename Target>
+ static const char* GetSources(Target const* tgt, cmMessenger* messenger,
+ cmListFileBacktrace const& context);
+};
+
+#endif
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 2170247..13c9a8f 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -2,7 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetSourcesCommand.h"
-#include "cmGeneratorExpression.h"
+#include <algorithm>
+#include <sstream>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 8f88b25..b1afac2 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -3,8 +3,16 @@
#ifndef cmTargetSourcesCommand_h
#define cmTargetSourcesCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmTargetPropCommandBase.h"
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
class cmTargetSourcesCommand : public cmTargetPropCommandBase
{
public:
@@ -25,8 +33,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "target_sources"; }
- cmTypeMacro(cmTargetSourcesCommand, cmTargetPropCommandBase);
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 4d0cbaa..1c36dc6 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -5,6 +5,7 @@
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
cmTest::cmTest(cmMakefile* mf)
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 3ea59cb..843f7b1 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmPropertyMap.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTest.h"
#include "cm_auto_ptr.hxx"
@@ -77,7 +77,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// be translated.
std::string exe = command[0];
cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(exe);
- if (target && target->GetType() == cmState::EXECUTABLE) {
+ if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
// Use the target file on disk.
exe = target->GetFullPath(config);
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index 6a8c9c6..9597e09 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTimestamp.h"
+#include "cmSystemTools.h"
+
#include <cstdlib>
#include <cstring>
#include <sstream>
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 45d92df..ed74ae1 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -29,8 +29,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "try_compile"; }
-
- cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
};
#endif
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 5c9e41a..6787c8e 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -2,7 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTryRunCommand.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmTryCompileCommand.h"
+
#include <cmsys/FStream.hxx>
// cmTryRunCommand
@@ -189,7 +192,8 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
strcpy(retChar, "FAILED_TO_RUN");
}
this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar,
- "Result of TRY_RUN", cmState::INTERNAL);
+ "Result of TRY_RUN",
+ cmStateEnums::INTERNAL);
}
/* This is only used when cross compiling. Instead of running the
@@ -231,7 +235,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment += detailsString;
this->Makefile->AddCacheDefinition(this->RunResultVariable,
"PLEASE_FILL_OUT-FAILED_TO_RUN",
- comment.c_str(), cmState::STRING);
+ comment.c_str(), cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
const char* existingValue =
@@ -254,9 +258,9 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"would have printed on stdout and stderr on its target platform.\n";
comment += detailsString;
- this->Makefile->AddCacheDefinition(internalRunOutputName,
- "PLEASE_FILL_OUT-NOTFOUND",
- comment.c_str(), cmState::STRING);
+ this->Makefile->AddCacheDefinition(
+ internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(),
+ cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
const char* existing = state->GetCacheEntryValue(internalRunOutputName);
if (existing) {
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index b569b0b..24447ed 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -30,8 +30,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "try_run"; }
- cmTypeMacro(cmTryRunCommand, cmCoreTryCompile);
-
private:
void RunExecutable(const std::string& runArgs,
std::string* runOutputContents);
diff --git a/Source/cmTypeMacro.h b/Source/cmTypeMacro.h
deleted file mode 100644
index b302ff1..0000000
--- a/Source/cmTypeMacro.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#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 746c435..2fea6192 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUnsetCommand.h"
+#include "cmSystemTools.h"
+
// cmUnsetCommand
bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index b3f045a..37b9270 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -34,8 +34,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "unset"; }
-
- cmTypeMacro(cmUnsetCommand, cmCommand);
};
#endif
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index e2b6b1a..ffeaa51 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -2,11 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUseMangledMesaCommand.h"
-#include "cmSystemTools.h"
-
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index a5fa146..9a49f94 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -3,12 +3,17 @@
#ifndef cmUseMangledMesaCommand_h
#define cmUseMangledMesaCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmUseMangledMesaCommand : public cmCommand
{
public:
- cmTypeMacro(cmUseMangledMesaCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 08ea21e..f98d512 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -2,6 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUtilitySourceCommand.h"
+#include <string.h>
+
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmUtilitySourceCommand
bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -98,13 +108,13 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
// Enter the value into the cache.
this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(),
"Path to an internal program.",
- cmState::FILEPATH);
+ cmStateEnums::FILEPATH);
// add a value into the cache that maps from the
// full path to the name of the project
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(),
"Executable to project name.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
return true;
}
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index 6ee5f3e..849b966 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -3,12 +3,17 @@
#ifndef cmUtilitySourceCommand_h
#define cmUtilitySourceCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmUtilitySourceCommand : public cmCommand
{
public:
- cmTypeMacro(cmUtilitySourceCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 7599551..1eb1f20 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -2,7 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVariableRequiresCommand.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmState.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
// cmLibraryCommand
bool cmVariableRequiresCommand::InitialPass(
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index e40151b..baf717c 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -3,12 +3,17 @@
#ifndef cmVariableRequiresCommand_h
#define cmVariableRequiresCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
class cmVariableRequiresCommand : public cmCommand
{
public:
- cmTypeMacro(cmVariableRequiresCommand, cmCommand);
cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 5c1e00a..90b0b28 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -2,7 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVariableWatchCommand.h"
+#include <sstream>
+
+#include "cmExecutionStatus.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
#include "cmVariableWatch.h"
+#include "cmake.h"
struct cmVariableWatchCallbackData
{
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index b1862f0..919bac4 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -3,8 +3,15 @@
#ifndef cmVariableWatchCommand_h
#define cmVariableWatchCommand_h
+#include <cmConfigure.h>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmVariableWatchCommand
* \brief Watch when the variable changes and invoke command
*
@@ -44,8 +51,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "variable_watch"; }
- cmTypeMacro(cmVariableWatchCommand, cmCommand);
-
protected:
std::set<std::string> WatchedVariables;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 82f4b99..9c857f2 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -255,7 +255,7 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
void cmVisualStudio10TargetGenerator::Generate()
{
// do not generate external ms projects
- if (this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY ||
+ if (this->GeneratorTarget->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) {
return;
}
@@ -264,7 +264,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->Name.c_str());
this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
- if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
if (!this->ComputeClOptions()) {
return;
}
@@ -329,13 +329,22 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("</PropertyGroup>\n", 1);
}
+ if (const char* hostArch =
+ this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<PreferredToolArchitecture>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(hostArch)
+ << "</PreferredToolArchitecture>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+
this->WriteProjectConfigurations();
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
if (this->MSTools &&
- this->GeneratorTarget->GetType() <= cmState::GLOBAL_TARGET) {
+ this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) {
this->WriteApplicationTypeSettings();
this->VerifyNecessaryFiles();
}
@@ -646,15 +655,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += cmVS10EscapeXML(vsConfigurationType);
} else {
switch (this->GeneratorTarget->GetType()) {
- case cmState::SHARED_LIBRARY:
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
configType += "DynamicLibrary";
break;
- case cmState::OBJECT_LIBRARY:
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
configType += "StaticLibrary";
break;
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if (this->NsightTegra &&
!this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
// Android executables are .so too.
@@ -663,8 +672,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "Application";
}
break;
- case cmState::UTILITY:
- case cmState::GLOBAL_TARGET:
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::GLOBAL_TARGET:
if (this->NsightTegra) {
// Tegra-Android platform does not understand "Utility".
configType += "StaticLibrary";
@@ -672,8 +681,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "Utility";
}
break;
- case cmState::UNKNOWN_LIBRARY:
- case cmState::INTERFACE_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
break;
}
}
@@ -701,7 +710,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
std::string useOfMfcValue = "false";
- if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
if (mfcFlagValue == "1") {
useOfMfcValue = "Static";
} else if (mfcFlagValue == "2") {
@@ -712,14 +721,15 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
this->WriteString(mfcLine.c_str(), 2);
- if ((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY &&
+ if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY &&
this->ClOptions[config]->UsingUnicode()) ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
- } else if (this->GeneratorTarget->GetType() <= cmState::MODULE_LIBRARY &&
+ } else if (this->GeneratorTarget->GetType() <=
+ cmStateEnums::MODULE_LIBRARY &&
this->ClOptions[config]->UsingSBCS()) {
this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
} else {
@@ -1342,7 +1352,7 @@ void cmVisualStudio10TargetGenerator::WriteSources(
void cmVisualStudio10TargetGenerator::WriteAllSources()
{
- if (this->GeneratorTarget->GetType() > cmState::UTILITY) {
+ if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) {
return;
}
this->WriteString("<ItemGroup>\n", 1);
@@ -1564,8 +1574,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
{
- cmState::TargetType ttype = this->GeneratorTarget->GetType();
- if (ttype > cmState::GLOBAL_TARGET) {
+ cmStateEnums::TargetType ttype = this->GeneratorTarget->GetType();
+ if (ttype > cmStateEnums::GLOBAL_TARGET) {
return;
}
@@ -1576,7 +1586,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
for (std::vector<std::string>::const_iterator config =
this->Configurations.begin();
config != this->Configurations.end(); ++config) {
- if (ttype >= cmState::UTILITY) {
+ if (ttype >= cmStateEnums::UTILITY) {
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
*this->BuildFileStream
<< "$(Platform)\\$(Configuration)\\$(ProjectName)\\"
@@ -1589,7 +1599,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
intermediateDir += "/";
std::string outDir;
std::string targetNameFull;
- if (ttype == cmState::OBJECT_LIBRARY) {
+ if (ttype == cmStateEnums::OBJECT_LIBRARY) {
outDir = intermediateDir;
targetNameFull = this->GeneratorTarget->GetName();
targetNameFull += ".lib";
@@ -1636,8 +1646,8 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
}
// static libraries and things greater than modules do not need
// to set this option
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
return;
}
Options& linkOptions = *(this->LinkOptions[configName]);
@@ -1758,8 +1768,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) {
clOptions.AddFlag("CompileAsWinRT", "true");
// For WinRT components, add the _WINRT_DLL define to produce a lib
- if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
clOptions.AddDefine("_WINRT_DLL");
}
} else if (this->GlobalGenerator->TargetsWindowsStore() ||
@@ -1949,8 +1959,8 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions(
void cmVisualStudio10TargetGenerator::WriteLibOptions(
std::string const& config)
{
- if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY &&
- this->GeneratorTarget->GetType() != cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) {
return;
}
std::string libflags;
@@ -1983,9 +1993,9 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
void cmVisualStudio10TargetGenerator::WriteManifestOptions(
std::string const& config)
{
- if (this->GeneratorTarget->GetType() != cmState::EXECUTABLE &&
- this->GeneratorTarget->GetType() != cmState::SHARED_LIBRARY &&
- this->GeneratorTarget->GetType() != cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE &&
+ this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY) {
return;
}
@@ -2136,9 +2146,9 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
{
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE ||
- this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
+ this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
for (std::vector<std::string>::const_iterator i =
this->Configurations.begin();
i != this->Configurations.end(); ++i) {
@@ -2169,10 +2179,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string CONFIG = cmSystemTools::UpperCase(config);
const char* linkType = "SHARED";
- if (this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
linkType = "MODULE";
}
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
linkType = "EXE";
}
std::string flags;
@@ -2249,7 +2259,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string targetNameFull;
std::string targetNameImport;
std::string targetNamePDB;
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB,
config.c_str());
@@ -2265,7 +2275,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) {
if (this->GlobalGenerator->TargetsWindowsCE()) {
linkOptions.AddFlag("SubSystem", "WindowsCE");
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (this->ClOptions[config]->UsingUnicode()) {
linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup");
} else {
@@ -2278,7 +2288,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
} else {
if (this->GlobalGenerator->TargetsWindowsCE()) {
linkOptions.AddFlag("SubSystem", "WindowsCE");
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (this->ClOptions[config]->UsingUnicode()) {
linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup");
} else {
@@ -2316,7 +2326,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
// A Windows Runtime component uses internal .NET metadata,
// so does not have an import library.
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
- this->GeneratorTarget->GetType() != cmState::EXECUTABLE) {
+ this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) {
linkOptions.AddFlag("GenerateWindowsMetadata", "true");
} else if (this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore()) {
@@ -2347,7 +2357,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
"%(IgnoreSpecificDefaultLibraries)");
}
- if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
+ if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (this->GeneratorTarget->GetPropertyAsBool(
@@ -2389,8 +2399,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
void cmVisualStudio10TargetGenerator::WriteLinkOptions(
std::string const& config)
{
- if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
return;
}
Options& linkOptions = *(this->LinkOptions[config]);
@@ -2423,7 +2433,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||
- l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
+ l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
libVec.push_back(l->Value);
}
}
@@ -2487,7 +2497,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1);
*this->BuildFileStream << "\n";
// output cl compile flags <ClCompile></ClCompile>
- if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
this->WriteClOptions(*i, includes);
// output rc compile flags <ResourceCompile></ResourceCompile>
this->WriteRCOptions(*i, includes);
@@ -2504,7 +2514,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
// output manifest flags <Manifest></Manifest>
this->WriteManifestOptions(*i);
if (this->NsightTegra &&
- this->GeneratorTarget->GetType() == cmState::EXECUTABLE &&
+ this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE &&
this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
this->WriteAntBuildOptions(*i);
}
@@ -2516,7 +2526,7 @@ void cmVisualStudio10TargetGenerator::WriteEvents(
std::string const& configName)
{
bool addedPrelink = false;
- if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
+ if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->IsExecutableWithExports()) &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
if (this->GeneratorTarget->GetPropertyAsBool(
@@ -2583,7 +2593,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for (OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i) {
cmGeneratorTarget const* dt = *i;
- if (dt->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (dt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
// skip fortran targets as they can not be processed by MSBuild
@@ -2719,7 +2729,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
{
if ((this->GlobalGenerator->TargetsWindowsStore() ||
this->GlobalGenerator->TargetsWindowsPhone()) &&
- (cmState::EXECUTABLE == this->GeneratorTarget->GetType())) {
+ (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType())) {
std::string pfxFile;
std::vector<cmSourceFile const*> certificates;
this->GeneratorTarget->GetCertificates(certificates, "");
@@ -2844,7 +2854,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
"</MinimumVisualStudioVersion>\n",
2);
- if (this->GeneratorTarget->GetType() < cmState::UTILITY) {
+ if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
isAppContainer = true;
}
} else if (v == "8.1") {
@@ -2856,7 +2866,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
"</MinimumVisualStudioVersion>\n",
2);
- if (this->GeneratorTarget->GetType() < cmState::UTILITY) {
+ if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
isAppContainer = true;
}
} else if (v == "8.0") {
@@ -2869,10 +2879,11 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
2);
if (isWindowsStore &&
- this->GeneratorTarget->GetType() < cmState::UTILITY) {
+ this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
isAppContainer = true;
} else if (isWindowsPhone &&
- this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ this->GeneratorTarget->GetType() ==
+ cmStateEnums::EXECUTABLE) {
this->WriteString("<XapOutputs>true</XapOutputs>\n", 2);
this->WriteString("<XapFilename>", 2);
(*this->BuildFileStream)
@@ -2922,7 +2933,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
{
// For Windows and Windows Phone executables, we will assume that if a
// manifest is not present that we need to add all the necessary files
- if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
std::vector<cmSourceFile const*> manifestSources;
this->GeneratorTarget->GetAppManifest(manifestSources, "");
{
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 9badda6..4be183d 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -137,6 +137,11 @@ bool cmVisualStudioGeneratorOptions::IsWinRt() const
return this->FlagMap.find("CompileAsWinRT") != this->FlagMap.end();
}
+bool cmVisualStudioGeneratorOptions::IsManaged() const
+{
+ return this->FlagMap.find("CompileAsManaged") != this->FlagMap.end();
+}
+
bool cmVisualStudioGeneratorOptions::UsingUnicode() const
{
// Look for the a _UNICODE definition.
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 4eeae3d..0a0b96d 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -49,6 +49,7 @@ public:
bool IsDebug() const;
bool IsWinRt() const;
+ bool IsManaged() const;
// Write options to output.
void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix,
const char* suffix,
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index c52ea40..beb59bf 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -3,6 +3,7 @@
#include "cmWhileCommand.h"
#include "cmConditionEvaluator.h"
+#include "cmSystemTools.h"
cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
: Makefile(mf)
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 9c70ca2..cc114ec 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -60,8 +60,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "while"; }
-
- cmTypeMacro(cmWhileCommand, cmCommand);
};
#endif
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 0bdef0f..b3ac31c 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -8,6 +8,11 @@
// include sys/stat.h after sys/types.h
#include <sys/stat.h>
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
+
// cmLibraryCommand
bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index dbadf84..73e6e22 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -3,8 +3,14 @@
#ifndef cmWriteFileCommand_h
#define cmWriteFileCommand_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmWriteFileCommand
* \brief Writes a message to a file
*
@@ -33,8 +39,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "write_file"; }
-
- cmTypeMacro(cmWriteFileCommand, cmCommand);
};
#endif
diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx
new file mode 100644
index 0000000..869dd32
--- /dev/null
+++ b/Source/cm_codecvt.cxx
@@ -0,0 +1,215 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cm_codecvt.hxx"
+#include <limits>
+
+#if defined(_WIN32)
+#include <windows.h>
+#undef max
+#include <cmsys/Encoding.hxx>
+#endif
+
+codecvt::codecvt(Encoding e)
+ : m_lastState(0)
+#if defined(_WIN32)
+ , m_codepage(0)
+#endif
+{
+ switch (e) {
+ case codecvt::ANSI:
+#if defined(_WIN32)
+ m_noconv = false;
+ m_codepage = CP_ACP;
+ break;
+#endif
+ // We don't know which ANSI encoding to use for other platforms than
+ // Windows so we don't do any conversion there
+ case codecvt::UTF8:
+ // Assume internal encoding is UTF-8
+ case codecvt::None:
+ // No encoding
+ default:
+ m_noconv = true;
+ }
+}
+
+codecvt::~codecvt(){};
+
+bool codecvt::do_always_noconv() const throw()
+{
+ return m_noconv;
+};
+
+std::codecvt_base::result codecvt::do_out(mbstate_t& state, const char* from,
+ const char* from_end,
+ const char*& from_next, char* to,
+ char* to_end, char*& to_next) const
+{
+ if (m_noconv) {
+ return noconv;
+ }
+ std::codecvt_base::result res = error;
+#if defined(_WIN32)
+ from_next = from;
+ to_next = to;
+ bool convert = true;
+ size_t count = from_end - from;
+ const char* data = from;
+ unsigned int& stateId = reinterpret_cast<unsigned int&>(state);
+ if (count == 0) {
+ return codecvt::ok;
+ } else if (count == 1) {
+ if (stateId == 0) {
+ // decode first byte for UTF-8
+ if ((*from & 0xF8) == 0xF0 || // 1111 0xxx; 4 bytes for codepoint
+ (*from & 0xF0) == 0xE0 || // 1110 xxxx; 3 bytes for codepoint
+ (*from & 0xE0) == 0xC0) // 110x xxxx; 2 bytes for codepoint
+ {
+ stateId = findStateId();
+ codecvt::State& s = m_states.at(stateId - 1);
+ s.bytes[0] = *from;
+ convert = false;
+ if ((*from & 0xF8) == 0xF0) {
+ s.totalBytes = 4;
+ } else if ((*from & 0xF0) == 0xE0) {
+ s.totalBytes = 3;
+ } else if ((*from & 0xE0) == 0xC0) {
+ s.totalBytes = 2;
+ }
+ s.bytesLeft = s.totalBytes - 1;
+ };
+ // else 1 byte for codepoint
+ } else {
+ codecvt::State& s = m_states.at(stateId - 1);
+ s.bytes[s.totalBytes - s.bytesLeft] = *from;
+ s.bytesLeft--;
+ data = s.bytes;
+ count = s.totalBytes - s.bytesLeft;
+ if ((*from & 0xC0) == 0x80) { // 10xx xxxx
+ convert = s.bytesLeft == 0;
+ } else {
+ // invalid multi-byte
+ convert = true;
+ }
+ if (convert) {
+ s.used = false;
+ if (stateId == m_lastState) {
+ m_lastState--;
+ }
+ stateId = 0;
+ }
+ }
+ if (convert) {
+ std::wstring wide = cmsys::Encoding::ToWide(std::string(data, count));
+ int r = WideCharToMultiByte(m_codepage, 0, wide.c_str(),
+ static_cast<int>(wide.size()), to,
+ to_end - to, NULL, NULL);
+ if (r > 0) {
+ from_next = from_end;
+ to_next = to + r;
+ res = ok;
+ }
+ } else {
+ res = partial;
+ from_next = from_end;
+ to_next = to;
+ }
+ }
+#else
+ static_cast<void>(state);
+ static_cast<void>(from);
+ static_cast<void>(from_end);
+ static_cast<void>(from_next);
+ static_cast<void>(to);
+ static_cast<void>(to_end);
+ static_cast<void>(to_next);
+ res = codecvt::noconv;
+#endif
+ return res;
+};
+
+std::codecvt_base::result codecvt::do_unshift(mbstate_t& state, char* to,
+ char* to_end,
+ char*& to_next) const
+{
+ std::codecvt_base::result res = error;
+ to_next = to;
+#if defined(_WIN32)
+ unsigned int& stateId = reinterpret_cast<unsigned int&>(state);
+ if (stateId > 0) {
+ codecvt::State& s = m_states.at(stateId - 1);
+ s.used = false;
+ if (stateId == m_lastState) {
+ m_lastState--;
+ }
+ stateId = 0;
+ std::wstring wide = cmsys::Encoding::ToWide(
+ std::string(s.bytes, s.totalBytes - s.bytesLeft));
+ int r = WideCharToMultiByte(m_codepage, 0, wide.c_str(),
+ static_cast<int>(wide.size()), to, to_end - to,
+ NULL, NULL);
+ if (r > 0) {
+ to_next = to + r;
+ res = ok;
+ }
+ } else {
+ res = ok;
+ }
+#else
+ static_cast<void>(state);
+ static_cast<void>(to_end);
+ res = ok;
+#endif
+ return res;
+};
+
+int codecvt::do_max_length() const throw()
+{
+ return 4;
+};
+
+int codecvt::do_encoding() const throw()
+{
+ return 0;
+};
+
+unsigned int codecvt::findStateId() const
+{
+ unsigned int stateId = 0;
+ bool add = false;
+ const unsigned int maxSize = std::numeric_limits<unsigned int>::max();
+ if (m_lastState >= maxSize) {
+ m_lastState = 0;
+ }
+ if (m_states.size() <= m_lastState) {
+ add = true;
+ } else {
+ unsigned int i = m_lastState;
+ while (i < maxSize) {
+ codecvt::State& s = m_states.at(i);
+ i++;
+ if (!s.used) {
+ m_lastState = i;
+ stateId = m_lastState;
+ s.used = true;
+ s.totalBytes = 0;
+ s.bytesLeft = 0;
+ break;
+ }
+ if (i >= m_states.size()) {
+ i = 0;
+ }
+ if (i == m_lastState) {
+ add = true;
+ break;
+ }
+ }
+ };
+ if (add) {
+ codecvt::State s = { true, 0, 0, { 0, 0, 0, 0 } };
+ m_states.push_back(s);
+ m_lastState = (unsigned int)m_states.size();
+ stateId = m_lastState;
+ }
+ return stateId;
+};
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
new file mode 100644
index 0000000..5f16bd8
--- /dev/null
+++ b/Source/cm_codecvt.hxx
@@ -0,0 +1,57 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cm_codecvt_hxx
+#define cm_codecvt_hxx
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <locale>
+#include <vector>
+
+class codecvt : public std::codecvt<char, char, mbstate_t>
+{
+public:
+ enum Encoding
+ {
+ None,
+ UTF8,
+ ANSI
+ };
+
+#ifdef CMAKE_BUILD_WITH_CMAKE
+
+ codecvt(Encoding e);
+
+protected:
+ ~codecvt() CM_OVERRIDE;
+ bool do_always_noconv() const throw() CM_OVERRIDE;
+ result do_out(mbstate_t& state, const char* from, const char* from_end,
+ const char*& from_next, char* to, char* to_end,
+ char*& to_next) const CM_OVERRIDE;
+ result do_unshift(mbstate_t& state, char* to, char*,
+ char*& to_next) const CM_OVERRIDE;
+ int do_max_length() const throw() CM_OVERRIDE;
+ int do_encoding() const throw() CM_OVERRIDE;
+
+private:
+ typedef struct
+ {
+ bool used;
+ unsigned char totalBytes;
+ unsigned char bytesLeft;
+ char bytes[4];
+ } State;
+
+ unsigned int findStateId() const;
+
+ bool m_noconv;
+ mutable std::vector<State> m_states;
+ mutable unsigned int m_lastState;
+#if defined(_WIN32)
+ unsigned int m_codepage;
+#endif
+
+#endif
+};
+
+#endif
diff --git a/Source/cm_unordered_map.hxx b/Source/cm_unordered_map.hxx
new file mode 100644
index 0000000..dc8ca35
--- /dev/null
+++ b/Source/cm_unordered_map.hxx
@@ -0,0 +1,25 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef CM_UNORDERED_MAP_HXX
+#define CM_UNORDERED_MAP_HXX
+
+#include <cmConfigure.h>
+
+#if defined(CMake_HAVE_CXX_UNORDERED_MAP)
+
+#include <unordered_map>
+#define CM_UNORDERED_MAP std::unordered_map
+
+#elif defined(CMAKE_BUILD_WITH_CMAKE)
+
+#include <cmsys/hash_map.hxx>
+#define CM_UNORDERED_MAP cmsys::hash_map
+
+#else
+
+#include <map>
+#define CM_UNORDERED_MAP std::map
+
+#endif
+
+#endif
diff --git a/Source/cm_unordered_set.hxx b/Source/cm_unordered_set.hxx
new file mode 100644
index 0000000..ce58dbf
--- /dev/null
+++ b/Source/cm_unordered_set.hxx
@@ -0,0 +1,25 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef CM_UNORDERED_SET_HXX
+#define CM_UNORDERED_SET_HXX
+
+#include <cmConfigure.h>
+
+#if defined(CMake_HAVE_CXX_UNORDERED_SET)
+
+#include <unordered_set>
+#define CM_UNORDERED_SET std::unordered_set
+
+#elif defined(CMAKE_BUILD_WITH_CMAKE)
+
+#include <cmsys/hash_set.hxx>
+#define CM_UNORDERED_SET cmsys::hash_set
+
+#else
+
+#include <set>
+#define CM_UNORDERED_SET std::set
+
+#endif
+
+#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c8cf465..eb76ca0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -12,6 +12,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalGeneratorFactory.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessenger.h"
@@ -26,6 +27,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmGraphVizWriter.h"
#include "cmVariableWatch.h"
+#include "cm_unordered_map.hxx"
#include <cm_jsoncpp_writer.h>
#endif
@@ -121,11 +123,7 @@ class cmCommand;
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
+typedef CM_UNORDERED_MAP<std::string, Json::Value> JsonValueMapType;
#endif
} // namespace
@@ -314,7 +312,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
std::string var, value;
- cmState::CacheEntryType type = cmState::UNINITIALIZED;
+ cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
if (cmState::ParseCacheEntry(entry, var, value, type)) {
// The value is transformed if it is a filepath for example, so
// we can't compare whether the value is already in the cache until
@@ -409,8 +407,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) {
- cmState::CacheEntryType t = this->State->GetCacheEntryType(*it);
- if (t != cmState::STATIC) {
+ cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(*it);
+ if (t != cmStateEnums::STATIC) {
if (regex.find(it->c_str())) {
entriesToDelete.push_back(*it);
}
@@ -480,7 +478,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- cmState::Snapshot snapshot = this->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource(
@@ -516,7 +514,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmGlobalGenerator* gg = new cmGlobalGenerator(this);
this->SetGlobalGenerator(gg);
- cmState::Snapshot snapshot = this->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource(
@@ -568,7 +566,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmSystemTools::ExpandListArgument(libs, libList);
for (std::vector<std::string>::const_iterator libIt = libList.begin();
libIt != libList.end(); ++libIt) {
- mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType);
+ tgt->AddLinkLibrary(*mf, *libIt, GENERAL_LibraryType);
}
std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -582,8 +580,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
gg->CreateGenerationObjects();
cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
- lg->GetTargetFlags(buildType, linkLibs, flags, linkFlags, frameworkPath,
- linkPath, gtgt, false);
+ cmLinkLineComputer linkLineComputer(lg,
+ lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(&linkLineComputer, buildType, linkLibs, flags,
+ linkFlags, frameworkPath, linkPath, gtgt);
linkLibs = frameworkPath + linkPath + linkLibs;
printf("%s\n", linkLibs.c_str());
@@ -856,14 +856,14 @@ int cmake::AddCMakePaths()
// Save the value in the cache
this->AddCacheEntry("CMAKE_COMMAND",
cmSystemTools::GetCMakeCommand().c_str(),
- "Path to CMake executable.", cmState::INTERNAL);
+ "Path to CMake executable.", cmStateEnums::INTERNAL);
#ifdef CMAKE_BUILD_WITH_CMAKE
- this->AddCacheEntry("CMAKE_CTEST_COMMAND",
- cmSystemTools::GetCTestCommand().c_str(),
- "Path to ctest program executable.", cmState::INTERNAL);
- this->AddCacheEntry("CMAKE_CPACK_COMMAND",
- cmSystemTools::GetCPackCommand().c_str(),
- "Path to cpack program executable.", cmState::INTERNAL);
+ this->AddCacheEntry(
+ "CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
+ "Path to ctest program executable.", cmStateEnums::INTERNAL);
+ this->AddCacheEntry(
+ "CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
+ "Path to cpack program executable.", cmStateEnums::INTERNAL);
#endif
if (!cmSystemTools::FileExists(
(cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake").c_str())) {
@@ -876,7 +876,7 @@ int cmake::AddCMakePaths()
return 0;
}
this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
- "Path to CMake installation.", cmState::INTERNAL);
+ "Path to CMake installation.", cmStateEnums::INTERNAL);
return 1;
}
@@ -1144,7 +1144,7 @@ struct SaveCacheEntry
std::string key;
std::string value;
std::string help;
- cmState::CacheEntryType type;
+ cmStateEnums::CacheEntryType type;
};
int cmake::HandleDeleteCacheVariables(const std::string& var)
@@ -1288,7 +1288,7 @@ int cmake::ActualConfigure()
"CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(),
"Source directory with the top level CMakeLists.txt file for this "
"project",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
// no generator specified on the command line
@@ -1310,54 +1310,7 @@ int cmake::ActualConfigure()
cmSystemTools::SetForceUnixPaths(
this->GlobalGenerator->GetForceUnixPaths());
} else {
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
- std::string installedCompiler;
- // Try to find the newest VS installed on the computer and
- // use that as a default if -G is not specified
- const std::string vsregBase =
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
- std::vector<std::string> vsVerions;
- vsVerions.push_back("VisualStudio\\");
- vsVerions.push_back("VCExpress\\");
- vsVerions.push_back("WDExpress\\");
- struct VSRegistryEntryName
- {
- const char* MSVersion;
- const char* GeneratorName;
- };
- VSRegistryEntryName version[] = {
- /* clang-format needs this comment to break after the opening brace */
- { "7.1", "Visual Studio 7 .NET 2003" },
- { "8.0", "Visual Studio 8 2005" },
- { "9.0", "Visual Studio 9 2008" },
- { "10.0", "Visual Studio 10 2010" },
- { "11.0", "Visual Studio 11 2012" },
- { "12.0", "Visual Studio 12 2013" },
- { "14.0", "Visual Studio 14 2015" },
- { "15.0", "Visual Studio 15" },
- { 0, 0 }
- };
- for (int i = 0; version[i].MSVersion != 0; i++) {
- for (size_t b = 0; b < vsVerions.size(); b++) {
- std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
- reg += ";InstallDir]";
- cmSystemTools::ExpandRegistryValues(reg, cmSystemTools::KeyWOW64_32);
- if (!(reg == "/registry")) {
- installedCompiler = version[i].GeneratorName;
- break;
- }
- }
- }
- cmGlobalGenerator* gen =
- this->CreateGlobalGenerator(installedCompiler.c_str());
- if (!gen) {
- gen = new cmGlobalNMakeMakefileGenerator(this);
- }
- this->SetGlobalGenerator(gen);
- std::cout << "-- Building for: " << gen->GetName() << "\n";
-#else
- this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
-#endif
+ this->CreateDefaultGlobalGenerator();
}
if (!this->GlobalGenerator) {
cmSystemTools::Error("Could not create generator");
@@ -1382,11 +1335,11 @@ int cmake::ActualConfigure()
if (!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) {
this->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName().c_str(),
- "Name of generator.", cmState::INTERNAL);
+ "Name of generator.", cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName().c_str(),
"Name of external makefile project generator.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
if (const char* platformName =
@@ -1406,7 +1359,7 @@ int cmake::ActualConfigure()
} else {
this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
this->GeneratorPlatform.c_str(),
- "Name of generator platform.", cmState::INTERNAL);
+ "Name of generator platform.", cmStateEnums::INTERNAL);
}
if (const char* tsName =
@@ -1426,7 +1379,7 @@ int cmake::ActualConfigure()
} else {
this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
this->GeneratorToolset.c_str(),
- "Name of generator toolset.", cmState::INTERNAL);
+ "Name of generator toolset.", cmStateEnums::INTERNAL);
}
// reset any system configuration information, except for when we are
@@ -1455,13 +1408,14 @@ int cmake::ActualConfigure()
if (!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) {
this->AddCacheEntry(
"LIBRARY_OUTPUT_PATH", "",
- "Single output directory for building all libraries.", cmState::PATH);
+ "Single output directory for building all libraries.",
+ cmStateEnums::PATH);
}
if (!this->State->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) {
this->AddCacheEntry(
"EXECUTABLE_OUTPUT_PATH", "",
"Single output directory for building all executables.",
- cmState::PATH);
+ cmStateEnums::PATH);
}
}
@@ -1485,6 +1439,63 @@ int cmake::ActualConfigure()
return 0;
}
+void cmake::CreateDefaultGlobalGenerator()
+{
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
+ std::string found;
+ // Try to find the newest VS installed on the computer and
+ // use that as a default if -G is not specified
+ const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+ static const char* const vsVariants[] = {
+ /* clang-format needs this comment to break after the opening brace */
+ "VisualStudio\\", "VCExpress\\", "WDExpress\\"
+ };
+ struct VSVersionedGenerator
+ {
+ const char* MSVersion;
+ const char* GeneratorName;
+ };
+ static VSVersionedGenerator const vsGenerators[] = {
+ { "15.0", "Visual Studio 15" }, //
+ { "14.0", "Visual Studio 14 2015" }, //
+ { "12.0", "Visual Studio 12 2013" }, //
+ { "11.0", "Visual Studio 11 2012" }, //
+ { "10.0", "Visual Studio 10 2010" }, //
+ { "9.0", "Visual Studio 9 2008" }, //
+ { "8.0", "Visual Studio 8 2005" }, //
+ { "7.1", "Visual Studio 7 .NET 2003" }
+ };
+ static const char* const vsEntries[] = {
+ "\\Setup\\VC;ProductDir", //
+ ";InstallDir" //
+ };
+ for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
+ found.empty() && g != cmArrayEnd(vsGenerators); ++g) {
+ for (const char* const* v = cmArrayBegin(vsVariants);
+ found.empty() && v != cmArrayEnd(vsVariants); ++v) {
+ for (const char* const* e = cmArrayBegin(vsEntries);
+ found.empty() && e != cmArrayEnd(vsEntries); ++e) {
+ std::string const reg = vsregBase + *v + g->MSVersion + *e;
+ std::string dir;
+ if (cmSystemTools::ReadRegistryValue(reg, dir,
+ cmSystemTools::KeyWOW64_32) &&
+ cmSystemTools::PathExists(dir)) {
+ found = g->GeneratorName;
+ }
+ }
+ }
+ }
+ cmGlobalGenerator* gen = this->CreateGlobalGenerator(found);
+ if (!gen) {
+ gen = new cmGlobalNMakeMakefileGenerator(this);
+ }
+ this->SetGlobalGenerator(gen);
+ std::cout << "-- Building for: " << gen->GetName() << "\n";
+#else
+ this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
+#endif
+}
+
void cmake::PreLoadCMakeFiles()
{
std::vector<std::string> args;
@@ -1627,7 +1638,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
const char* helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
- cmState::CacheEntryType(type));
+ cmStateEnums::CacheEntryType(type));
this->UnwatchUnusedCli(key);
}
@@ -1638,11 +1649,8 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
void cmake::AddDefaultCommands()
{
- std::vector<cmCommand*> commands;
- GetBootstrapCommands1(commands);
- GetBootstrapCommands2(commands);
- GetPredefinedCommands(commands);
- for (std::vector<cmCommand*>::iterator i = commands.begin();
+ std::vector<cmCommand*> const commands = GetPredefinedCommands();
+ for (std::vector<cmCommand*>::const_iterator i = commands.begin();
i != commands.end(); ++i) {
this->State->AddCommand(*i);
}
@@ -1681,7 +1689,8 @@ void cmake::AddDefaultGenerators()
}
bool cmake::ParseCacheEntry(const std::string& entry, std::string& var,
- std::string& value, cmState::CacheEntryType& type)
+ std::string& value,
+ cmStateEnums::CacheEntryType& type)
{
return cmState::ParseCacheEntry(entry, var, value, type);
}
@@ -2451,7 +2460,7 @@ void cmake::SetSuppressDevWarnings(bool b)
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(),
"Suppress Warnings that are meant for"
" the author of the CMakeLists.txt files.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
bool cmake::GetSuppressDeprecatedWarnings() const
@@ -2475,7 +2484,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b)
this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(),
"Whether to issue warnings for deprecated "
"functionality.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
bool cmake::GetDevWarningsAsErrors() const
@@ -2499,7 +2508,7 @@ void cmake::SetDevWarningsAsErrors(bool b)
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(),
"Suppress errors that are meant for"
" the author of the CMakeLists.txt files.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
bool cmake::GetDeprecatedWarningsAsErrors() const
@@ -2523,5 +2532,5 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b)
this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(),
"Whether to issue deprecation errors for macros"
" and functions.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
diff --git a/Source/cmake.h b/Source/cmake.h
index ae1a502..cd00c61 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -7,7 +7,7 @@
#include "cmInstalledFile.h"
#include "cmListFileCache.h"
-#include "cmState.h"
+#include "cmStateSnapshot.h"
#include <map>
#include <set>
@@ -161,7 +161,7 @@ public:
///! Break up a line like VAR:type="value" into var, type and value
static bool ParseCacheEntry(const std::string& entry, std::string& var,
std::string& value,
- cmState::CacheEntryType& type);
+ cmStateEnums::CacheEntryType& type);
int LoadCache();
bool LoadCache(const std::string& path);
@@ -407,14 +407,11 @@ public:
void WatchUnusedCli(const std::string& var);
cmState* GetState() const { return this->State; }
- void SetCurrentSnapshot(cmState::Snapshot snapshot)
+ void SetCurrentSnapshot(cmStateSnapshot snapshot)
{
this->CurrentSnapshot = snapshot;
}
- cmState::Snapshot GetCurrentSnapshot() const
- {
- return this->CurrentSnapshot;
- }
+ cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; }
protected:
void RunCheckForUnusedVariables();
@@ -490,7 +487,7 @@ private:
InstalledFilesMap InstalledFiles;
cmState* State;
- cmState::Snapshot CurrentSnapshot;
+ cmStateSnapshot CurrentSnapshot;
cmMessenger* Messenger;
std::vector<std::string> TraceOnlyThisSources;
@@ -500,6 +497,8 @@ private:
// Print a list of valid generators to stderr.
void PrintGeneratorList();
+ void CreateDefaultGlobalGenerator();
+
/**
* Convert a message type between a warning and an error, based on the state
* of the error output CMake variables, in the cache.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 0d1f1ce..d1159c3 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -292,9 +292,9 @@ int do_cmake(int ac, char const* const* av)
std::vector<std::string> keys = cm.GetState()->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
- cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it);
- if (t != cmState::INTERNAL && t != cmState::STATIC &&
- t != cmState::UNINITIALIZED) {
+ cmStateEnums::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it);
+ if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC &&
+ t != cmStateEnums::UNINITIALIZED) {
const char* advancedProp =
cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED");
if (list_all_cached || !advancedProp) {
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 167d60a..b86ad6e 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -205,7 +205,7 @@ static int process(const std::string& srcfilename, const std::string& dfile,
std::vector<std::string> command;
for (std::vector<std::string>::iterator i = args.begin(); i != args.end();
++i) {
- command.push_back(i->c_str());
+ command.push_back(*i);
}
// run the command
int exit_code = 0;
@@ -258,7 +258,7 @@ int main()
// needed to suppress filename output of msvc tools
std::string srcfilename;
{
- std::string::size_type pos = srcfile.rfind("\\");
+ std::string::size_type pos = srcfile.rfind('\\');
if (pos == std::string::npos) {
srcfilename = srcfile;
} else {
@@ -279,12 +279,7 @@ int main()
clrest = replace(clrest, "/fo", "/out:");
clrest = replace(clrest, objfile, objfile + ".dep.obj ");
- // rc: src\x\x.rc -> cl: /Tc src\x\x.rc
- if (srcfile.find(" ") != std::string::npos)
- srcfile = "\"" + srcfile + "\"";
- clrest = replace(clrest, srcfile, "/Tc " + srcfile);
-
- cl = "\"" + cl + "\" /P /DRC_INVOKED ";
+ cl = "\"" + cl + "\" /P /DRC_INVOKED /TC ";
// call cl in object dir so the .i is generated there
std::string objdir;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4387bf6..c008791 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -7,7 +7,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmQtAutoGenerators.h"
-#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include "cmUtils.hxx"
#include "cmVersion.h"
@@ -414,7 +414,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0;
}
- else if (args[1] == "env") {
+ if (args[1] == "env") {
std::vector<std::string>::const_iterator ai = args.begin() + 2;
std::vector<std::string>::const_iterator ae = args.end();
for (; ai != ae; ++ai) {
@@ -454,7 +454,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
- else if (args[1] == "environment") {
+ if (args[1] == "environment") {
std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
std::vector<std::string>::iterator it;
for (it = env.begin(); it != env.end(); ++it) {
@@ -464,7 +464,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#endif
- else if (args[1] == "make_directory" && args.size() > 2) {
+ if (args[1] == "make_directory" && args.size() > 2) {
// If error occurs we want to continue copying next files.
bool return_value = 0;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
@@ -476,7 +476,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return return_value;
}
- else if (args[1] == "remove_directory" && args.size() == 3) {
+ if (args[1] == "remove_directory" && args.size() == 3) {
if (cmSystemTools::FileIsDirectory(args[2]) &&
!cmSystemTools::RemoveADirectory(args[2])) {
std::cerr << "Error removing directory \"" << args[2] << "\".\n";
@@ -486,7 +486,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Remove file
- else if (args[1] == "remove" && args.size() > 2) {
+ if (args[1] == "remove" && args.size() > 2) {
bool force = false;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (args[cc] == "\\-f" || args[cc] == "-f") {
@@ -502,8 +502,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// Touch file
- else if (args[1] == "touch" && args.size() > 2) {
+ if (args[1] == "touch" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (!cmSystemTools::Touch(args[cc], true)) {
return 1;
@@ -511,8 +512,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// Touch file
- else if (args[1] == "touch_nocreate" && args.size() > 2) {
+ if (args[1] == "touch_nocreate" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
// Complain if the file could not be removed, still exists,
// and the -f option was not given.
@@ -522,8 +524,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// capabilities
- else if (args[1] == "capabilities") {
+ if (args[1] == "capabilities") {
if (args.size() > 2) {
std::cerr << "-E capabilities accepts no additional arguments\n";
return 1;
@@ -538,7 +541,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Sleep command
- else if (args[1] == "sleep" && args.size() > 2) {
+ if (args[1] == "sleep" && args.size() > 2) {
double total = 0;
for (size_t i = 2; i < args.size(); ++i) {
double num = 0.0;
@@ -559,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Clock command
- else if (args[1] == "time" && args.size() > 2) {
+ if (args[1] == "time" && args.size() > 2) {
std::vector<std::string> command(args.begin() + 2, args.end());
clock_t clock_start, clock_finish;
@@ -583,8 +586,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
<< "\n";
return ret;
}
+
// Command to calculate the md5sum of a file
- else if (args[1] == "md5sum" && args.size() >= 3) {
+ if (args[1] == "md5sum" && args.size() >= 3) {
char md5out[32];
int retval = 0;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
@@ -606,7 +610,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to change directory and run a program.
- else if (args[1] == "chdir" && args.size() >= 4) {
+ if (args[1] == "chdir" && args.size() >= 4) {
std::string directory = args[2];
if (!cmSystemTools::FileExists(directory.c_str())) {
cmSystemTools::Error("Directory does not exist for chdir command: ",
@@ -628,7 +632,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to start progress for a build
- else if (args[1] == "cmake_progress_start" && args.size() == 4) {
+ if (args[1] == "cmake_progress_start" && args.size() == 4) {
// basically remove the directory
std::string dirName = args[2];
dirName += "/Progress";
@@ -660,7 +664,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to report progress for a build
- else if (args[1] == "cmake_progress_report" && args.size() >= 3) {
+ if (args[1] == "cmake_progress_report" && args.size() >= 3) {
// This has been superseded by cmake_echo_color --progress-*
// options. We leave it here to avoid errors if somehow this
// is invoked by an existing makefile without regenerating.
@@ -669,7 +673,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to create a symbolic link. Fails on platforms not
// supporting them.
- else if (args[1] == "create_symlink" && args.size() == 4) {
+ if (args[1] == "create_symlink" && args.size() == 4) {
const char* destinationFileName = args[3].c_str();
if ((cmSystemTools::FileExists(destinationFileName) ||
cmSystemTools::FileIsSymlink(destinationFileName)) &&
@@ -690,16 +694,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Internal CMake shared library support.
- else if (args[1] == "cmake_symlink_library" && args.size() == 5) {
+ if (args[1] == "cmake_symlink_library" && args.size() == 5) {
return cmcmd::SymlinkLibrary(args);
}
+
// Internal CMake versioned executable support.
- else if (args[1] == "cmake_symlink_executable" && args.size() == 4) {
+ if (args[1] == "cmake_symlink_executable" && args.size() == 4) {
return cmcmd::SymlinkExecutable(args);
}
// Internal CMake dependency scanning support.
- else if (args[1] == "cmake_depends" && args.size() >= 6) {
+ if (args[1] == "cmake_depends" && args.size() >= 6) {
const bool verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
@@ -760,7 +765,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cm.GetCurrentSnapshot().SetDefaultDefinitions();
if (cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) {
cm.SetGlobalGenerator(ggd);
- cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir);
CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot));
@@ -774,41 +779,47 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Internal CMake link script support.
- else if (args[1] == "cmake_link_script" && args.size() >= 3) {
+ if (args[1] == "cmake_link_script" && args.size() >= 3) {
return cmcmd::ExecuteLinkScript(args);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake ninja dependency scanning support.
- else if (args[1] == "cmake_ninja_depends") {
+ if (args[1] == "cmake_ninja_depends") {
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
}
// Internal CMake ninja dyndep support.
- else if (args[1] == "cmake_ninja_dyndep") {
+ if (args[1] == "cmake_ninja_dyndep") {
return cmcmd_cmake_ninja_dyndep(args.begin() + 2, args.end());
}
#endif
// Internal CMake unimplemented feature notification.
- else if (args[1] == "cmake_unimplemented_variable") {
+ if (args[1] == "cmake_unimplemented_variable") {
std::cerr << "Feature not implemented for this platform.";
if (args.size() == 3) {
std::cerr << " Variable " << args[2] << " is not set.";
}
std::cerr << std::endl;
return 1;
- } else if (args[1] == "vs_link_exe") {
+ }
+
+ if (args[1] == "vs_link_exe") {
return cmcmd::VisualStudioLink(args, 1);
- } else if (args[1] == "vs_link_dll") {
+ }
+
+ if (args[1] == "vs_link_dll") {
return cmcmd::VisualStudioLink(args, 2);
}
+
// Internal CMake color makefile support.
- else if (args[1] == "cmake_echo_color") {
+ if (args[1] == "cmake_echo_color") {
return cmcmd::ExecuteEchoColor(args);
}
+
#ifdef CMAKE_BUILD_WITH_CMAKE
- else if (args[1] == "cmake_autogen" && args.size() >= 4) {
+ if (args[1] == "cmake_autogen" && args.size() >= 4) {
cmQtAutoGenerators autogen;
std::string const& config = args[3];
bool autogenSuccess = autogen.Run(args[2], config);
@@ -817,7 +828,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
#endif
// Tar files
- else if (args[1] == "tar" && args.size() > 3) {
+ if (args[1] == "tar" && args.size() > 3) {
const char* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
std::string flags = args[2];
@@ -921,7 +932,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
#endif
}
return 0;
- } else if (args[1] == "server") {
+ }
+
+ if (args[1] == "server") {
const std::string pipePrefix = "--pipe=";
bool supportExperimental = false;
bool isDebug = false;
@@ -958,28 +971,26 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string errorMessage;
if (server.Serve(&errorMessage)) {
return 0;
- } else {
- cmSystemTools::Error(errorMessage.c_str());
- return 1;
}
+ cmSystemTools::Error(errorMessage.c_str());
#else
static_cast<void>(supportExperimental);
static_cast<void>(isDebug);
cmSystemTools::Error("CMake was not built with server mode enabled");
- return 1;
#endif
+ return 1;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
// Internal CMake Fortran module support.
- else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
+ if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
return cmDependsFortran::CopyModule(args) ? 0 : 1;
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
// Write registry value
- else if (args[1] == "write_regv" && args.size() > 3) {
+ if (args[1] == "write_regv" && args.size() > 3) {
return cmSystemTools::WriteRegistryValue(args[2].c_str(),
args[3].c_str())
? 0
@@ -987,16 +998,21 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Delete registry value
- else if (args[1] == "delete_regv" && args.size() > 2) {
+ if (args[1] == "delete_regv" && args.size() > 2) {
return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
}
+
// Remove file
- else if (args[1] == "comspec" && args.size() > 2) {
+ if (args[1] == "comspec" && args.size() > 2) {
std::cerr << "Win9x helper \"cmake -E comspec\" no longer supported\n";
return 1;
- } else if (args[1] == "env_vs8_wince" && args.size() == 3) {
+ }
+
+ if (args[1] == "env_vs8_wince" && args.size() == 3) {
return cmcmd::WindowsCEEnvironment("8.0", args[2]);
- } else if (args[1] == "env_vs9_wince" && args.size() == 3) {
+ }
+
+ if (args[1] == "env_vs9_wince" && args.size() == 3) {
return cmcmd::WindowsCEEnvironment("9.0", args[2]);
}
#endif
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 1fb39ff..8ab17b9 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -163,11 +163,7 @@ int main(int argc, char const* const* argv)
doc.SetSection("Name", cmDocumentationName);
doc.SetSection("Usage", cmDocumentationUsage);
doc.PrependSection("Options", cmDocumentationOptions);
-#ifdef cout
-#undef cout
-#endif
return doc.PrintRequestedDocumentation(std::cout) ? 0 : 1;
-#define cout no_cout_use_cmCTestLog
}
}
diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake
index 9c9fe09..07a65bf 100644
--- a/Tests/BootstrapTest.cmake
+++ b/Tests/BootstrapTest.cmake
@@ -1,7 +1,12 @@
file(MAKE_DIRECTORY "${bin_dir}")
-message(STATUS "running bootstrap: ${bootstrap}")
+include(ProcessorCount)
+ProcessorCount(nproc)
+if(NOT nproc EQUAL 0)
+ set(parallel_arg --parallel=${nproc})
+endif()
+message(STATUS "running bootstrap: ${bootstrap} ${parallel_arg}")
execute_process(
- COMMAND ${bootstrap}
+ COMMAND ${bootstrap} ${parallel_arg}
WORKING_DIRECTORY "${bin_dir}"
RESULT_VARIABLE result
)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 7df9403..5d72e5c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3081,8 +3081,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
-P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
- # Make this test run early during parallel execution
- set_tests_properties(BootstrapTest PROPERTIES COST 5000)
+ # This test will use all processors.
+ set_tests_properties(BootstrapTest PROPERTIES RUN_SERIAL 1)
# provide more time for the bootstrap test
get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
index 56fcc5d..23832da 100644
--- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt
+++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
@@ -20,16 +20,9 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND
configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY)
# now set up the test:
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk"
- CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n"
- )
- else()
- get_target_property(cmakeLocation cmake LOCATION)
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk"
- "CMAKE = \"${cmakeLocation}\"\n"
- )
- endif()
+ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk"
+ CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n"
+ )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 27f33a2..4f2f434 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -171,6 +171,13 @@ add_executable(Alias::SomeExe ALIAS someexe)
add_library(Alias::SomeLib ALIAS empty1)
+add_library(importedFallback STATIC IMPORTED)
+set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_DEBUG debug_loc)
+set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_RELEASE release_loc)
+set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc)
+set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG)
+set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "")
+
add_custom_target(check-part3 ALL
COMMAND ${CMAKE_COMMAND}
-Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1>
@@ -184,6 +191,7 @@ add_custom_target(check-part3 ALL
-Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
-Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
-Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
+ -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc>
-Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>>
-Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>>
-Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>>
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 70ccfe1..e12d8c6 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -21,6 +21,8 @@ foreach(c debug release relwithdebinfo minsizerel)
endif()
endforeach()
+check(test_imported_fallback "1")
+
check(test_alias_file_exe "1")
check(test_alias_file_lib "1")
check(test_alias_target_name "1")
diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt
index ade0a3c..bf937e6 100644
--- a/Tests/MacRuntimePath/A/CMakeLists.txt
+++ b/Tests/MacRuntimePath/A/CMakeLists.txt
@@ -40,21 +40,30 @@ target_link_libraries(test3 framework)
add_executable(test4 test1.cpp)
target_link_libraries(test4 shared2)
+# executable to test a shared library dependency with build rpath
+add_executable(test5 test1.cpp)
+
+# avoid linking by 'target_link_libraries' so CMake
+# will not be able to set correct RPATH automatically
+add_dependencies(test5 shared)
+target_link_libraries(test5 "$<TARGET_FILE:shared>")
+set_target_properties(test5 PROPERTIES BUILD_RPATH "@loader_path/../lib")
+
set_target_properties(shared shared2 framework PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
-set_target_properties(test1 test2 test3 test4 PROPERTIES
+set_target_properties(test1 test2 test3 test4 test5 PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} CONFIG)
set_target_properties(shared shared2 framework PROPERTIES
LIBRARY_OUTPUT_DIRECTORY_${CONFIG}
"${CMAKE_CURRENT_BINARY_DIR}/${config}/lib")
- set_target_properties(test1 test2 test3 test4 PROPERTIES
+ set_target_properties(test1 test2 test3 test4 test5 PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${CONFIG}
"${CMAKE_CURRENT_BINARY_DIR}/${config}/bin")
endforeach()
-foreach(test test1 test2 test3 test4)
+foreach(test test1 test2 test3 test4 test5)
add_custom_target(${test}_run ALL
COMMAND ${test}
DEPENDS ${test}
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index ed2c7d4..f764b3a 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -10,6 +10,9 @@ set(expressions
"1 +(3*4) + 10 >> 2"
"10000 / 20 / 4"
"10000 / (20 / 4)"
+ "-1 + +1"
+ "+1 - -1"
+ "+1 - - + + -(-3 + - - +1)"
)
set(FILE_EXPRESSIONS "")
diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt
index 1018dd8..737e17a 100644
--- a/Tests/Module/ExternalData/CMakeLists.txt
+++ b/Tests/Module/ExternalData/CMakeLists.txt
@@ -45,6 +45,8 @@ ExternalData_Add_Test(Data1
-D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat}
-D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat}
-D DirRecurse=DATA{DirRecurse/,RECURSE:,A.dat,REGEX:[BC].dat}
+ -D MultipleAlgorithmNoSHA1=DATA{MultipleAlgorithmNoSHA1.dat}
+ -D MultipleAlgorithmNoMD5=DATA{MultipleAlgorithmNoMD5.dat}
-D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake
)
diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5
new file mode 100644
index 0000000..a956f36
--- /dev/null
+++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5
@@ -0,0 +1 @@
+29848e54a4d0343f138ab14419b863de
diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1
new file mode 100644
index 0000000..43a3540
--- /dev/null
+++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1
@@ -0,0 +1 @@
+2af59a7022024974f3b8521b7ed8137c996a79f1
diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5
new file mode 100644
index 0000000..1906cbf
--- /dev/null
+++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5
@@ -0,0 +1 @@
+08cfcf221f76ace7b906b312284e73d7
diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1
new file mode 100644
index 0000000..65781b2
--- /dev/null
+++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1
@@ -0,0 +1 @@
+223b134e6e3a9bf34aa7531c009d97cff6b0d8a3
diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake
new file mode 100644
index 0000000..99c6cae
--- /dev/null
+++ b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake
@@ -0,0 +1,14 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications)
+install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
+install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
+ set(CPACK_RPM_MAIN_COMPONENT "")
+else()
+ set(CPACK_RPM_MAIN_COMPONENT "applications")
+ set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
+endif()
+
+set(CPACK_PACKAGE_NAME "main_component")
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
new file mode 100644
index 0000000..69603dd
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
@@ -0,0 +1,13 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "0")
+
+if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
+ set(EXPECTED_FILES_COUNT "3")
+ set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm")
+ set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
+ set(EXPECTED_FILE_2 "main_component*-headers.rpm")
+ set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
+ set(EXPECTED_FILE_3 "main_component*-libs.rpm")
+ set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$")
+endif()
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
new file mode 100644
index 0000000..dff163d
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
@@ -0,0 +1,3 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt
new file mode 100644
index 0000000..4d8ac6e
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt
@@ -0,0 +1 @@
+CPACK_RPM_MAIN_COMPONENT set to non existing component.
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake
new file mode 100644
index 0000000..dc49343
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake
@@ -0,0 +1,30 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "0")
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
+ set(EXPECTED_FILES_COUNT "4")
+ set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm")
+ set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+ set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm")
+ set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
+ set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm")
+ set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
+
+ set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm")
+ set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo")
+ set(EXPECTED_FILES_COUNT "2")
+ set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm")
+ set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+
+ set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm")
+ set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components")
+ set(EXPECTED_FILES_COUNT "2")
+ set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm")
+ set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+
+ set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm")
+ set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
+endif()
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt
new file mode 100644
index 0000000..d80939f
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_components-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt
new file mode 100644
index 0000000..86396db
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt
@@ -0,0 +1,3 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt
new file mode 100644
index 0000000..454283c
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt
@@ -0,0 +1 @@
+CPack Error: CPACK_RPM_MAIN_COMPONENT not set but it is mandatory with CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE being set.
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt
new file mode 100644
index 0000000..080c4ff
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt
new file mode 100644
index 0000000..665597c
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_main-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt
new file mode 100644
index 0000000..b64b1f5
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt
new file mode 100644
index 0000000..f4c1bef
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt
@@ -0,0 +1,3 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 60d42ac..474ee33 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -12,11 +12,13 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true)
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(CUSTOM_NAMES "RPM;DEB" true)
+run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false)
run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false)
run_cpack_test(RPM_DIST "RPM" false)
run_cpack_test(INSTALL_SCRIPTS "RPM" false)
run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true)
run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true)
run_cpack_test(DEBUGINFO "RPM" true)
+run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true)
run_cpack_test(LONG_FILENAMES "DEB" false)
run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false)
diff --git a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake
new file mode 100644
index 0000000..ae4995e
--- /dev/null
+++ b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake
@@ -0,0 +1,56 @@
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+
+# PGI compiler doesn't add build id to binaries by default
+if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id")
+endif()
+
+if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+endif()
+
+set(CMAKE_BUILD_TYPE Debug)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
+ "int test_lib();\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
+ "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
+add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n")
+add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+target_link_libraries(test_prog test_lib)
+
+install(TARGETS test_prog DESTINATION foo COMPONENT applications)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
+ install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
+ install(TARGETS test_lib DESTINATION bas COMPONENT libs)
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo")
+ set(CPACK_COMPONENTS_ALL applications)
+endif()
+
+set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
+ set(CPACK_RPM_MAIN_COMPONENT "applications")
+ set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
+endif()
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component")
+ set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON)
+ set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON)
+endif()
+
+set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src")
+
+set(CPACK_PACKAGE_NAME "single_debuginfo")
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 8bc2a58..ad2a651 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -27,10 +27,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
expected_content_list "${PACKAGE_CONTENT}")
if(NOT expected_content_list)
+ string(REPLACE "\n" "\n actual> " msg_actual "\n${PACKAGE_CONTENT}")
+ string(REPLACE "\n" "\n expect> " msg_expected "\n${EXPECTED_FILE_CONTENT_${file_no_}}")
message(FATAL_ERROR
"Unexpected file content for file No. '${file_no_}'!\n"
- " Content: '${PACKAGE_CONTENT}'\n\n"
- " Expected: '${EXPECTED_FILE_CONTENT_${file_no_}}'"
+ "The content was:${msg_actual}\n"
+ "which does not match:${msg_expected}\n"
"${output_error_message}")
endif()
else()
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
index e4dbb71..d4e5b29 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
@@ -1,4 +1,4 @@
-CMake Warning \(dev\) in CMakeLists.txt:
+CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
@@ -7,4 +7,6 @@ CMake Warning \(dev\) in CMakeLists.txt:
name directly with add_custom_command, or use the generator expression
\$<TARGET_FILE>, as appropriate.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt
new file mode 100644
index 0000000..5737e95
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ .*
+
+ does not recognize the toolset
+
+ Test Toolset,host=x6[45]
+
+ that was specified\.$
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
index 283a2a0..e8ce47d 100644
--- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
@@ -6,6 +6,21 @@ run_cmake(NoToolset)
if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3)
set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
run_cmake(TestToolset)
+ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[245]")
+ set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64")
+ run_cmake(TestToolsetHostArchBoth)
+ set(RunCMake_GENERATOR_TOOLSET ",host=x64")
+ run_cmake(TestToolsetHostArchOnly)
+ set(RunCMake_GENERATOR_TOOLSET "host=x64")
+ run_cmake(TestToolsetHostArchOnly)
+ set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
+ run_cmake(TestToolsetHostArchNone)
+ set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x65")
+ run_cmake(BadToolsetHostArch)
+ else()
+ set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64")
+ run_cmake(BadToolsetHostArch)
+ endif()
else()
set(RunCMake_GENERATOR_TOOLSET "Bad Toolset")
run_cmake(BadToolset)
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt
new file mode 100644
index 0000000..f0b6d46
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt
@@ -0,0 +1,2 @@
+-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset'
+-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake
new file mode 100644
index 0000000..26926f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake
@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'")
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt
new file mode 100644
index 0000000..576b40c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt
@@ -0,0 +1,2 @@
+-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset'
+-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=''
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake
new file mode 100644
index 0000000..26926f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake
@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'")
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt
new file mode 100644
index 0000000..8271bd4
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt
@@ -0,0 +1,2 @@
+-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+'
+-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake
new file mode 100644
index 0000000..26926f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake
@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'")
diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt
new file mode 100644
index 0000000..1214288
--- /dev/null
+++ b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Running
+
+ 'ninja-tool-missing' '--version'
+
+ failed with:
diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing.cmake b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 1d3639d..7b4e51e 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -15,6 +15,12 @@ else()
message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
endif()
+function(run_NinjaToolMissing)
+ set(RunCMake_MAKE_PROGRAM ninja-tool-missing)
+ run_cmake(NinjaToolMissing)
+endfunction()
+run_NinjaToolMissing()
+
function(run_CMP0058 case)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)
diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
index 82cb7c4..133ae36 100644
--- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.1)
+@CASE_CMAKELISTS_PREFIX_CODE@
project(CTestBuild@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
index 324f25c..1092d2a 100644
--- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
@@ -13,6 +13,11 @@ function(run_BuildFailure)
set(CASE_CMAKELISTS_SUFFIX_CODE [[
add_custom_target(BuildFailure ALL COMMAND command-does-not-exist)
]])
+ set(CASE_CMAKELISTS_PREFIX_CODE [[
+if(NOT CTEST_USE_LAUNCHERS)
+ message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set")
+endif()
+]])
set(CASE_TEST_PREFIX_CODE [[
cmake_policy(SET CMP0061 NEW)
]])
diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in
index 768f1c6..6f15ec9 100644
--- a/Tests/RunCMake/ctest_build/test.cmake.in
+++ b/Tests/RunCMake/ctest_build/test.cmake.in
@@ -9,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+set(CTEST_USE_LAUNCHERS TRUE)
set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@")
ctest_start(Experimental)
diff --git a/Utilities/GitSetup/config b/Utilities/GitSetup/config
index b7d5423..d69a679 100644
--- a/Utilities/GitSetup/config
+++ b/Utilities/GitSetup/config
@@ -1,5 +1,5 @@
[hooks]
- url = http://cmake.org/cmake.git
+ url = https://cmake.org/cmake.git
[ssh]
host = cmake.org
key = id_git_cmake
diff --git a/Utilities/Release/README b/Utilities/Release/README
index ed1d52e..11de1c3 100644
--- a/Utilities/Release/README
+++ b/Utilities/Release/README
@@ -1,7 +1,7 @@
To create a cmake release, make sure the "release" tag is pointing to the
expected git commit:
-http://cmake.org/gitweb?p=cmake.git;a=shortlog;h=refs/heads/release
+https://cmake.org/gitweb?p=cmake.git;a=shortlog;h=refs/heads/release
Then as kitware@hythloth, using an up-to-date CMake:
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index b72fc12..b9447ca 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -2,6 +2,7 @@ set(PROCESSORS 4)
set(BOOTSTRAP_ARGS "--docdir=doc/cmake")
set(HOST linux64)
set(MAKE_PROGRAM "make")
+set(CPACK_BINARY_GENERATORS "STGZ TGZ")
set(CC /opt/gcc-6.1.0/bin/gcc)
set(CXX /opt/gcc-6.1.0/bin/g++)
set(CFLAGS "")
diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake
index 27c820f..88ea39b 100644
--- a/Utilities/Release/osx_release.cmake
+++ b/Utilities/Release/osx_release.cmake
@@ -4,7 +4,7 @@ set(BOOTSTRAP_ARGS "--prefix=/ --docdir=doc/cmake")
set(HOST dragnipur)
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j5")
-set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ")
+set(CPACK_BINARY_GENERATORS "DragNDrop TGZ")
set(CPACK_SOURCE_GENERATORS "TGZ TZ")
set(CPACK_DMG_FORMAT "UDBZ") #build using bzip2 for smaller package size
set(CC clang)
diff --git a/bootstrap b/bootstrap
index 889cc33..4ce0dee 100755
--- a/bootstrap
+++ b/bootstrap
@@ -240,87 +240,177 @@ CMAKE_UNUSED_SOURCES="\
"
CMAKE_CXX_SOURCES="\
- cmake \
- cmakemain \
- cmcmd \
+ cmAddCustomCommandCommand \
+ cmAddCustomTargetCommand \
+ cmAddDefinitionsCommand \
+ cmAddDependenciesCommand \
+ cmAddExecutableCommand \
+ cmAddLibraryCommand \
+ cmAddSubDirectoryCommand \
+ cmAddTestCommand \
+ cmBreakCommand \
+ cmBuildCommand \
+ cmCMakeMinimumRequired \
+ cmCMakePolicyCommand \
+ cmCPackPropertiesGenerator \
+ cmCacheManager \
+ cmCommand \
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmCommandArgumentParserHelper \
+ cmCommandArgumentsHelper \
+ cmCommands \
cmCommonTargetGenerator \
- cmCPackPropertiesGenerator \
+ cmComputeComponentGraph \
+ cmComputeLinkDepends \
+ cmComputeLinkInformation \
+ cmComputeTargetDepends \
+ cmConditionEvaluator \
+ cmConfigureFileCommand \
+ cmContinueCommand \
+ cmCoreTryCompile \
+ cmCreateTestSourceList \
+ cmCustomCommand \
+ cmCustomCommandGenerator \
+ cmDefinePropertyCommand \
cmDefinitions \
cmDepends \
cmDependsC \
cmDocumentationFormatter \
- cmPolicies \
- cmProperty \
- cmPropertyMap \
- cmPropertyDefinition \
- cmPropertyDefinitionMap \
- cmMakefile \
- cmMessenger \
+ cmElseCommand \
+ cmEnableLanguageCommand \
+ cmEnableTestingCommand \
+ cmEndForEachCommand \
+ cmEndFunctionCommand \
+ cmEndIfCommand \
+ cmEndMacroCommand \
+ cmEndWhileCommand \
+ cmExecProgramCommand \
+ cmExecuteProcessCommand \
+ cmExpandedCommandArgument \
cmExportBuildFileGenerator \
cmExportFileGenerator \
cmExportInstallFileGenerator \
- cmExportTryCompileFileGenerator \
cmExportSet \
cmExportSetMap \
+ cmExportTryCompileFileGenerator \
+ cmExprLexer \
+ cmExprParser \
+ cmExprParserHelper \
cmExternalMakefileProjectGenerator \
- cmGeneratorExpressionEvaluationFile \
+ cmFileCommand \
+ cmFileTimeComparison \
+ cmFindBase \
+ cmFindCommon \
+ cmFindFileCommand \
+ cmFindLibraryCommand \
+ cmFindPackageCommand \
+ cmFindPathCommand \
+ cmFindProgramCommand \
+ cmForEachCommand \
+ cmFunctionCommand \
cmGeneratedFileStream \
- cmGeneratorTarget \
+ cmGeneratorExpression \
cmGeneratorExpressionContext \
cmGeneratorExpressionDAGChecker \
+ cmGeneratorExpressionEvaluationFile \
cmGeneratorExpressionEvaluator \
cmGeneratorExpressionLexer \
cmGeneratorExpressionNode \
cmGeneratorExpressionParser \
- cmGeneratorExpression \
+ cmGeneratorTarget \
+ cmGetCMakePropertyCommand \
+ cmGetDirectoryPropertyCommand \
+ cmGetFilenameComponentCommand \
+ cmGetPropertyCommand \
+ cmGetSourceFilePropertyCommand \
+ cmGetTargetPropertyCommand \
+ cmGetTestPropertyCommand \
cmGlobalCommonGenerator \
cmGlobalGenerator \
+ cmGlobalUnixMakefileGenerator3 \
+ cmHexFileConverter \
+ cmIfCommand \
+ cmIncludeCommand \
+ cmIncludeDirectoryCommand \
+ cmIncludeRegularExpressionCommand \
+ cmInstallCommand \
+ cmInstallCommandArguments \
cmInstallDirectoryGenerator \
- cmLocalCommonGenerator \
- cmLocalGenerator \
- cmInstalledFile \
- cmInstallGenerator \
cmInstallExportGenerator \
+ cmInstallFilesCommand \
cmInstallFilesGenerator \
+ cmInstallGenerator \
cmInstallScriptGenerator \
cmInstallTargetGenerator \
- cmScriptGenerator \
- cmSourceFile \
- cmSourceFileLocation \
- cmState \
- cmSystemTools \
- cmTestGenerator \
- cmVersion \
- cmFileTimeComparison \
- cmGlobalUnixMakefileGenerator3 \
+ cmInstallTargetsCommand \
+ cmInstalledFile \
+ cmLinkDirectoriesCommand \
+ cmLinkLineComputer \
+ cmListCommand \
+ cmListFileCache \
+ cmLocalCommonGenerator \
+ cmLocalGenerator \
cmLocalUnixMakefileGenerator3 \
+ cmMSVC60LinkLineComputer \
+ cmMacroCommand \
+ cmMakeDirectoryCommand \
+ cmMakefile \
cmMakefileExecutableTargetGenerator \
cmMakefileLibraryTargetGenerator \
cmMakefileTargetGenerator \
cmMakefileUtilityTargetGenerator \
- cmOutputConverter \
- cmOSXBundleGenerator \
+ cmMarkAsAdvancedCommand \
+ cmMathCommand \
+ cmMessageCommand \
+ cmMessenger \
cmNewLineStyle \
- cmBootstrapCommands1 \
- cmBootstrapCommands2 \
- cmCommandsForBootstrap \
+ cmOSXBundleGenerator \
+ cmOptionCommand \
+ cmOrderDirectories \
+ cmOutputConverter \
+ cmParseArgumentsCommand \
+ cmPathLabel \
+ cmPolicies \
+ cmProjectCommand \
+ cmProperty \
+ cmPropertyDefinition \
+ cmPropertyDefinitionMap \
+ cmPropertyMap \
+ cmReturnCommand \
+ cmRulePlaceholderExpander \
+ cmScriptGenerator \
+ cmSearchPath \
+ cmSeparateArgumentsCommand \
+ cmSetCommand \
+ cmSetDirectoryPropertiesCommand \
+ cmSetPropertyCommand \
+ cmSetSourceFilesPropertiesCommand \
+ cmSetTargetPropertiesCommand \
+ cmSetTestsPropertiesCommand \
+ cmSiteNameCommand \
+ cmSourceFile \
+ cmSourceFileLocation \
+ cmState \
+ cmStateDirectory \
+ cmStateSnapshot \
+ cmStringCommand \
+ cmSubdirCommand \
+ cmSystemTools \
cmTarget \
+ cmTargetLinkLibrariesCommand \
+ cmTargetPropertyComputer \
cmTest \
- cmCustomCommand \
- cmCustomCommandGenerator \
- cmCacheManager \
- cmListFileCache \
- cmComputeLinkDepends \
- cmComputeLinkInformation \
- cmOrderDirectories \
- cmComputeTargetDepends \
- cmComputeComponentGraph \
- cmExprLexer \
- cmExprParser \
- cmExprParserHelper \
+ cmTestGenerator \
+ cmTimestamp \
+ cmTryCompileCommand \
+ cmTryRunCommand \
+ cmUnsetCommand \
+ cmVersion \
+ cmWhileCommand \
+ cmake \
+ cmakemain \
+ cmcmd \
"
if ${cmake_system_mingw}; then
@@ -1316,16 +1406,6 @@ for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_
objs="${objs} ${a}.o"
done
-# Generate dependencies for cmBootstrapCommands1.cxx
-for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands1.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
- cmBootstrapCommands1Deps="${cmBootstrapCommands1Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
-done
-cmBootstrapCommands1Deps=`echo $cmBootstrapCommands1Deps`
-for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands2.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
- cmBootstrapCommands2Deps="${cmBootstrapCommands2Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
-done
-cmBootstrapCommands2Deps=`echo $cmBootstrapCommands2Deps`
-
if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
fi