skips tests on systems without git

pull/577/head
Peter LaValle 2015-05-31 13:14:16 +01:00
parent 99e45b995b
commit 69b9bfec51
2 changed files with 38 additions and 28 deletions

View File

@ -30,7 +30,14 @@ endif()
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest")
ExternalProject_Add(gtest
# try to find git - if found, setup gtest
find_package(Git)
if(NOT GIT_FOUND)
set(AddGTest_FOUND false CACHE BOOL "Was gtest setup correctly?")
else(NOT GIT_FOUND)
set(AddGTest_FOUND true CACHE BOOL "Was gtest setup correctly?")
ExternalProject_Add(gtest
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
TIMEOUT 10
PREFIX "${GTEST_PREFIX}"
@ -40,25 +47,26 @@ ExternalProject_Add(gtest
LOG_BUILD ON
# Disable install
INSTALL_COMMAND ""
)
)
set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
set(GTEST_DEBUG_LIBRARIES
set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
set(GTEST_DEBUG_LIBRARIES
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")
SET(GTEST_RELEASE_LIBRARIES
SET(GTEST_RELEASE_LIBRARIES
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")
if(MSVC_VERSION EQUAL 1700)
if(MSVC_VERSION EQUAL 1700)
add_definitions(-D_VARIADIC_MAX=10)
endif()
endif()
ExternalProject_Get_Property(gtest source_dir)
include_directories(${source_dir}/include)
include_directories(${source_dir}/gtest/include)
ExternalProject_Get_Property(gtest source_dir)
include_directories(${source_dir}/include)
include_directories(${source_dir}/gtest/include)
ExternalProject_Get_Property(gtest binary_dir)
link_directories(${binary_dir})
ExternalProject_Get_Property(gtest binary_dir)
link_directories(${binary_dir})
endif(NOT GIT_FOUND)

View File

@ -46,6 +46,7 @@ SET( TEST_SRCS
SOURCE_GROUP( tests FILES ${TEST_SRCS} )
if(AddGTest_FOUND)
add_executable( unit
unit/CCompilerTest.c
unit/Main.cpp
@ -60,5 +61,6 @@ target_link_libraries( unit assimp
debug ${GTEST_DEBUG_LIBRARIES}
optimized ${GTEST_RELEASE_LIBRARIES}
)
endif(AddGTest_FOUND)
add_subdirectory(headercheck)