Changed the main method for tests

This commit is contained in:
jowr
2014-06-07 10:39:03 +02:00
parent f4be09df63
commit 42e6f941ba
2 changed files with 7 additions and 2 deletions

View File

@@ -53,6 +53,8 @@ option (COOLPROP_TESTING
file(GLOB_RECURSE APP_SOURCES "src/*.cpp")
file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h") # "externals/*.hpp")
list(REMOVE_ITEM APP_SOURCES "${CMAKE_SOURCE_DIR}/src/Tests/Tests.cpp")
## You can exclude this file as well, in case you want to run your own tests
#list(REMOVE_ITEM APP_SOURCES "${CMAKE_SOURCE_DIR}/src/Tests/test_main.cpp")
set (APP_INCLUDE_DIRS "externals/eigen")
@@ -115,8 +117,6 @@ if (COOLPROP_TESTING)
add_executable (testRunner.exe ${APP_SOURCES})
add_dependencies (testRunner.exe generate_headers)
set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH")
#set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN")
set_source_files_properties(src/MatrixMath.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN")
if(UNIX)
target_link_libraries (testRunner.exe ${CMAKE_DL_LIBS})
endif()

5
src/Tests/test_main.cpp Normal file
View File

@@ -0,0 +1,5 @@
#ifdef ENABLE_CATCH
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#endif /* ENABLE_CATCH */