FindGTestSrc.cmake 828 B

123456789101112131415161718192021222324252627282930
  1. SET(GTEST_SEARCH_PATH
  2. "${GTEST_SOURCE_DIR}"
  3. "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest/googletest")
  4. IF(UNIX)
  5. IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
  6. LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest")
  7. ELSE()
  8. LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
  9. ENDIF()
  10. ENDIF()
  11. FIND_PATH(GTEST_SOURCE_DIR
  12. NAMES CMakeLists.txt src/gtest_main.cc
  13. PATHS ${GTEST_SEARCH_PATH})
  14. # Debian installs gtest include directory in /usr/include, thus need to look
  15. # for include directory separately from source directory.
  16. FIND_PATH(GTEST_INCLUDE_DIR
  17. NAMES gtest/gtest.h
  18. PATH_SUFFIXES include
  19. HINTS ${GTEST_SOURCE_DIR}
  20. PATHS ${GTEST_SEARCH_PATH})
  21. INCLUDE(FindPackageHandleStandardArgs)
  22. find_package_handle_standard_args(GTestSrc DEFAULT_MSG
  23. GTEST_SOURCE_DIR
  24. GTEST_INCLUDE_DIR)