diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-12-06 11:14:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-08 14:02:43 (GMT) |
commit | 765386279815f208c5f83b1ad2b66776e990feb9 (patch) | |
tree | 081056ac29f6abe71a2ce21838d488ca8120c806 /Tests/CMakeCommands | |
parent | 40cf3fb95bc391519c0db4be1dc03c49e040579f (diff) | |
download | CMake-765386279815f208c5f83b1ad2b66776e990feb9.zip CMake-765386279815f208c5f83b1ad2b66776e990feb9.tar.gz CMake-765386279815f208c5f83b1ad2b66776e990feb9.tar.bz2 |
Add LINK_LIBRARIES property for direct target link dependencies
Previously we kept direct link dependencies in OriginalLinkLibraries.
The property exposes the information in the CMake language through the
get/set_property commands. We preserve the OriginalLinkLibraries value
internally to support old APIs like that for CMP0003's OLD behavior, but
the property is now authoritative. This follows up from commit d5cf644a
(Split link information processing into two steps, 2012-11-01).
This will be used later to populate the link interface properties when
exporting targets, and will later allow use of generator expressions
when linking to libraries with target_link_libraries.
Also make targets depend on the (config-specific) union of dependencies.
CMake now allows linking to dependencies or not depending on the config.
However, generated build systems are not all capable of processing
config-specific dependencies, so the targets depend on the union of
dependencies for all configs.
Diffstat (limited to 'Tests/CMakeCommands')
4 files changed, 31 insertions, 1 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 60b36fc..63ae675 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -34,6 +34,13 @@ generate_export_header(depB) target_link_libraries(depB LINK_PRIVATE depA) +add_library(libgenex SHARED libgenex.cpp) +generate_export_header(libgenex) + +set_property(TARGET depB APPEND PROPERTY + LINK_LIBRARIES $<1:libgenex> +) + add_library(depC SHARED depC.cpp) generate_export_header(depC) diff --git a/Tests/CMakeCommands/target_link_libraries/depB.cpp b/Tests/CMakeCommands/target_link_libraries/depB.cpp index 1bbe38b..4f46552 100644 --- a/Tests/CMakeCommands/target_link_libraries/depB.cpp +++ b/Tests/CMakeCommands/target_link_libraries/depB.cpp @@ -3,9 +3,13 @@ #include "depA.h" +#include "libgenex.h" + int DepB::foo() { DepA a; - return a.foo(); + LibGenex lg; + + return a.foo() + lg.foo(); } diff --git a/Tests/CMakeCommands/target_link_libraries/libgenex.cpp b/Tests/CMakeCommands/target_link_libraries/libgenex.cpp new file mode 100644 index 0000000..c925c08 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/libgenex.cpp @@ -0,0 +1,7 @@ + +#include "libgenex.h" + +int LibGenex::foo() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/libgenex.h b/Tests/CMakeCommands/target_link_libraries/libgenex.h new file mode 100644 index 0000000..733f9b6 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/libgenex.h @@ -0,0 +1,12 @@ + +#include "libgenex_export.h" + +#ifndef LIBGENEX_H +#define LIBGENEX_H + +struct LIBGENEX_EXPORT LibGenex +{ + int foo(); +}; + +#endif |