Move code to find gtest shared version into src/CMakeLists.txt

This commit is contained in:
David Capello 2015-06-08 17:42:08 -03:00
parent b03f6de006
commit 0c115e5567
2 changed files with 16 additions and 14 deletions

View File

@ -143,6 +143,22 @@ else()
include_directories(${CMAKE_BINARY_DIR})
endif()
if(USE_SHARED_GTEST)
find_library(LIBGTEST_LIBRARY NAMES gtest)
find_path(LIBGTEST_INCLUDE_DIR NAMES "gtest/gtest.h")
set(libs3rdparty ${libs3rdparty} ${LIBGTEST_LIBRARY})
include_directories(${LIBGTEST_INCLUDE_DIR})
check_cxx_source_compiles("
#include <gtest/gtest.h>
int main() { }
" HAVE_GTEST_GTEST_H)
if(NOT HAVE_GTEST_GTEST_H)
message(FATAL_ERROR "gtest/gtest.h is missing. Set USE_SHARED_GTEST=OFF and initialize submodules: git submodule update --init --recursive")
endif()
endif()
set(libs3rdparty simpleini ${libs3rdparty})
include_directories(${SIMPLEINI_DIR})

View File

@ -35,20 +35,6 @@ if(NOT USE_SHARED_GTEST AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.
# CMakeLists.txt modifies some MSVC flags.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/include)
add_library(gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/src/gtest-all.cc)
else()
find_library(LIBGTEST_LIBRARY NAMES gtest)
find_path(LIBGTEST_INCLUDE_DIR NAMES "gtest/gtest.h")
set(libs3rdparty ${libs3rdparty} ${LIBGTEST_LIBRARY})
include_directories(${LIBGTEST_INCLUDE_DIR})
check_cxx_source_compiles("
#include <gtest/gtest.h>
int main() { }
" HAVE_GTEST_GTEST_H)
if(NOT HAVE_GTEST_GTEST_H)
message(FATAL_ERROR "gtest/gtest.h is missing. Set USE_SHARED_GTEST=OFF and initialize submodules: git submodule update --init --recursive")
endif()
endif()
if(NOT USE_SHARED_CURL)