[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-252-gda3c79a

Stephen Kelly steveire at gmail.com
Fri Oct 7 16:04:45 EDT 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  da3c79a376774a27792e349381ea727bc91e1eef (commit)
       via  d8633d344b2393a38746898963f7fdd5c997098a (commit)
      from  9f667ee9f52f436a3d43121d43c8efe4e05709e1 (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=da3c79a376774a27792e349381ea727bc91e1eef
commit da3c79a376774a27792e349381ea727bc91e1eef
Merge: 9f667ee d8633d3
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 16:04:44 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 7 16:04:44 2016 -0400

    Merge topic 'clean-up-link-configuration' into next
    
    d8633d34 Revert "cmMakefile: Move link_libraries() related code out"


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8633d344b2393a38746898963f7fdd5c997098a
commit d8633d344b2393a38746898963f7fdd5c997098a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 22:04:20 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 22:04:20 2016 +0200

    Revert "cmMakefile: Move link_libraries() related code out"
    
    This reverts commit 9723f4ddb9cc0767b7b963aa31def62c11b05c50.

diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 10b4b76..96ad82a 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -2,8 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddExecutableCommand.h"
 
-#include "cmLinkLibrariesCommand.h"
-
 // cmExecutableCommand
 bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
                                          cmExecutionStatus&)
@@ -190,9 +188,6 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
   std::vector<std::string> srclists(s, args.end());
   cmTarget* tgt =
     this->Makefile->AddExecutable(exename.c_str(), srclists, excludeFromAll);
-
-  cmLinkLibrariesCommand::PopulateTarget(*tgt, this->Makefile);
-
   if (use_win32) {
     tgt->SetProperty("WIN32_EXECUTABLE", "ON");
   }
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 8c02f75..26e38b8 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -4,7 +4,6 @@
 
 #include "cmState.h"
 #include "cmake.h"
-#include "cmLinkLibrariesCommand.h"
 
 // cmLibraryCommand
 bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
@@ -356,9 +355,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
 
   srclists.insert(srclists.end(), s, args.end());
 
-  cmTarget* tgt = this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
-
-  cmLinkLibrariesCommand::PopulateTarget(*tgt, this->Makefile);
+  this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
 
   return true;
 }
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index ecf3f57..4202cf5 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -35,57 +35,3 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
 
   return true;
 }
-
-void cmLinkLibrariesCommand::PopulateTarget(cmTarget& target, cmMakefile* mf)
-{
-  // for these targets do not add anything
-  switch (target.GetType()) {
-    case cmState::UTILITY:
-    case cmState::GLOBAL_TARGET:
-    case cmState::INTERFACE_LIBRARY:
-      return;
-    default:;
-  }
-  if (const char* linkDirsProp = mf->GetProperty("LINK_DIRECTORIES")) {
-    std::vector<std::string> linkDirs;
-    cmSystemTools::ExpandListArgument(linkDirsProp, linkDirs);
-
-    for (std::vector<std::string>::iterator j = linkDirs.begin();
-         j != linkDirs.end(); ++j) {
-      std::string newdir = *j;
-      // remove trailing slashes
-      if (*j->rbegin() == '/') {
-        newdir = j->substr(0, j->size() - 1);
-      }
-      target.AddLinkDirectory(*j);
-    }
-  }
-
-  if (const char* linkLibsProp = mf->GetProperty("LINK_LIBRARIES")) {
-    std::vector<std::string> linkLibs;
-    cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
-
-    for (std::vector<std::string>::iterator j = linkLibs.begin();
-         j != linkLibs.end(); ++j) {
-      std::string libraryName = *j;
-      cmTargetLinkLibraryType libType = GENERAL_LibraryType;
-      if (libraryName == "optimized")
-      {
-        libType = OPTIMIZED_LibraryType;
-        ++j;
-        libraryName = *j;
-      } else
-      if (libraryName == "debug")
-      {
-        libType = DEBUG_LibraryType;
-        ++j;
-        libraryName = *j;
-      }
-      // This is equivalent to the target_link_libraries plain signature.
-      target.AddLinkLibrary(*mf, libraryName, libType);
-      target.AppendProperty(
-        "INTERFACE_LINK_LIBRARIES",
-        target.GetDebugGeneratorExpressions(libraryName, libType).c_str());
-    }
-  }
-}
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 5170f03..b4943b6 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -27,8 +27,6 @@ public:
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) CM_OVERRIDE;
 
