Merge pull request #11950 from jmallach/gtest
Allow building against system gtest
This commit is contained in:
commit
afa8a47be1
|
@ -1032,10 +1032,16 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core")
|
||||||
# Unit testing.
|
# Unit testing.
|
||||||
#
|
#
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
|
find_package(GTest)
|
||||||
|
if (GTEST_FOUND)
|
||||||
|
message(STATUS "Using the system gtest")
|
||||||
|
include_directories(${GTEST_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
message(STATUS "Using static gtest from Externals")
|
message(STATUS "Using static gtest from Externals")
|
||||||
|
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
# Force gtest to link the C runtime dynamically on Windows in order to avoid runtime mismatches.
|
# Force gtest to link the C runtime dynamically on Windows in order to avoid runtime mismatches.
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Unit tests are disabled")
|
message(STATUS "Unit tests are disabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue