Skip to content

Commit 4b21907

Browse files
committed
fix issue #360
1 parent 151a98e commit 4b21907

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1) # version on Ubuntu Xenial
1+
cmake_minimum_required(VERSION 3.10.2) # version on Ubuntu Bionic
22
project(behaviortree_cpp_v3)
33

44
#---- Add the subdirectory cmake ----
@@ -111,14 +111,18 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
111111
set(BUILD_TOOL_INCLUDE_DIRS ${catkin_INCLUDE_DIRS})
112112

113113
elseif(BUILD_UNIT_TESTS)
114-
include(FetchContent)
115-
FetchContent_Declare(
116-
googletest
117-
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
118-
)
119-
# For Windows: Prevent overriding the parent project's compiler/linker settings
120-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
121-
FetchContent_MakeAvailable(googletest)
114+
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
115+
find_package(GTest REQUIRED)
116+
else()
117+
include(FetchContent)
118+
FetchContent_Declare(
119+
googletest
120+
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
121+
)
122+
# For Windows: Prevent overriding the parent project's compiler/linker settings
123+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
124+
FetchContent_MakeAvailable(googletest)
125+
endif()
122126
endif()
123127

124128

0 commit comments

Comments
 (0)