diff --git a/.gitignore b/.gitignore index 9868d06e9e03ecec56653adeff95c64c5c3344bb..da71b5ba0d26201e9fe25fde79e37d09d1d3da55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ CMakeFiles cmake_install.cmake stage +tests dng gipltng ost diff --git a/CMakeLists.txt b/CMakeLists.txt index af9d0819fbed418e7c134e257db61061f871343c..aba144713e5ae73011301a29466826141118bc5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,8 @@ option(USE_DOUBLE_PRECISION "whether to compile in double precision" option(ENABLE_SPNAV "whether 3DConnexion devices should be supported" OFF) option(STATIC_PROPERTY_WORKAROUND "workaround for static property bug with some boost/boost_python combinations" OFF) -option(DEPLOYMENT "switch on deployment settings" OFF) +option(DEPLOYMENT "switch on deployment settings" OFF) +option(COMPILE_TESTS "wheter unit tests should be compiled by default" OFF) if (PREFIX) set(CMAKE_INSTALL_PREFIX ${PREFIX}) @@ -223,8 +224,8 @@ include_directories(${Boost_INCLUDE_DIRS} add_subdirectory(modules) add_subdirectory(scripts) -add_subdirectory(deployment) -set (FILES_TO_BE_REMOVED stage CMakeFiles) +add_subdirectory(deployment) +set(FILES_TO_BE_REMOVED CMakeFiles stage tests) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${FILES_TO_BE_REMOVED}") @@ -245,4 +246,5 @@ message(STATUS #set(SPHINX_OPTIONS -c doc/conf -b html -d doc/html/doctrees) #add_custom_target(doc COMMAND # ${SPHINX} ${SPHINX_OPTIONS} modules doc/html -# VERBATIM) \ No newline at end of file +# VERBATIM) + diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 5538e8057010306e7fa80ff6c43e9d6b0c9e56b3..7df33d611b778b1119e379e4a229f8ed30c9e723 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -474,6 +474,7 @@ macro(ost_unittest MODULE SOURCE_FILES) set(_SOURCES ${SOURCE_FILES}) set(CPP_TESTS) set(PY_TESTS) + set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}/tests") foreach(src ${_SOURCES}) if (${src} MATCHES "\\.py$") list(APPEND PY_TESTS "${src}") @@ -484,7 +485,11 @@ macro(ost_unittest MODULE SOURCE_FILES) set(_SOURCES ${CPP_TESTS}) set(_test_name "${MODULE}_tests") if(DEFINED CPP_TESTS) - add_executable(${_test_name} EXCLUDE_FROM_ALL ${_SOURCES}) + if(COMPILE_TESTS) + add_executable(${_test_name} ${_SOURCES}) + else() + add_executable(${_test_name} EXCLUDE_FROM_ALL ${_SOURCES}) + endif() if (WIN32) target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES} "ost_${MODULE}") add_custom_target("${_test_name}_run" @@ -501,8 +506,7 @@ macro(ost_unittest MODULE SOURCE_FILES) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "running checks for module ${MODULE}" DEPENDS ${_test_name}) - add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} ) - + add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} ) endif() add_dependencies(check "${_test_name}_run")