Commit 7030ad26 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD] option for cmake to deactivate building of tests. This helps on slow

computers
parent b80f184d
......@@ -41,13 +41,19 @@ FIND_PACKAGE( OpenGL REQUIRED )
### CxxTest ###
FIND_PACKAGE( CxxTest QUIET )
MARK_AS_ADVANCED( CXXTEST_PERL_TESTGEN_EXECUTABLE )
IF( CXXTEST_FOUND )
OPTION( OW_USE_TESTS "This enables compilation of tests" ON )
IF( CXXTEST_FOUND AND OW_USE_TESTS ) #We need this variable because this is tested more often.
SET( OW_COMPILE_TESTS ON )
ELSE()
SET( OW_COMPILE_TESTS OFF )
ENDIF()
IF( OW_COMPILE_TESTS )
INCLUDE_DIRECTORIES( ${CXXTEST_INCLUDE_DIR} )
# Package settings:
SET( CXXTEST_USE_PYTHON 1 )
# Activate CTest and "test" target
ENABLE_TESTING()
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
### OpenSceneGraph ###
SET( MIN_OSG_VERSION 2.8.0 )
......
......@@ -13,7 +13,7 @@ ENDIF()
TARGET_LINK_LIBRARIES( common ${Boost_LIBRARIES} )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${COMMON_SRC}"
"common;utils"
"WSegmentationFault.cpp"
......@@ -22,4 +22,4 @@ IF( CXXTEST_FOUND )
"WPrototyped.cpp"
"WLimits.cpp" # there are only some definitions
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB COMMON_DATASTRUCTURES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${COMMON_DATASTRUCTURES_SRC}"
"common;utils" # no libs for linking required
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
......@@ -18,6 +18,6 @@ ELSE()
TARGET_LINK_LIBRARIES( dataHandler common math utils ${Boost_LIBRARIES} niftiio biosig ${OPENSCENEGRAPH_LIBRARIES})
ENDIF()
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${DATAHANDLER_SRC}" "dataHandler" "WDataTexture3D.cpp" )
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
......@@ -4,7 +4,7 @@ ADD_SUBDIRECTORY( biosig )
FILE( GLOB DATAHANDLER_IO_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${DATAHANDLER_IO_SRC}"
"dataHandler;niftiio;biosig"
"WWriter.cpp" # too simple to test
......@@ -13,4 +13,4 @@ IF( CXXTEST_FOUND )
"WReaderLookUpTableVTK.cpp" # there is only one member function which is not trivial, but its more an integration test
"WWriterFiberVTK.cpp" # there is only one member function which is not trivial, but its more an integration test
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
# Unit tests
# IF( CXXTEST_FOUND )
# IF( OW_COMPILE_TESTS )
# ENDIF( CXXTEST_FOUND )
# ENDIF( OW_COMPILE_TESTS )
......@@ -11,9 +11,9 @@ ENDIF()
TARGET_LINK_LIBRARIES( gui common )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${GUI_SRC}"
"common;utils"
"WGUI.cpp"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
......@@ -15,7 +15,7 @@ TARGET_LINK_LIBRARIES( kernel common dataHandler ge math utils ${OPENSCENEGRAPH_
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
# SET( testLibs guiqt4 )
CXXTEST_ADD_TESTS_FROM_LIST( "${KERNEL_SRC}"
"kernel"
......@@ -34,4 +34,4 @@ IF( CXXTEST_FOUND )
"../modules/navSlices/WMNavSlices.cpp"
"../modules/eegTest/WMEEGTest.cpp"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
# Unit tests
# IF( CXXTEST_FOUND )
# IF( OW_COMPILE_TESTS )
# ENDIF( CXXTEST_FOUND )
# ENDIF( OW_COMPILE_TESTS )
......@@ -10,9 +10,9 @@ ELSE()
ENDIF()
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MATH_SRC}"
"math;common;utils"
"WMath.cpp" # this declares only a namespace
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB FIBERSIMILARITY_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${FIBERSIMILARITY_SRC}"
"math;utils"
"WFiberSimilarity.cpp" # This is just an interface
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel"
)
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel"
)
ENDIF( CXXTEST_FOUND )
\ No newline at end of file
ENDIF( OW_COMPILE_TESTS )
\ No newline at end of file
......@@ -9,6 +9,6 @@ ENDIF()
TARGET_LINK_LIBRARIES( utils ${Boost_PROGRAM_OPTIONS_LIBRARY} common math )
# Unit tests
IF( CXXTEST_FOUND )
IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${UTILS_SRC}" "utils;guiqt4;dataHandler;${Boost_LIBRARIES}" )
ENDIF( CXXTEST_FOUND )
ENDIF( OW_COMPILE_TESTS )
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