diff options
author | Jelle Spijker <j.spijker@ultimaker.com> | 2022-04-04 18:24:38 +0300 |
---|---|---|
committer | Jelle Spijker <spijker.jelle@gmail.com> | 2022-04-04 18:24:38 +0300 |
commit | 8131b47a48e25562e4c9aa8773c576828ff325ec (patch) | |
tree | a2fc7a20aafea230b5f0f740f1dee2cc716cbd20 | |
parent | 63f415eaaf9473db8ad0fccc9a530ce19f526aa8 (diff) |
Allow usage of Conan cmake find protobuf target
Contributes to CURA-8640
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c3afefef..7ac18e0fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,17 +17,16 @@ endif() if(ENABLE_ARCUS) message(STATUS "Building with Arcus") - # We want to have access to protobuf_generate_cpp and other FindProtobuf features. - # However, if ProtobufConfig is used instead, there is a CMake option that controls - # this, which defaults to OFF. We need to force this option to ON instead. - set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE) - find_package(Protobuf 3.0.0 REQUIRED) + + find_package(protobuf 3.17.1 QUIET) + if(NOT TARGET protobuf::protobuf) + find_package(Protobuf 3.15.0 REQUIRED) + else() + add_library(Protobuf ALIAS protobuf::protobuf) + endif() + find_package(Arcus REQUIRED) add_definitions(-DARCUS) - find_program(PROTOC "protoc") - if(${PROTOC} STREQUAL "PROTOC-NOTFOUND") - message(FATAL_ERROR "Protobuf compiler missing") - endif() endif() #For reading image files. |