fix: macos?

This commit is contained in:
Xiphoseer 2024-01-05 22:18:39 +01:00
parent dab70ac096
commit 4569ea29d5
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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 $<TARGET_FILE:MariaDB::ConnCpp> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})