Skip to content

Commit

Permalink
fix: macos?
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphoseer committed Jan 5, 2024
1 parent dab70ac commit 4569ea2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmake/FindMariaDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down

0 comments on commit 4569ea2

Please sign in to comment.