Skip to content

Commit

Permalink
install fix
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Sep 8, 2023
1 parent 5dc0f8b commit 226d023
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ function(set_target_imported_locations target lib libd)
set_target_properties(${target}
PROPERTIES
IMPORTED_GLOBAL TRUE
# IMPORTED_LOCATION $<IF:$<CONFIG:Debug>,${cargo_binary_dir_debug}/${libd},${cargo_binary_dir_release}/${lib}>
IMPORTED_LOCATION_DEBUG ${cargo_binary_dir_debug}/${libd}
IMPORTED_LOCATION_RELEASE ${cargo_binary_dir_release}/${lib}
IMPORTED_LOCATION_MINSIZEREL ${cargo_binary_dir_release}/${lib}
Expand All @@ -211,7 +210,6 @@ function(set_target_imported_implib target lib libd)
set_target_properties(${target}
PROPERTIES
IMPORTED_GLOBAL TRUE
# IMPORTED_IMPLIB $<IF:$<CONFIG:Debug>,${cargo_binary_dir_debug}/${lib},${cargo_binary_dir_release}/${lib}>
IMPORTED_IMPLIB_DEBUG ${cargo_binary_dir_debug}/${libd}
IMPORTED_IMPLIB_RELEASE ${cargo_binary_dir_release}/${lib}
IMPORTED_IMPLIB_MINSIZEREL ${cargo_binary_dir_release}/${lib}
Expand Down
12 changes: 8 additions & 4 deletions install/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ status_print(CMAKE_INSTALL_PREFIX)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

function(install_zenohc_lib configurations property_postfix package_name libname_postfix)
function(install_zenohc_lib configurations property_postfix package_name)
get_target_property(dylib_path zenohc::lib IMPORTED_LOCATION_${property_postfix})
get_target_property_if_set(implib_path zenohc::lib IMPORTED_IMPLIB_${property_postfix})
get_target_property(staticlib_path zenohc::static IMPORTED_LOCATION_${property_postfix})

get_filename_component(DYLIB ${dylib_path} NAME)
get_filename_component(IMPLIB ${implib_path} NAME)
get_filename_component(STATICLIB ${staticlib_path} NAME)

# Install dynamic, import and static library
install(FILES ${dylib_path} DESTINATION ${CMAKE_INSTALL_LIBDIR} CONFIGURATIONS ${configurations})
if(DEFINED implib_path)
Expand Down Expand Up @@ -48,7 +52,7 @@ function(install_zenohc_lib configurations property_postfix package_name libname
COMPONENT dev)

if(APPLE OR UNIX)
set(LIBNAME_POSTFIX ${libname_postfix})
get_filename_component(LIBNAME ${DYLIB} NAME_WE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zenohc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${package_name}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${package_name}.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
Expand All @@ -69,5 +73,5 @@ endforeach()
#
# Install lib files
#
install_zenohc_lib("Release;RelWithDebInfo;MinSizeRel" "RELEASE" zenohc "")
install_zenohc_lib("Debug" "DEBUG" zenohc_debug "d")
install_zenohc_lib("Release;RelWithDebInfo;MinSizeRel" "RELEASE" zenohc)
install_zenohc_lib("Debug" "DEBUG" zenohc_debug)

0 comments on commit 226d023

Please sign in to comment.