[Cmake-commits] CMake branch, master, updated. v3.12.2-614-g42212f7

Kitware Robot kwrobot at kitware.com
Wed Sep 12 09:45:04 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  42212f7539040139ecec092547b7d58ef12a4d72 (commit)
       via  708b3fecfe4ea4f92f49bb5eea5c9eed370a5956 (commit)
       via  1c1a1e08e82626aaf53ec0285ff4eabdb75d6d71 (commit)
       via  920ac301b5516273036fdabb334bcd38dff20a20 (commit)
       via  8bf5c2326e3e37a3431adb72a1cb46623a65f331 (commit)
       via  c1fd1607b8b2e879258f4257a86f9262ccd3d27c (commit)
       via  e8213404cec972ba43b16ec1b49b62f43c9f48b8 (commit)
       via  3e125c0c017e346768f9882882c31b81cc07940f (commit)
       via  8fdf08c097edadd134dc36cc80b4b557cddbfea8 (commit)
       via  13d10ee61642ab384d506fa81a991e51d90c6488 (commit)
      from  e7a45e3ec34df651ea165ea7344c474245ded7df (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42212f7539040139ecec092547b7d58ef12a4d72
commit 42212f7539040139ecec092547b7d58ef12a4d72
Merge: 708b3fe 3e125c0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 12 13:39:41 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 12 09:39:46 2018 -0400

    Merge topic 'rule-launch-custom-extra-space'
    
    3e125c0c01 Ninja,Makefile: Drop extra space after RULE_LAUNCH_CUSTOM value
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2372


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=708b3fecfe4ea4f92f49bb5eea5c9eed370a5956
commit 708b3fecfe4ea4f92f49bb5eea5c9eed370a5956
Merge: 1c1a1e0 13d10ee
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 12 13:38:30 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 12 09:38:37 2018 -0400

    Merge topic 'gicv-stdstring'
    
    13d10ee616 cmState::GetInitializedCacheValue: Return as const std::string*
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2365


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c1a1e08e82626aaf53ec0285ff4eabdb75d6d71
commit 1c1a1e08e82626aaf53ec0285ff4eabdb75d6d71
Merge: 920ac30 8fdf08c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 12 13:37:53 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 12 09:37:58 2018 -0400

    Merge topic 'IAR_6_50_6_fix'
    
    8fdf08c097 IAR: Fix compiler id, version, and arch detection on 6.50.6
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2371


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=920ac301b5516273036fdabb334bcd38dff20a20
commit 920ac301b5516273036fdabb334bcd38dff20a20
Merge: 8bf5c23 c1fd160
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 12 09:36:46 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 12 09:36:46 2018 -0400

    Merge branch 'release-3.12'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bf5c2326e3e37a3431adb72a1cb46623a65f331
commit 8bf5c2326e3e37a3431adb72a1cb46623a65f331
Merge: e7a45e3 e821340
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 12 13:35:39 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 12 09:35:45 2018 -0400

    Merge topic 'FindDoxygen-CMP0057'
    
    e8213404ce FindDoxygen: Ensure policy settings allow use of IN_LIST
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2373


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e125c0c017e346768f9882882c31b81cc07940f
commit 3e125c0c017e346768f9882882c31b81cc07940f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 11 14:04:33 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 11 14:18:10 2018 -0400

    Ninja,Makefile: Drop extra space after RULE_LAUNCH_CUSTOM value
    
    The Ninja and Makefile generators were adding a space to the value both
    before and after expanding rule variables.  Only the latter is needed.
    
    While at it, revise some outdated comments since the rule variable
    expansion is no longer responsible for inserting the launcher.
    
    Suggested-by: Mate Pek <mate.pek at gmail.com>
    Fixes: #18340

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 360f73d..eb31478 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -564,8 +564,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
     return std::string();
   }
 
-  // Expand rules in the empty string.  It may insert the launcher and
-  // perform replacements.
+  // Expand rule variables referenced in the given launcher command.
   cmRulePlaceholderExpander::RuleVariables vars;
 
   std::string output;
@@ -580,12 +579,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
   }
   vars.Output = output.c_str();
 
-  std::string launcher = property_value;
-  launcher += " ";
-
   std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
     this->CreateRulePlaceholderExpander());
 
