[Cmake-commits] CMake branch, next, updated. v2.8.6-2015-g99966be

Brad King brad.king at kitware.com
Tue Nov 22 17:04:48 EST 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  99966be1f7e2497bfca909db9232e64351687865 (commit)
       via  ff35ae79e208a705575f8c1aadd4666a00a352db (commit)
       via  914382224d34cfb86a67c8191b6e7b3a3e918f88 (commit)
       via  cf64218eeb7dbe8a0d71292c42df63c4cb982fed (commit)
      from  4d5ece3c047ec2a5d56e03888116a430ecf2a4cc (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=99966be1f7e2497bfca909db9232e64351687865
commit 99966be1f7e2497bfca909db9232e64351687865
Merge: 4d5ece3 ff35ae7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 22 17:04:45 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Nov 22 17:04:45 2011 -0500

    Merge topic 'test-target_link_libraries' into next
    
    ff35ae7 Merge branch 'target-link-libraries-interfaces' into test-target_link_libraries
    9143822 target_link_libraries: Add LINK_(PUBLIC|PRIVATE) options
    cf64218 target_link_libraries: Trim trailing whitespace


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff35ae79e208a705575f8c1aadd4666a00a352db
commit ff35ae79e208a705575f8c1aadd4666a00a352db
Merge: 1e55661 9143822
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 22 16:54:53 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Nov 22 16:55:30 2011 -0500

    Merge branch 'target-link-libraries-interfaces' into test-target_link_libraries
    
    Conflicts:
    	Tests/CMakeCommands/target_link_libraries/CMakeLists.txt

diff --cc Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index fdd53eb,1faa888..6df1b4c
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@@ -13,271 -13,46 +13,315 @@@ add_executable
    "${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 "")
++
 +try_compile(LINK_INTERFACE_LIBRARIES_FAILS
 +  "${CMAKE_CURRENT_BINARY_DIR}/control_point"
 +  "${CMAKE_CURRENT_SOURCE_DIR}/control_point"
 +  control_point
 +)
 +
 +if (LINK_INTERFACE_LIBRARIES_FAILS)
 +  message("\n\n#######################\nTHIS PLATFORM DOES NOT SUPPORT LINK_INTERFACE_LIBRARIES\n\n")
 +  return()
 +endif()
 +
 +set(Bools True False)
 +
 +foreach(B1 ${Bools})
 +  foreach(B2 ${Bools})
 +    execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
 +      "${CMAKE_CURRENT_SOURCE_DIR}/libs"
 +      "${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_${B2}"
 +    )
 +  endforeach()
 +endforeach()
 +
 +foreach(B1 ${Bools})
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libs_True_${B1}/CMakeLists.txt"
 +    "set(CMAKE_LINK_INTERFACE_LIBRARIES \"\")\n"
 +  )
 +endforeach()
 +
 +foreach(B1 ${Bools})
 +  foreach(B2 ${Bools})
 +    file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_${B2}/CMakeLists.txt"
 +
 +      "add_library(libA SHARED classA.cpp)\n"
 +      "add_library(libB SHARED classB.cpp)\n"
 +      "add_library(libC SHARED classC.cpp)\n"
 +
 +      "generate_export_header(libA)\n"
 +      "generate_export_header(libB)\n"
 +      "generate_export_header(libC)\n"
 +
 +      "target_link_libraries(libB libA)\n"
 +      "target_link_libraries(libC libA libB)\n"
 +    )
 +  endforeach()
 +endforeach()
 +
 +foreach(B1 ${Bools})
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_True/CMakeLists.txt"
 +      "target_link_libraries(libB LINK_INTERFACE_LIBRARIES libA)\n"
 +      "target_link_libraries(libC LINK_INTERFACE_LIBRARIES libA)\n"
 +    )
 +endforeach()
 +
 +foreach(B1 ${Bools})
 +  foreach(B2 ${Bools})
 +    file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_${B2}/CMakeLists.txt"
 +      "export(TARGETS libA libB libC FILE Targets.cmake)\n"
 +    )
 +
 +    try_compile(Result "${CMAKE_CURRENT_BINARY_DIR}/libs_build_${B1}_${B2}"
 +      "${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_${B2}"
 +      libs
 +      OUTPUT_VARIABLE Out
 +    )
 +    if (NOT Result)
 +      message("Libs CLEAR_LINK_INTERFACE_LIBRARIES: ${B1}\n"
 +              "Libs SPECIFY_LINK_INTERFACE_LIBRARIES: ${B2}\n\n\n${Out}")
 +      message("\n\n#######################\nTHIS PLATFORM DOES NOT SUPPORT LINK_INTERFACE_LIBRARIES\n\n")
 +      return()
 +    endif()
 +  endforeach()
 +endforeach()
 +
 +
 +set (COUNT 0)
 +macro(_do_build CLEAR_LINK_INTERFACE_LIBRARIES
 +                SPECIFY_LINK_INTERFACE_LIBRARIES)
 +  math(EXPR COUNT "${COUNT} + 1" )
 +
 +  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
 +    "${CMAKE_CURRENT_SOURCE_DIR}/src"
 +    "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}"
 +  )
 +
 +  # Set local short variables to avoid long lines
 +  set(B1 ${CLEAR_LINK_INTERFACE_LIBRARIES})
 +  set(B2 ${SPECIFY_LINK_INTERFACE_LIBRARIES})
 +  set(Libs_Build_Dir "${CMAKE_CURRENT_BINARY_DIR}/libs_build_${B1}_${B2}")
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
 +    "include_directories(\"${CMAKE_CURRENT_BINARY_DIR}/libs_${B1}_${B2}\"\n"
 +    "                    \"${Libs_Build_Dir}\"\n"
 +    ")\n"
 +    "include(\"${Libs_Build_Dir}/Targets.cmake\")\n"
 +  )
 +
 +  file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp"
 +    ""
 +  )
 +
 +  foreach(klass ${ARGN})
 +    if (klass STREQUAL "LIBS")
 +      break()
 +    endif()
 +    file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp"
 +      "#include \"${klass}.h\"\n"
 +    )
 +  endforeach()
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp"
 +    "int main(int, char **) {"
 +  )
 +
 +  foreach(klass ${ARGN})
 +    if (klass STREQUAL "LIBS")
 +      break()
 +    endif()
 +    file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp"
 +      "${klass} ${klass}_;\n"
 +    )
 +  endforeach()
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp"
 +    "return 0;"
 +    "}\n"
 +  )
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
 +
 +    "add_executable(exec \n"
 +    "\"${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/main.cpp\")\n"
 +  )
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
 +    "target_link_libraries(exec "
 +  )
 +
 +  set(continue True)
 +  foreach(klass ${ARGN})
 +    if (klass STREQUAL "LIBS")
 +      # CMake has no continue() command
 +      set(continue False)
 +    endif()
 +    if (NOT continue AND NOT klass STREQUAL "LIBS")
 +      file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
 +        "${klass} "
 +      )
 +    endif()
 +  endforeach()
 +
 +  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
 +    ")\n"
 +  )
 +
 +  try_compile(Result "${CMAKE_CURRENT_BINARY_DIR}/fail${COUNT}"
 +    "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}"
 +    src
 +    OUTPUT_VARIABLE Out
 +  )
 +endmacro()
 +
 +macro(EXPECT_PASS)
 +  _do_build(${ARGN})
 +  if (NOT ${Result})
 +    message(SEND_ERROR "Failed! \n\n${Out}")
 +  endif()
 +endmacro()
 +
 +macro(EXPECT_FAIL)
 +  _do_build(${ARGN})
 +  if (${Result})
 +    message(SEND_ERROR "Failed! \n\n${Out}")
 +  endif()
 +endmacro()
 +
 +macro(all_pass)
 +  expect_pass(False False ${ARGN})
 +  expect_pass(True False ${ARGN})
 +  expect_pass(False True ${ARGN})
 +  expect_pass(True True ${ARGN})
 +endmacro()
 +
 +# If we specify all libs to the executable, it will always pass
 +all_pass(
 +    classA
 +  LIBS
 +    libA
 +)
 +
 +all_pass(
 +    classA classB
 +  LIBS
 +    libA libB
 +)
 +
 +all_pass(
 +    classA classC
 +  LIBS
 +    libA libC
 +)
 +
 +all_pass(
 +    classA classB classC
 +  LIBS
 +    libA libB libC
 +)
 +
 +# If we don't set the CMAKE_LINK_INTERFACE_LIBRARIES to empty and
 +# we don't explicitly specify the LINK_INTERFACE_LIBRARIES, the
 +# executable can use all classes if linked
 +# indirectly to them
 +expect_pass(False False
 +    classA classB
 +  LIBS
 +    libB
 +)
 +
 +# Although libC is linked to libA, libA is not part of the link interface of
 +# libC.
 +# Because we don't clear the CMAKE_LINK_INTERFACE_LIBRARIES it still works.
 +expect_pass(False False
 +    classA classC
 +  LIBS
 +    libC
 +)
 +
 +# However, if we do clear it and don't explicitly link the executable to it,
 +# it fails,
 +# whether we specify the link_interface_libraries properly or not.
 +if (NOT APPLE)
 +  expect_fail(True False
 +    classB classC
 +  LIBS
 +    libC
 +  )
 +  expect_fail(True True
 +      classB classC
 +    LIBS
 +      libC
 +  )
 +endif()
 +
 +
 +# Then we can still link the executable to libA directly of course to pass
 +expect_pass(True False
 +    classA classC
 +  LIBS
 +    libC libA
 +)
 +expect_pass(True True
 +    classA classC
 +  LIBS
 +    libC libA
 +)
 +
 +# Also, if we clear and specify the link interface, we can use classes defined
 +# in that interface without linking to the library directly
 +expect_pass(True True
 +    classA classB
 +  LIBS
 +    libB
 +)
 +
 +expect_pass(True True
 +    classA classC
 +  LIBS
 +    libC
 +)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=914382224d34cfb86a67c8191b6e7b3a3e918f88
