Introduce option to select default gtest installation. Refs #309
This will introduce RAPIDJSON_BUILD_THIRDPARTY_GTEST option. If it is set to TRUE, cmake will look for GTest installation in `thirdparty/gtest` before looking in other places. Current default value (OFF) for RAPIDJSON_BUILD_THIRDPARTY_GTEST represents previous behaviour when system-wide gtest installation is used whenever possible. This commit will as well eliminate problem described in #309 when source directory found is `thirdparty/gtest` while include files are found system-wide. This however won't give the user possibility to select gtest installation to use.
This commit is contained in:
parent
8d39282af5
commit
04b673686a
@ -17,6 +17,8 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON)
|
||||
option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON)
|
||||
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
|
||||
option(RAPIDJSON_BUILD_THIRDPARTY_GTEST
|
||||
"Use gtest installation in `thirdparty/gtest` by default if available" OFF)
|
||||
|
||||
option(RAPIDJSON_HAS_STDSTRING "" OFF)
|
||||
if(RAPIDJSON_HAS_STDSTRING)
|
||||
|
@ -1,9 +1,14 @@
|
||||
|
||||
SET(GTEST_SEARCH_PATH
|
||||
"${GTEST_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/thirdparty/gtest")
|
||||
|
||||
IF(UNIX)
|
||||
LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
|
||||
IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
|
||||
LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest")
|
||||
ELSE()
|
||||
LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(GTEST_SOURCE_DIR
|
||||
@ -15,6 +20,7 @@ FIND_PATH(GTEST_SOURCE_DIR
|
||||
FIND_PATH(GTEST_INCLUDE_DIR
|
||||
NAMES gtest/gtest.h
|
||||
PATH_SUFFIXES include
|
||||
HINTS ${GTEST_SOURCE_DIR}
|
||||
PATHS ${GTEST_SEARCH_PATH})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user