From c75ce16e855e8b1f0562523cdf6be6c37f4ebb56 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 18 Jul 2024 12:52:30 +0200 Subject: [PATCH] Install zenohc.dll in /bin on Windows (#471) --- install/CMakeLists.txt | 10 +++++++++- install/PackageConfig.cmake.in | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/install/CMakeLists.txt b/install/CMakeLists.txt index 414373edc..f297b5cdc 100644 --- a/install/CMakeLists.txt +++ b/install/CMakeLists.txt @@ -23,7 +23,15 @@ function(install_zenohc_lib configurations property_postfix package_name) get_filename_component(STATICLIB ${staticlib_path} NAME) # Install dynamic, import and static library - install(FILES ${dylib_path} DESTINATION ${CMAKE_INSTALL_LIBDIR} CONFIGURATIONS ${configurations}) + + # On Windows .dll need to be installed in ${CMAKE_INSTALL_BINDIR}, + # while on Linux and macOS .so and .dylib need to be installed in ${CMAKE_INSTALL_LIBDIR} + if(WIN32) + set(ZENOHC_INSTALL_DYLIBDIR ${CMAKE_INSTALL_BINDIR}) + else() + set(ZENOHC_INSTALL_DYLIBDIR ${CMAKE_INSTALL_LIBDIR}) + endif() + install(FILES ${dylib_path} DESTINATION ${ZENOHC_INSTALL_DYLIBDIR} CONFIGURATIONS ${configurations}) if(DEFINED implib_path) install(FILES ${implib_path} DESTINATION ${CMAKE_INSTALL_LIBDIR} CONFIGURATIONS ${configurations}) endif() diff --git a/install/PackageConfig.cmake.in b/install/PackageConfig.cmake.in index fe88a38ff..f0257214b 100644 --- a/install/PackageConfig.cmake.in +++ b/install/PackageConfig.cmake.in @@ -39,7 +39,7 @@ if(NOT TARGET __zenohc_shared) set_target_properties(__zenohc_shared PROPERTIES IMPORTED_NO_SONAME TRUE INTERFACE_COMPILE_DEFINITION ZENOHC_DYN_LIB - IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_LIBDIR@/@DYLIB@" + IMPORTED_LOCATION "${_IMPORT_PREFIX}/@ZENOHC_INSTALL_DYLIBDIR@/@DYLIB@" INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@" ) endif()