Skip to content

Commit

Permalink
CMAKE: Add targets once in case of multiple find_package()
Browse files Browse the repository at this point in the history
  • Loading branch information
tvegas1 committed Feb 19, 2024
1 parent 089203d commit 132cabe
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions cmake/ucx-targets.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@
get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
set(exec_prefix "@exec_prefix@")

add_library(ucx::ucs SHARED IMPORTED)
if(NOT TARGET ucx::ucs)
add_library(ucx::ucs SHARED IMPORTED)

set_target_properties(ucx::ucs PROPERTIES
IMPORTED_LOCATION "@libdir@/libucs.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
set_target_properties(ucx::ucs PROPERTIES
IMPORTED_LOCATION "@libdir@/libucs.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
endif()

add_library(ucx::ucp SHARED IMPORTED)
if(NOT TARGET ucx::ucp)
add_library(ucx::ucp SHARED IMPORTED)

set_target_properties(ucx::ucp PROPERTIES
IMPORTED_LOCATION "@libdir@/libucp.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
set_target_properties(ucx::ucp PROPERTIES
IMPORTED_LOCATION "@libdir@/libucp.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
endif()

add_library(ucx::uct SHARED IMPORTED)
if(NOT TARGET ucx::uct)
add_library(ucx::uct SHARED IMPORTED)

set_target_properties(ucx::uct PROPERTIES
IMPORTED_LOCATION "@libdir@/libuct.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
set_target_properties(ucx::uct PROPERTIES
IMPORTED_LOCATION "@libdir@/libuct.so"
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
)
endif()

0 comments on commit 132cabe

Please sign in to comment.