Share testing library for all project
git-svn-id: svn://db.shs.com.ru/pip@873 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -19,6 +19,7 @@ option(INTROSPECTION "Build with introspection" OFF)
|
||||
option(LIB "System install" ON)
|
||||
option(STATIC_LIB OFF)
|
||||
option(DEBUG "Build with -g3" OFF)
|
||||
option(TESTS "Build tests and perform their before install step" OFF)
|
||||
set(PIP_UTILS 1)
|
||||
if(LIBPROJECT)
|
||||
set(PIP_UTILS ${UTILS})
|
||||
@@ -221,6 +222,10 @@ else()
|
||||
message(STATUS "Building PIP release version")
|
||||
endif()
|
||||
|
||||
if (TESTS)
|
||||
include(DownloadGTest.cmake)
|
||||
option(CONCURRENT_TESTS "Enable tests for concurrent library" ON)
|
||||
endif()
|
||||
|
||||
# Check if std::iostream operators support
|
||||
if(STD_IOSTREAM)
|
||||
@@ -487,7 +492,7 @@ if (NOT PIP_FREERTOS)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_concurrent)
|
||||
|
||||
# Enable build tests for concurrent module
|
||||
if(CONCURRENT_TESTING)
|
||||
if(CONCURRENT_TESTS)
|
||||
add_subdirectory(src_concurrent/test)
|
||||
endif()
|
||||
|
||||
|
||||
31
DownloadGTest.cmake
Normal file
31
DownloadGTest.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
# Download and unpack googletest at configure time
|
||||
configure_file(GTestCMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "Build step for googletest failed: ${result}")
|
||||
endif()
|
||||
|
||||
# Prevent overriding the parent project's compiler/linker
|
||||
# settings on Windows
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Add googletest directly to our build. This defines
|
||||
# the gtest and gtest_main targets.
|
||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# The gtest/gtest_main targets carry header search path
|
||||
# dependencies automatically when using CMake 2.8.11 or
|
||||
# later. Otherwise we have to add them here ourselves.
|
||||
if (CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
include_directories("${gtest_SOURCE_DIR}/include")
|
||||
endif()
|
||||
@@ -1,35 +1,4 @@
|
||||
project(concurrent_test)
|
||||
# Download and unpack googletest at configure time
|
||||
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "Build step for googletest failed: ${result}")
|
||||
endif()
|
||||
|
||||
# Prevent overriding the parent project's compiler/linker
|
||||
# settings on Windows
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Add googletest directly to our build. This defines
|
||||
# the gtest and gtest_main targets.
|
||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# The gtest/gtest_main targets carry header search path
|
||||
# dependencies automatically when using CMake 2.8.11 or
|
||||
# later. Otherwise we have to add them here ourselves.
|
||||
if (CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
include_directories("${gtest_SOURCE_DIR}/include")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE CPPS "*.cpp")
|
||||
#find_package(GTest REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user