diff --git a/CMakeLists.txt b/CMakeLists.txt index 155a36600..30f22735f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,12 @@ if(SystemC_FOUND) if (NOT (DEFINED CMAKE_CXX_CLANG_TIDY OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) add_subdirectory(examples) endif() + if(Catch2_FOUND) + message(STATUS "SCC: Including Catch2 based tests") + include(Catch) + set(WITH_SCP4SCC ON) + add_subdirectory(tests) + endif() endif() # Define the scc library @@ -174,13 +180,6 @@ if(SystemC_FOUND) add_library(scc::scc_shared ALIAS scc_shared) endif() - if(Catch2_FOUND) - message(STATUS "SCC: Including Catch2 based tests") - include(Catch) - set(WITH_SCP4SCC ON) - add_subdirectory(tests) - endif() - install(TARGETS scc EXPORT scc-targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/tests/io-redirector/CMakeLists.txt b/tests/io-redirector/CMakeLists.txt index 9f3156ca1..8a9435b20 100644 --- a/tests/io-redirector/CMakeLists.txt +++ b/tests/io-redirector/CMakeLists.txt @@ -1,6 +1,8 @@ project (io_redirector) -add_executable (${PROJECT_NAME} test.cpp) -target_link_libraries (io_redirector LINK_PUBLIC scc-util Catch2::Catch2WithMain) +if(TARGET Catch2::Catch2WithMain) + add_executable (${PROJECT_NAME} test.cpp) + target_link_libraries (io_redirector LINK_PUBLIC scc-util Catch2::Catch2WithMain) -#add_test(NAME io_redirector_test COMMAND io_redirector) -catch_discover_tests(${PROJECT_NAME}) \ No newline at end of file + #add_test(NAME io_redirector_test COMMAND io_redirector) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file