[Cmake-commits] CMake branch, next, updated. v2.8.6-1769-gaba5f57

Stephen Kelly steveire at gmail.com
Wed Nov 2 07:53:48 EDT 2011


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  aba5f5771d959fee46258cf4e6cdb83a7e5eb729 (commit)
       via  8587bc2f0928648bad50bcbddbde3870e71590e2 (commit)
       via  9ea6541ce98f96dfba9ef865d4445c62dd96cad6 (commit)
       via  a8faf5b4ccd611b17399e9a91ee5333f48e3a8aa (commit)
      from  aa28ba5a5dce708f79bea56129716118ea14eb48 (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=aba5f5771d959fee46258cf4e6cdb83a7e5eb729
commit aba5f5771d959fee46258cf4e6cdb83a7e5eb729
Merge: aa28ba5 8587bc2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 2 07:53:42 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 2 07:53:42 2011 -0400

    Merge topic 'target-link-libraries-interfaces' into next
    
    8587bc2 Add some tests for the new target_link_libraries features.
    9ea6541 Trim trailing whitespace.
    a8faf5b Remove unnecessary boolean.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8587bc2f0928648bad50bcbddbde3870e71590e2
commit 8587bc2f0928648bad50bcbddbde3870e71590e2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 2 12:43:53 2011 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Nov 2 12:46:20 2011 +0100

    Add some tests for the new target_link_libraries features.

diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
new file mode 100644
index 0000000..1faa888
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -0,0 +1,58 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(target_link_libraries)
+
+file(WRITE
+  "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
+  "int main() { return 0; }
+"
+)
+
+add_executable(
+  target_link_libraries
+  "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
+)
+
+macro(ASSERT_PROPERTY _target _property _value)
+  get_target_property(_out ${_target} ${_property})
+  if (NOT _out)
+    set(_out "")
+  endif()
+  if (NOT "${_out}" STREQUAL "${_value}")
+    message(SEND_ERROR "Target ${_target} does not have property ${_property} with value ${_value}. Actual value: ${_out}")
+  endif()
+endmacro()
+
+include(GenerateExportHeader)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_library(depA SHARED depA.cpp)
+generate_export_header(depA)
+
+add_library(depB SHARED depB.cpp)
+generate_export_header(depB)
+
+target_link_libraries(depB LINK_PRIVATE depA)
+
+add_library(depC SHARED depC.cpp)
+generate_export_header(depC)
+
+target_link_libraries(depC LINK_PUBLIC depA)
+
+assert_property(depA LINK_INTERFACE_LIBRARIES "")
+assert_property(depB LINK_INTERFACE_LIBRARIES "")
+assert_property(depC LINK_INTERFACE_LIBRARIES "depA")
+
+add_executable(targetA targetA.cpp)
+
+target_link_libraries(targetA LINK_INTERFACE_LIBRARIES depA depB)
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "depA;depB")
+
+set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "")
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+
+target_link_libraries(targetA depB depC)
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "")
diff --git a/Tests/CMakeCommands/target_link_libraries/depA.cpp b/Tests/CMakeCommands/target_link_libraries/depA.cpp
new file mode 100644
index 0000000..c2e8e7b
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depA.cpp
@@ -0,0 +1,7 @@
+
+#include "depA.h"
+
+int DepA::foo()
+{
+  return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depA.h b/Tests/CMakeCommands/target_link_libraries/depA.h
new file mode 100644
index 0000000..7a85948
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depA.h
@@ -0,0 +1,7 @@
+
+#include "depa_export.h"
+
+struct DEPA_EXPORT DepA
+{
+  int foo();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/depB.cpp b/Tests/CMakeCommands/target_link_libraries/depB.cpp
new file mode 100644
index 0000000..97e5be2
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depB.cpp
@@ -0,0 +1,11 @@
+
+#include "depB.h"
+
+#include "depA.h"
+
+int DepB::foo()
+{
+  DepA a;
+
+  return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depB.h b/Tests/CMakeCommands/target_link_libraries/depB.h
new file mode 100644
index 0000000..e617813
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depB.h
@@ -0,0 +1,7 @@
+
+#include "depb_export.h"
+
+struct DEPB_EXPORT DepB
+{
+  int foo();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/depC.cpp b/Tests/CMakeCommands/target_link_libraries/depC.cpp
new file mode 100644
index 0000000..93410a8
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depC.cpp
@@ -0,0 +1,13 @@
+
+#include "depC.h"
+
+int DepC::foo()
+{
+  return 0;
+}
+
+DepA DepC::getA()
+{
+  DepA a;
+  return a;
+}
\ No newline at end of file
diff --git a/Tests/CMakeCommands/target_link_libraries/depC.h b/Tests/CMakeCommands/target_link_libraries/depC.h
new file mode 100644
index 0000000..4d65c9e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depC.h
@@ -0,0 +1,12 @@
+
+#include "depc_export.h"
+
+#include "depA.h"
+
+struct DEPC_EXPORT DepC
+{
+  int foo();
+
+  DepA getA();
+
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/targetA.cpp b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
new file mode 100644
index 0000000..3c6472e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
@@ -0,0 +1,12 @@
+
+#include "depB.h"
+#include "depC.h"
+
+int main(int argc, char **argv)
+{
+  DepA a;
+  DepB b;
+  DepC c;
+
+  return a.foo() + b.foo() + c.foo();
+}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 78db39d..44ed2f5 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1574,6 +1574,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
     -P "${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command/RunCMake.cmake"
   )
 
+  ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
+
   CONFIGURE_FILE(
     "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"
     "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ea6541ce98f96dfba9ef865d4445c62dd96cad6
commit 9ea6541ce98f96dfba9ef865d4445c62dd96cad6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 2 12:43:01 2011 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Nov 2 12:43:01 2011 +0100

    Trim trailing whitespace.

diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index f4632bd..e91c46d 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -19,7 +19,7 @@
  *
  * cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
  * into executable(s) or shared objects. The names of the libraries
- * should be those defined by the LIBRARY(library) command(s).  
+ * should be those defined by the LIBRARY(library) command(s).
  */
 class cmTargetLinkLibrariesCommand : public cmCommand
 {
@@ -27,7 +27,7 @@ public:
   /**
    * This is a virtual constructor for the command.
    */
-  virtual cmCommand* Clone() 
+  virtual cmCommand* Clone()
     {
     return new cmTargetLinkLibrariesCommand;
     }
@@ -47,12 +47,12 @@ public:
   /**
    * Succinct documentation.
    */
-  virtual const char* GetTerseDocumentation() 
+  virtual const char* GetTerseDocumentation()
     {
-    return 
+    return
       "Link a target to given libraries.";
     }
-  
+
   /**
    * More documentation.
    */
@@ -142,7 +142,7 @@ public:
       ")"
       ;
     }
-  
+
   cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
 private:
   void LinkLibraryTypeSpecifierWarning(int left, int right);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8faf5b4ccd611b17399e9a91ee5333f48e3a8aa
commit a8faf5b4ccd611b17399e9a91ee5333f48e3a8aa
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 2 12:42:27 2011 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Nov 2 12:42:27 2011 +0100

    Remove unnecessary boolean.

diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 2a40164..ab35c97 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -98,8 +98,6 @@ bool cmTargetLinkLibrariesCommand
   // specification if the keyword is encountered as the first argument.
   this->CurrentProcessingState = ProcessingLinkLibraries;
 
-  this->SpecifiesPublicAndPrivate = false;
-
   // add libraries, nothe that there is an optional prefix
   // of debug and optimized than can be used
   for(unsigned int i=1; i < args.size(); ++i)
@@ -128,10 +126,6 @@ bool cmTargetLinkLibrariesCommand
           );
         return true;
         }
-      if (this->CurrentProcessingState == ProcessingPrivateInterface)
-        {
-        this->SpecifiesPublicAndPrivate = true;
-        }
       this->CurrentProcessingState = ProcessingPublicInterface;
       }
     else if(args[i] == "LINK_PRIVATE")
@@ -145,10 +139,6 @@ bool cmTargetLinkLibrariesCommand
           );
         return true;
         }