-  static void PopulateTarget(cmTarget& target, cmMakefile* mf);
-
   /**
    * The name of the command as specified in CMakeList.txt.
    */
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c4d6103..d443423 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1771,6 +1771,60 @@ void cmMakefile::SetProjectName(std::string const& p)
   this->StateSnapshot.SetProjectName(p);
 }
 
+void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
+{
+  // for these targets do not add anything
+  switch (target.GetType()) {
+    case cmState::UTILITY:
+    case cmState::GLOBAL_TARGET:
+    case cmState::INTERFACE_LIBRARY:
+      return;
+    default:;
+  }
+  if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) {
+    std::vector<std::string> linkDirs;
+    cmSystemTools::ExpandListArgument(linkDirsProp, linkDirs);
+
+    for (std::vector<std::string>::iterator j = linkDirs.begin();
+         j != linkDirs.end(); ++j) {
+      std::string newdir = *j;
+      // remove trailing slashes
+      if (*j->rbegin() == '/') {
+        newdir = j->substr(0, j->size() - 1);
+      }
+      target.AddLinkDirectory(*j);
+    }
+  }
+
+  if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+    std::vector<std::string> linkLibs;
+    cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+
+    for (std::vector<std::string>::iterator j = linkLibs.begin();
+         j != linkLibs.end(); ++j) {
+      std::string libraryName = *j;
+      cmTargetLinkLibraryType libType = GENERAL_LibraryType;
+      if (libraryName == "optimized")
+      {
+        libType = OPTIMIZED_LibraryType;
+        ++j;
+        libraryName = *j;
+      } else
+      if (libraryName == "debug")
+      {
+        libType = DEBUG_LibraryType;
+        ++j;
+        libraryName = *j;
+      }
+      // This is equivalent to the target_link_libraries plain signature.
+      target.AddLinkLibrary(*this, libraryName, libType);
+      target.AppendProperty(
+        "INTERFACE_LINK_LIBRARIES",
+        target.GetDebugGeneratorExpressions(libraryName, libType).c_str());
+    }
+  }
+}
+
 void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName)
 {
   this->AliasTargets[lname] = tgtName;
@@ -1795,6 +1849,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
   }
   target->AddSources(srcs);
+  this->AddGlobalLinkInformation(*target);
   return target;
 }
 
@@ -1807,6 +1862,7 @@ cmTarget* cmMakefile::AddExecutable(const char* exeName,
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
   }
   target->AddSources(srcs);
+  this->AddGlobalLinkInformation(*target);
   return target;
 }
 
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c9ab3ba..8fef38b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -771,6 +771,9 @@ public:
   void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen);
 
 protected:
+  // add link libraries and directories to the target
+  void AddGlobalLinkInformation(cmTarget& target);
+
   // Check for a an unused variable
   void LogUnused(const char* reason, const std::string& name) const;
 

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

Summary of changes:
 Source/cmAddExecutableCommand.cxx |    5 ----
 Source/cmAddLibraryCommand.cxx    |    5 +---
 Source/cmLinkLibrariesCommand.cxx |   54 -----------------------------------
 Source/cmLinkLibrariesCommand.h   |    2 --
 Source/cmMakefile.cxx             |   56 +++++++++++++++++++++++++++++++++++++
 Source/cmMakefile.h               |    3 ++
 6 files changed, 60 insertions(+), 65 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list