Make CMake export namespace to be consistent with library name
Use camel-cased library name "LibtorrentRasterbar" is used as namespace name for exports and the import target in the find module.
This commit is contained in:
parent
5667b8f72c
commit
44b5777be3
|
@ -779,7 +779,7 @@ include(CheckCXXCompilerFlag)
|
|||
|
||||
add_subdirectory(bindings)
|
||||
|
||||
install(TARGETS torrent-rasterbar EXPORT libtorrent-rasterbar-targets
|
||||
install(TARGETS torrent-rasterbar EXPORT LibtorrentRasterbarTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
|
@ -788,7 +788,7 @@ install(DIRECTORY include/libtorrent DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FIL
|
|||
|
||||
# === generate a CMake Config File ===
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/libtorrent-rasterbar)
|
||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/LibtorrentRasterbar)
|
||||
string(REGEX REPLACE "([^;]+)" "find_dependency(\\1)" _find_dependency_calls "${_package_dependencies}")
|
||||
string(REPLACE ";" "\n" _find_dependency_calls "${_find_dependency_calls}")
|
||||
|
||||
|
@ -799,33 +799,33 @@ else()
|
|||
endif()
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbar-config-version.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfigVersion.cmake"
|
||||
VERSION ${libtorrent_VERSION}
|
||||
COMPATIBILITY ${_compatibility}
|
||||
)
|
||||
|
||||
export(EXPORT libtorrent-rasterbar-targets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbar-targets.cmake"
|
||||
NAMESPACE Libtorrent::
|
||||
export(EXPORT LibtorrentRasterbarTargets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarTargets.cmake"
|
||||
NAMESPACE LibtorrentRasterbar::
|
||||
)
|
||||
|
||||
configure_package_config_file(libtorrent-rasterbar-config.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbar-config.cmake"
|
||||
configure_package_config_file(LibtorrentRasterbarConfig.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake"
|
||||
INSTALL_DESTINATION "${ConfigPackageLocation}"
|
||||
NO_SET_AND_CHECK_MACRO
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
|
||||
install(EXPORT libtorrent-rasterbar-targets
|
||||
install(EXPORT LibtorrentRasterbarTargets
|
||||
NAMESPACE
|
||||
Libtorrent::
|
||||
LibtorrentRasterbar::
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbar-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbar-config-version.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfigVersion.cmake"
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# LibtorrentRasterbar_LIBRARIES - The libraries needed to use libtorrent-rasterbar
|
||||
# LibtorrentRasterbar_DEFINITIONS - Compiler switches required for using libtorrent-rasterbar
|
||||
# LibtorrentRasterbar_OPENSSL_ENABLED - libtorrent-rasterbar uses and links against OpenSSL
|
||||
# Libtorrent::torrent-rasterbar imported target will be created
|
||||
# LibtorrentRasterbar::torrent-rasterbar imported target will be created
|
||||
|
||||
# Let's begin with the config mode
|
||||
|
||||
|
@ -21,9 +21,7 @@ if (${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT})
|
|||
set(_exactKeyword "EXACT")
|
||||
endif()
|
||||
|
||||
find_package(LibtorrentRasterbar ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} ${_exactKeyword} CONFIG
|
||||
NAMES libtorrent-rasterbar LibtorrentRasterbar
|
||||
)
|
||||
find_package(LibtorrentRasterbar ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} ${_exactKeyword} CONFIG)
|
||||
|
||||
if (LibtorrentRasterbar_FOUND)
|
||||
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
|
@ -31,12 +29,12 @@ if (LibtorrentRasterbar_FOUND)
|
|||
message(STATUS "LibtorrentRasterbar version: ${LibtorrentRasterbar_VERSION}")
|
||||
endif()
|
||||
# Extract target properties into this module variables
|
||||
get_target_property(LibtorrentRasterbar_INCLUDE_DIRS Libtorrent::torrent-rasterbar INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(LibtorrentRasterbar_LIBRARIES Libtorrent::torrent-rasterbar IMPORTED_LOCATION)
|
||||
get_target_property(_iface_link_libs Libtorrent::torrent-rasterbar INTERFACE_LINK_LIBRARIES)
|
||||
get_target_property(LibtorrentRasterbar_INCLUDE_DIRS LibtorrentRasterbar::torrent-rasterbar INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(LibtorrentRasterbar_LIBRARIES LibtorrentRasterbar::torrent-rasterbar IMPORTED_LOCATION)
|
||||
get_target_property(_iface_link_libs LibtorrentRasterbar::torrent-rasterbar INTERFACE_LINK_LIBRARIES)
|
||||
list(APPEND LibtorrentRasterbar_LIBRARIES ${_iface_link_libs})
|
||||
get_target_property(LibtorrentRasterbar_DEFINITIONS Libtorrent::torrent-rasterbar INTERFACE_COMPILE_DEFINITIONS)
|
||||
get_target_property(_iface_compile_options Libtorrent::torrent-rasterbar INTERFACE_COMPILE_OPTIONS)
|
||||
get_target_property(LibtorrentRasterbar_DEFINITIONS LibtorrentRasterbar::torrent-rasterbar INTERFACE_COMPILE_DEFINITIONS)
|
||||
get_target_property(_iface_compile_options LibtorrentRasterbar::torrent-rasterbar INTERFACE_COMPILE_OPTIONS)
|
||||
list(APPEND LibtorrentRasterbar_DEFINITIONS ${_iface_compile_options})
|
||||
list(FIND _iface_link_libs "OpenSSL::SSL" _openssl_lib_index)
|
||||
if (_openssl_lib_index GREATER -1)
|
||||
|
@ -127,10 +125,10 @@ else()
|
|||
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
||||
LibtorrentRasterbar_ENCRYPTION_INDEX)
|
||||
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET Libtorrent::torrent-rasterbar)
|
||||
add_library(Libtorrent::torrent-rasterbar SHARED IMPORTED)
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::torrent-rasterbar)
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar SHARED IMPORTED)
|
||||
|
||||
set_target_properties(Libtorrent::torrent-rasterbar PROPERTIES
|
||||
set_target_properties(LibtorrentRasterbar::torrent-rasterbar PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"
|
||||
|
|
Loading…
Reference in New Issue