Skip to content

Commit 357cb1e

Browse files
authored
Merge pull request #65 from emmenlau/emmenlau_cmake_gtest_fix
CMakeLists.txt: use internal gtest only if gtest is not found
2 parents aa793bf + d0d1dc3 commit 357cb1e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ endif(APR_BUILD_EXAMPLES)
8484
option (APR_TESTS "Build tests wrappers" OFF)
8585
if(APR_TESTS)
8686
message(STATUS "APR: Building tests")
87-
add_subdirectory("external/gtest")
88-
set(GTEST_LIBRARIES gtest)
87+
find_package(GTest 1.8.0)
88+
if(GTEST_FOUND)
89+
include_directories(${GTEST_INCLUDE_DIRS})
90+
else(GTEST_FOUND)
91+
message(STATUS "APR: GTest not found, using internal gtest")
92+
add_subdirectory("external/gtest")
93+
set(GTEST_LIBRARIES gtest)
94+
endif(GTEST_FOUND)
8995
add_subdirectory(test)
9096
endif(APR_TESTS)
9197

0 commit comments

Comments
 (0)