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  b09b42069ca7cfe9510fafbf8e5282a49bb45e93 (commit)
       via  3b6f1587bed536e3d31e6665aff35aa27f5e79bc (commit)
      from  fddd06191565ba067f82b0baa6f33beabe78ccab (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=b09b42069ca7cfe9510fafbf8e5282a49bb45e93
commit b09b42069ca7cfe9510fafbf8e5282a49bb45e93
Merge: fddd061 3b6f158
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Oct 17 10:08:17 2016 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Oct 17 10:08:17 2016 -0400

    Merge topic 'refactor-folder-name-retrieval' into next
    
    3b6f1587 Factor IDE folder name retrieval out into helper method


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b6f1587bed536e3d31e6665aff35aa27f5e79bc
commit 3b6f1587bed536e3d31e6665aff35aa27f5e79bc
Author:     Gregor Jasny <gja...@googlemail.com>
AuthorDate: Tue Aug 30 20:55:37 2016 +0200
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Mon Oct 17 10:06:18 2016 -0400

    Factor IDE folder name retrieval out into helper method
    
    Add a `cmGeneratorTarget::GetEffectiveFolderName` helper to abstract
    lookup of the `FOLDER` property in combination with checking for
    generator support of folders.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 7eb0ebf..f11149a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1767,6 +1767,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
 {
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 68ffd5c..9382726 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -220,6 +220,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;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx 
b/Source/cmGhsMultiTargetGenerator.cxx
index 5fbaea4..3154f8d 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -44,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 += "/";
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1aa6af1..7d0c2da 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2377,7 +2377,7 @@ const char* 
cmGlobalGenerator::GetPredefinedTargetsFolder()
   return "CMakePredefinedTargets";
 }
 
-bool cmGlobalGenerator::UseFolderProperty()
+bool cmGlobalGenerator::UseFolderProperty() const
 {
   const char* prop =
     this->GetCMakeInstance()->GetState()->GetGlobalProperty("USE_FOLDERS");
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 38eaa76..c3498e0 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -334,6 +334,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.  */
@@ -463,7 +465,6 @@ protected:
     std::string const& name) const;
 
   const char* GetPredefinedTargetsFolder();
-  virtual bool UseFolderProperty();
 
 private:
 #if defined(CMAKE_BUILD_WITH_CMAKE)
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx 
b/Source/cmGlobalGhsMultiGenerator.cxx
index 0eac338..d4ae677 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -439,11 +439,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/cmGlobalVisualStudio7Generator.cxx 
b/Source/cmGlobalVisualStudio7Generator.cxx
index 3637fed..0287def 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -409,8 +409,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);
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index 0ddfc9a..7b1afa5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2723,8 +2723,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 += "/";
   }

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

Summary of changes:


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to