Fix cmake's gmock handling to work with Fedora packages

Similar checks were already in configure.ac for the autotools variant
This commit is contained in:
Geert Janssens 2017-02-06 10:37:39 +01:00
parent 659c96eb1b
commit 1241b71770
2 changed files with 8 additions and 4 deletions

View File

@ -116,11 +116,15 @@ FUNCTION(GNC_GTEST_CONFIGURE)
MESSAGE(STATUS "Checking for GMOCK")
FIND_PATH(GMOCK_INCLUDE_DIR gmock/gmock.h
PATHS ${GMOCK_ROOT}/include /usr/include)
FIND_PATH(GMOCK_SRC_DIR src/gmock-all.cc
PATHS ${GMOCK_ROOT} /usr/src/gmock)
FIND_PATH(GMOCK_SRC_DIR gmock-all.cc
PATHS ${GMOCK_ROOT}/src /usr/src/gmock/src)
if (NOT GMOC_SRC_DIR)
FIND_PATH(GMOCK_SRC_DIR gmock-all.cc
PATHS ${GMOCK_ROOT} /usr/src/gmock)
endif()
if (GMOCK_INCLUDE_DIR AND GMOCK_SRC_DIR)
SET(GMOCK_FOUND YES PARENT_SCOPE)
SET(GMOCK_SRC "${GMOCK_SRC_DIR}/src/gmock_main.cc" PARENT_SCOPE)
SET(GMOCK_SRC "${GMOCK_SRC_DIR}/gmock_main.cc" PARENT_SCOPE)
SET(GMOCK_LIB "${CMAKE_BINARY_DIR}/src/test-core/libgmock.a" PARENT_SCOPE)
ELSE()
MESSAGE(FATAL_ERROR "GMOCK not found. Please install it or set GMOCK_ROOT")

View File

@ -70,7 +70,7 @@ IF(NOT GTEST_SHARED_LIB)
ADD_LIBRARY(gtest STATIC ${lib_gtest_SOURCES})
TARGET_INCLUDE_DIRECTORIES(gtest PUBLIC ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR})
ENDIF()
SET (lib_gmock_SOURCES ${GMOCK_SRC_DIR}/src/gmock-all.cc)
SET (lib_gmock_SOURCES ${GMOCK_SRC_DIR}/gmock-all.cc)
ADD_LIBRARY(gmock STATIC ${lib_gmock_SOURCES})
TARGET_INCLUDE_DIRECTORIES(gmock PUBLIC
${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}