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"
This commit is part of merge request !49. Comments created here will be created in the context of that merge request.
...@@ -147,6 +147,9 @@ add_custom_command( ...@@ -147,6 +147,9 @@ add_custom_command(
${PROTO_FILES} ${PROTO_FILES}
DEPENDS ${PROTO_FILES}) DEPENDS ${PROTO_FILES})
# show generated files
message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}")
############################################################################### ###############################################################################
### Set up main targets ### Set up main targets
### * [caosdb_grpc] - only in Debug builds. Otherwise this library is compiled ### * [caosdb_grpc] - only in Debug builds. Otherwise this library is compiled
...@@ -157,51 +160,66 @@ add_custom_command( ...@@ -157,51 +160,66 @@ add_custom_command(
### * ccaosdbcli - A plain C test client. ### * ccaosdbcli - A plain C test client.
############################################################################### ###############################################################################
find_package(gRPC) find_package(gRPC CONFIG REQUIRED)
find_package(protobuf) find_package(Protobuf CONFIG REQUIRED)
find_package(Boost) find_package(Boost REQUIRED)
find_package(GTest) 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 # libcaosdb
# ---------
# In Debug, build separate libraries for grpc-generated code and caosdb
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") 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)
add_library(caosdb_grpc SHARED ${GRPC_GENERATED})
target_link_libraries(caosdb_grpc
grpc::grpc protobuf::protobuf boost::boost
)
target_include_directories(caosdb_grpc PUBLIC target_include_directories(caosdb_grpc PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE: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() else()
add_library(caosdb add_library(caosdb
SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED}) SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
set(LIBCAOSDB caosdb)
endif()
target_link_libraries(caosdb target_link_libraries(caosdb
grpc::grpc protobuf::protobuf boost::boost gtest::gtest grpc::grpc protobuf::protobuf boost::boost
stdc++fs stdc++fs
) )
set(LIBCAOSDB caosdb)
endif()
target_include_directories(caosdb PUBLIC target_include_directories(caosdb PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/src> $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_include_directories(caosdb SYSTEM PUBLIC
${CONAN_INCLUDE_DIRS}
)
# libccaosdb # libccaosdb
# ----------
add_library(ccaosdb SHARED src/ccaosdb.cpp) add_library(ccaosdb SHARED src/ccaosdb.cpp)
target_link_libraries(ccaosdb target_link_libraries(ccaosdb
grpc::grpc protobuf::protobuf boost::boost gtest::gtest grpc::grpc protobuf::protobuf boost::boost
${LIBCAOSDB} ${LIBCAOSDB}
stdc++fs stdc++fs
) )
...@@ -224,11 +242,13 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC ...@@ -224,11 +242,13 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC
) )
target_link_libraries(ccaosdbcli target_link_libraries(ccaosdbcli
grpc::grpc protobuf::protobuf boost::boost gtest::gtest grpc::grpc protobuf::protobuf boost::boost
${LIBCAOSDB} ${LIBCAOSDB}
ccaosdb ccaosdb
) )
# cxxcaosdbcli
# ------------
add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp) add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp)
target_include_directories(cxxcaosdbcli PUBLIC target_include_directories(cxxcaosdbcli PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
...@@ -240,7 +260,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC ...@@ -240,7 +260,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC
) )
target_link_libraries(cxxcaosdbcli target_link_libraries(cxxcaosdbcli
${LIBCAOSDB} ${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.
Please register or to comment