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

Fix errors in CMakeLists.txt for Debug

parent c8b7bc33
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!49Resolve "EXTERN: Adapt to Conan 2"
......@@ -147,6 +147,9 @@ add_custom_command(
${PROTO_FILES}
DEPENDS ${PROTO_FILES})
# show generated files
message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}")
###############################################################################
### Set up main targets
### * [caosdb_grpc] - only in Debug builds. Otherwise this library is compiled
......@@ -157,51 +160,66 @@ add_custom_command(
### * ccaosdbcli - A plain C test client.
###############################################################################
find_package(gRPC)
find_package(protobuf)
find_package(Boost)
find_package(GTest)
find_package(gRPC CONFIG REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
find_package(Boost REQUIRED)
find_package(GTest REQUIRED)
# print include directories for debugging
message(DEBUG "CMAKE_INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}")
message(DEBUG "PROTOBUF_INCLUDE_DIRS: ${PROTOBUF_INCLUDE_DIRS}")
message(DEBUG "gRPC_INCLUDE_DIRS: ${gRPC_INCLUDE_DIRS}")
# libcaosdb
# ---------
# In Debug, build separate libraries for grpc-generated code and caosdb
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
add_library(caosdb_grpc SHARED ${GRPC_GENERATED})
add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC})
target_link_libraries(caosdb caosdb_grpc
grpc::grpc protobuf::protobuf boost::boost gtest::gtest)
set(LIBCAOSDB caosdb caosdb_grpc)
target_include_directories(caosdb_grpc PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
add_library(caosdb_grpc SHARED ${GRPC_GENERATED})
target_link_libraries(caosdb_grpc
grpc::grpc protobuf::protobuf boost::boost
)
target_include_directories(caosdb_grpc PUBLIC
$<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(caosdb_grpc SYSTEM PUBLIC
${CONAN_INCLUDE_DIRS}
)
)
add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC})
target_link_libraries(caosdb
caosdb_grpc grpc::grpc protobuf::protobuf boost::boost
)
set(LIBCAOSDB caosdb caosdb_grpc)
else()
add_library(caosdb
SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
set(LIBCAOSDB caosdb)
add_library(caosdb
SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
target_link_libraries(caosdb
grpc::grpc protobuf::protobuf boost::boost
stdc++fs
)
set(LIBCAOSDB caosdb)
endif()
target_link_libraries(caosdb
grpc::grpc protobuf::protobuf boost::boost gtest::gtest
stdc++fs
)
target_include_directories(caosdb PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
target_include_directories(caosdb SYSTEM PUBLIC
${CONAN_INCLUDE_DIRS}
)
# libccaosdb
# ----------
add_library(ccaosdb SHARED src/ccaosdb.cpp)
target_link_libraries(ccaosdb
grpc::grpc protobuf::protobuf boost::boost gtest::gtest
grpc::grpc protobuf::protobuf boost::boost
${LIBCAOSDB}
stdc++fs
)
......@@ -224,11 +242,13 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC
)
target_link_libraries(ccaosdbcli
grpc::grpc protobuf::protobuf boost::boost gtest::gtest
grpc::grpc protobuf::protobuf boost::boost
${LIBCAOSDB}
ccaosdb
)
# cxxcaosdbcli
# ------------
add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp)
target_include_directories(cxxcaosdbcli PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
......@@ -240,7 +260,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC
)
target_link_libraries(cxxcaosdbcli
${LIBCAOSDB}
grpc::grpc protobuf::protobuf boost::boost gtest::gtest
grpc::grpc protobuf::protobuf boost::boost
)
......
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