2020-09-19 17:45:11 +00:00
|
|
|
# included only if ENABLE_TESTS=1
|
2020-07-10 19:08:18 +00:00
|
|
|
|
2018-01-05 18:03:57 +00:00
|
|
|
option (USE_INTERNAL_GTEST_LIBRARY "Set to FALSE to use system Google Test instead of bundled" ${NOT_UNBUNDLED})
|
|
|
|
|
2018-01-20 02:35:16 +00:00
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest/CMakeLists.txt")
|
|
|
|
if (USE_INTERNAL_GTEST_LIBRARY)
|
2021-10-17 23:29:04 +00:00
|
|
|
message (WARNING "submodule contrib/googletest is missing. to fix try run: \n git submodule update --init")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gtest")
|
2018-01-20 02:35:16 +00:00
|
|
|
set (USE_INTERNAL_GTEST_LIBRARY 0)
|
|
|
|
endif ()
|
2020-09-19 16:42:36 +00:00
|
|
|
|
2018-01-20 02:35:16 +00:00
|
|
|
set (MISSING_INTERNAL_GTEST_LIBRARY 1)
|
2018-01-05 18:03:57 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-01-25 20:12:15 +00:00
|
|
|
if(NOT USE_INTERNAL_GTEST_LIBRARY)
|
|
|
|
# TODO: autodetect of GTEST_SRC_DIR by EXISTS /usr/src/googletest/CMakeLists.txt
|
|
|
|
if(NOT GTEST_SRC_DIR)
|
|
|
|
find_package(GTest)
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT GTEST_INCLUDE_DIRS)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system Google Test")
|
|
|
|
endif()
|
2019-01-25 20:12:15 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT GTEST_SRC_DIR AND NOT GTEST_INCLUDE_DIRS AND NOT MISSING_INTERNAL_GTEST_LIBRARY)
|
2018-01-05 18:03:57 +00:00
|
|
|
set (USE_INTERNAL_GTEST_LIBRARY 1)
|
2018-06-19 18:09:09 +00:00
|
|
|
set (GTEST_MAIN_LIBRARIES gtest_main)
|
2019-02-27 12:52:24 +00:00
|
|
|
set (GTEST_LIBRARIES gtest)
|
2019-03-14 20:52:10 +00:00
|
|
|
set (GTEST_BOTH_LIBRARIES ${GTEST_MAIN_LIBRARIES} ${GTEST_LIBRARIES})
|
2019-01-25 20:02:03 +00:00
|
|
|
set (GTEST_INCLUDE_DIRS ${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest)
|
2020-08-14 15:44:04 +00:00
|
|
|
elseif(USE_INTERNAL_GTEST_LIBRARY)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Wouldn't use internal Google Test library")
|
|
|
|
set (USE_INTERNAL_GTEST_LIBRARY 0)
|
2018-01-05 18:03:57 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-03-14 20:52:10 +00:00
|
|
|
if((GTEST_INCLUDE_DIRS AND GTEST_BOTH_LIBRARIES) OR GTEST_SRC_DIR)
|
2019-01-25 20:02:03 +00:00
|
|
|
set(USE_GTEST 1)
|
|
|
|
endif()
|
|
|
|
|
2019-03-14 20:52:10 +00:00
|
|
|
message (STATUS "Using gtest=${USE_GTEST}: ${GTEST_INCLUDE_DIRS} : ${GTEST_BOTH_LIBRARIES} : ${GTEST_SRC_DIR}")
|