[Cmake-commits] CMake branch, next, updated. v3.7.0-1133-g9b8450a

Brad King brad.king at kitware.com
Mon Nov 14 11:24:48 EST 2016


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, next has been updated
       via  9b8450a4a95777151048b769a2fd8cd79fd0bd92 (commit)
       via  516a2cd3604ccebe9d0e74248ded9fb7b07bac71 (commit)
      from  e2ebe9d929c61f16cc0847a53b32b4d4475f8244 (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=9b8450a4a95777151048b769a2fd8cd79fd0bd92
commit 9b8450a4a95777151048b769a2fd8cd79fd0bd92
Merge: e2ebe9d 516a2cd
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 14 11:24:43 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 14 11:24:43 2016 -0500

    Merge topic 'cmake-server-fix-16423' into next
    
    516a2cd3 server-mode: Reset GlobalGenerator before configure


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=516a2cd3604ccebe9d0e74248ded9fb7b07bac71
commit 516a2cd3604ccebe9d0e74248ded9fb7b07bac71
Author:     Tobias Hunger <tobias.hunger at qt.io>
AuthorDate: Mon Nov 14 16:54:04 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 14 11:06:37 2016 -0500

    server-mode: Reset GlobalGenerator before configure
    
    This is what cmake-gui also does to avoid CMake crashing on repeated
    attempts to configure it.
    
    Fixes #16423.

diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 09b08fe..d35efe0 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -381,25 +381,9 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request,
     return false;
   }
 
-  const std::string fullGeneratorName =
-    cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
-      generator, extraGenerator);
-
-  cm->SetGeneratorToolset(toolset);
-  cm->SetGeneratorPlatform(platform);
-
-  cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName);
-  if (!gg) {
-    setErrorMessage(
-      errorMessage,
-      std::string("Could not set up the requested combination of \"") +
-        kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\"");
-    return false;
-  }
-
-  cm->SetGlobalGenerator(gg);
-  cm->SetHomeDirectory(sourceDirectory);
-  cm->SetHomeOutputDirectory(buildDirectory);
+  this->GeneratorInfo =
+    GeneratorInformation(generator, extraGenerator, toolset, platform,
+                         sourceDirectory, buildDirectory);
 
   this->m_State = STATE_ACTIVE;
   return true;
@@ -931,6 +915,13 @@ cmServerResponse cmServerProtocol1_0::ProcessConfigure(
 
   FileMonitor()->StopMonitoring();
 
+  std::string errorMessage;
+  cmake* cm = this->CMakeInstance();
+  this->GeneratorInfo.SetupGenerator(cm, &errorMessage);
+  if (!errorMessage.empty()) {
+    return request.ReportError(errorMessage);
+  }
+
   // Make sure the types of cacheArguments matches (if given):
   std::vector<std::string> cacheArgs;
   bool cacheArgumentsError = false;
@@ -955,15 +946,13 @@ cmServerResponse cmServerProtocol1_0::ProcessConfigure(
       "cacheArguments must be unset, a string or an array of strings.");
   }
 
-  cmake* cm = this->CMakeInstance();
   std::string sourceDir = cm->GetHomeDirectory();
   const std::string buildDir = cm->GetHomeOutputDirectory();
 
   cmGlobalGenerator* gg = cm->GetGlobalGenerator();
 
   if (buildDir.empty()) {
-    return request.ReportError(
-      "No build directory set via setGlobalSettings.");
+    return request.ReportError("No build directory set via Handshake.");
   }
 
   if (cm->LoadCache(buildDir)) {
@@ -1038,14 +1027,12 @@ cmServerResponse cmServerProtocol1_0::ProcessGlobalSettings(
   obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli();
   obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars();
 
-  obj[kSOURCE_DIRECTORY_KEY] = cm->GetHomeDirectory();
-  obj[kBUILD_DIRECTORY_KEY] = cm->GetHomeOutputDirectory();
+  obj[kSOURCE_DIRECTORY_KEY] = this->GeneratorInfo.SourceDirectory;
+  obj[kBUILD_DIRECTORY_KEY] = this->GeneratorInfo.BuildDirectory;
 
   // Currently used generator:
-  cmGlobalGenerator* gen = cm->GetGlobalGenerator();
-  obj[kGENERATOR_KEY] = gen ? gen->GetName() : std::string();
-  obj[kEXTRA_GENERATOR_KEY] =
-    gen ? gen->GetExtraGeneratorName() : std::string();
+  obj[kGENERATOR_KEY] = this->GeneratorInfo.GeneratorName;
+  obj[kEXTRA_GENERATOR_KEY] = this->GeneratorInfo.ExtraGeneratorName;
 
   return request.Reply(obj);
 }
@@ -1109,3 +1096,41 @@ cmServerResponse cmServerProtocol1_0::ProcessFileSystemWatchers(
 
   return request.Reply(result);
 }
+
+cmServerProtocol1_0::GeneratorInformation::GeneratorInformation(
+  const std::string& generatorName, const std::string& extraGeneratorName,
+  const std::string& toolset, const std::string& platform,
+  const std::string& sourceDirectory, const std::string& buildDirectory)
+  : GeneratorName(generatorName)
+  , ExtraGeneratorName(extraGeneratorName)
+  , Toolset(toolset)
+  , Platform(platform)
+  , SourceDirectory(sourceDirectory)
+  , BuildDirectory(buildDirectory)
+{
+}
+
+void cmServerProtocol1_0::GeneratorInformation::SetupGenerator(
+  cmake* cm, std::string* errorMessage)
+{
+  const std::string fullGeneratorName =
+    cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
+      GeneratorName, ExtraGeneratorName);
+
+  cm->SetHomeDirectory(SourceDirectory);
+  cm->SetHomeOutputDirectory(BuildDirectory);
+
+  cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName);
+  if (!gg) {
+    setErrorMessage(
+      errorMessage,
+      std::string("Could not set up the requested combination of \"") +
+        kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\"");
+    return;
+  }
+
+  cm->SetGlobalGenerator(gg);
+
+  cm->SetGeneratorToolset(Toolset);
+  cm->SetGeneratorPlatform(Platform);
+}
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 5238d5d..027f145 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -131,4 +131,28 @@ private:
   State m_State = STATE_INACTIVE;
 
   bool m_isDirty = false;
+
+  struct GeneratorInformation
+  {
+  public:
+    GeneratorInformation() = default;
+    GeneratorInformation(const std::string& generatorName,
+                         const std::string& extraGeneratorName,
+                         const std::string& toolset,
+                         const std::string& platform,
+                         const std::string& sourceDirectory,
+                         const std::string& buildDirectory);
+
+    void SetupGenerator(cmake* cm, std::string* errorMessage);
+
+    std::string GeneratorName;
+    std::string ExtraGeneratorName;
+    std::string Toolset;
+    std::string Platform;
+
+    std::string SourceDirectory;
+    std::string BuildDirectory;
+  };
+
+  GeneratorInformation GeneratorInfo;
 };

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

Summary of changes:
 Source/cmServerProtocol.cxx |   81 ++++++++++++++++++++++++++++---------------
 Source/cmServerProtocol.h   |   24 +++++++++++++
 2 files changed, 77 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list