Commit d18797ab authored by Kamil Strzempowicz's avatar Kamil Strzempowicz
Browse files

change gmock/gtest source to github

parent d855fcd9
......@@ -84,11 +84,13 @@ if(NOT CUKE_DISABLE_GTEST)
set(GMOCK_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gmock")
find_package(GMock REQUIRED)
if(GMOCK_FOUND)
if(GTEST_FOUND)
set(CUKE_GTEST_LIBRARIES
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
endif()
if(GMOCK_FOUND)
set(CUKE_GMOCK_LIBRARIES
${GTEST_BOTH_LIBRARIES}
${GMOCK_BOTH_LIBRARIES}
......
......@@ -22,9 +22,7 @@
# Accepts the following variables as input:
#
# GMOCK_ROOT - The root directory of the gmock install prefix
#
# GMOCK_SRC_DIR -The directory of the gmock sources
#
# GMOCK_VER - The version of the gmock sources to be downloaded
#
#-----------------------
......@@ -149,20 +147,56 @@ else()
endif()
if("${GMOCK_SRC_DIR}" STREQUAL "")
if("${GMOCK_VER}" STREQUAL "")
if("${GMOCK_VER}" STREQUAL "1.8.0")
set(GMOCK_VER "1.7.0")
message("GMock ver 1.8 not supported -> switching to 1.7")
#todo add 1.8 support from single repo of gtest
endif()
message(STATUS "Downloading GMock / GTest version ${GMOCK_VER}")
ExternalProject_Add(
gtest
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "release-${GMOCK_VER}"
PREFIX ${GMOCK_ROOT}
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
CMAKE_ARGS ${GTEST_CMAKE_ARGS}
)
ExternalProject_Add(
gmock
URL "https://googlemock.googlecode.com/files/gmock-${GMOCK_VER}.zip"
GIT_REPOSITORY "https://github.com/google/googlemock.git"
GIT_TAG "release-${GMOCK_VER}"
PREFIX ${GMOCK_ROOT}
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
CMAKE_ARGS ${GTEST_CMAKE_ARGS}
DEPENDS gtest
)
add_library(libgtest IMPORTED STATIC GLOBAL)
add_dependencies(libgtest gtest)
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
ExternalProject_Get_Property(gtest source_dir binary_dir)
set(GTEST_INCLUDE_DIR "${source_dir}/include")
mark_as_advanced(GTEST_INCLUDE_DIR)
set(GTEST_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${Suffix}")
mark_as_advanced(GTEST_LIBRARY)
set(GTEST_MAIN_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${Suffix}")
mark_as_advanced(GTEST_MAIN_LIBRARY)
ExternalProject_Get_Property(gmock source_dir binary_dir)
set(GMOCK_INCLUDE_DIR "${source_dir}/include")
mark_as_advanced(GMOCK_INCLUDE_DIR)
set(GMOCK_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${Suffix}")
mark_as_advanced(GMOCK_LIBRARY)
set(GMOCK_MAIN_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${Suffix}")
mark_as_advanced(GMOCK_MAIN_LIBRARY)
else()
Message(STATUS "Building Gmock / Gtest from dir ${GMOCK_SRC_DIR}")
ExternalProject_Add(
......@@ -175,44 +209,41 @@ else()
LOG_BUILD ON
CMAKE_ARGS ${GTEST_CMAKE_ARGS}
)
endif()
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
ExternalProject_Get_Property(gmock source_dir binary_dir)
add_library(libgtest IMPORTED STATIC GLOBAL)
add_dependencies(libgtest gmock)
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
set(GTEST_LIB_DIR "${binary_dir}/gtest/${CMAKE_CFG_INTDIR}")
set(GMOCK_LIB_DIR "${binary_dir}/${CMAKE_CFG_INTDIR}")
ExternalProject_Get_Property(gmock source_dir binary_dir)
set(GTEST_INCLUDE_DIR "${source_dir}/gtest/include")
mark_as_advanced(GTEST_INCLUDE_DIR)
set(GTEST_LIBRARY "${binary_dir}/gtest/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${Suffix}")
mark_as_advanced(GTEST_LIBRARY)
set(GTEST_MAIN_LIBRARY "${binary_dir}/gtest/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${Suffix}")
mark_as_advanced(GTEST_MAIN_LIBRARY)
set(GMOCK_INCLUDE_DIR "${source_dir}/include")
mark_as_advanced(GMOCK_INCLUDE_DIR)
set(GMOCK_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${Suffix}")
mark_as_advanced(GMOCK_LIBRARY)
set(GMOCK_MAIN_LIBRARY "${binary_dir}/${CMAKE_CFG_INTDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${Suffix}")
mark_as_advanced(GMOCK_MAIN_LIBRARY)
endif()
set_target_properties(libgtest PROPERTIES
"IMPORTED_LOCATION" "${GTEST_LIBRARY}"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
"INTERFACE_INCLUDE_DIRECTORIES" "${GTEST_INCLUDE_DIR}"
)
set_target_properties(libgmock PROPERTIES
"IMPORTED_LOCATION" "${GMOCK_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock.${Suffix}"
"IMPORTED_LOCATION" "${GMOCK_LIBARY}"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
"INTERFACE_INCLUDE_DIRECTORIES" "${source_dir}/include"
"INTERFACE_INCLUDE_DIRECTORIES" "${GMOCK_INCLUDE_DIR}"
)
set(GMOCK_INCLUDE_DIR ${source_dir}/include)
mark_as_advanced(GMOCK_INCLUDE_DIR)
set(GTEST_INCLUDE_DIR ${source_dir}/gtest/include)
mark_as_advanced(GTEST_INCLUDE_DIR)
set(GTEST_LIBRARY "${GTEST_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${Suffix}")
set(GTEST_MAIN_LIBRARY "${GTEST_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${Suffix}")
set(GMOCK_LIBRARY "${GMOCK_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${Suffix}")
set(GMOCK_MAIN_LIBRARY "${GMOCK_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${Suffix}")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR GMOCK_MAIN_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR GMOCK_MAIN_LIBRARY)
if(GMOCK_FOUND)
set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
set(GMOCK_LIBRARIES ${GMOCK_LIBRARY})
set(GMOCK_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARY})
set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES})
if(VERBOSE)
Message(STATUS "GMock includes: ${GMOCK_INCLUDE_DIRS}")
Message(STATUS "GMock libs: ${GMOCK_BOTH_LIBRARIES}")
endif()
endif()
if(GTEST_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
set(GTEST_LIBRARIES ${GTEST_LIBRARY})
......@@ -223,3 +254,14 @@ if(GTEST_FOUND)
Message(STATUS "GTest libs: ${GTEST_BOTH_LIBRARIES}")
endif()
endif()
if(GMOCK_FOUND)
set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
set(GMOCK_LIBRARIES ${GMOCK_LIBRARY})
set(GMOCK_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARY})
set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES})
if(VERBOSE)
Message(STATUS "GMock includes: ${GMOCK_INCLUDE_DIRS}")
Message(STATUS "GMock libs: ${GMOCK_BOTH_LIBRARIES}")
endif()
endif()
......@@ -15,7 +15,7 @@ set(CUKE_SOURCES
connectors/wire/WireProtocolCommands.cpp
)
if(GMOCK_FOUND)
if(GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS})
list(APPEND CUKE_SOURCES drivers/GTestDriver.cpp)
endif()
......@@ -35,8 +35,3 @@ endif()
add_library(cucumber-cpp-nomain STATIC ${CUKE_SOURCES})
add_library(cucumber-cpp STATIC ${CUKE_SOURCES} main.cpp)
if(GMOCK_FOUND)
add_dependencies(cucumber-cpp gmock)
add_dependencies(cucumber-cpp-nomain gmock)
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment