diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 1465229fc4389eefc96bff662434c698d55e6dca..2f48ea60c6d1310449439c4b9f5181c5dd4cf37e 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -537,7 +537,7 @@ endif() macro(ost_unittest) set(_ARG_PREFIX ost) parse_argument_list(_ARG - "MODULE;PREFIX;SOURCES" "" ${ARGN}) + "MODULE;PREFIX;SOURCES;LINK" "" ${ARGN}) set(_SOURCES ${_ARG_SOURCES}) set(CPP_TESTS) set(PY_TESTS) @@ -550,7 +550,7 @@ macro(ost_unittest) endif() endforeach() set(_SOURCES ${CPP_TESTS}) - set(_test_name "${_ARG_MODULE}_tests") + set(_test_name "${_ARG_PREFIX}_${_ARG_MODULE}_tests") if(DEFINED CPP_TESTS) if(COMPILE_TESTS) add_executable(${_test_name} ${_SOURCES}) @@ -575,6 +575,10 @@ macro(ost_unittest) DEPENDS ${_test_name}) add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} ) endif() + + if (_ARG_LINK) + target_link_libraries("${_test_name}" ${_ARG_LINK}) + endif() add_dependencies(check "${_test_name}_run") set_target_properties(${_test_name} diff --git a/modules/base/tests/CMakeLists.txt b/modules/base/tests/CMakeLists.txt index 1847b42be55ee90e0a5b094a8c9ae66a4c15885b..c18fcda10eef03664e59767ce1659004689188c1 100644 --- a/modules/base/tests/CMakeLists.txt +++ b/modules/base/tests/CMakeLists.txt @@ -8,5 +8,5 @@ set(OST_BASE_UNIT_TESTS ) ost_unittest(MODULE base - SOURCES "${OST_BASE_UNIT_TESTS}") -target_link_libraries(base_tests ost_mol) + SOURCES "${OST_BASE_UNIT_TESTS}" + LINK ost_mol) diff --git a/modules/gfx/tests/CMakeLists.txt b/modules/gfx/tests/CMakeLists.txt index 1c67cb45ac6afe73bf4d316d4e48fba550253f7c..469122e944ac2e30911ce45a1517110d7f19641d 100644 --- a/modules/gfx/tests/CMakeLists.txt +++ b/modules/gfx/tests/CMakeLists.txt @@ -7,6 +7,6 @@ if (ENABLE_IMG) endif() ost_unittest(MODULE gfx - SOURCES "${OST_GFX_UNIT_TESTS}") + SOURCES "${OST_GFX_UNIT_TESTS}" + LINK ost_io) -target_link_libraries(gfx_tests ost_io) diff --git a/modules/img/base/tests/CMakeLists.txt b/modules/img/base/tests/CMakeLists.txt index a568268f5ef6fe06bfad01edcbbf244e96394dd0..503345f160b89b0c98997d43278f0c4e1e33b633 100644 --- a/modules/img/base/tests/CMakeLists.txt +++ b/modules/img/base/tests/CMakeLists.txt @@ -17,7 +17,6 @@ tests.cc ost_unittest(MODULE img - SOURCES "${OST_IMG_BASE_UNIT_TESTS}") - -target_link_libraries(img_tests ost_img_alg) + SOURCES "${OST_IMG_BASE_UNIT_TESTS}" + LINK ost_img_alg) diff --git a/modules/io/tests/CMakeLists.txt b/modules/io/tests/CMakeLists.txt index cb21766c31280c3addc87111400aaa49958ba638..ae1d0dab1132c61679b057802fd3f3b2833f0634 100644 --- a/modules/io/tests/CMakeLists.txt +++ b/modules/io/tests/CMakeLists.txt @@ -11,9 +11,8 @@ set(OST_IO_UNIT_TESTS # missing: test_star_parser.cc ost_unittest(MODULE io - SOURCES "${OST_IO_UNIT_TESTS}") -target_link_libraries(io_tests ost_mol) -target_link_libraries(io_tests ost_seq) + SOURCES "${OST_IO_UNIT_TESTS}" + LINK ost_mol ost_seq) add_executable(test_mae_standalone test_mae_standalone.cc) target_link_libraries(test_mae_standalone ost_mol)