From 35e36c6053c912f748b410c8b1f17adceae6fad0 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Tue, 5 Oct 2021 13:34:56 +0200 Subject: [PATCH] ENH: Debug builds should work now: "system" including external libs --- CMakeLists.txt | 21 ++++++++++++++------- Makefile | 7 +++++++ test/test_connection.cpp | 2 +- test/test_info.cpp | 2 +- test_package/CMakeLists.txt | 3 +++ 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0176a56..1fb6d40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,17 +147,19 @@ add_custom_command( ############################################################################### if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") - add_library(caosdb_grpc SHARED ${GRPC_GENERATED}) - add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC}) + add_library(caosdb_grpc SHARED ${GRPC_GENERATED}) + add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC}) target_link_libraries(caosdb caosdb_grpc) set(LIBCAOSDB caosdb caosdb_grpc) + target_include_directories(caosdb_grpc SYSTEM PUBLIC + ${CONAN_INCLUDE_DIRS} + ) target_include_directories(caosdb_grpc PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<INSTALL_INTERFACE:include> - ${CONAN_INCLUDE_DIRS} ) else() add_library(caosdb @@ -167,11 +169,13 @@ endif() target_link_libraries(caosdb ${CONAN_LIBS} ) +target_include_directories(caosdb SYSTEM PUBLIC + ${CONAN_INCLUDE_DIRS} +) target_include_directories(caosdb PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<INSTALL_INTERFACE:include> - ${CONAN_INCLUDE_DIRS} ) add_library(ccaosdb SHARED src/ccaosdb.cpp) @@ -181,11 +185,13 @@ target_link_libraries(ccaosdb ) add_executable(ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c) +target_include_directories(ccaosdbcli SYSTEM PUBLIC + ${CONAN_INCLUDE_DIRS} +) target_include_directories(ccaosdbcli PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<INSTALL_INTERFACE:include> - ${CONAN_INCLUDE_DIRS} ) target_link_libraries(ccaosdbcli ccaosdb @@ -193,11 +199,13 @@ target_link_libraries(ccaosdbcli ) add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp) +target_include_directories(cxxcaosdbcli SYSTEM PUBLIC + ${CONAN_INCLUDE_DIRS} +) target_include_directories(cxxcaosdbcli PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<INSTALL_INTERFACE:include> - ${CONAN_INCLUDE_DIRS} ) target_link_libraries(cxxcaosdbcli ${LIBCAOSDB} @@ -205,7 +213,6 @@ target_link_libraries(cxxcaosdbcli ) - ####################################################### ### LINTING with CLANG-TIDY and INCLUDE-WHAT-YOU-USE ####################################################### diff --git a/Makefile b/Makefile index 819b9ca..aedb508 100644 --- a/Makefile +++ b/Makefile @@ -62,5 +62,12 @@ conan-create: conan create . -s $(CONAN_SETTINGS) .PHONY: conan-create +conan-create-debug: + conan create . -s $(CONAN_SETTINGS) -s build_type=Debug +.PHONY: conan-create + conan: conan-install conan-create .PHONY: conan + +conan-debug: conan-install conan-create-debug +.PHONY: conan-debug diff --git a/test/test_connection.cpp b/test/test_connection.cpp index 9939153..97a86df 100644 --- a/test/test_connection.cpp +++ b/test/test_connection.cpp @@ -26,7 +26,7 @@ #include "caosdb_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_... #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR... -#include "gtest/gtest_pred_impl.h" // for AssertionResult, TestInfo +#include <gtest/gtest_pred_impl.h> // for AssertionResult, TestInfo #include <memory> // for allocator, operator!=, shar... #include <string> // for operator+, string diff --git a/test/test_info.cpp b/test/test_info.cpp index a958702..f73398b 100644 --- a/test/test_info.cpp +++ b/test/test_info.cpp @@ -24,7 +24,7 @@ #include "caosdb/info/v1alpha1/main.pb.h" // for VersionInfo #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiRe... -#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST +#include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ, TEST #include <memory> // for allocator namespace caosdb::info { diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index d11580a..d9ed76e 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -33,6 +33,9 @@ foreach (i RANGE "${len_test_cases}") ${CONAN_LIBS_GTEST} ${CONAN_LIBS_GRPC} ${CONAN_LIBS_ABSEIL} ${CONAN_LIBS_OPENSSL} ${CONAN_LIBS_C-ARES} ${CONAN_LIBS_BZIP2} ${CONAN_LIBS_PROTOBUF} ${CONAN_LIBS_ZLIB}) + if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") + target_link_libraries(${test_case_name} PRIVATE caosdb_grpc) + endif() target_include_directories(${test_case_name} PUBLIC ${CONAN_INCLUDE_DIRS}) set_target_properties(${test_case_name} PROPERTIES -- GitLab