mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Additionally search for system headers, if sources are found in /usr/src
This commit is contained in:
parent
d637c53fff
commit
3c93f18115
@ -136,30 +136,35 @@ function(gnc_gtest_configure)
|
||||
elseif (GMOCK_ROOT)
|
||||
find_path(GTEST_SRC_DIR src/gtest-all.cc NO_CMAKE_SYSTEM_PATH
|
||||
PATHS ${GMOCK_ROOT}/../googletest ${GMOCK_ROOT}/gtest)
|
||||
else()
|
||||
find_path(GTEST_SRC_DIR src/gtest-all.cc
|
||||
PATHS /usr/src PATH_SUFFIXES googletest/googletest gtest)
|
||||
endif()
|
||||
if (GTEST_SRC_DIR)
|
||||
if (EXISTS ${GTEST_SRC_DIR}/include/gtest/gtest.h)
|
||||
set(GTEST_INCLUDE_DIR ${GTEST_SRC_DIR}/include CACHE PATH "" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "GTEST sources found, but it doesn't have 'gtest/gtest.h'")
|
||||
message(FATAL_ERROR "GTEST sources found, but it doesn't have 'gtest/gtest.h'")
|
||||
endif()
|
||||
else()
|
||||
if (GTEST_ROOT OR GMOCK_ROOT)
|
||||
message(FATAL_ERROR "GTEST sources not found in GTEST_ROOT or GMOCK_ROOT")
|
||||
endif()
|
||||
find_path(GTEST_SRC_DIR src/gtest-all.cc
|
||||
PATHS /usr/src PATH_SUFFIXES googletest/googletest gtest)
|
||||
if (GTEST_SRC_DIR)
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h NO_CMAKE_SYSTEM_PATH
|
||||
PATHS ${GTEST_SRC_DIR}/include)
|
||||
endif()
|
||||
endif()
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h)
|
||||
if (GTEST_SRC_DIR)
|
||||
set(lib_gtest_SOURCES
|
||||
"${GTEST_SRC_DIR}/src/gtest_main.cc"
|
||||
"${GTEST_SRC_DIR}/src/gtest-all.cc"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
if (GTEST_ROOT OR GMOCK_ROOT)
|
||||
message(FATAL_ERROR "GTEST sources not found in GTEST_ROOT or GMOCK_ROOT")
|
||||
else()
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h)
|
||||
find_library(GTEST_SHARED_LIB gtest)
|
||||
find_library(GTEST_MAIN_LIB gtest_main)
|
||||
if (NOT (GTEST_SHARED_LIB AND GTEST_MAIN_LIB AND GTEST_INCLUDE_DIR))
|
||||
message(FATAL_ERROR "GTEST not found. Please install it or set GTEST_ROOT or GMOCK_ROOT")
|
||||
endif()
|
||||
find_library(GTEST_SHARED_LIB gtest)
|
||||
find_library(GTEST_MAIN_LIB gtest_main)
|
||||
if (NOT (GTEST_SHARED_LIB AND GTEST_MAIN_LIB AND GTEST_INCLUDE_DIR))
|
||||
message(FATAL_ERROR "GTEST not found. Please install it or set GTEST_ROOT or GMOCK_ROOT")
|
||||
endif()
|
||||
endif()
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
@ -174,7 +179,17 @@ function(gnc_gtest_configure)
|
||||
elseif (GTEST_ROOT)
|
||||
find_path(GMOCK_SRC_DIR src/gmock-all.cc NO_CMAKE_SYSTEM_PATH
|
||||
PATHS ${GTEST_ROOT}/googlemock ${GTEST_ROOT}/../googlemock)
|
||||
endif()
|
||||
if (GMOCK_SRC_DIR)
|
||||
if (EXISTS ${GMOCK_SRC_DIR}/include/gmock/gmock.h)
|
||||
set(GMOCK_INCLUDE_DIR ${GMOCK_SRC_DIR}/include CACHE PATH "" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "GMOCK sources found, but it doesn't have 'gmock/gmock.h'")
|
||||
endif()
|
||||
else()
|
||||
if (GMOCK_ROOT OR GTEST_ROOT)
|
||||
message(FATAL_ERROR "GMOCK sources not found in GMOCK_ROOT or GTEST_ROOT")
|
||||
endif()
|
||||
find_path(GMOCK_SRC_DIR src/gmock-all.cc
|
||||
PATHS /usr/src PATH_SUFFIXES googletest/googlemock gmock)
|
||||
if (NOT GMOCK_SRC_DIR)
|
||||
@ -184,30 +199,25 @@ function(gnc_gtest_configure)
|
||||
set(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (GMOCK_SRC_DIR)
|
||||
if (EXISTS ${GMOCK_SRC_DIR}/include/gmock/gmock.h)
|
||||
set(GMOCK_INCLUDE_DIR ${GMOCK_SRC_DIR}/include CACHE PATH "" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "GMOCK sources found, but it doesn't have 'gmock/gmock.h'")
|
||||
if (GMOCK_SRC_DIR)
|
||||
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h NO_CMAKE_SYSTEM_PATH
|
||||
PATHS ${GMOCK_SRC_DIR}/include)
|
||||
endif()
|
||||
endif()
|
||||
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
|
||||
if (GMOCK_SRC_DIR)
|
||||
if (NOT GMOCK_MAIN_SRC_DIR)
|
||||
set(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}/src")
|
||||
endif()
|
||||
set(GMOCK_SRC "${GMOCK_MAIN_SRC_DIR}/gmock-all.cc" PARENT_SCOPE)
|
||||
set(GMOCK_LIB "${CMAKE_BINARY_DIR}/common/test-core/libgmock.a" PARENT_SCOPE)
|
||||
else()
|
||||
if (GMOCK_ROOT OR GTEST_ROOT)
|
||||
message(FATAL_ERROR "GMOCK sources not found in GMOCK_ROOT or GTEST_ROOT")
|
||||
find_library(GMOCK_SHARED_LIB gmock)
|
||||
find_library(GMOCK_MAIN_LIB gmock_main)
|
||||
if (GMOCK_MAIN_LIB AND GMOCK_SHARED_LIB AND GMOCK_INCLUDE_DIR)
|
||||
set(GMOCK_LIB "${GMOCK_SHARED_LIB};${GMOCK_MAIN_LIB}" PARENT_SCOPE)
|
||||
else()
|
||||
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
|
||||
find_library(GMOCK_SHARED_LIB gmock)
|
||||
find_library(GMOCK_MAIN_LIB gmock_main)
|
||||
if (GMOCK_MAIN_LIB AND GMOCK_SHARED_LIB AND GMOCK_INCLUDE_DIR)
|
||||
set(GMOCK_LIB "${GMOCK_SHARED_LIB};${GMOCK_MAIN_LIB}" PARENT_SCOPE)
|
||||
else()
|
||||
message(FATAL_ERROR "GMOCK not found. Please install it or set GMOCK_ROOT")
|
||||
endif()
|
||||
message(FATAL_ERROR "GMOCK not found. Please install it or set GMOCK_ROOT")
|
||||
endif()
|
||||
endif()
|
||||
set(GMOCK_FOUND YES PARENT_SCOPE)
|
||||
|
Loading…
Reference in New Issue
Block a user