diff options
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmDefinitions.cxx | 37 | ||||
-rw-r--r-- | Source/cmDefinitions.h | 19 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 |
6 files changed, 40 insertions, 39 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 001e670..4a8cdb0 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 2) -set(CMake_VERSION_PATCH 20150503) +set(CMake_VERSION_PATCH 20150504) #set(CMake_VERSION_RC 1) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 61328be..f54bc4d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -11,38 +11,39 @@ ============================================================================*/ #include "cmDefinitions.h" -//---------------------------------------------------------------------------- -cmDefinitions::Def cmDefinitions::NoDef; +#include <assert.h> //---------------------------------------------------------------------------- -cmDefinitions::cmDefinitions(cmDefinitions* parent) - : Up(parent) -{ -} +cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key) +cmDefinitions::Def const& cmDefinitions::GetInternal( + const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { - MapType::const_iterator i = this->Map.find(key); - if(i != this->Map.end()) + assert(rbegin != rend); + MapType::const_iterator i = rbegin->Map.find(key); + if (i != rbegin->Map.end()) { return i->second; } - cmDefinitions* up = this->Up; - if(!up) + std::list<cmDefinitions>::reverse_iterator rit = rbegin; + ++rit; + if (rit == rend) { - return this->NoDef; + return cmDefinitions::NoDef; } - // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); - return this->Map.insert(MapType::value_type(key, def)).first->second; + Def const& def = cmDefinitions::GetInternal(key, rit, rend); + return rbegin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) +const char* cmDefinitions::Get(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { - Def const& def = this->GetInternal(key); + Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4c7f11f..b244793 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -29,15 +29,11 @@ class cmDefinitions { public: - /** Construct with the given parent scope. */ - cmDefinitions(cmDefinitions* parent = 0); - - /** Returns the parent scope, if any. */ - cmDefinitions* GetParent() const { return this->Up; } - /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const std::string& key); + static const char* Get(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); @@ -69,9 +65,6 @@ private: }; static Def NoDef; - // Parent scope, if any. - cmDefinitions* Up; - // Local definitions, set or unset. #if defined(CMAKE_BUILD_WITH_CMAKE) typedef cmsys::hash_map<std::string, Def> MapType; @@ -80,9 +73,9 @@ private: #endif MapType Map; - // Internal query and update methods. - Def const& GetInternal(const std::string& key); - + static Def const& GetInternal(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend); void MakeClosure(std::set<std::string>& undefined, std::list<cmDefinitions>::const_reverse_iterator rbegin, std::list<cmDefinitions>::const_reverse_iterator rend); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 9f83b86..aee22ec 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -95,6 +95,7 @@ public: * Set to true if the make tool being used is MinGW Make. */ void SetMinGWMake(bool v) {this->MinGWMake = v;} + bool IsMinGWMake() const { return this->MinGWMake; } /** * Set to true if the make tool being used is NMake. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b7b4f79..7b3ca53 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -53,12 +53,7 @@ public: void PushDefinitions() { - cmDefinitions* parent = 0; - if (!this->VarStack.empty()) - { - parent = &this->VarStack.back(); - } - this->VarStack.push_back(cmDefinitions(parent)); + this->VarStack.push_back(cmDefinitions()); } void InitializeDefinitions(cmMakefile* parent) @@ -70,7 +65,8 @@ public: const char* GetDefinition(std::string const& name) { - return this->VarStack.back().Get(name); + return cmDefinitions::Get(name, this->VarStack.rbegin(), + this->VarStack.rend()); } void SetDefinition(std::string const& name, std::string const& value) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index d28dde1..a4dad1e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -24,6 +24,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -681,6 +682,15 @@ cmMakefileTargetGenerator this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); + + if (this->LocalGenerator->IsMinGWMake() && + cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) + { + // mingw32-make incorrectly interprets 'a\ b c' as 'a b' and 'c' + // (but 'a\ b "c"' as 'a\', 'b', and 'c'!). Workaround this by + // avoiding a trailing backslash in the argument. + targetOutPathCompilePDB[targetOutPathCompilePDB.size()-1] = '/'; + } } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; |