Skip to content

Commit

Permalink
set search path args and then append (#543)
Browse files Browse the repository at this point in the history
Fix appending search paths specified by GTEST_DIR that was being
overridden by the set command for system paths

Signed-off-by: William Wedler <[email protected]>
Co-authored-by: William Wedler <[email protected]>
  • Loading branch information
zflat and William Wedler authored Aug 23, 2024
1 parent 446e3ed commit 4c630d4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ament_cmake_gtest/ament_cmake_gtest-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@ 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 "")
list(APPEND _search_path_include "$ENV{GTEST_DIR}/include/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)
Expand Down

0 comments on commit 4c630d4

Please sign in to comment.