Add required dependencies to the generated package Config.cmake file
This commit is contained in:
parent
63229dbda6
commit
4afa4932df
|
@ -469,6 +469,7 @@ if(UNIX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
set(_package_dependencies "Threads") # Dependencies to be used below for generating Config.cmake file
|
||||||
|
|
||||||
include_directories(${includes})
|
include_directories(${includes})
|
||||||
|
|
||||||
|
@ -589,6 +590,7 @@ target_link_libraries(torrent-rasterbar
|
||||||
|
|
||||||
if (libiconv)
|
if (libiconv)
|
||||||
find_package(Iconv REQUIRED)
|
find_package(Iconv REQUIRED)
|
||||||
|
list(APPEND _package_dependencies "Iconv")
|
||||||
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV)
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV)
|
||||||
target_include_directories(torrent-rasterbar PUBLIC ${ICONV_INCLUDE_DIR})
|
target_include_directories(torrent-rasterbar PUBLIC ${ICONV_INCLUDE_DIR})
|
||||||
target_link_libraries(torrent-rasterbar PRIVATE ${ICONV_LIBRARIES})
|
target_link_libraries(torrent-rasterbar PRIVATE ${ICONV_LIBRARIES})
|
||||||
|
@ -616,6 +618,7 @@ endif()
|
||||||
# Boost
|
# Boost
|
||||||
find_package(Boost REQUIRED COMPONENTS system)
|
find_package(Boost REQUIRED COMPONENTS system)
|
||||||
target_link_libraries(torrent-rasterbar PUBLIC Boost::system)
|
target_link_libraries(torrent-rasterbar PUBLIC Boost::system)
|
||||||
|
list(APPEND _package_dependencies "Boost COMPONENTS system")
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(torrent-rasterbar
|
target_link_libraries(torrent-rasterbar
|
||||||
|
@ -697,6 +700,10 @@ install(DIRECTORY include/libtorrent DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FIL
|
||||||
|
|
||||||
# === generate a CMake Config File ===
|
# === generate a CMake Config File ===
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/libtorrent-rasterbar)
|
||||||
|
string(REGEX REPLACE "([^;]+)" "find_dependency(\\1)" _find_dependency_calls "${_package_dependencies}")
|
||||||
|
string(REPLACE ";" "\n" _find_dependency_calls "${_find_dependency_calls}")
|
||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
||||||
VERSION ${libtorrent_VERSION}
|
VERSION ${libtorrent_VERSION}
|
||||||
|
@ -708,12 +715,13 @@ export(EXPORT torrent-rasterbarTargets
|
||||||
NAMESPACE Libtorrent::
|
NAMESPACE Libtorrent::
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(libtorrent-rasterbarConfig.cmake
|
configure_package_config_file(libtorrent-rasterbarConfig.cmake.in
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfig.cmake"
|
||||||
COPYONLY
|
INSTALL_DESTINATION "${ConfigPackageLocation}"
|
||||||
|
NO_SET_AND_CHECK_MACRO
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
)
|
)
|
||||||
|
|
||||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/libtorrent-rasterbar)
|
|
||||||
install(EXPORT torrent-rasterbarTargets
|
install(EXPORT torrent-rasterbarTargets
|
||||||
FILE
|
FILE
|
||||||
libtorrent-rasterbarTargets.cmake
|
libtorrent-rasterbarTargets.cmake
|
||||||
|
@ -724,7 +732,7 @@ install(EXPORT torrent-rasterbarTargets
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
libtorrent-rasterbarConfig.cmake
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfig.cmake"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
||||||
DESTINATION
|
DESTINATION
|
||||||
${ConfigPackageLocation}
|
${ConfigPackageLocation}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/libtorrent-rasterbarTargets.cmake")
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# - Config file for the @PROJECT_NAME@ package
|
||||||
|
# It defines the following variables
|
||||||
|
# @PROJECT_NAME@_INCLUDE_DIRS - include directories for @PROJECT_NAME@
|
||||||
|
# @PROJECT_NAME@_LIBRARIES - libraries to link against
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
@_find_dependency_calls@
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/libtorrent-rasterbarTargets.cmake")
|
||||||
|
|
||||||
|
get_target_property(@PROJECT_NAME@_INCLUDE_DIRS Libtorrent::torrent-rasterbar INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
get_target_property(_lt_iface_link_libraries Libtorrent::torrent-rasterbar INTERFACE_LINK_LIBRARIES)
|
||||||
|
get_target_property(_lt_imported_location Libtorrent::torrent-rasterbar IMPORTED_LOCATION)
|
||||||
|
set(@PROJECT_NAME@_LIBRARIES "${_lt_imported_location};${_lt_iface_link_libraries}")
|
Loading…
Reference in New Issue