From 4569ea29d53e20ffb92868d5613f933db097ce0d Mon Sep 17 00:00:00 2001 From: Xiphoseer Date: Fri, 5 Jan 2024 22:18:39 +0100 Subject: [PATCH] fix: macos? --- cmake/FindMariaDB.cmake | 9 +++++++-- tests/CMakeLists.txt | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/FindMariaDB.cmake b/cmake/FindMariaDB.cmake index d9c4a882..47054697 100644 --- a/cmake/FindMariaDB.cmake +++ b/cmake/FindMariaDB.cmake @@ -134,10 +134,15 @@ message("libmariadb: ${MARIADBC_SHARED_LIBRARY_LOCATION}") message("libmariadbcpp: ${MARIADBCPP_SHARED_LIBRARY_LOCATION}") add_library(MariaDB::ConnCpp SHARED IMPORTED GLOBAL) add_dependencies(MariaDB::ConnCpp mariadb_connector_cpp) -set_property(TARGET MariaDB::ConnCpp PROPERTY IMPORTED_LOCATION ${MARIADBCPP_SHARED_LIBRARY_LOCATION}) +set_target_properties(MariaDB::ConnCpp PROPERTIES + IMPORTED_LOCATION "${MARIADBCPP_SHARED_LIBRARY_LOCATION}") if(WIN32) - set_property(TARGET MariaDB::ConnCpp PROPERTY IMPORTED_IMPLIB ${MARIADB_IMPLIB_LOCATION}) + set_target_properties(MariaDB::ConnCpp PROPERTIES + IMPORTED_IMPLIB "${MARIADB_IMPLIB_LOCATION}") +elseif(APPLE) + set_target_properties(MariaDB::ConnCpp PROPERTIES + MACOSX_RPATH TRUE) endif() # Add directories to include lists diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6c4e8d38..62de71d7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,10 @@ include(GoogleTest) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH True) +set(CMAKE_BUILD_WITH_INSTALL_RPATH True) +set(CMAKE_INSTALL_RPATH "@executable_path") + add_custom_target(conncpp_tests ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})