From 6b94e7f9edd2b1211d149d013aba9cd1b62a983d Mon Sep 17 00:00:00 2001 From: Xiphoseer Date: Fri, 5 Jan 2024 23:29:40 +0100 Subject: [PATCH] try: install_name_tool --- tests/dCommonTests/CMakeLists.txt | 8 ++------ tests/dGameTests/CMakeLists.txt | 9 ++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/dCommonTests/CMakeLists.txt b/tests/dCommonTests/CMakeLists.txt index 6af0c56b..2fe0e309 100644 --- a/tests/dCommonTests/CMakeLists.txt +++ b/tests/dCommonTests/CMakeLists.txt @@ -22,15 +22,11 @@ add_dependencies(dCommonTests conncpp_tests) if(APPLE) add_custom_command(TARGET dCommonTests POST_BUILD COMMAND otool ARGS -l dCommonTests - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -add_custom_command(TARGET dCommonTests POST_BUILD COMMAND otool ARGS -L dCommonTests - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -add_custom_command(TARGET dCommonTests POST_BUILD COMMAND ls - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -add_custom_command(TARGET dCommonTests POST_BUILD COMMAND otool ARGS -D libmariadbcpp.dylib + COMMAND install_name_tool ARGS -change libmariadbcpp.dylib @rpath/libmariadbcpp.dylib dCommonTests + COMMAND otool ARGS -L dCommonTests WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif() diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index 20d7e530..5bf4c81f 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -12,7 +12,14 @@ file(COPY ${GAMEMESSAGE_TESTBITSTREAMS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) # Add the executable. Remember to add all tests above this! add_executable(dGameTests ${DGAMETEST_SOURCES}) -add_dependencies(dCommonTests conncpp_tests) +add_dependencies(dGameTests conncpp_tests) + +if(APPLE) +add_custom_command(TARGET dGameTests POST_BUILD + COMMAND install_name_tool ARGS -change libmariadbcpp.dylib @rpath/libmariadbcpp.dylib dGameTests + COMMAND otool ARGS -L dGameTests + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +endif() target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation)