[Cmake-commits] CMake branch, next, updated. v2.8.12-4301-gcca0b6c

Stephen Kelly steveire at gmail.com
Tue Oct 22 17:07:15 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  cca0b6c1d0082f8eaa09549a3badfedd1b0da4e3 (commit)
       via  25f724c37e05c2eb4167765a74eadf79ca2d6bc5 (commit)
      from  b698e6691392d3f567815af0f347458bf10a1c74 (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=cca0b6c1d0082f8eaa09549a3badfedd1b0da4e3
commit cca0b6c1d0082f8eaa09549a3badfedd1b0da4e3
Merge: b698e66 25f724c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 17:07:08 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 22 17:07:08 2013 -0400

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


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25f724c37e05c2eb4167765a74eadf79ca2d6bc5
commit 25f724c37e05c2eb4167765a74eadf79ca2d6bc5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 20 20:39:16 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 22 23:04:21 2013 +0200

    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 b6182ab..0b40d08 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -985,15 +985,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 0707c62..9add198 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -395,10 +395,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..7a5c621 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -21,7 +21,10 @@ add_library(staticlib1 STATIC staticlib1.cpp)
 generate_export_header(staticlib1)
 add_library(staticlib2 STATIC staticlib2.cpp)
 generate_export_header(staticlib2)
+add_library(staticlib3 STATIC staticlib3.cpp)
+generate_export_header(staticlib3)
 target_link_libraries(staticlib1 LINK_PUBLIC staticlib2)
+target_link_libraries(staticlib1 LINK_PRIVATE "-L${CMAKE_CURRENT_BINARY_DIR} -Wl,--start-group -lstaticlib3 -Wl,--end-group")
 
 add_executable(staticlib_exe staticlib_exe.cpp)
 target_link_libraries(staticlib_exe staticlib1)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.cpp
new file mode 100644
index 0000000..570a911
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.cpp
@@ -0,0 +1,2 @@
+
+int staticlib3() { return 0; }
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.h
new file mode 100644
index 0000000..9c88522
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib3.h
@@ -0,0 +1,4 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int staticlib3();
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
index 3e4144f..884db39 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
@@ -5,4 +5,4 @@ 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)
+target_link_libraries(bar bat "-lz -lm")

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list