From 65fb73cf9f279c45fc247f268f486c064cfd937c Mon Sep 17 00:00:00 2001 From: duongtd Date: Tue, 2 Dec 2025 13:21:26 +0700 Subject: [PATCH] fix file cmake --- CMakeLists.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d16766d..c6cfd45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,8 +140,7 @@ if(BUILD_COSTMAP_TESTS) target_link_libraries(test_array_parser PRIVATE costmap_2d GTest::GTest GTest::Main pthread) target_link_libraries(test_costmap PRIVATE costmap_2d GTest::GTest GTest::Main pthread) target_link_libraries(test_plugin PRIVATE - # ${tf3_LIBRARY} - costmap_2d + ${Boost_LIBRARIES} Boost::filesystem Boost::system @@ -149,7 +148,25 @@ if(BUILD_COSTMAP_TESTS) pthread yaml-cpp tf3 - GTest::GTest GTest::Main robot_time + costmap_2d + GTest::GTest GTest::Main ) -endif() + + # --- Set RPATH để tìm thư viện của project này thay vì system ROS libraries --- + set_target_properties(test_array_parser PROPERTIES + BUILD_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d:${CMAKE_BINARY_DIR}/src/Libraries/robot_time:${CMAKE_BINARY_DIR}/src/Libraries/tf3" + INSTALL_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d" + LINK_FLAGS "-Wl,--disable-new-dtags" + ) + set_target_properties(test_costmap PROPERTIES + BUILD_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d:${CMAKE_BINARY_DIR}/src/Libraries/robot_time:${CMAKE_BINARY_DIR}/src/Libraries/tf3" + INSTALL_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d" + LINK_FLAGS "-Wl,--disable-new-dtags" + ) + set_target_properties(test_plugin PROPERTIES + BUILD_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d:${CMAKE_BINARY_DIR}/src/Libraries/robot_time:${CMAKE_BINARY_DIR}/src/Libraries/tf3" + INSTALL_RPATH "${CMAKE_BINARY_DIR}/src/Libraries/costmap_2d" + LINK_FLAGS "-Wl,--disable-new-dtags" + ) +endif() \ No newline at end of file