From 4c630d4c36af09e8a426ef5c1fbc8850f656019c Mon Sep 17 00:00:00 2001 From: Will <1305536+zflat@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:23:04 -0400 Subject: [PATCH] set search path args and then append (#543) Fix appending search paths specified by GTEST_DIR that was being overridden by the set command for system paths Signed-off-by: William Wedler Co-authored-by: William Wedler --- ament_cmake_gtest/ament_cmake_gtest-extras.cmake | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ament_cmake_gtest/ament_cmake_gtest-extras.cmake b/ament_cmake_gtest/ament_cmake_gtest-extras.cmake index c60c1f11..0380e77d 100644 --- a/ament_cmake_gtest/ament_cmake_gtest-extras.cmake +++ b/ament_cmake_gtest/ament_cmake_gtest-extras.cmake @@ -24,8 +24,9 @@ macro(_ament_cmake_gtest_find_gtest) # if gtest sources were not found in a previous run if(NOT GTEST_FROM_SOURCE_FOUND) # search path for gtest includes and sources - set(_search_path_include "") - set(_search_path_src "") + # check the system installed path (i.e. on Ubuntu) + set(_search_path_include "/usr/include/gtest") + set(_search_path_src "/usr/src/gtest/src") # option() consider environment variable to find gtest if(NOT $ENV{GTEST_DIR} STREQUAL "") @@ -33,10 +34,6 @@ macro(_ament_cmake_gtest_find_gtest) list(APPEND _search_path_src "$ENV{GTEST_DIR}/src") endif() - # check to system installed path (i.e. on Ubuntu) - set(_search_path_include "/usr/include/gtest") - set(_search_path_src "/usr/src/gtest/src") - # check gtest_vendor path, prefer this version over a system installed find_package(gtest_vendor QUIET) if(gtest_vendor_FOUND AND gtest_vendor_BASE_DIR)