Skip to content
Snippets Groups Projects
Commit 1d84a449 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Improve boost linking

- Only use required components of boost
- Link automatically to ${Boost_LIBRARIES}
parent 6e1c6203
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!53Add vcpkg support
......@@ -2,7 +2,9 @@
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2021 Joscha Schmiedt <joscha@schmiedt.dev>
# Copyright (C) 2021-2024 IndiScale GmbH <info@indiscale.com>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -51,24 +53,8 @@ IF (BUILD_ACM)
add_compile_definitions("BUILD_ACM")
ENDIF()
###########################################
### DEPENDENCY MANAGEMENT with CONAN
###########################################
message(STATUS "Build directory ${CMAKE_BINARY_DIR}")
# TODO: Is this still necessary?
# # fix grpc - remove unsecure (no-op ssl implementations)
# string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS_GRPC
# "${CONAN_LIBS_GRPC}")
# string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS_GRPC
# "${CONAN_PKG_LIBS_GRPC}")
# string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
# "${CONAN_LIBS}")
# string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
# "${CONAN_PKG_LIBS}")
# message(STATUS "CONAN_LIBS: ${CONAN_LIBS}")
###########################################
### GENERAL SETUP of SOURCES
###########################################
......@@ -81,7 +67,7 @@ add_subdirectory(doc)
### CODE GENERATION (WITH GRPC)
####################################################################
find_package(Protobuf CONFIG REQUIRED)
find_package(protobuf CONFIG REQUIRED)
# Protobuf/Grpc source files
set(PROTO_FILES
......@@ -161,7 +147,12 @@ message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}")
###############################################################################
find_package(gRPC CONFIG REQUIRED)
find_package(Boost REQUIRED)
find_package(Boost COMPONENTS json REQUIRED)
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(Boost COMPONENTS log REQUIRED)
find_package(Boost COMPONENTS thread REQUIRED)
find_package(Boost COMPONENTS system REQUIRED)
find_package(Boost COMPONENTS beast REQUIRED)
find_package(GTest REQUIRED)
# print include directories for debugging
......@@ -178,7 +169,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
add_library(caosdb_grpc SHARED ${GRPC_GENERATED})
target_link_libraries(caosdb_grpc
grpc::grpc protobuf::protobuf boost::boost
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
)
target_include_directories(caosdb_grpc PUBLIC
$<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}>
......@@ -189,7 +180,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC})
target_link_libraries(caosdb
caosdb_grpc grpc::grpc protobuf::protobuf boost::boost
caosdb_grpc gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
)
set(LIBCAOSDB caosdb caosdb_grpc)
......@@ -197,7 +188,7 @@ else()
add_library(caosdb
SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
target_link_libraries(caosdb
grpc::grpc protobuf::protobuf boost::boost
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
stdc++fs
)
set(LIBCAOSDB caosdb)
......@@ -218,7 +209,7 @@ target_include_directories(caosdb PUBLIC
# ----------
add_library(ccaosdb SHARED src/ccaosdb.cpp)
target_link_libraries(ccaosdb
grpc::grpc protobuf::protobuf boost::boost
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
${LIBCAOSDB}
stdc++fs
)
......@@ -242,7 +233,7 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC
)
target_link_libraries(ccaosdbcli
grpc::grpc protobuf::protobuf boost::boost
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
${LIBCAOSDB}
ccaosdb
)
......@@ -260,7 +251,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC
)
target_link_libraries(cxxcaosdbcli
${LIBCAOSDB}
grpc::grpc protobuf::protobuf boost::boost
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment