summaryrefslogtreecommitdiffstats
path: root/Tests/ExportImport/Export
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-28 15:58:07 (GMT)
committerBrad King <brad.king@kitware.com>2018-02-28 15:58:10 (GMT)
commitea0ce73a195e1cc0f672f1e7519c42a240592f15 (patch)
tree568319f21bf3e9ed2583832c0b2e69eb2d29d5b3 /Tests/ExportImport/Export
parentd870148537319da2e86237cbd8baf6815975e594 (diff)
downloadCMake-ea0ce73a195e1cc0f672f1e7519c42a240592f15.zip
CMake-ea0ce73a195e1cc0f672f1e7519c42a240592f15.tar.gz
CMake-ea0ce73a195e1cc0f672f1e7519c42a240592f15.tar.bz2
install,export: Maybe transform OBJECT libraries to INTERFACE libraries
Teach the `install` and `export` commands to support installing and exporting `OBJECT` libraries without their object files. Transform them to `INTERFACE` libraries in such cases. For `install(TARGETS)`, activate this when no destination for the object files is specified. For `export`, activate this only under Xcode with multiple architectures when we have no well-defined object file locations to give to clients.
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt18
-rw-r--r--Tests/ExportImport/Export/testLib9Obj.c4
2 files changed, 17 insertions, 5 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index eeae3f0..4f663f6 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -83,11 +83,13 @@ set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$<CONFIG>)
add_library(testLib8 OBJECT testLib8A.c testLib8B.c sub/testLib8C.c)
if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]")
- set(maybe_testLib8 testLib8)
+ set(maybe_OBJECTS_DESTINATION OBJECTS DESTINATION $<1:lib>)
else()
- set(maybe_testLib8 "")
+ set(maybe_OBJECTS_DESTINATION "")
endif()
+add_library(testLib9Obj OBJECT testLib9Obj.c)
+
# Test using the target_link_libraries command to set the
# LINK_INTERFACE_LIBRARIES* properties. We construct two libraries
# providing the same two symbols. In each library one of the symbols
@@ -483,7 +485,7 @@ install(
TARGETS
testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4
testExe2lib testLib4lib testLib4libdbg testLib4libopt
- testLib6 testLib7 ${maybe_testLib8}
+ testLib6 testLib7 testLib8
testLibCycleA testLibCycleB
testLibNoSONAME
cmp0022NEW cmp0022OLD
@@ -492,10 +494,15 @@ install(
RUNTIME DESTINATION $<1:bin>
LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP
ARCHIVE DESTINATION $<1:lib>
- OBJECTS DESTINATION $<1:lib>
+ ${maybe_OBJECTS_DESTINATION}
FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications
)
+install(
+ TARGETS
+ testLib9Obj
+ EXPORT exp
+ )
if (APPLE)
file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testLib4.framework/Headers)
file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/testLib4.framework/Headers)
@@ -545,7 +552,8 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
FILE ExportBuildTree.cmake
)
export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib
- ${maybe_testLib8}
+ testLib8
+ testLib9Obj
testLib4lib testLib4libdbg testLib4libopt
testLibCycleA testLibCycleB
testLibNoSONAME
diff --git a/Tests/ExportImport/Export/testLib9Obj.c b/Tests/ExportImport/Export/testLib9Obj.c
new file mode 100644
index 0000000..6a13e48
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib9Obj.c
@@ -0,0 +1,4 @@
+int testLib9Obj(void)
+{
+ return 0;
+}