From 0d9066fc3310486f8a5c7f5a2eb15110075dad80 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 b832e1ed7..e8e3a0574 100644 --- a/install/PackageConfig.cmake.in +++ b/install/PackageConfig.cmake.in @@ -41,7 +41,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()