+  std::string launcher = property_value;
   rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
   if (!launcher.empty()) {
     launcher += " ";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index bc83ce2..690b827 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -967,8 +967,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
       // Short-circuit if there is no launcher.
       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.
+        // Expand rule variables referenced in the given launcher command.
         cmRulePlaceholderExpander::RuleVariables vars;
         vars.CMTargetName = target->GetName().c_str();
         vars.CMTargetType = cmState::GetTargetTypeName(target->GetType());
@@ -986,7 +985,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
         vars.Output = output.c_str();
 
         launcher = val;
-        launcher += " ";
         rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
         if (!launcher.empty()) {
           launcher += " ";

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8fdf08c097edadd134dc36cc80b4b557cddbfea8
commit 8fdf08c097edadd134dc36cc80b4b557cddbfea8
Author:     Daniel Schürmann <daschuer at mixxx.org>
AuthorDate: Tue Sep 11 15:24:20 2018 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 11 10:43:03 2018 -0400

    IAR: Fix compiler id, version, and arch detection on 6.50.6
    
    The IAR 6.50.6 compiler places extra/truncated copies of the
    compiler id `INFO:` strings into binaries with a prefix like
    `?<Constant "`.  Teach CMakeDetermineCompilerId to ignore them.
    
    Fixes: #18333

diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index dc4d9be..5e2df26 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -525,6 +525,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
       ${CMAKE_${lang}_COMPILER_ID_STRINGS_PARAMETERS}
       REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
     set(COMPILER_ID_TWICE)
+    # With the IAR Compiler, some strings are found twice, first time as incomplete
+    # list like "?<Constant "INFO:compiler[IAR]">".  Remove the incomplete copies.
+    list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"")
     # In C# binaries, some strings are found more than once.
     list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS)
     foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13d10ee61642ab384d506fa81a991e51d90c6488
commit 13d10ee61642ab384d506fa81a991e51d90c6488
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Mon Sep 10 09:31:48 2018 -0400
Commit:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Mon Sep 10 09:31:48 2018 -0400

    cmState::GetInitializedCacheValue: Return as const std::string*

diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 0e14a3f..0133b88 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -94,11 +94,11 @@ void QCMake::setBinaryDirectory(const QString& _dir)
     }
     const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
     if (gen) {
-      const char* extraGen =
+      const std::string* extraGen =
         state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
       std::string curGen =
         cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
-          gen, extraGen ? extraGen : "");
+          gen, extraGen ? *extraGen : "");
       this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
     }
 
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index c7210b4..650d02d 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -68,12 +68,12 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
     return "";
   }
   if (strcmp(key, "CACHE") == 0) {
-    if (const char* c =
+    if (const std::string* c =
           this->Makefile->GetState()->GetInitializedCacheValue(var)) {
       if (this->EscapeQuotes) {
-        return this->AddString(cmSystemTools::EscapeQuotes(c));
+        return this->AddString(cmSystemTools::EscapeQuotes(*c));
       }
-      return this->AddString(c);
+      return this->AddString(*c);
     }
     return "";
   }
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 313d46b..34f58ad 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -215,7 +215,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
 
   std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
   cacheEntryName += envVar;
-  const char* cacheValue =
+  const std::string* cacheValue =
     lg->GetState()->GetInitializedCacheValue(cacheEntryName);
 
   // now we have both, decide which one to use
@@ -232,14 +232,14 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
     mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
   } else if (!envVarSet && cacheValue != nullptr) {
     // It is already in the cache, but not in the env, so use it from the cache
-    valueToUse = cacheValue;
+    valueToUse = *cacheValue;
   } else {
     // It is both in the cache and in the env.
     // Use the version from the env. except if the value from the env is
     // completely contained in the value from the cache (for the case that we
     // now have a PATH without MSVC dirs in the env. but had the full PATH with
     // all MSVC dirs during the cmake run which stored the var in the cache:
-    valueToUse = cacheValue;
+    valueToUse = *cacheValue;
     if (valueToUse.find(envVarValue) == std::string::npos) {
       valueToUse = envVarValue;
       mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b5212fc..99135c8 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -215,15 +215,15 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
   if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
     return;
   }
-  const char* cname =
+  const std::string* cname =
     this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
   std::string changeVars;
   if (cname && !optional) {
     std::string cnameString;
-    if (!cmSystemTools::FileIsFullPath(cname)) {
-      cnameString = cmSystemTools::FindProgram(cname);
+    if (!cmSystemTools::FileIsFullPath(*cname)) {
+      cnameString = cmSystemTools::FindProgram(*cname);
     } else {
-      cnameString = cname;
+      cnameString = *cname;
     }
     std::string pathString = path;
     // get rid of potentially multiple slashes:
@@ -239,7 +239,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
       }
       changeVars += langComp;
       changeVars += ";";
-      changeVars += cname;
+      changeVars += *cname;
       this->GetCMakeInstance()->GetState()->SetGlobalProperty(
         "__CMAKE_DELETE_CACHE_CHANGE_VARS_", changeVars.c_str());
     }
@@ -1970,7 +1970,7 @@ void cmGlobalGenerator::AddMakefile(cmMakefile* mf)
 
   // update progress
   // estimate how many lg there will be
-  const char* numGenC =
+  const std::string* numGenC =
     this->CMakeInstance->GetState()->GetInitializedCacheValue(
       "CMAKE_NUMBER_OF_MAKEFILES");
 
@@ -1988,7 +1988,7 @@ void cmGlobalGenerator::AddMakefile(cmMakefile* mf)
     return;
   }
 
