skips tests on systems without git
parent
99e45b995b
commit
69b9bfec51
|
@ -30,35 +30,43 @@ endif()
|
||||||
|
|
||||||
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest")
|
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest")
|
||||||
|
|
||||||
ExternalProject_Add(gtest
|
# try to find git - if found, setup gtest
|
||||||
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
|
find_package(Git)
|
||||||
TIMEOUT 10
|
if(NOT GIT_FOUND)
|
||||||
PREFIX "${GTEST_PREFIX}"
|
set(AddGTest_FOUND false CACHE BOOL "Was gtest setup correctly?")
|
||||||
CMAKE_ARGS "${GTEST_CMAKE_ARGS}"
|
else(NOT GIT_FOUND)
|
||||||
LOG_DOWNLOAD ON
|
set(AddGTest_FOUND true CACHE BOOL "Was gtest setup correctly?")
|
||||||
LOG_CONFIGURE ON
|
|
||||||
LOG_BUILD ON
|
ExternalProject_Add(gtest
|
||||||
# Disable install
|
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
|
||||||
INSTALL_COMMAND ""
|
TIMEOUT 10
|
||||||
)
|
PREFIX "${GTEST_PREFIX}"
|
||||||
|
CMAKE_ARGS "${GTEST_CMAKE_ARGS}"
|
||||||
|
LOG_DOWNLOAD ON
|
||||||
|
LOG_CONFIGURE ON
|
||||||
|
LOG_BUILD ON
|
||||||
|
# Disable install
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
|
||||||
set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||||
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
|
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
|
||||||
set(GTEST_DEBUG_LIBRARIES
|
set(GTEST_DEBUG_LIBRARIES
|
||||||
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
|
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}")
|
"${CMAKE_THREAD_LIBS_INIT}")
|
||||||
SET(GTEST_RELEASE_LIBRARIES
|
SET(GTEST_RELEASE_LIBRARIES
|
||||||
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
|
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}")
|
"${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
|
||||||
if(MSVC_VERSION EQUAL 1700)
|
if(MSVC_VERSION EQUAL 1700)
|
||||||
add_definitions(-D_VARIADIC_MAX=10)
|
add_definitions(-D_VARIADIC_MAX=10)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ExternalProject_Get_Property(gtest source_dir)
|
ExternalProject_Get_Property(gtest source_dir)
|
||||||
include_directories(${source_dir}/include)
|
include_directories(${source_dir}/include)
|
||||||
include_directories(${source_dir}/gtest/include)
|
include_directories(${source_dir}/gtest/include)
|
||||||
|
|
||||||
ExternalProject_Get_Property(gtest binary_dir)
|
ExternalProject_Get_Property(gtest binary_dir)
|
||||||
link_directories(${binary_dir})
|
link_directories(${binary_dir})
|
||||||
|
endif(NOT GIT_FOUND)
|
||||||
|
|
|
@ -46,6 +46,7 @@ SET( TEST_SRCS
|
||||||
|
|
||||||
SOURCE_GROUP( tests FILES ${TEST_SRCS} )
|
SOURCE_GROUP( tests FILES ${TEST_SRCS} )
|
||||||
|
|
||||||
|
if(AddGTest_FOUND)
|
||||||
add_executable( unit
|
add_executable( unit
|
||||||
unit/CCompilerTest.c
|
unit/CCompilerTest.c
|
||||||
unit/Main.cpp
|
unit/Main.cpp
|
||||||
|
@ -60,5 +61,6 @@ target_link_libraries( unit assimp
|
||||||
debug ${GTEST_DEBUG_LIBRARIES}
|
debug ${GTEST_DEBUG_LIBRARIES}
|
||||||
optimized ${GTEST_RELEASE_LIBRARIES}
|
optimized ${GTEST_RELEASE_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
endif(AddGTest_FOUND)
|
||||||
add_subdirectory(headercheck)
|
add_subdirectory(headercheck)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue