From 55ecd818f6bf70590d61584a87aae7bba992e26d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:08:42 +0200 Subject: [PATCH 01/22] cmGlobalGenerator: Store languages as vector, not map. The second component of the map is never used. --- Source/cmGlobalGenerator.cxx | 17 ++++++++++------- Source/cmGlobalGenerator.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8f92..6a6a50394c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -968,7 +968,13 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - this->LanguageEnabled[l] = true; + std::vector::iterator it = + std::lower_bound(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); + if (it == this->LanguageEnabled.end() || *it != l) + { + this->LanguageEnabled.insert(it, l); + } // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1079,7 +1085,8 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); + return std::binary_search(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); } void cmGlobalGenerator::ClearEnabledLanguages() @@ -1958,11 +1965,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - for(std::map::const_iterator i = - this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) - { - lang.push_back(i->first); - } + lang = this->LanguageEnabled; } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b9ddee5b6..ce3f03773f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -441,7 +441,7 @@ private: // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map IgnoreExtensions; - std::map LanguageEnabled; + std::vector LanguageEnabled; std::set LanguagesReady; // Ready for try_compile std::map OutputExtensions; std::map LanguageToOutputExtension; From 8c13d7709bb2a254e5927d3df1346d8264ba1bd5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 18:35:49 +0200 Subject: [PATCH 02/22] cmake: Don't set the CMakeInstance on the Properties member. There is no need, as global properties have nowhere to chain up to. --- Source/cmake.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7595155b00..99c12d6bad 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -187,7 +187,6 @@ cmake::~cmake() void cmake::InitializeProperties() { this->Properties.clear(); - this->Properties.SetCMakeInstance(this); this->PropertyDefinitions.clear(); // initialize properties From 7450a2c6ed601dc94f2de410661065554ff8ce12 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 14:16:47 +0200 Subject: [PATCH 03/22] cmake: Remove method with no external users. Port internal users to access the member. --- Source/cmake.cxx | 10 +++++----- Source/cmake.h | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 99c12d6bad..d2331cb34c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -290,9 +290,9 @@ void cmake::AddCommand(cmCommand* wg) void cmake::RemoveUnscriptableCommands() { std::vector unscriptableCommands; - cmake::RegisteredCommandsMap* commands = this->GetCommands(); - for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin(); - pos != commands->end(); + for (cmake::RegisteredCommandsMap::const_iterator + pos = this->Commands.begin(); + pos != this->Commands.end(); ++pos) { if (!pos->second->IsScriptable()) @@ -2323,8 +2323,8 @@ const char *cmake::GetProperty(const std::string& prop, else if ( prop == "COMMANDS" ) { cmake::RegisteredCommandsMap::iterator cmds - = this->GetCommands()->begin(); - for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds ) + = this->Commands.begin(); + for (unsigned int cc=0 ; cmds != this->Commands.end(); ++ cmds ) { if ( cc > 0 ) { diff --git a/Source/cmake.h b/Source/cmake.h index 3acf4a82f2..d2d3a85ece 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -249,9 +249,6 @@ class cmake */ cmCommand *GetCommand(const std::string& name); - /** Get list of all commands */ - RegisteredCommandsMap* GetCommands() { return &this->Commands; } - /** Check if a command exists. */ bool CommandExists(const std::string& name) const; From 6fb306ea3bbe04b8e4dde8f13eec3e6bdfe35086 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 11:31:43 +0200 Subject: [PATCH 04/22] Test expected value of DEBUG_CONFIGURATIONS global property. --- .../DebugConfigurations-stderr.txt | 11 +++++ .../get_property/DebugConfigurations.cmake | 41 +++++++++++++++++++ .../RunCMake/get_property/RunCMakeTest.cmake | 1 + 3 files changed, 53 insertions(+) create mode 100644 Tests/RunCMake/get_property/DebugConfigurations-stderr.txt create mode 100644 Tests/RunCMake/get_property/DebugConfigurations.cmake diff --git a/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt b/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt new file mode 100644 index 0000000000..b2956043c3 --- /dev/null +++ b/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt @@ -0,0 +1,11 @@ +CONFIGS: +IFACE1:\$<\$:external1> +CONFIGS:EXTRA +IFACE1:\$<\$:external1> +IFACE1:\$<\$:external1>;\$<\$:external2> +CONFIGS:NEW;CONFIGS +IFACE1:\$<\$:external1>;\$<\$:external2> +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3> +CONFIGS:NEW;CONFIGS;EXTRA +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3> +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3>;\$<\$,\$,\$>:external4> diff --git a/Tests/RunCMake/get_property/DebugConfigurations.cmake b/Tests/RunCMake/get_property/DebugConfigurations.cmake new file mode 100644 index 0000000000..534beafcde --- /dev/null +++ b/Tests/RunCMake/get_property/DebugConfigurations.cmake @@ -0,0 +1,41 @@ + +enable_language(CXX) + +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +add_library(iface1 INTERFACE) +target_link_libraries(iface1 INTERFACE debug external1) + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external2) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS NEW CONFIGS) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external3) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external4) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 1964824228..e420b5b137 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -7,3 +7,4 @@ run_cmake(install_properties) run_cmake(source_properties) run_cmake(target_properties) run_cmake(test_properties) +run_cmake(DebugConfigurations) From ade20b433b2ce1cf176bc727a8ed9c47a5f6537e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:04:05 +0200 Subject: [PATCH 05/22] cmake: Remove DebugConfigs member. It adds needless complexity to global property handling. --- Source/cmTarget.cxx | 4 +-- Source/cmTargetLinkLibrariesCommand.cxx | 2 +- Source/cmake.cxx | 45 +++++++++---------------- Source/cmake.h | 3 +- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 85e5165b13..745a84c60b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1157,7 +1157,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType( } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); // Check if any entry in the list matches this configuration. @@ -1216,7 +1216,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string configString = "$"; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 75c94c5440..9be7d46ef6 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string prop; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d2331cb34c..bef8904bb4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2283,24 +2283,12 @@ bool cmake::IsPropertyChained(const std::string& name, void cmake::SetProperty(const std::string& prop, const char* value) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); } void cmake::AppendProperty(const std::string& prop, const char* value, bool asString) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); } @@ -2758,27 +2746,24 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } //---------------------------------------------------------------------------- -std::vector const& cmake::GetDebugConfigs() +std::vector cmake::GetDebugConfigs() { - // Compute on-demand. - if(this->DebugConfigs.empty()) + std::vector configs; + if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) { - if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) - { - // Expand the specified list and convert to upper-case. - cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); - std::transform(this->DebugConfigs.begin(), - this->DebugConfigs.end(), - this->DebugConfigs.begin(), - cmSystemTools::UpperCase); - } - // If no configurations were specified, use a default list. - if(this->DebugConfigs.empty()) - { - this->DebugConfigs.push_back("DEBUG"); - } + // Expand the specified list and convert to upper-case. + cmSystemTools::ExpandListArgument(config_list, configs); + std::transform(configs.begin(), + configs.end(), + configs.begin(), + cmSystemTools::UpperCase); } - return this->DebugConfigs; + // If no configurations were specified, use a default list. + if(configs.empty()) + { + configs.push_back("DEBUG"); + } + return configs; } diff --git a/Source/cmake.h b/Source/cmake.h index d2d3a85ece..0c3de651b8 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -359,7 +359,7 @@ class cmake /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ - std::vector const& GetDebugConfigs(); + std::vector GetDebugConfigs(); void SetCMakeEditCommand(std::string const& s) { this->CMakeEditCommand = s; } @@ -469,7 +469,6 @@ private: bool DebugTryCompile; cmFileTimeComparison* FileComparison; std::string GraphVizFile; - std::vector DebugConfigs; InstalledFilesMap InstalledFiles; void UpdateConversionPathTable(); From 6ed19e615bada326c38a2b27d9378959503094ae Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:09:15 +0200 Subject: [PATCH 06/22] cmake: Remove duplicate condition. --- Source/cmake.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bef8904bb4..cf81ea456d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1530,11 +1530,7 @@ int cmake::ActualConfigure() if (!this->InTryCompile) { this->GlobalGenerator->ClearEnabledLanguages(); - } - // Truncate log files - if (!this->InTryCompile) - { this->TruncateOutputLog("CMakeOutput.log"); this->TruncateOutputLog("CMakeError.log"); } From 14c70b8c580c519ca38bcd9ba5ca8fc9e7629068 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:12:14 +0200 Subject: [PATCH 07/22] cmake: out-of-line try compile state methods. --- Source/cmake.cxx | 10 ++++++++++ Source/cmake.h | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cf81ea456d..0cbb2994dd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1935,6 +1935,16 @@ void cmake::UpdateProgress(const char *msg, float prog) } } +bool cmake::GetIsInTryCompile() const +{ + return this->InTryCompile; +} + +void cmake::SetIsInTryCompile(bool b) +{ + this->InTryCompile = b; +} + void cmake::GetGeneratorDocumentation(std::vector& v) { for(RegisteredGeneratorsVector::const_iterator i = diff --git a/Source/cmake.h b/Source/cmake.h index 0c3de651b8..a9f791d743 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -257,10 +257,8 @@ class cmake bool directoriesSetBefore = false); ///! Is this cmake running as a result of a TRY_COMPILE command - bool GetIsInTryCompile() { return this->InTryCompile; } - - ///! Is this cmake running as a result of a TRY_COMPILE command - void SetIsInTryCompile(bool i) { this->InTryCompile = i; } + bool GetIsInTryCompile() const; + void SetIsInTryCompile(bool b); ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector&); From 23368c9b83cd62724e94d345e3af940b3cda8762 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:32:00 +0200 Subject: [PATCH 08/22] cmake: Use make_pair instead of Foo::value_type. It works with all supported compilers. --- Source/cmake.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0cbb2994dd..8e09485f13 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -257,7 +257,7 @@ void cmake::RenameCommand(const std::string& oldName, delete pos->second; this->Commands.erase(pos); } - this->Commands.insert(RegisteredCommandsMap::value_type(sNewName, cmd)); + this->Commands.insert(std::make_pair(sNewName, cmd)); pos = this->Commands.find(sOldName); this->Commands.erase(pos); } @@ -283,7 +283,7 @@ void cmake::AddCommand(cmCommand* wg) delete pos->second; this->Commands.erase(pos); } - this->Commands.insert( RegisteredCommandsMap::value_type(name, wg)); + this->Commands.insert(std::make_pair(name, wg)); } From c57f086a81c487fa88c36a785865d27b81e3cb8d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:36:58 +0200 Subject: [PATCH 09/22] cmake: Don't lower-case a string needlessly. --- Source/cmake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8e09485f13..8868ef64be 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -243,12 +243,12 @@ void cmake::RenameCommand(const std::string& oldName, { // if the command already exists, free the old one std::string sOldName = cmSystemTools::LowerCase(oldName); - std::string sNewName = cmSystemTools::LowerCase(newName); RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName); if ( pos == this->Commands.end() ) { return; } + std::string sNewName = cmSystemTools::LowerCase(newName); cmCommand* cmd = pos->second; pos = this->Commands.find(sNewName); From 275185ac2b30b655b53100a129f5d7518ed943ad Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:44:18 +0200 Subject: [PATCH 10/22] cmake: Constify GetCommand method. --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8868ef64be..b27fefa8d9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -226,11 +226,11 @@ bool cmake::CommandExists(const std::string& name) const return (this->Commands.find(sName) != this->Commands.end()); } -cmCommand *cmake::GetCommand(const std::string& name) +cmCommand *cmake::GetCommand(const std::string& name) const { cmCommand* rm = 0; std::string sName = cmSystemTools::LowerCase(name); - RegisteredCommandsMap::iterator pos = this->Commands.find(sName); + RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); if (pos != this->Commands.end()) { rm = (*pos).second; diff --git a/Source/cmake.h b/Source/cmake.h index a9f791d743..c436c77732 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -247,7 +247,7 @@ class cmake /** * Get a command by its name */ - cmCommand *GetCommand(const std::string& name); + cmCommand *GetCommand(const std::string& name) const; /** Check if a command exists. */ bool CommandExists(const std::string& name) const; From 0f1f324b0dd7147850f923ab266873bd8a4a4353 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:45:12 +0200 Subject: [PATCH 11/22] cmake: Rename oddly named variables. --- Source/cmake.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b27fefa8d9..f22989d77d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -228,14 +228,14 @@ bool cmake::CommandExists(const std::string& name) const cmCommand *cmake::GetCommand(const std::string& name) const { - cmCommand* rm = 0; + cmCommand* command = 0; std::string sName = cmSystemTools::LowerCase(name); RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); if (pos != this->Commands.end()) { - rm = (*pos).second; + command = (*pos).second; } - return rm; + return command; } void cmake::RenameCommand(const std::string& oldName, @@ -273,9 +273,9 @@ void cmake::RemoveCommand(const std::string& name) } } -void cmake::AddCommand(cmCommand* wg) +void cmake::AddCommand(cmCommand* command) { - std::string name = cmSystemTools::LowerCase(wg->GetName()); + std::string name = cmSystemTools::LowerCase(command->GetName()); // if the command already exists, free the old one RegisteredCommandsMap::iterator pos = this->Commands.find(name); if (pos != this->Commands.end()) @@ -283,7 +283,7 @@ void cmake::AddCommand(cmCommand* wg) delete pos->second; this->Commands.erase(pos); } - this->Commands.insert(std::make_pair(name, wg)); + this->Commands.insert(std::make_pair(name, command)); } From 04b307b961a34c00f72d9031817ce4f918288701 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:33:27 +0200 Subject: [PATCH 12/22] cmake: Simplify CommandExists method. --- Source/cmake.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f22989d77d..f624214554 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -222,8 +222,7 @@ void cmake::CleanupCommandsAndMacros() bool cmake::CommandExists(const std::string& name) const { - std::string sName = cmSystemTools::LowerCase(name); - return (this->Commands.find(sName) != this->Commands.end()); + return this->GetCommand(name) ? true : false; } cmCommand *cmake::GetCommand(const std::string& name) const From ecdb1b3bba991c13f3f61c7b00a80b8dd97567b2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:09:25 +0200 Subject: [PATCH 13/22] Add some missing includes. --- Source/cmFileCommand.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 93e3ac4fe8..6ac0def71e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -15,6 +15,8 @@ #include "cmHexFileConverter.h" #include "cmInstallType.h" #include "cmFileTimeComparison.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmCryptoHash.h" #include "cmAlgorithms.h" From 6deb43e6c836a61536c3d6e36ca16b51013e9134 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:09:31 +0200 Subject: [PATCH 14/22] Remove some files which do not need to be in BootstrapCommands. --- Source/CMakeLists.txt | 4 ++++ Source/cmBootstrapCommands1.cxx | 1 - Source/cmBootstrapCommands2.cxx | 1 - bootstrap | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a81364..868e8b9b76 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -219,6 +219,8 @@ set(SRCS cmExportSet.cxx cmExportSetMap.h cmExportSetMap.cxx + cmExternalMakefileProjectGenerator.cxx + cmExternalMakefileProjectGenerator.h cmExtraCodeBlocksGenerator.cxx cmExtraCodeBlocksGenerator.h cmExtraCodeLiteGenerator.cxx @@ -244,6 +246,8 @@ set(SRCS cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h + cmGeneratorExpressionEvaluationFile.cxx + cmGeneratorExpressionEvaluationFile.h cmGeneratorExpressionEvaluator.cxx cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 4274d85b20..1b0abf4986 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -42,7 +42,6 @@ #include "cmEndWhileCommand.cxx" #include "cmExecProgramCommand.cxx" #include "cmExecuteProcessCommand.cxx" -#include "cmExternalMakefileProjectGenerator.cxx" #include "cmFindBase.cxx" #include "cmFindCommon.cxx" #include "cmFileCommand.cxx" diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx index 5675295f58..e292a3a61c 100644 --- a/Source/cmBootstrapCommands2.cxx +++ b/Source/cmBootstrapCommands2.cxx @@ -16,7 +16,6 @@ #include "cmCommands.h" #include "cmConditionEvaluator.cxx" #include "cmExpandedCommandArgument.cxx" -#include "cmGeneratorExpressionEvaluationFile.cxx" #include "cmGetCMakePropertyCommand.cxx" #include "cmGetDirectoryPropertyCommand.cxx" #include "cmGetFilenameComponentCommand.cxx" diff --git a/bootstrap b/bootstrap index 423980292a..c7c66132f1 100755 --- a/bootstrap +++ b/bootstrap @@ -264,7 +264,8 @@ CMAKE_CXX_SOURCES="\ cmExportTryCompileFileGenerator \ cmExportSet \ cmExportSetMap \ - cmInstallDirectoryGenerator \ + cmExternalMakefileProjectGenerator \ + cmGeneratorExpressionEvaluationFile \ cmGeneratedFileStream \ cmGeneratorTarget \ cmGeneratorExpressionContext \ @@ -275,6 +276,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ + cmInstallDirectoryGenerator \ cmLocalGenerator \ cmInstalledFile \ cmInstallGenerator \ From 57dd094eded03a94402b6eecf7027325bd7b5136 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 02:44:41 +0200 Subject: [PATCH 15/22] Use vector, not list for cmCommand storage. --- Source/cmBootstrapCommands1.cxx | 2 +- Source/cmBootstrapCommands2.cxx | 2 +- Source/cmCommands.cxx.in | 2 +- Source/cmCommands.h | 8 ++++---- Source/cmCommandsForBootstrap.cxx | 2 +- Source/cmake.cxx | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 1b0abf4986..1184514326 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -55,7 +55,7 @@ #include "cmPathLabel.cxx" #include "cmSearchPath.cxx" -void GetBootstrapCommands1(std::list& commands) +void GetBootstrapCommands1(std::vector& commands) { commands.push_back(new cmAddCustomCommandCommand); commands.push_back(new cmAddCustomTargetCommand); diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx index e292a3a61c..e522d8c795 100644 --- a/Source/cmBootstrapCommands2.cxx +++ b/Source/cmBootstrapCommands2.cxx @@ -59,7 +59,7 @@ #include "cmUnsetCommand.cxx" #include "cmWhileCommand.cxx" -void GetBootstrapCommands2(std::list& commands) +void GetBootstrapCommands2(std::vector& commands) { commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetDirectoryPropertyCommand); diff --git a/Source/cmCommands.cxx.in b/Source/cmCommands.cxx.in index f0745d780e..e23bbd1e35 100644 --- a/Source/cmCommands.cxx.in +++ b/Source/cmCommands.cxx.in @@ -13,7 +13,7 @@ @COMMAND_INCLUDES@ -void GetPredefinedCommands(std::list& commands) +void GetPredefinedCommands(std::vector& commands) { @NEW_COMMANDS@ } diff --git a/Source/cmCommands.h b/Source/cmCommands.h index e902853867..7a94423a49 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -13,7 +13,7 @@ #define cmCommands_h #include "cmStandardIncludes.h" -#include +#include class cmCommand; /** @@ -23,9 +23,9 @@ class cmCommand; * It is up to the caller to delete the commands created by this * call. */ -void GetBootstrapCommands1(std::list& commands); -void GetBootstrapCommands2(std::list& commands); -void GetPredefinedCommands(std::list& commands); +void GetBootstrapCommands1(std::vector& commands); +void GetBootstrapCommands2(std::vector& commands); +void GetPredefinedCommands(std::vector& commands); #endif diff --git a/Source/cmCommandsForBootstrap.cxx b/Source/cmCommandsForBootstrap.cxx index 15b664eeed..5f397a1fb5 100644 --- a/Source/cmCommandsForBootstrap.cxx +++ b/Source/cmCommandsForBootstrap.cxx @@ -11,6 +11,6 @@ ============================================================================*/ #include "cmCommands.h" -void GetPredefinedCommands(std::list&) +void GetPredefinedCommands(std::vector&) { } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f624214554..1d067a596d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1804,11 +1804,11 @@ const char* cmake::GetCacheDefinition(const std::string& name) const void cmake::AddDefaultCommands() { - std::list commands; + std::vector commands; GetBootstrapCommands1(commands); GetBootstrapCommands2(commands); GetPredefinedCommands(commands); - for(std::list::iterator i = commands.begin(); + for(std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { this->AddCommand(*i); From 0ee3ccb3b0a25264e8302a150eee297dd40affde Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 19:32:48 +0200 Subject: [PATCH 16/22] cmake: Fix variable name bugs. --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1d067a596d..f182ad248f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1112,9 +1112,9 @@ void cmake::SetHomeDirectory(const std::string& dir) cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } -void cmake::SetHomeOutputDirectory(const std::string& lib) +void cmake::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = lib; + this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); } diff --git a/Source/cmake.h b/Source/cmake.h index c436c77732..26ee8fe3c2 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -117,7 +117,7 @@ class cmake { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const std::string& lib); + void SetHomeOutputDirectory(const std::string& dir); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); @@ -141,9 +141,9 @@ class cmake { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const std::string& lib) + void SetStartOutputDirectory(const std::string& dir) { - this->StartOutputDirectory = lib; + this->StartOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); } const char* GetStartOutputDirectory() const From 6241253a4b20e74625b855b1e0d5220c8e7282b1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:40 +0200 Subject: [PATCH 17/22] cmake: Out-of-line Home and Start directory methods. --- Source/cmake.cxx | 32 ++++++++++++++++++++++++++++++++ Source/cmake.h | 32 ++++++-------------------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f182ad248f..ec05a0ed45 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1112,12 +1112,44 @@ void cmake::SetHomeDirectory(const std::string& dir) cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } +const char* cmake::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + void cmake::SetHomeOutputDirectory(const std::string& dir) { this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); } +const char* cmake::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + +const char* cmake::GetStartDirectory() const +{ + return this->cmStartDirectory.c_str(); +} + +void cmake::SetStartDirectory(const std::string& dir) +{ + this->cmStartDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); +} + +const char* cmake::GetStartOutputDirectory() const +{ + return this->StartOutputDirectory.c_str(); +} + +void cmake::SetStartOutputDirectory(const std::string& dir) +{ + this->StartOutputDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); +} + void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) diff --git a/Source/cmake.h b/Source/cmake.h index 26ee8fe3c2..87b771d8ff 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -113,15 +113,9 @@ class cmake * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } + const char* GetHomeDirectory() const; void SetHomeOutputDirectory(const std::string& dir); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeOutputDirectory() const; //@} //@{ @@ -132,24 +126,10 @@ class cmake * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const std::string& dir) - { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - } - const char* GetStartDirectory() const - { - return this->cmStartDirectory.c_str(); - } - void SetStartOutputDirectory(const std::string& dir) - { - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - } - const char* GetStartOutputDirectory() const - { - return this->StartOutputDirectory.c_str(); - } + void SetStartDirectory(const std::string& dir); + const char* GetStartDirectory() const; + void SetStartOutputDirectory(const std::string& dir); + const char* GetStartOutputDirectory() const; //@} /** From 7bb4e3db069e06fe2eac053e329ffb9f1ea322bf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:45 +0200 Subject: [PATCH 18/22] cmMakefile: Out-of-line Home directory accessors. --- Source/cmMakefile.cxx | 10 ++++++++++ Source/cmMakefile.h | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 34b46218d2..dea9e4601d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3461,6 +3461,11 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } +const char* cmMakefile::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + void cmMakefile::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; @@ -3472,6 +3477,11 @@ void cmMakefile::SetHomeDirectory(const std::string& dir) } } +const char* cmMakefile::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + void cmMakefile::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5209891d2d..823acb1438 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -438,15 +438,9 @@ public: * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } + const char* GetHomeDirectory() const; void SetHomeOutputDirectory(const std::string& lib); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeOutputDirectory() const; //@} /** From fca2b542b43546c64aa2c474b810890e52bd0ea4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:48 +0200 Subject: [PATCH 19/22] cmMakefile: Internalize setting of CMakeInstance on Properties. --- Source/cmLocalGenerator.cxx | 1 - Source/cmMakefile.cxx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1998e4207..c143bce835 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -252,7 +252,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) this->Makefile->SetLocalGenerator(this); // setup the home directories - this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance()); this->Makefile->SetHomeDirectory( gg->GetCMakeInstance()->GetHomeDirectory()); this->Makefile->SetHomeOutputDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dea9e4601d..35be1b7e2e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -741,6 +741,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif + this->Properties.SetCMakeInstance(this->GetCMakeInstance()); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); } From 6ad86c7fc4167561c7c13c28482a5fea0fe9d70b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 18:47:24 +0200 Subject: [PATCH 20/22] cmMakefile: Remove bad comment. --- Source/cmMakefile.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 35be1b7e2e..ec0a165179 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1658,7 +1658,6 @@ void cmMakefile::InitializeFromParent() void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { - // copy our variables from the child makefile lg2->GetMakefile()->InitializeFromParent(); lg2->GetMakefile()->MakeStartDirectoriesCurrent(); if (this->GetCMakeInstance()->GetDebugOutput()) From ea819b29f8735ca09242cc646a7b25e933bc913c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 18:34:12 +0200 Subject: [PATCH 21/22] cmMakefile: Remove unused method. --- Source/cmMakefile.cxx | 27 --------------------------- Source/cmMakefile.h | 1 - 2 files changed, 28 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ec0a165179..35fdd0cc04 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1676,33 +1676,6 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } } -void cmMakefile::AddSubDirectory(const std::string& sub, - bool excludeFromAll) -{ - // the source path must be made full if it isn't already - std::string srcPath = sub; - if (!cmSystemTools::FileIsFullPath(srcPath.c_str())) - { - srcPath = this->GetCurrentDirectory(); - srcPath += "/"; - srcPath += sub; - } - - // binary path must be made full if it isn't already - std::string binPath = sub; - if (!cmSystemTools::FileIsFullPath(binPath.c_str())) - { - binPath = this->GetCurrentOutputDirectory(); - binPath += "/"; - binPath += sub; - } - - - this->AddSubDirectory(srcPath, binPath, - excludeFromAll, false); -} - - void cmMakefile::AddSubDirectory(const std::string& srcPath, const std::string& binPath, bool excludeFromAll, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 823acb1438..b78f921f2c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -281,7 +281,6 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const std::string&, bool excludeFromAll=false); void AddSubDirectory(const std::string& fullSrcDir, const std::string& fullBinDir, bool excludeFromAll, From 07d44d638bca028d2a76fb1ffdc1f1542184243c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 19:22:09 +0200 Subject: [PATCH 22/22] cmake: Remove confusing duplication. --- Source/cmake.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ec05a0ed45..7ccd76aef1 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -843,12 +843,8 @@ void cmake::SetArgs(const std::vector& args, { this->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); } this->SetStartDirectory(this->GetHomeDirectory());