MOD: Modifies cmake include for protobuf #6

Merged
byterazor merged 1 commits from development into main 2023-08-31 16:00:34 +02:00
2 changed files with 3 additions and 3 deletions

View File

@ -65,6 +65,8 @@ IF(NOT TARGET protobuf)
SET(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "disable shared libraries")
#SET(WITH_PROTOC ON CACHE BOOL "enable building of protoc")
add_subdirectory(libs/protobuf EXCLUDE_FROM_ALL)
set(PROTOC ${CMAKE_CURRENT_BINARY_DIR}/libs/protobuf/protoc CACHE INTERNAL "" )
set(PROTO_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/protobuf/src CACHE INTERNAL "" )
ENDIF()
# we are building with c++20

View File

@ -13,8 +13,6 @@ function(protobuf_generate_cpp)
${ARGN})
FILE(GLOB PROTO_FILES ${protobuf_PROTO_PATH}/*.proto)
set(PROTOC ${CMAKE_BINARY_DIR}/libs/protobuf/protoc)
# set(PROTOC protoc)
FOREACH(proto ${PROTO_FILES})
FILE(TO_NATIVE_PATH ${proto} proto_native)
@ -25,7 +23,7 @@ function(protobuf_generate_cpp)
add_custom_command(
OUTPUT "${protoDIR}/${protoFILENAME}.pb.cc"
DEPENDS "${protoDIR}/${protoFILENAME}.proto"
COMMAND ${PROTOC} --cpp_out=${protoDIR} --proto_path=${protoDIR} --proto_path="${CMAKE_SOURCE_DIR}/libs/protobuf/src" "${protoDIR}/${protoFILENAME}.proto"
COMMAND ${PROTOC} --cpp_out=${protoDIR} --proto_path=${protoDIR} --proto_path=${PROTO_SRC_PATH} "${protoDIR}/${protoFILENAME}.proto"
)
ENDFOREACH(proto)