-  int numGen = atoi(numGenC);
+  int numGen = atoi(numGenC->c_str());
   float prog = 0.9f * static_cast<float>(this->Makefiles.size()) /
     static_cast<float>(numGen);
   if (prog > 0.9f) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5498ad2..dce7bd0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1718,7 +1718,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
                                     cmStateEnums::CacheEntryType type,
                                     bool force)
 {
-  const char* existingValue = this->GetState()->GetInitializedCacheValue(name);
+  const std::string* existingValue =
+    this->GetState()->GetInitializedCacheValue(name);
   // must be outside the following if() to keep it alive long enough
   std::string nvalue;
 
@@ -1728,7 +1729,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
     // 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;
+      value = existingValue->c_str();
     }
     if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
       std::vector<std::string>::size_type cc;
@@ -1748,7 +1749,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
       }
 
       this->GetCMakeInstance()->AddCacheEntry(name, nvalue.c_str(), doc, type);
-      nvalue = this->GetState()->GetInitializedCacheValue(name);
+      nvalue = *this->GetState()->GetInitializedCacheValue(name);
       value = nvalue.c_str();
     }
   }
@@ -2368,17 +2369,15 @@ std::string cmMakefile::GetRequiredDefinition(const std::string& name) const
 
 bool cmMakefile::IsDefinitionSet(const std::string& name) const
 {
-  const char* def;
-  if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
-    def = d->c_str();
-  } else {
+  const std::string* def = this->StateSnapshot.GetDefinition(name);
+  if (!def) {
     def = this->GetState()->GetInitializedCacheValue(name);
   }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   if (cmVariableWatch* vv = this->GetVariableWatch()) {
     if (!def) {
       vv->VariableAccessed(
-        name, cmVariableWatch::UNKNOWN_VARIABLE_DEFINED_ACCESS, def, this);
+        name, cmVariableWatch::UNKNOWN_VARIABLE_DEFINED_ACCESS, nullptr, this);
     }
   }
 #endif
@@ -2387,10 +2386,8 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
 
 const char* cmMakefile::GetDefinition(const std::string& name) const
 {
-  const char* def;
-  if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
-    def = d->c_str();
-  } else {
+  const std::string* def = this->StateSnapshot.GetDefinition(name);
+  if (!def) {
     def = this->GetState()->GetInitializedCacheValue(name);
   }
 #ifdef CMAKE_BUILD_WITH_CMAKE
@@ -2400,21 +2397,20 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
       vv->VariableAccessed(name,
                            def ? cmVariableWatch::VARIABLE_READ_ACCESS
                                : cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS,
-                           def, this);
+                           (def ? def->c_str() : nullptr), this);
 
     if (watch_function_executed) {
       // A callback was executed and may have caused re-allocation of the
       // variable storage.  Look it up again for now.
       // FIXME: Refactor variable storage to avoid this problem.
-      if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
-        def = d->c_str();
-      } else {
+      def = this->StateSnapshot.GetDefinition(name);
+      if (!def) {
         def = this->GetState()->GetInitializedCacheValue(name);
       }
     }
   }
 #endif
