зеркало из https://github.com/mozilla/cubeb.git
CMake: allow googletest and sanitizers-cmake from parent projects
This makes it easier to embed cubeb within larger projects that already provide googletest and/or sanitizers-cmake, by testing directly for what is used rather than indirectly for .git folders.
This commit is contained in:
Родитель
32fcb3a7a7
Коммит
91f801d661
|
@ -19,17 +19,22 @@ set(CMAKE_C_STANDARD 99)
|
|||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/googletest/.git" OR
|
||||
NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sanitizers-cmake/.git")
|
||||
message(FATAL_ERROR "submodules not initialized: run\n\tgit submodule update --init --recursive\nin base git checkout")
|
||||
if(NOT COMMAND add_sanitizers)
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake")
|
||||
find_package(Sanitizers)
|
||||
if(NOT COMMAND add_sanitizers)
|
||||
message(FATAL_ERROR "Could not find sanitizers-cmake: run\n\tgit submodule update --init --recursive\nin base git checkout")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/sanitizers-cmake/cmake")
|
||||
find_package(Sanitizers)
|
||||
|
||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "")
|
||||
add_subdirectory(googletest)
|
||||
if(NOT TARGET gtest_main)
|
||||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
|
||||
message(FATAL_ERROR "Could not find googletest: run\n\tgit submodule update --init --recursive\nin base git checkout")
|
||||
endif()
|
||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "")
|
||||
add_subdirectory(googletest)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
|
Загрузка…
Ссылка в новой задаче