From b740e83686ad7ec2a79d687917b6bd9eba7646e0 Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Wed, 12 Jun 2024 22:44:52 +0200 Subject: [PATCH] WIP: Fix CMakeLists.txt of tests for Conan 2.0 Still crashes with weird linker errors regarding boost::test (??) usr/bin/ld: /home/joscha/.conan2/p/b/boostec508655df7a4/p/lib/libboost_test_exec_monitor.a(test_main.o): in function `test_main_caller::operator()()': /home/joscha/.conan2/p/boostada19f4305785/s/src/./boost/test/impl/test_main.ipp:34: undefined reference to `test_main(int, char**)' /usr/bin/ld: /home/joscha/.conan2/p/b/boostec508655df7a4/p/lib/libboost_test_exec_monitor.a(test_main.o): in function `test_main_caller::operator()()': /home/joscha/.conan2/p/boostada19f4305785/s/src/./boost/test/impl/test_main.ipp:34: undefined reference to `test_main(int, char**)' collect2: error: ld returned 1 exit status gmake[3]: *** [test/CMakeFiles/test_data_type.dir/build.make:223: test/test_data_type] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:347: test/CMakeFiles/test_data_type.dir/all] Error 2 gmake[2]: *** Waiting for unfinished jobs.... collect2: error: ld returned 1 exit status gmake[3]: *** [test/CMakeFiles/test_configuration.dir/build.make:223: test/test_configuration] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:375: test/CMakeFiles/test_configuration.dir/all] Error 2 /usr/bin/ld: /home/joscha/.conan2/p/b/boostec508655df7a4/p/lib/libboost_test_exec_monitor.a(test_main.o): in function `test_main_caller::operator()()': /home/joscha/.conan2/p/boostada19f4305785/s/src/./boost/test/impl/test_main.ipp:34: undefined reference to `test_main(int, char**)' /usr/bin/ld: /home/joscha/.conan2/p/b/boostec508655df7a4/p/lib/libboost_test_exec_monitor.a(test_main.o): in function `test_main_caller::operator()()': /home/joscha/.conan2/p/boostada19f4305785/s/src/./boost/test/impl/test_main.ipp:34: undefined reference to `test_main(int, char**)' collect2: error: ld returned 1 exit status gmake[3]: *** [test/CMakeFiles/test_entity.dir/build.make:223: test/test_entity] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:431: test/CMakeFiles/test_entity.dir/all] Error 2 collect2: error: ld returned 1 exit status gmake[3]: *** [test/CMakeFiles/test_connection.dir/build.make:223: test/test_connection] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:403: test/CMakeFiles/test_connection.dir/all] Error 2 gmake[1]: *** [Makefile:146: all] Error 2 gmake[1]: Leaving directory '/home/joscha/caosdb/src/caosdb-cpplib/build/Debug' --- test/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 659254b..a27c14d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,6 +51,7 @@ set(_CMAKE_CXX_CLANG_TIDY_TEST_CHECKS ) # add special cmake functions for gtest +find_package(GTest REQUIRED) include(GoogleTest) @@ -63,7 +64,7 @@ foreach (i RANGE "${len_test_cases}") set(libcaosdb_TEST_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${test_case_name}.cpp ${libcaosdb_TEST_SRC}") target_link_libraries(${test_case_name} - PRIVATE ${LIBCAOSDB} ccaosdb ${CONAN_LIBS_GTEST} ${CONAN_LIBS_BOOST}) + PRIVATE ${LIBCAOSDB} ccaosdb gtest::gtest boost::boost) target_include_directories(${test_case_name} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) if(_LINTING) -- GitLab