install: Teach EXPORT option to handle INTERFACE_LIBRARY targets

This commit is contained in:
Stephen Kelly
2012-11-20 11:06:29 +01:00
committed by Brad King
parent 435c912848
commit ce0c303d62
4 changed files with 58 additions and 2 deletions
@@ -27,3 +27,23 @@ export(TARGETS sharediface sharedlib headeronly
NAMESPACE bld_
FILE ../ExportInterfaceBuildTree.cmake
)
install(TARGETS headeronly sharediface sharedlib
EXPORT expInterface
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib NAMELINK_SKIP
ARCHIVE DESTINATION lib
FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications
)
install(FILES
headeronly/headeronly.h
DESTINATION include/headeronly
)
install(FILES
sharedlib/sharedlib.h
"${CMAKE_CURRENT_BINARY_DIR}/sharedlib_export.h"
DESTINATION include/sharedlib
)
install(EXPORT expInterface NAMESPACE exp_ DESTINATION lib/exp)
@@ -2,6 +2,9 @@
# Import targets from the exported build tree.
include(${Import_BINARY_DIR}/../Export/ExportInterfaceBuildTree.cmake)
# Import targets from the exported install tree.
include(${CMAKE_INSTALL_PREFIX}/lib/exp/expInterface.cmake)
add_library(define_iface INTERFACE)
set_property(TARGET define_iface PROPERTY
INTERFACE_COMPILE_DEFINITIONS DEFINE_IFACE_DEFINE)
@@ -40,3 +43,13 @@ macro(do_try_compile prefix)
endmacro()
do_try_compile(bld_)
add_executable(headeronlytest_exp headeronlytest.cpp)
target_link_libraries(headeronlytest_exp exp_headeronly)
set_property(TARGET exp_sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface)
add_executable(interfacetest_exp interfacetest.cpp)
target_link_libraries(interfacetest_exp exp_sharediface)
do_try_compile(exp_)