-  return def;
+  return (def ? def->c_str() : nullptr);
 }
 
 const char* cmMakefile::GetSafeDefinition(const std::string& def) const
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index af4b466..0ed3953 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -1340,20 +1340,20 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
 
   if (cm->LoadCache(buildDir)) {
     // build directory has been set up before
-    const char* cachedSourceDir =
+    const std::string* cachedSourceDir =
       cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
     if (!cachedSourceDir) {
       return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache.");
     }
     if (sourceDir.empty()) {
-      sourceDir = std::string(cachedSourceDir);
+      sourceDir = *cachedSourceDir;
       cm->SetHomeDirectory(sourceDir);
     }
 
-    const char* cachedGenerator =
+    const std::string* cachedGenerator =
       cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR");
     if (cachedGenerator) {
-      if (gg && gg->GetName() != cachedGenerator) {
+      if (gg && gg->GetName() != *cachedGenerator) {
         return request.ReportError("Configured generator does not match with "
                                    "CMAKE_GENERATOR found in cache.");
       }
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index e01bf71..c8b8653 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -140,10 +140,10 @@ const char* cmState::GetCacheEntryValue(std::string const& key) const
   return e->Value.c_str();
 }
 
-const char* cmState::GetInitializedCacheValue(std::string const& key) const
+const std::string* cmState::GetInitializedCacheValue(
+  std::string const& key) const
 {
-  const std::string* p = this->CacheManager->GetInitializedCacheValue(key);
-  return p ? p->c_str() : nullptr;
+  return this->CacheManager->GetInitializedCacheValue(key);
 }
 
 cmStateEnums::CacheEntryType cmState::GetCacheEntryType(
diff --git a/Source/cmState.h b/Source/cmState.h
index 38bdfec..ca7093a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -68,7 +68,7 @@ public:
 
   std::vector<std::string> GetCacheEntryKeys() const;
   const char* GetCacheEntryValue(std::string const& key) const;
-  const char* GetInitializedCacheValue(std::string const& key) const;
+  const std::string* GetInitializedCacheValue(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);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1bf8f7d..783dbf2 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -319,9 +319,10 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         bool haveValue = false;
         std::string cachedValue;
         if (this->WarnUnusedCli) {
-          if (const char* v = this->State->GetInitializedCacheValue(var)) {
+          if (const std::string* v =
+                this->State->GetInitializedCacheValue(var)) {
             haveValue = true;
-            cachedValue = v;
+            cachedValue = *v;
           }
         }
 
@@ -331,7 +332,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
 
         if (this->WarnUnusedCli) {
           if (!haveValue ||
-              cachedValue != this->State->GetInitializedCacheValue(var)) {
+              cachedValue != *this->State->GetInitializedCacheValue(var)) {
             this->WatchUnusedCli(var);
           }
         }
@@ -1107,7 +1108,7 @@ int cmake::DoPreConfigureChecks()
   // do a sanity check on some values
   if (this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) {
     std::string cacheStart =
-      this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
+      *this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
     cacheStart += "/CMakeLists.txt";
     std::string currentStart = this->GetHomeDirectory();
     currentStart += "/CMakeLists.txt";
@@ -1276,14 +1277,14 @@ int cmake::ActualConfigure()
 
   // no generator specified on the command line
   if (!this->GlobalGenerator) {
-    const char* genName =
+    const std::string* genName =
       this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
-    const char* extraGenName =
+    const std::string* extraGenName =
       this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
     if (genName) {
       std::string fullName =
         cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
-          genName, extraGenName ? extraGenName : "");
+          *genName, extraGenName ? *extraGenName : "");
       this->GlobalGenerator = this->CreateGlobalGenerator(fullName);
     }
     if (this->GlobalGenerator) {
@@ -1301,14 +1302,14 @@ int cmake::ActualConfigure()
     }
   }
 
-  const char* genName =
+  const std::string* genName =
     this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
   if (genName) {
-    if (!this->GlobalGenerator->MatchesGeneratorName(genName)) {
+    if (!this->GlobalGenerator->MatchesGeneratorName(*genName)) {
       std::string message = "Error: generator : ";
       message += this->GlobalGenerator->GetName();
       message += "\nDoes not match the generator used previously: ";
-      message += genName;
+      message += *genName;
       message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
                  "directory or choose a different binary directory.";
       cmSystemTools::Error(message.c_str());
@@ -1325,14 +1326,14 @@ int cmake::ActualConfigure()
                         cmStateEnums::INTERNAL);
   }
 
-  if (const char* instance =
+  if (const std::string* instance =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) {
     if (!this->GeneratorInstance.empty() &&
-        this->GeneratorInstance != instance) {
+        this->GeneratorInstance != *instance) {
       std::string message = "Error: generator instance: ";
       message += this->GeneratorInstance;
       message += "\nDoes not match the instance used previously: ";
-      message += instance;
+      message += *instance;
       message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
                  "directory or choose a different binary directory.";
       cmSystemTools::Error(message.c_str());
@@ -1344,14 +1345,14 @@ int cmake::ActualConfigure()
       "Generator instance identifier.", cmStateEnums::INTERNAL);
   }
 
-  if (const char* platformName =
+  if (const std::string* platformName =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
     if (!this->GeneratorPlatform.empty() &&
-        this->GeneratorPlatform != platformName) {
+        this->GeneratorPlatform != *platformName) {
       std::string message = "Error: generator platform: ";
       message += this->GeneratorPlatform;
       message += "\nDoes not match the platform used previously: ";
-      message += platformName;
+      message += *platformName;
       message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
                  "directory or choose a different binary directory.";
       cmSystemTools::Error(message.c_str());
@@ -1363,13 +1364,13 @@ int cmake::ActualConfigure()
                         "Name of generator platform.", cmStateEnums::INTERNAL);
   }
 
-  if (const char* tsName =
+  if (const std::string* tsName =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
-    if (!this->GeneratorToolset.empty() && this->GeneratorToolset != tsName) {
+    if (!this->GeneratorToolset.empty() && this->GeneratorToolset != *tsName) {
       std::string message = "Error: generator toolset: ";
       message += this->GeneratorToolset;
       message += "\nDoes not match the toolset used previously: ";
-      message += tsName;
+      message += *tsName;
       message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
                  "directory or choose a different binary directory.";
       cmSystemTools::Error(message.c_str());
@@ -1685,7 +1686,8 @@ std::string cmake::StripExtension(const std::string& file) const
 
 const char* cmake::GetCacheDefinition(const std::string& name) const
 {
-  return this->State->GetInitializedCacheValue(name);
+  const std::string* p = this->State->GetInitializedCacheValue(name);
+  return p ? p->c_str() : nullptr;
 }
 
 void cmake::AddScriptingCommands()
@@ -1868,14 +1870,14 @@ void cmake::PrintGeneratorList()
 void cmake::UpdateConversionPathTable()
 {
   // Update the path conversion table with any specified file:
-  const char* tablepath =
+  const std::string* tablepath =
     this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
 
   if (tablepath) {
-    cmsys::ifstream table(tablepath);
+    cmsys::ifstream table(tablepath->c_str());
     if (!table) {
-      cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", tablepath,
-                           ". CMake can not open file.");
+      cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ",
+                           tablepath->c_str(), ". CMake can not open file.");
       cmSystemTools::ReportLastSystemError("CMake can not open file.");
     } else {
       std::string a, b;
@@ -2527,11 +2529,11 @@ bool cmake::Open(const std::string& dir, bool dryRun)
     std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
     return false;
   }
-  const char* extraGenName =
+  const std::string* extraGenName =
     this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
   std::string fullName =
     cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
-      genName, extraGenName ? extraGenName : "");
+      genName, extraGenName ? *extraGenName : "");
 
   std::unique_ptr<cmGlobalGenerator> gen(
     this->CreateGlobalGenerator(fullName));

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeDetermineCompilerId.cmake   |  3 ++
 Modules/FindDoxygen.cmake                |  5 +++
 Source/QtDialog/QCMake.cxx               |  4 +--
 Source/cmCommandArgumentParserHelper.cxx |  6 ++--
 Source/cmExtraEclipseCDT4Generator.cxx   |  6 ++--
 Source/cmGlobalGenerator.cxx             | 14 ++++-----
 Source/cmLocalNinjaGenerator.cxx         |  7 ++---
 Source/cmLocalUnixMakefileGenerator3.cxx |  4 +--
 Source/cmMakefile.cxx                    | 30 ++++++++----------
 Source/cmServerProtocol.cxx              |  8 ++---
 Source/cmState.cxx                       |  6 ++--
 Source/cmState.h                         |  2 +-
 Source/cmake.cxx                         | 54 +++++++++++++++++---------------
 13 files changed, 75 insertions(+), 74 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list