From 740f1b581f8ac4c2f05aa189014829bd9d1b39cf Mon Sep 17 00:00:00 2001 From: Andrew Saba Date: Wed, 7 Aug 2019 16:35:28 -0400 Subject: [PATCH] added check to see if testing is enabled before adding tests to prevent build failures in th event tests are disabled --- mav_trajectory_generation/CMakeLists.txt | 18 ++++++++++-------- mav_trajectory_generation_ros/CMakeLists.txt | 10 ++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mav_trajectory_generation/CMakeLists.txt b/mav_trajectory_generation/CMakeLists.txt index 2b15960e..1035088c 100644 --- a/mav_trajectory_generation/CMakeLists.txt +++ b/mav_trajectory_generation/CMakeLists.txt @@ -47,15 +47,17 @@ target_link_libraries(polynomial_timing_evaluation ${PROJECT_NAME}) ######### # TESTS # ######### -catkin_add_gtest(test_polynomial - test/test_polynomial.cpp -) -target_link_libraries(test_polynomial ${PROJECT_NAME} ${catkin_LIBRARIES}) +if (CATKIN_ENABLE_TESTING) + catkin_add_gtest(test_polynomial + test/test_polynomial.cpp + ) + target_link_libraries(test_polynomial ${PROJECT_NAME} ${catkin_LIBRARIES}) -catkin_add_gtest(test_polynomial_optimization - test/test_polynomial_optimization.cpp -) -target_link_libraries(test_polynomial_optimization ${PROJECT_NAME} ${catkin_LIBRARIES}) + catkin_add_gtest(test_polynomial_optimization + test/test_polynomial_optimization.cpp + ) + target_link_libraries(test_polynomial_optimization ${PROJECT_NAME} ${catkin_LIBRARIES}) +endif() ########## # EXPORT # diff --git a/mav_trajectory_generation_ros/CMakeLists.txt b/mav_trajectory_generation_ros/CMakeLists.txt index f80efc05..8d3100d7 100644 --- a/mav_trajectory_generation_ros/CMakeLists.txt +++ b/mav_trajectory_generation_ros/CMakeLists.txt @@ -48,10 +48,12 @@ target_link_libraries(time_evaluation_node ${PROJECT_NAME}) ######### # TESTS # ######### -catkin_add_gtest(test_feasibility - test/test_feasibility.cpp -) -target_link_libraries(test_feasibility ${PROJECT_NAME} ${catkin_LIBRARIES}) +if (CATKIN_ENABLE_TESTING) + catkin_add_gtest(test_feasibility + test/test_feasibility.cpp + ) + target_link_libraries(test_feasibility ${PROJECT_NAME} ${catkin_LIBRARIES}) +endif() ########## # EXPORT #