From a5f80d06084f74335b6b517b06ec3e8ef45f0693 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Mon, 6 Dec 2021 15:08:01 +0200 Subject: [PATCH] [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) --- cmake/TestCase.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/TestCase.cmake b/cmake/TestCase.cmake index de9597df1..f4fd99d99 100644 --- a/cmake/TestCase.cmake +++ b/cmake/TestCase.cmake @@ -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} $ "${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()