[CMakeLists.txt] Added option to disable building tests.
This commit is contained in:
parent
bf793e9bfb
commit
5db8341153
@ -23,12 +23,14 @@ addons:
|
|||||||
- libxi-dev
|
- libxi-dev
|
||||||
- g++-8
|
- g++-8
|
||||||
- cmake
|
- cmake
|
||||||
|
- cxxtest
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake ..
|
- cmake ..
|
||||||
- make -j8
|
- make -j8
|
||||||
|
# - ./openminer_tests
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
@ -15,6 +15,8 @@ endif ()
|
|||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
option(OM_BUILD_TESTS ON "Enable building tests if CxxTest is available")
|
||||||
|
|
||||||
include_directories(external)
|
include_directories(external)
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -131,9 +133,10 @@ add_subdirectory(source/client)
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Unit testing
|
# Unit testing
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
find_package(CxxTest QUIET)
|
if(OM_BUILD_TESTS)
|
||||||
|
find_package(CxxTest QUIET)
|
||||||
|
|
||||||
if(CXXTEST_FOUND)
|
if(CXXTEST_FOUND)
|
||||||
include_directories(${CXXTEST_INCLUDE_DIRS})
|
include_directories(${CXXTEST_INCLUDE_DIRS})
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
@ -146,7 +149,8 @@ if(CXXTEST_FOUND)
|
|||||||
file(GLOB_RECURSE TEST_FILES tests/*.hpp)
|
file(GLOB_RECURSE TEST_FILES tests/*.hpp)
|
||||||
CXXTEST_ADD_TEST(${CMAKE_PROJECT_NAME}_tests unit-test.cpp ${TEST_FILES})
|
CXXTEST_ADD_TEST(${CMAKE_PROJECT_NAME}_tests unit-test.cpp ${TEST_FILES})
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME}_tests ${CMAKE_PROJECT_NAME}_common ${CMAKE_PROJECT_NAME}_server_lib)
|
target_link_libraries(${CMAKE_PROJECT_NAME}_tests ${CMAKE_PROJECT_NAME}_common ${CMAKE_PROJECT_NAME}_server_lib)
|
||||||
else()
|
else()
|
||||||
message(WARNING "CxxTest not found!")
|
message(WARNING "CxxTest not found!")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user