[Cmake-commits] CMake branch, next, updated. v2.8.12-4513-gd2ab3e6

Brad King brad.king at kitware.com
Sat Oct 26 10:11:53 EDT 2013


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  d2ab3e6997af6ee2150343e993dc7a9bc85ee5cb (commit)
       via  239b0c6b0ed821fd012a2a980961b9a9d43793e5 (commit)
      from  02ed4d7b1e6e00f594b0a4e504749cb184fd3840 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2ab3e6997af6ee2150343e993dc7a9bc85ee5cb
commit d2ab3e6997af6ee2150343e993dc7a9bc85ee5cb
Merge: 02ed4d7 239b0c6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sat Oct 26 10:11:50 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Oct 26 10:11:50 2013 -0400

    Merge topic 'fix-tll-static-private' into next
    
    239b0c6 Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=239b0c6b0ed821fd012a2a980961b9a9d43793e5
commit 239b0c6b0ed821fd012a2a980961b9a9d43793e5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 20 20:39:16 2013 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Sat Oct 26 10:10:20 2013 -0400

    Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
    
    Only valid target names or generator expressions may appear in
    the target field of a LINK_ONLY expression.
    
    Other content like link flags should still be added to that property
    (wrapped in config-specific generator expressions), but not wrapped
    in LINK_ONLY. Otherwise undue warnings would be issued for the
    policy CMP0022.
    
    The LINK_ONLY expression only has an effect for actual target
    names anyway, so there is no logical deficit.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ac655da..c9095df 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2331,15 +2331,20 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf,
   i += this->PrevLinkedLibraries.size();
   for( ; i != libs.end(); ++i )
     {
+    const char *lib = i->first.c_str();
     // We call this so that the dependencies get written to the cache
-    this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second );
+    this->AddLinkLibrary( mf, selfname, lib, i->second );
 
     if (this->GetType() == cmTarget::STATIC_LIBRARY)
       {
-      this->AppendProperty("INTERFACE_LINK_LIBRARIES",
-            ("$<LINK_ONLY:" +
-            this->GetDebugGeneratorExpressions(i->first.c_str(), i->second) +
-            ">").c_str());
+      std::string configLib = this->GetDebugGeneratorExpressions(lib,
+                                                                 i->second);
+      if (cmGeneratorExpression::IsValidTargetName(lib)
+          || cmGeneratorExpression::Find(lib) != std::string::npos)
+        {
+        configLib = "$<LINK_ONLY:" + configLib + ">";
+        }
+        this->AppendProperty("INTERFACE_LINK_LIBRARIES", configLib.c_str());
       }
     }
   this->PrevLinkedLibraries = libs;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 863b391..6030a44 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -384,10 +384,15 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
       {
       if (this->Target->GetType() == cmTarget::STATIC_LIBRARY)
         {
+        std::string configLib = this->Target
+                                     ->GetDebugGeneratorExpressions(lib, llt);
+        if (cmGeneratorExpression::IsValidTargetName(lib)
+            || cmGeneratorExpression::Find(lib) != std::string::npos)
+          {
+          configLib = "$<LINK_ONLY:" + configLib + ">";
+          }
         this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
-                  ("$<LINK_ONLY:" +
-                  this->Target->GetDebugGeneratorExpressions(lib, llt) +
-                  ">").c_str());
+                                     configLib.c_str());
         }
       // Not a 'public' or 'interface' library. Do not add to interface
       // property.
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
index 07d7c43..33757b6 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -22,6 +22,9 @@ generate_export_header(staticlib1)
 add_library(staticlib2 STATIC staticlib2.cpp)
 generate_export_header(staticlib2)
 target_link_libraries(staticlib1 LINK_PUBLIC staticlib2)
+if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
+  target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v")
+endif()
 
 add_executable(staticlib_exe staticlib_exe.cpp)
 target_link_libraries(staticlib_exe staticlib1)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
index 3e4144f..ad3b8df 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
@@ -5,4 +5,8 @@ add_library(foo STATIC empty_vs6_1.cpp)
 add_library(bar STATIC empty_vs6_2.cpp)
 add_library(bat STATIC empty_vs6_3.cpp)
 target_link_libraries(foo bar)
-target_link_libraries(bar bat)
+# The last element here needs to contain a space so that it is a single
+# element which is not a valid target name. As bar is a STATIC library,
+# this tests that the LINK_ONLY generator expression is not used for
+# that element, creating an error.
+target_link_libraries(bar bat "-lz -lm")

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list