-      if (this->CurrentProcessingState == ProcessingPublicInterface)
-        {
-        this->SpecifiesPublicAndPrivate = true;
-        }
       this->CurrentProcessingState = ProcessingPrivateInterface;
       }
     else if(args[i] == "debug")
@@ -222,12 +212,12 @@ bool cmTargetLinkLibrariesCommand
     cmSystemTools::SetFatalErrorOccured();
     }
 
-  // If the INTERFACE option was given, make sure the
-  // LINK_INTERFACE_LIBRARIES property exists.  This allows the
-  // command to be used to specify an empty link interface.
-  if((this->CurrentProcessingState == ProcessingLinkInterface
-        || (this->CurrentProcessingState == ProcessingPrivateInterface
-          && !this->SpecifiesPublicAndPrivate))
+  // If any of the LINK_ options were given, make sure the
+  // LINK_INTERFACE_LIBRARIES target property exists.
+  // Use of any of the new keywords implies awareness of
+  // this property. And if no libraries are named, it should
+  // result in an empty link interface.
+  if((this->CurrentProcessingState != ProcessingLinkInterface)
     && !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
     {
     this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 1c59020..f4632bd 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -158,8 +158,6 @@ private:
 
   ProcessingState CurrentProcessingState;
 
-  bool SpecifiesPublicAndPrivate;
-
   void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
 };
 

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

Summary of changes:
 Source/cmTargetLinkLibrariesCommand.cxx            |   22 ++------
 Source/cmTargetLinkLibrariesCommand.h              |   14 ++---
 .../target_link_libraries/CMakeLists.txt           |   58 ++++++++++++++++++++
 Tests/CMakeCommands/target_link_libraries/depA.cpp |    7 +++
 Tests/CMakeCommands/target_link_libraries/depA.h   |    7 +++
 Tests/CMakeCommands/target_link_libraries/depB.cpp |   11 ++++
 Tests/CMakeCommands/target_link_libraries/depB.h   |    7 +++
 Tests/CMakeCommands/target_link_libraries/depC.cpp |   13 +++++
 Tests/CMakeCommands/target_link_libraries/depC.h   |   12 ++++
 .../target_link_libraries/targetA.cpp              |   12 ++++
 10 files changed, 139 insertions(+), 24 deletions(-)
 create mode 100644 Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depA.cpp
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depA.h
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depB.cpp
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depB.h
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depC.cpp
 create mode 100644 Tests/CMakeCommands/target_link_libraries/depC.h
 create mode 100644 Tests/CMakeCommands/target_link_libraries/targetA.cpp


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list