@@ -17,10 +17,9 @@ function(__idi_component_test component_name test_file)
1717 # target_include_directories("${CURRENT_LIBRARY_TEST}" SYSTEM PRIVATE
1818 # "${IDICMAKE_EXTERNAL_LIB_DIR}/Catch2/single_include")
1919
20- target_link_libraries ("${CURRENT_LIBRARY_TEST} " PRIVATE Catch2::Catch2WithMain )
21-
2220 set (ADD_MODE "ADDITIONAL_SOURCES" )
2321 set (ADD_CORE true )
22+ set (ADD_CATCH true )
2423
2524 foreach (var IN LISTS ARGN)
2625 if (var STREQUAL "ADDITIONAL_LIBRARIES" )
@@ -31,6 +30,8 @@ function(__idi_component_test component_name test_file)
3130 set (ADD_MODE "ADDITIONAL_INCLUDES" )
3231 elseif (var STREQUAL "ADDITIONAL_SOURCES" )
3332 set (ADD_MODE "ADDITIONAL_SOURCES" )
33+ elseif (var STREQUAL "NO_CATCH" )
34+ set (ADD_CATCH false )
3435 elseif (var STREQUAL "EXCLUDE_CORE" )
3536 set (ADD_CORE false )
3637 else ()
@@ -49,7 +50,11 @@ function(__idi_component_test component_name test_file)
4950 endif ()
5051 endforeach ()
5152
52- if (ADD_CORE)
53+ if (ADD_CATCH)
54+ target_link_libraries ("${CURRENT_LIBRARY_TEST} " PRIVATE Catch2::Catch2WithMain )
55+ endif ()
56+
57+ if (ADD_CORE)
5358 target_link_libraries ("${CURRENT_LIBRARY_TEST} " PUBLIC "${IDICMAKE_CORE} " )
5459 list (APPEND __LIBRARY_LIST ${CURRENT_LIBRARY_TEST} )
5560 list (APPEND __LIBRARY_LIST ${IDICMAKE_CORE} )
@@ -59,7 +64,7 @@ function(__idi_component_test component_name test_file)
5964 endif ()
6065
6166 add_test (NAME "${CURRENT_LIBRARY_TEST} " COMMAND "${CURRENT_LIBRARY_TEST} " WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY} " )
62- if (IDICMAKE_IS_SHARED)
67+ if (IDICMAKE_IS_SHARED)
6368 # setting target BUILD_WITH_INSTALL_RPATH to OFF for a shared library
6469 # will make sure that tests link against the build tree RPATH and not
6570 # the system install dir, this lets tests for the .so on linux.
0 commit comments