1
1
diff --git a/CMakeLists.txt b/CMakeLists.txt
2
- index 2139dc0..1942ad0 100644
2
+ index 2139dc0..df3f30a 100644
3
3
--- a/CMakeLists.txt
4
4
+++ b/CMakeLists.txt
5
- @@ -27,7 +27,7 @@ include(CTest)
5
+ @@ -27,58 +27,64 @@ include(CTest)
6
6
# ============================================================================
7
7
# Find Python
8
8
@@ -11,7 +11,106 @@ index 2139dc0..1942ad0 100644
11
11
12
12
# ============================================================================
13
13
# Build dependencies
14
- @@ -87,8 +87,10 @@ pybind11_add_module(
14
+ + include(FetchContent)
15
+
16
+ - if(USE_SYSTEM_ABSEIL)
17
+ - # Version omitted, as absl only allows EXACT version matches
18
+ - set(_absl_package_args REQUIRED)
19
+ - else()
20
+ - set(_absl_package_args 20230125)
21
+ - endif()
22
+ - if(USE_SYSTEM_PROTOBUF)
23
+ - set(_protobuf_package_args 4.23.3 REQUIRED)
24
+ - else()
25
+ - set(_protobuf_package_args 4.23.3)
26
+ - endif()
27
+ - if(USE_SYSTEM_PYBIND)
28
+ - set(_pybind11_package_args 2.11.1 REQUIRED)
29
+ - else()
30
+ - set(_pybind11_package_args 2.11.1)
31
+ + message(CHECK_START "Checking for external dependencies")
32
+ + list(APPEND CMAKE_MESSAGE_INDENT " ")
33
+ +
34
+ + if(NOT TARGET absl::base)
35
+ + if(USE_SYSTEM_ABSEIL)
36
+ + # Version omitted, as absl only allows EXACT version matches
37
+ + set(_absl_package_args REQUIRED)
38
+ + else()
39
+ + set(_absl_package_args 20230125)
40
+ + endif()
41
+ + FetchContent_Declare(
42
+ + absl
43
+ + GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
44
+ + GIT_TAG 20230125.3
45
+ + FIND_PACKAGE_ARGS ${_absl_package_args} NAMES absl)
46
+ + set(ABSL_PROPAGATE_CXX_STD ON)
47
+ + set(ABSL_ENABLE_INSTALL ON)
48
+ + FetchContent_MakeAvailable(absl)
49
+ endif()
50
+
51
+ - set(ABSL_PROPAGATE_CXX_STD ON)
52
+ - set(ABSL_ENABLE_INSTALL ON)
53
+ + if(NOT TARGET protobuf::libprotobuf)
54
+ + if(USE_SYSTEM_PROTOBUF)
55
+ + set(_protobuf_package_args 4.23.3 REQUIRED)
56
+ + else()
57
+ + set(_protobuf_package_args 4.23.3)
58
+ + endif()
59
+ + FetchContent_Declare(
60
+ + Protobuf
61
+ + GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
62
+ + GIT_TAG v23.3
63
+ + GIT_SUBMODULES ""
64
+ + FIND_PACKAGE_ARGS ${_protobuf_package_args} NAMES protobuf)
65
+ + set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
66
+ + FetchContent_MakeAvailable(Protobuf)
67
+ + endif()
68
+
69
+ - include(FetchContent)
70
+ - FetchContent_Declare(
71
+ - absl
72
+ - GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
73
+ - GIT_TAG 20230125.3
74
+ - FIND_PACKAGE_ARGS ${_absl_package_args} NAMES absl)
75
+ -
76
+ - # cmake-format: off
77
+ - FetchContent_Declare(
78
+ - Protobuf
79
+ - GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
80
+ - GIT_TAG v23.3
81
+ - GIT_SUBMODULES ""
82
+ - FIND_PACKAGE_ARGS ${_protobuf_package_args} NAMES protobuf)
83
+ - set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
84
+ - # cmake-format: on
85
+ -
86
+ - FetchContent_Declare(
87
+ - pybind11
88
+ - GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
89
+ - GIT_TAG v2.11.1
90
+ - FIND_PACKAGE_ARGS ${_pybind11_package_args} NAMES pybind11)
91
+ + if(NOT TARGET pybind11::pybind11_headers)
92
+ + if(USE_SYSTEM_PYBIND)
93
+ + set(_pybind11_package_args 2.11.1 REQUIRED)
94
+ + else()
95
+ + set(_pybind11_package_args 2.11.1)
96
+ + endif()
97
+ + FetchContent_Declare(
98
+ + pybind11
99
+ + GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
100
+ + GIT_TAG v2.11.1
101
+ + FIND_PACKAGE_ARGS ${_pybind11_package_args} NAMES pybind11)
102
+ + FetchContent_MakeAvailable(pybind11)
103
+ + endif()
104
+
105
+ - message(CHECK_START "Checking for external dependencies")
106
+ - list(APPEND CMAKE_MESSAGE_INDENT " ")
107
+ - FetchContent_MakeAvailable(absl Protobuf pybind11)
108
+ list(POP_BACK CMAKE_MESSAGE_INDENT)
109
+ + message(CHECK_PASS "found")
110
+
111
+ # ============================================================================
112
+ # pybind11_proto_utils pybind11 extension module
113
+ @@ -87,8 +93,10 @@ pybind11_add_module(
15
114
pybind11_protobuf/proto_utils.h)
16
115
17
116
target_link_libraries(
@@ -24,7 +123,7 @@ index 2139dc0..1942ad0 100644
24
123
25
124
target_include_directories(
26
125
pybind11_proto_utils PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS}
27
- @@ -116,10 +118 ,11 @@ target_link_libraries(
126
+ @@ -116,10 +124 ,11 @@ target_link_libraries(
28
127
absl::optional
29
128
protobuf::libprotobuf
30
129
pybind11::pybind11
@@ -37,7 +136,7 @@ index 2139dc0..1942ad0 100644
37
136
PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
38
137
${pybind11_INCLUDE_DIRS})
39
138
40
- @@ -143,7 +146 ,7 @@ target_link_libraries(
139
+ @@ -143,7 +152 ,7 @@ target_link_libraries(
41
140
absl::optional
42
141
protobuf::libprotobuf
43
142
pybind11::pybind11
0 commit comments