From 42e6f941baaa2e8597a4f1519b1c8dceb225fe33 Mon Sep 17 00:00:00 2001 From: jowr Date: Sat, 7 Jun 2014 10:39:03 +0200 Subject: [PATCH] Changed the main method for tests --- CMakeLists.txt | 4 ++-- src/Tests/test_main.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/Tests/test_main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index cba4b751..660c9804 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/Tests/test_main.cpp b/src/Tests/test_main.cpp new file mode 100644 index 00000000..cf8b8431 --- /dev/null +++ b/src/Tests/test_main.cpp @@ -0,0 +1,5 @@ +#ifdef ENABLE_CATCH +#define CATCH_CONFIG_MAIN +#include "catch.hpp" + +#endif /* ENABLE_CATCH */