summaryrefslogtreecommitdiffstats
path: root/Tests/ExportImport/Import
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/Import
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/Import')
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 01960ea..6d16cb7 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -229,6 +229,8 @@ add_library(imp_lib1b STATIC imp_lib1.c)
target_link_libraries(imp_lib1b bld_testLib2)
if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]")
+ set(bld_objlib_type OBJECT_LIBRARY)
+
# Create a executable that is using objects imported from the install tree
add_executable(imp_testLib8 imp_testLib8.c $<TARGET_OBJECTS:exp_testLib8>)
@@ -236,6 +238,18 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "
# Create a executable that is using objects imported from the build tree
add_executable(imp_testLib8b imp_testLib8.c $<TARGET_OBJECTS:bld_testLib8>)
endif()
+else()
+ set(bld_objlib_type INTERFACE_LIBRARY)
+endif()
+
+# Check that object libraries were transformed on export as expected.
+get_property(type TARGET exp_testLib9Obj PROPERTY TYPE)
+if(NOT type STREQUAL INTERFACE_LIBRARY)
+ message(FATAL_ERROR "exp_testLib9Obj type is '${type}', not 'INTERFACE_LIBRARY'")
+endif()
+get_property(type TARGET bld_testLib9Obj PROPERTY TYPE)
+if(NOT type STREQUAL "${bld_objlib_type}")
+ message(FATAL_ERROR "bld_testLib9Obj type is '${type}', not '${bld_objlib_type}'")
endif()
#-----------------------------------------------------------------------------