mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
cmake: fix detection protobuf
This commit is contained in:
parent
d9e041a525
commit
6ecac46b4e
1 changed files with 28 additions and 28 deletions
|
@ -38,33 +38,8 @@ set(LIBRARIES
|
|||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
|
||||
if(DEFINED PROTOBUF_COMPILER)
|
||||
add_custom_target(protobuf ALL
|
||||
COMMAND ${PROTOBUF_COMPILER}
|
||||
--python_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
#--php_out=${CMAKE_BINARY_DIR}
|
||||
--js_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
villas.proto
|
||||
DEPENDS villas.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DEFINED PROTOBUFC_COMPILER)
|
||||
add_custom_target(protobuf-c ALL
|
||||
COMMAND ${PROTOBUFC_COMPILER}
|
||||
--c_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
villas.proto
|
||||
DEPENDS villas.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_dependencies(protobuf protobuf-c)
|
||||
endif()
|
||||
|
||||
# Enable Google Protobuf format
|
||||
if(ProtobufC_FOUND)
|
||||
if(PROTOBUFC_FOUND)
|
||||
list(APPEND FORMAT_SRC
|
||||
protobuf.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/villas.pb-c.c
|
||||
|
@ -83,10 +58,35 @@ if(ProtobufC_FOUND)
|
|||
PROPERTIES
|
||||
GENERATED TRUE
|
||||
)
|
||||
|
||||
add_dependencies(formats protobuf-c)
|
||||
endif()
|
||||
|
||||
add_library(formats STATIC ${FORMAT_SRC})
|
||||
target_include_directories(formats PUBLIC ${INCLUDE_DIRS})
|
||||
target_link_libraries(formats INTERFACE ${LIBRARIES})
|
||||
|
||||
if(DEFINED PROTOBUF_COMPILER AND PROTOBUF_FOUND)
|
||||
add_custom_target(protobuf ALL
|
||||
COMMAND ${PROTOBUF_COMPILER}
|
||||
--python_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
#--php_out=${CMAKE_BINARY_DIR}
|
||||
--js_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
villas.proto
|
||||
DEPENDS villas.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_dependencies(formats protobuf)
|
||||
endif()
|
||||
|
||||
if(DEFINED PROTOBUFC_COMPILER AND PROTOBUFC_FOUND)
|
||||
add_custom_target(protobuf-c ALL
|
||||
COMMAND ${PROTOBUFC_COMPILER}
|
||||
--c_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
villas.proto
|
||||
DEPENDS villas.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_dependencies(formats protobuf-c)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue