Commit 09bd19d2 authored by shadow_walker's avatar shadow_walker
Browse files

cmake: Catch 2 for testing

parent fa6830ea
...@@ -86,6 +86,8 @@ else() ...@@ -86,6 +86,8 @@ else()
set(CMAKE_INSTALL_RPATH "${SP_DIR};${EMAN_PREFIX_LIB}") set(CMAKE_INSTALL_RPATH "${SP_DIR};${EMAN_PREFIX_LIB}")
endif() endif()
option(ENABLE_CATCH2 "Enable Catch 2 framework for unit testing (internal development only)" OFF)
OPTION(ENABLE_AUTODOC "enable latex/doxygen document generation and etc. " OFF) OPTION(ENABLE_AUTODOC "enable latex/doxygen document generation and etc. " OFF)
OPTION(ENABLE_FFTW3 "enable fftw 3 support (USE THIS)" ON) OPTION(ENABLE_FFTW3 "enable fftw 3 support (USE THIS)" ON)
......
...@@ -7,11 +7,24 @@ add_custom_target(test-eer ...@@ -7,11 +7,24 @@ add_custom_target(test-eer
DEPENDS test_eer DEPENDS test_eer
) )
add_executable(test_renderer test_renderer.cpp) if (ENABLE_CATCH2)
target_link_libraries(test_renderer PRIVATE EM2) Include(FetchContent)
add_test(test-renderer test_renderer)
add_custom_target(test-renderer FetchContent_Declare(
COMMAND ${CMAKE_CTEST_COMMAND} -V -C Release -R test-renderer Catch2
DEPENDS test_renderer GIT_REPOSITORY https://github.com/catchorg/Catch2.git
) GIT_TAG v3.0.1 # or a later release
)
FetchContent_MakeAvailable(Catch2)
add_executable(test_renderer test_renderer.cpp)
target_link_libraries(test_renderer PRIVATE EM2 Catch2::Catch2WithMain)
add_test(test-renderer test_renderer)
add_custom_target(test-renderer
COMMAND ${CMAKE_CTEST_COMMAND} -V --output-on-failure -C Release -R test-renderer
DEPENDS test_renderer
)
endif ()
...@@ -2,12 +2,7 @@ ...@@ -2,12 +2,7 @@
using namespace EMAN; using namespace EMAN;
#include <catch2/catch_test_macros.hpp>
#undef NDEBUG TEST_CASE("test class Renderer") {
#include <cassert>
int main()
{
return 0;
} }
Supports Markdown
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