commit 914382224d34cfb86a67c8191b6e7b3a3e918f88
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 02:41:37 2011 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Nov 22 16:52:35 2011 -0500

    target_link_libraries: Add LINK_(PUBLIC|PRIVATE) options
    
    Makes it possible to specify the link dependencies and link
    interfaces in one command without repetition.

diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 805959d..0db5943 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -95,8 +95,8 @@ bool cmTargetLinkLibrariesCommand
   bool haveLLT = false;
 
   // Start with primary linking and switch to link interface
-  // specification when the keyword is encountered.
-  this->DoingInterface = false;
+  // specification if the keyword is encountered as the first argument.
+  this->CurrentProcessingState = ProcessingLinkLibraries;
 
   // add libraries, nothe that there is an optional prefix
   // of debug and optimized than can be used
@@ -104,7 +104,7 @@ bool cmTargetLinkLibrariesCommand
     {
     if(args[i] == "LINK_INTERFACE_LIBRARIES")
       {
-      this->DoingInterface = true;
+      this->CurrentProcessingState = ProcessingLinkInterface;
       if(i != 1)
         {
         this->Makefile->IssueMessage(
@@ -115,6 +115,32 @@ bool cmTargetLinkLibrariesCommand
         return true;
         }
       }
+    else if(args[i] == "LINK_PUBLIC")
+      {
+      if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface)
+        {
+        this->Makefile->IssueMessage(
+          cmake::FATAL_ERROR,
+          "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+          "argument, just after the target name."
+          );
+        return true;
+        }
+      this->CurrentProcessingState = ProcessingPublicInterface;
+      }
+    else if(args[i] == "LINK_PRIVATE")
+      {
+      if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface)
+        {
+        this->Makefile->IssueMessage(
+          cmake::FATAL_ERROR,
+          "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+          "argument, just after the target name."
+          );
+        return true;
+        }
+      this->CurrentProcessingState = ProcessingPrivateInterface;
+      }
     else if(args[i] == "debug")
       {
       if(haveLLT)
@@ -186,11 +212,13 @@ 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->DoingInterface &&
-     !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
+  // 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 != ProcessingLinkLibraries)
+    && !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
     {
     this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
     }
@@ -217,11 +245,15 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
                                             cmTarget::LinkLibraryType llt)
 {
   // Handle normal case first.
-  if(!this->DoingInterface)
+  if(this->CurrentProcessingState != ProcessingLinkInterface)
     {
     this->Makefile
       ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
-    return;
+    if (this->CurrentProcessingState != ProcessingPublicInterface
+        || this->CurrentProcessingState == ProcessingPrivateInterface)
+      {
+      return;
+      }
     }
 
   // Get the list of configurations considered to be DEBUG.
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index a9b5d8b..e91c46d 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -107,6 +107,18 @@ public:
       "Libraries specified as \"general\" (or without any keyword) are "
       "treated as if specified for both \"debug\" and \"optimized\"."
       "\n"
+      "  target_link_libraries(<target>\n"
+      "                        <LINK_PRIVATE|LINK_PUBLIC>\n"
+      "                          [[debug|optimized|general] <lib>] ...\n"
+      "                        [<LINK_PRIVATE|LINK_PUBLIC>\n"
+      "                          [[debug|optimized|general] <lib>] ...])\n"
+      "The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both the"
+      "link dependencies and the link interface in one command.  "
+      "Libraries and targets following LINK_PUBLIC are linked to, and are "
+      "made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
+      "following LINK_PRIVATE are linked to, but are not made part of the "
+      "LINK_INTERFACE_LIBRARIES.  "
+      "\n"
       "The library dependency graph is normally acyclic (a DAG), but in the "
       "case of mutually-dependent STATIC libraries CMake allows the graph "
       "to contain cycles (strongly connected components).  "
@@ -137,7 +149,14 @@ private:
   static const char* LinkLibraryTypeNames[3];
 
   cmTarget* Target;
-  bool DoingInterface;
+  enum ProcessingState {
+    ProcessingLinkLibraries,
+    ProcessingLinkInterface,
+    ProcessingPublicInterface,
+    ProcessingPrivateInterface
+  };
+
+  ProcessingState CurrentProcessingState;
 
   void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
 };
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=cf64218eeb7dbe8a0d71292c42df63c4cb982fed
commit cf64218eeb7dbe8a0d71292c42df63c4cb982fed
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 2 12:43:01 2011 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Nov 22 16:52:27 2011 -0500

    target_link_libraries: Trim trailing whitespace

diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index ce57df7..a9b5d8b 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.
    */
@@ -130,7 +130,7 @@ public:
       ")"
       ;
     }
-  
+
   cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
 private:
   void LinkLibraryTypeSpecifierWarning(int left, int right);

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list