diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-11-05 11:43:28 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-31 16:34:20 (GMT) |
commit | 77cecb778ff1882d87401c1055ec06585462f787 (patch) | |
tree | 7abf8c4ffc3839e6b2f8593757cd34119aea17a2 /Tests/ExportImport/Export | |
parent | 0b92602b816e2584db3781b120a1e5200da72ada (diff) | |
download | CMake-77cecb778ff1882d87401c1055ec06585462f787.zip CMake-77cecb778ff1882d87401c1055ec06585462f787.tar.gz CMake-77cecb778ff1882d87401c1055ec06585462f787.tar.bz2 |
Add includes and compile definitions with target_link_libraries.
This establishes that linking is used to propagate usage-requirements
between targets in CMake code. The use of the target_link_libraries
command as the API for this is chosen because introducing a new command
would introduce confusion due to multiple commands which differ only in
a subtle way.
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index ae44c28..ae938cd 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -90,23 +90,7 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) # Test exporting dependent libraries into different exports add_library(testLibRequired testLibRequired.c) add_library(testLibDepends testLibDepends.c) -set_property(TARGET testLibDepends APPEND PROPERTY - INCLUDE_DIRECTORIES - $<TARGET_PROPERTY:testLibRequired,INTERFACE_INCLUDE_DIRECTORIES> -) -set_property(TARGET testLibDepends APPEND PROPERTY - COMPILE_DEFINITIONS - $<TARGET_PROPERTY:testLibRequired,INTERFACE_COMPILE_DEFINITIONS> -) -set_property(TARGET testLibDepends APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES - $<TARGET_PROPERTY:testLibRequired,INTERFACE_INCLUDE_DIRECTORIES> -) -set_property(TARGET testLibDepends APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS - $<TARGET_PROPERTY:testLibRequired,INTERFACE_COMPILE_DEFINITIONS> -) -target_link_libraries(testLibDepends testLibRequired) +target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) macro(add_include_lib _libName) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "// no content\n") @@ -239,6 +223,25 @@ install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DES install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) +file(WRITE + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfig.cmake" + " +if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 2.3 AND NOT \${CMAKE_FIND_PACKAGE_NAME}_INTERFACES) + set(\${CMAKE_FIND_PACKAGE_NAME}_NO_INTERFACES 1) +endif() +include(\"\${CMAKE_CURRENT_LIST_DIR}/testLibRequiredTargets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS \"${CMAKE_CURRENT_BINARY_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}\" ) +" +) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( testLibRequiredConfigVersion.cmake VERSION 2.5 COMPATIBILITY AnyNewerVersion) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfigVersion.cmake" + DESTINATION lib/cmake/testLibRequired +) # Install and export from install tree. install( |