From 807fc79fe2700ddb704f17989874e55b7ba33917 Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Fri, 16 Feb 2024 01:17:40 -0800 Subject: [PATCH] Bring ament_add_gtest/target_link_libraries back together (#452) Signed-off-by: Christophe Bedard --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed547dc..2dc7f5a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,6 +568,9 @@ if(BUILD_TESTING) ament_add_gtest(test_macros test/test_macros.cpp ) + if(TARGET test_macros) + target_link_libraries(test_macros ${PROJECT_NAME}) + endif() add_performance_test(benchmark_logging test/benchmark/benchmark_logging.cpp) if(TARGET benchmark_logging) @@ -578,10 +581,6 @@ if(BUILD_TESTING) if(TARGET benchmark_err_handle) target_link_libraries(benchmark_err_handle ${PROJECT_NAME}) endif() - - if(TARGET test_macros) - target_link_libraries(test_macros ${PROJECT_NAME}) - endif() endif() # Export old-style CMake variables