Browse Source

Use find_package(Protobuf CONFIG)

pull/3213/head
Dark Dragon 2 years ago
parent
commit
47182ebba9
2 changed files with 7 additions and 6 deletions
  1. +6
    -5
      cpp/CMakeLists.txt
  2. +1
    -1
      cpp/cmake/config.cmake.in

+ 6
- 5
cpp/CMakeLists.txt View File

@ -176,11 +176,11 @@ if (USE_RE2)
find_required_library (RE2 re2/re2.h re2 "Google RE2")
endif ()
find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
if (USE_PROTOBUF_LITE)
set(PROTOBUF_LIB ${Protobuf_LITE_LIBRARIES})
set(PROTOBUF_LIB protobuf::libprotobuf-lite)
else ()
set(PROTOBUF_LIB ${Protobuf_LIBRARIES})
set(PROTOBUF_LIB protobuf::libprotobuf)
endif ()
find_required_library (ICU_UC unicode/uchar.h icuuc "ICU")
@ -233,8 +233,9 @@ set (
)
add_custom_command (
COMMAND ${Protobuf_PROTOC_EXECUTABLE} --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/
--proto_path=${RESOURCES_DIR} ${PROTOBUF_SOURCES}
COMMAND protobuf::protoc
ARGS --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/ --proto_path=${RESOURCES_DIR} ${PROTOBUF_SOURCES}
VERBATIM
OUTPUT ${PROTOBUF_OUTPUT}
DEPENDS ${PROTOBUF_SOURCES}


+ 1
- 1
cpp/cmake/config.cmake.in View File

@ -3,7 +3,7 @@
include(CMakeFindDependencyMacro)
find_dependency(absl CONFIG)
find_dependency(Protobuf)
find_dependency(Protobuf CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
check_required_components("@PROJECT_NAME@")

Loading…
Cancel
Save