summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-12-26 09:58:21 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-03 18:31:50 (GMT)
commit30962029325b2126b0b986db0c5ce8e0660428a0 (patch)
tree1c3d146023bb26dd8ce6959f21bc76605f24c803 /Tests/CMakeCommands
parent00deb127be64cf8934d92c1593c8ea4a5f0f2061 (diff)
downloadCMake-30962029325b2126b0b986db0c5ce8e0660428a0.zip
CMake-30962029325b2126b0b986db0c5ce8e0660428a0.tar.gz
CMake-30962029325b2126b0b986db0c5ce8e0660428a0.tar.bz2
Make targets depend on the link interface of their dependees.
Diffstat (limited to 'Tests/CMakeCommands')
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/targetA.cpp5
4 files changed, 25 insertions, 1 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 1faa888..60b36fc 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -56,3 +56,10 @@ assert_property(targetA LINK_INTERFACE_LIBRARIES "")
target_link_libraries(targetA depB depC)
assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+
+# Exclude depIfaceOnly from ALL so that it will only be built if something
+# depends on it. As it is in the link interface of depB, targetA
+# will depend on it. That dependency is what is being tested here.
+add_library(depIfaceOnly SHARED EXCLUDE_FROM_ALL depIfaceOnly.cpp)
+generate_export_header(depIfaceOnly)
+set_property(TARGET depB APPEND PROPERTY LINK_INTERFACE_LIBRARIES depIfaceOnly)
diff --git a/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp
new file mode 100644
index 0000000..3b90af0
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp
@@ -0,0 +1,7 @@
+
+#include "depIfaceOnly.h"
+
+int DepIfaceOnly::foo()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h
new file mode 100644
index 0000000..dddf6a5
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h
@@ -0,0 +1,7 @@
+
+#include "depifaceonly_export.h"
+
+struct DEPIFACEONLY_EXPORT DepIfaceOnly
+{
+ int foo();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/targetA.cpp b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
index 3c6472e..6ff65b1 100644
--- a/Tests/CMakeCommands/target_link_libraries/targetA.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
@@ -1,6 +1,7 @@
#include "depB.h"
#include "depC.h"
+#include "depIfaceOnly.h"
int main(int argc, char **argv)
{
@@ -8,5 +9,7 @@ int main(int argc, char **argv)
DepB b;
DepC c;
- return a.foo() + b.foo() + c.foo();
+ DepIfaceOnly iface_only;
+
+ return a.foo() + b.foo() + c.foo() + iface_only.foo();
}