Skip to content

Commit

Permalink
fix GTest detection when cmake-extras is installed (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas authored May 14, 2020
1 parent b305797 commit 860b699
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmake/test/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,13 @@ function(catkin_find_google_test_source gtest_path googletest_path
endfunction()

find_package(GMock QUIET)
find_package(GTest QUIET)
# the GMockConfig.cmake from the Debian package cmake-extras provides all targets
if(TARGET gtest AND TARGET gtest_main AND TARGET gmock AND TARGET gmock_main)
set(GMOCK_FOUND TRUE)
set(GTEST_FOUND TRUE)
else()
find_package(GTest QUIET)
endif()
if(NOT GMOCK_FOUND OR NOT GTEST_FOUND)
# If we find one but not the other, see if we can get both from source
# only add gmock/gtest directory once per workspace
Expand Down

0 comments on commit 860b699

Please sign in to comment.