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) ...@@ -84,11 +84,13 @@ if(NOT CUKE_DISABLE_GTEST)
set(GMOCK_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gmock") set(GMOCK_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gmock")
find_package(GMock REQUIRED) find_package(GMock REQUIRED)
if(GMOCK_FOUND) if(GTEST_FOUND)
set(CUKE_GTEST_LIBRARIES set(CUKE_GTEST_LIBRARIES
${GTEST_BOTH_LIBRARIES} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
) )
endif()
if(GMOCK_FOUND)
set(CUKE_GMOCK_LIBRARIES set(CUKE_GMOCK_LIBRARIES
${GTEST_BOTH_LIBRARIES} ${GTEST_BOTH_LIBRARIES}
${GMOCK_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES}
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
# Accepts the following variables as input: # Accepts the following variables as input:
# #
# GMOCK_ROOT - The root directory of the gmock install prefix # GMOCK_ROOT - The root directory of the gmock install prefix
#
# GMOCK_SRC_DIR -The directory of the gmock sources # GMOCK_SRC_DIR -The directory of the gmock sources
#
# GMOCK_VER - The version of the gmock sources to be downloaded # GMOCK_VER - The version of the gmock sources to be downloaded
# #
#----------------------- #-----------------------
...@@ -148,21 +146,57 @@ else() ...@@ -148,21 +146,57 @@ else()
set(GTEST_CMAKE_ARGS -DBUILD_SHARED_LIBS=ON) set(GTEST_CMAKE_ARGS -DBUILD_SHARED_LIBS=ON)
endif() endif()
if("${GMOCK_SRC_DIR}" STREQUAL "") if("${GMOCK_SRC_DIR}" STREQUAL "")
if("${GMOCK_VER}" STREQUAL "") if("${GMOCK_VER}" STREQUAL "1.8.0")
set(GMOCK_VER "1.7.0") set(GMOCK_VER "1.7.0")
endif() message("GMock ver 1.8 not supported -> switching to 1.7")
message(STATUS "Downloading GMock / GTest version ${GMOCK_VER}") #todo add 1.8 support from single repo of gtest
ExternalProject_Add( endif()
gmock message(STATUS "Downloading GMock / GTest version ${GMOCK_VER}")
URL "https://googlemock.googlecode.com/files/gmock-${GMOCK_VER}.zip" ExternalProject_Add(
PREFIX ${GMOCK_ROOT} gtest
INSTALL_COMMAND "" GIT_REPOSITORY "https://github.com/google/googletest.git"
LOG_DOWNLOAD ON GIT_TAG "release-${GMOCK_VER}"
LOG_CONFIGURE ON PREFIX ${GMOCK_ROOT}
LOG_BUILD ON INSTALL_COMMAND ""
CMAKE_ARGS ${GTEST_CMAKE_ARGS} LOG_DOWNLOAD ON
) LOG_CONFIGURE ON
LOG_BUILD ON
CMAKE_ARGS ${GTEST_CMAKE_ARGS}
)
ExternalProject_Add(
gmock
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() else()
Message(STATUS "Building Gmock / Gtest from dir ${GMOCK_SRC_DIR}") Message(STATUS "Building Gmock / Gtest from dir ${GMOCK_SRC_DIR}")
ExternalProject_Add( ExternalProject_Add(
...@@ -175,44 +209,41 @@ else() ...@@ -175,44 +209,41 @@ else()
LOG_BUILD ON LOG_BUILD ON
CMAKE_ARGS ${GTEST_CMAKE_ARGS} CMAKE_ARGS ${GTEST_CMAKE_ARGS}
) )
endif()
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
ExternalProject_Get_Property(gmock source_dir binary_dir)
set(GTEST_LIB_DIR "${binary_dir}/gtest/${CMAKE_CFG_INTDIR}") add_library(libgtest IMPORTED STATIC GLOBAL)
set(GMOCK_LIB_DIR "${binary_dir}/${CMAKE_CFG_INTDIR}") add_dependencies(libgtest gmock)
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
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 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}" "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(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) if(GTEST_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
set(GTEST_LIBRARIES ${GTEST_LIBRARY}) set(GTEST_LIBRARIES ${GTEST_LIBRARY})
...@@ -223,3 +254,14 @@ if(GTEST_FOUND) ...@@ -223,3 +254,14 @@ if(GTEST_FOUND)
Message(STATUS "GTest libs: ${GTEST_BOTH_LIBRARIES}") Message(STATUS "GTest libs: ${GTEST_BOTH_LIBRARIES}")
endif() endif()
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 ...@@ -15,7 +15,7 @@ set(CUKE_SOURCES
connectors/wire/WireProtocolCommands.cpp connectors/wire/WireProtocolCommands.cpp
) )
if(GMOCK_FOUND) if(GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS}) include_directories(${GTEST_INCLUDE_DIRS})
list(APPEND CUKE_SOURCES drivers/GTestDriver.cpp) list(APPEND CUKE_SOURCES drivers/GTestDriver.cpp)
endif() endif()
...@@ -35,8 +35,3 @@ endif() ...@@ -35,8 +35,3 @@ endif()
add_library(cucumber-cpp-nomain STATIC ${CUKE_SOURCES}) add_library(cucumber-cpp-nomain STATIC ${CUKE_SOURCES})
add_library(cucumber-cpp STATIC ${CUKE_SOURCES} main.cpp) 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