Skip to content

Commit

Permalink
Merge pull request #278 from Hoikas/namespace_library
Browse files Browse the repository at this point in the history
Use namespaces for exported targets.
  • Loading branch information
zrax committed Oct 3, 2023
2 parents 05a50b8 + 9ecb805 commit aa32355
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,10 @@ install(TARGETS HSPlasma
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(EXPORT HSPlasma-targets DESTINATION share/cmake/HSPlasma)
install(EXPORT HSPlasma-targets
DESTINATION share/cmake/HSPlasma
NAMESPACE HSPlasma::
)

include(CMakePackageConfigHelpers)
configure_package_config_file(HSPlasmaConfig.cmake.in
Expand Down
2 changes: 2 additions & 0 deletions core/HSPlasmaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/HSPlasma-targets.cmake)

check_required_components("HSPlasma")
set_and_check(HSPlasma_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/HSPlasma")

add_library(HSPlasma ALIAS HSPlasma::HSPlasma)
5 changes: 4 additions & 1 deletion net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ install(TARGETS HSPlasmaNet
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(EXPORT HSPlasmaNet-targets DESTINATION share/cmake/HSPlasmaNet)
install(EXPORT HSPlasmaNet-targets
DESTINATION share/cmake/HSPlasmaNet
NAMESPACE HSPlasma::
)

include(CMakePackageConfigHelpers)
configure_package_config_file(HSPlasmaNetConfig.cmake.in
Expand Down
4 changes: 3 additions & 1 deletion net/HSPlasmaNetConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ check_required_components("HSPlasmaNet")
set_and_check(HSPlasmaNet_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include/HSPlasmaNet")

set(HSPlasmaNet_INCLUDE_DIRS ${HSPlasmaNet_INCLUDE_DIR} ${HSPlasma_INCLUDE_DIRS})
set(HSPlasmaNet_LIBRARIES HSPlasmaNet HSPlasma)
set(HSPlasmaNet_LIBRARIES HSPlasma::HSPlasmaNet HSPlasma::HSPlasma)

add_library(HSPlasmaNet ALIAS HSPlasma::HSPlasmaNet)

0 comments on commit aa32355

Please sign in to comment.