From 9cb305262f4b755c8313c35c330bec049943aca4 Mon Sep 17 00:00:00 2001 From: Thibault Poignonec Date: Wed, 13 Sep 2023 13:56:55 +0200 Subject: [PATCH] move build after install in CMakeLists --- CMakeLists.txt | 62 ++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6777dcc..e80849f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,36 +65,6 @@ target_link_libraries( ${libusb-1.0_LIBRARIES} ) -# Testing -#---------- -if(BUILD_TESTING) - find_package(ament_cmake_test REQUIRED) - find_package(ament_lint_auto REQUIRED) - set(ament_cmake_copyright_FOUND TRUE) - set(ament_cmake_cpplint_FOUND TRUE) - - ament_lint_auto_find_test_dependencies() - - find_package(ament_cmake_gtest REQUIRED) - ament_add_gtest( - test_dhd - test/test_dhd.cpp - test/test_drd.cpp - ) - target_include_directories( - test_dhd - PRIVATE - $ - $ - $ - ) - target_link_libraries(test_dhd - ${dhd_LIBS} - ${drd_LIBS} - ${libusb-1.0_LIBRARIES} - ) -endif() - # Install #---------- @@ -125,6 +95,38 @@ install( RUNTIME DESTINATION bin ) + +# Testing +#---------- +if(BUILD_TESTING) + find_package(ament_cmake_test REQUIRED) + find_package(ament_lint_auto REQUIRED) + set(ament_cmake_copyright_FOUND TRUE) + set(ament_cmake_cpplint_FOUND TRUE) + + ament_lint_auto_find_test_dependencies() + + find_package(ament_cmake_gtest REQUIRED) + ament_add_gtest( + test_dhd + test/test_dhd.cpp + test/test_drd.cpp + ) + target_include_directories( + test_dhd + PRIVATE + $ + $ + $ + ) + target_link_libraries(test_dhd + ${CMAKE_INSTALL_PREFIX}/lib/libdhd.so.${VERSION_SDK_MAJOR} + ${CMAKE_INSTALL_PREFIX}/lib/libdrd.so.${VERSION_SDK_MAJOR} + ${libusb-1.0_LIBRARIES} + ) +endif() + + ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) ament_package()