[tests] fix catch_main linkage

This fixes the following error on my Ubuntu 18.04 with CMake 3.10.2:

CMake Error at cmake/TestCase.cmake:8 (target_link_libraries):
Target "catch_main" of type OBJECT_LIBRARY may not be linked into another
target. One may link only to STATIC or SHARED libraries, or to executables
with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
test/unit/CMakeLists.txt:6 (test_case)
pull/1204/head
Hleb Valoshka 2021-12-06 15:08:01 +02:00
parent 30dda19ef9
commit a5f80d0608
1 changed files with 2 additions and 2 deletions

View File

@ -3,9 +3,9 @@ macro(test_case)
set(libs ${ARGV})
list(REMOVE_AT libs 0 0)
add_executable(${trgt} "${trgt}_test.cpp")
add_executable(${trgt} $<TARGET_OBJECTS:catch_main> "${trgt}_test.cpp")
target_include_directories(${trgt} PRIVATE "${CMAKE_SOURCE_DIR}/test/common")
target_link_libraries(${trgt} PRIVATE celestia catch_main ${libs})
target_link_libraries(${trgt} PRIVATE celestia ${libs})
add_test(${trgt} ${trgt})
set_target_properties(${trgt} PROPERTIES FOLDER test/unit)
endmacro()