From 940bd9d0af5c47d5a0650bb3995ea5d7f9612098 Mon Sep 17 00:00:00 2001 From: Gilles Vollant Date: Sat, 9 Jan 2021 10:56:51 +0100 Subject: [PATCH] =?UTF-8?q?Original=20commit=20from=20=20Timur=20Krist?= =?UTF-8?q?=C3=B3f=20(#2363)=20(#2482)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ability for the C++ library to link against protobuf-lite. . --- cpp/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 696d888de..960291b54 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -81,6 +81,7 @@ endfunction (find_required_program) option ("BUILD_GEOCODER" "Build the offline phone number geocoder" "ON") option ("REGENERATE_METADATA" "Regenerate metadata instead of using it from the source tree" "ON") option ("USE_ALTERNATE_FORMATS" "Use alternate formats" "ON") +option ("USE_PROTOBUF_LITE" "Link to protobuf-lite" "OFF") option ("USE_BOOST" "Use Boost" "ON") option ("USE_ICU_REGEXP" "Use ICU regexp engine" "ON") option ("USE_LITE_METADATA" "Use lite metadata" "OFF") @@ -126,9 +127,15 @@ if (${USE_RE2} STREQUAL "ON") find_required_library (RE2 re2/re2.h re2 "Google RE2") endif () -find_required_library (PROTOBUF google/protobuf/message_lite.h protobuf - "Google Protocol Buffers") -check_library_version (PC_PROTOBUF protobuf>=2.4) +if (${USE_PROTOBUF_LITE} STREQUAL "ON") + find_required_library (PROTOBUF google/protobuf/message_lite.h protobuf-lite + "Google Protocol Buffers") + check_library_version (PC_PROTOBUF protobuf-lite>=2.4) +else () + find_required_library (PROTOBUF google/protobuf/message_lite.h protobuf + "Google Protocol Buffers") + check_library_version (PC_PROTOBUF protobuf>=2.4) +endif () find_required_library (ICU_UC unicode/uchar.h icuuc "ICU") check_library_version (PC_ICU_UC icu-uc>=4.4)