summaryrefslogtreecommitdiffstats
path: root/Tests/ExportImport/Export
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-11-28 17:58:38 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-10 23:51:34 (GMT)
commit6da65b3907419df28484c570f24d0da3593a0e5a (patch)
treeae814193dd7306ad6aa369dca4d489f9f8f6eaf9 /Tests/ExportImport/Export
parent736bcb9664b714b91e8a2a573451e0453716f4da (diff)
downloadCMake-6da65b3907419df28484c570f24d0da3593a0e5a.zip
CMake-6da65b3907419df28484c570f24d0da3593a0e5a.tar.gz
CMake-6da65b3907419df28484c570f24d0da3593a0e5a.tar.bz2
Allow export of targets with INTERFACE_SOURCES.
Use the same rules for paths in source and binary dirs in installed INTERFACE_SOURCES as are used for INTERFACE_INCLUDE_DIRECTORIES.
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt12
-rw-r--r--Tests/ExportImport/Export/Interface/source_target.cpp13
-rw-r--r--Tests/ExportImport/Export/Interface/source_target_for_install.cpp13
3 files changed, 37 insertions, 1 deletions
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index 523fc29..00a5375 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -29,7 +29,17 @@ target_compile_features(use_auto_type INTERFACE cxx_auto_type)
add_library(use_c_restrict INTERFACE)
target_compile_features(use_c_restrict INTERFACE c_restrict)
-install(TARGETS headeronly sharediface use_auto_type use_c_restrict
+add_library(source_target INTERFACE)
+target_sources(source_target INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source_target.cpp>
+ $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/src/source_target_for_install.cpp>
+)
+install(FILES
+ source_target_for_install.cpp
+ DESTINATION src
+)
+
+install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target
EXPORT expInterface
)
install(TARGETS sharedlib
diff --git a/Tests/ExportImport/Export/Interface/source_target.cpp b/Tests/ExportImport/Export/Interface/source_target.cpp
new file mode 100644
index 0000000..037191c
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/source_target.cpp
@@ -0,0 +1,13 @@
+
+#ifndef USE_FROM_BUILD_DIR
+#error Expected define USE_FROM_BUILD_DIR
+#endif
+
+#ifdef USE_FROM_INSTALL_DIR
+#error Unexpected define USE_FROM_INSTALL_DIR
+#endif
+
+int source_symbol()
+{
+ return 42;
+}
diff --git a/Tests/ExportImport/Export/Interface/source_target_for_install.cpp b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp
new file mode 100644
index 0000000..64514ed
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp
@@ -0,0 +1,13 @@
+
+#ifdef USE_FROM_BUILD_DIR
+#error Unexpected define USE_FROM_BUILD_DIR
+#endif
+
+#ifndef USE_FROM_INSTALL_DIR
+#error Expected define USE_FROM_INSTALL_DIR
+#endif
+
+int source_symbol()
+{
+ return 42;
+}