forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindProtobuf.cmake
34 lines (24 loc) · 998 Bytes
/
FindProtobuf.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#[=======================================================================[.rst:
FindProtobuf
--------
This module determines the Protobuf library of the system.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``protobuf::libprotobuf`` and
``protobuf::protoc``, if Protobuf has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
Protobuf_FOUND - True if Protobuf found.
#]=======================================================================]
find_package(PkgConfig REQUIRED)
pkg_check_modules(PROTOBUF REQUIRED protobuf>=3.12 IMPORTED_TARGET GLOBAL)
add_library(protobuf::libprotobuf ALIAS PkgConfig::PROTOBUF)
set_target_properties(PkgConfig::PROTOBUF PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PROTOBUF_INCLUDEDIR}")
find_program(PROTOC_EXEC protoc REQUIRED)
add_executable(protobuf::protoc IMPORTED GLOBAL)
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LOCATION ${PROTOC_EXEC}
)