From 8c4a3a19a08dd73dc15d3e08358a2e04fb53239b Mon Sep 17 00:00:00 2001 From: James Xu Date: Thu, 14 Feb 2019 15:57:26 -0800 Subject: [PATCH] update cmake include directories to use correct gtest.h --- diagnostic_aggregator/CMakeLists.txt | 9 ++++++--- diagnostic_aggregator/test/analyzer_loader.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/diagnostic_aggregator/CMakeLists.txt b/diagnostic_aggregator/CMakeLists.txt index fc009ede9..1bc654770 100644 --- a/diagnostic_aggregator/CMakeLists.txt +++ b/diagnostic_aggregator/CMakeLists.txt @@ -20,7 +20,11 @@ if( (${diagnostic_msgs_VERSION} VERSION_EQUAL "1.12.0") OR endif() find_package(Boost REQUIRED COMPONENTS system) -include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} gtest-1.7.0/include) +include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) + +set(LOCAL_GTEST_DIR "gtest-1.7.0") +# gtest could be included in ${catkin_INCLUDE_DIRS}, prepend local gtest include directory so it's searched first +include_directories(BEFORE ${LOCAL_GTEST_DIR}/include) add_library(${PROJECT_NAME} src/status_item.cpp @@ -41,8 +45,7 @@ target_link_libraries(aggregator_node ${catkin_LIBRARIES} ) # Analyzer loader allows other users to test that Analyzers load -add_executable(analyzer_loader test/analyzer_loader.cpp - gtest-1.7.0/gtest-all.cc) +add_executable(analyzer_loader test/analyzer_loader.cpp ${LOCAL_GTEST_DIR}/gtest-all.cc) target_link_libraries(analyzer_loader diagnostic_aggregator) if(CATKIN_ENABLE_TESTING) diff --git a/diagnostic_aggregator/test/analyzer_loader.cpp b/diagnostic_aggregator/test/analyzer_loader.cpp index 4bff88aea..97a7cb339 100644 --- a/diagnostic_aggregator/test/analyzer_loader.cpp +++ b/diagnostic_aggregator/test/analyzer_loader.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include "gtest/gtest.h" //using namespace std; //using namespace diagnostic_aggregator;