|
1 | | -if(USE_SYSTEM_ABSEIL) |
2 | | - # Version omitted, as absl only allows EXACT version matches |
3 | | - set(_absl_package_args REQUIRED) |
4 | | -else() |
5 | | - set(_absl_package_args 20240722) |
6 | | -endif() |
7 | | -if(USE_SYSTEM_PYBIND) |
8 | | - set(_pybind11_package_args 2.13.6 REQUIRED) |
9 | | -else() |
10 | | - set(_pybind11_package_args 2.13.6) |
11 | | -endif() |
12 | | - |
13 | 1 | include(FetchContent) |
| 2 | +set(BUILD_SHARED_LIBS ON) |
14 | 3 | set(BUILD_TESTING OFF) |
15 | 4 |
|
16 | 5 | message(CHECK_START "Checking for external dependencies") |
17 | 6 | list(APPEND CMAKE_MESSAGE_INDENT " ") |
18 | 7 |
|
19 | 8 | if(NOT TARGET absl::base) |
20 | | - message(CHECK_START "Fetching Abseil-cpp") |
21 | | - list(APPEND CMAKE_MESSAGE_INDENT " ") |
22 | | - # ensure that abseil also installs itself, since we are using it in our public API |
23 | | - set(ABSL_ENABLE_INSTALL ON) |
24 | | - set(ABSL_PROPAGATE_CXX_STD ON) |
25 | | - set(ABSL_USE_SYSTEM_INCLUDES ON) |
26 | | - set(ABSL_BUILD_TESTING OFF) |
27 | | - FetchContent_Declare( |
28 | | - absl |
29 | | - GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git" |
30 | | - GIT_TAG "20240722.0" |
31 | | - GIT_SHALLOW TRUE |
32 | | - FIND_PACKAGE_ARGS ${_absl_package_args} NAMES absl) |
33 | | - FetchContent_MakeAvailable(absl) |
34 | | - list(POP_BACK CMAKE_MESSAGE_INDENT) |
35 | | - message(CHECK_PASS "fetched") |
| 9 | + if(USE_SYSTEM_ABSEIL) |
| 10 | + # Version omitted, as absl only allows EXACT version matches |
| 11 | + find_package(absl REQUIRED) |
| 12 | + else() |
| 13 | + message(CHECK_START "Fetching Abseil-cpp") |
| 14 | + list(APPEND CMAKE_MESSAGE_INDENT " ") |
| 15 | + # ensure that abseil also installs itself, since we are using it in our public |
| 16 | + # API |
| 17 | + set(ABSL_ENABLE_INSTALL ON) |
| 18 | + set(ABSL_PROPAGATE_CXX_STD ON) |
| 19 | + set(ABSL_USE_SYSTEM_INCLUDES ON) |
| 20 | + set(ABSL_BUILD_TESTING OFF) |
| 21 | + FetchContent_Declare( |
| 22 | + absl |
| 23 | + GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git" |
| 24 | + GIT_TAG "20240722.0" |
| 25 | + GIT_SHALLOW TRUE) |
| 26 | + FetchContent_MakeAvailable(absl) |
| 27 | + list(POP_BACK CMAKE_MESSAGE_INDENT) |
| 28 | + message(CHECK_PASS "fetched") |
| 29 | + endif() |
36 | 30 | endif() |
37 | 31 |
|
38 | 32 | if(NOT TARGET pybind11::pybind11_headers) |
39 | | - message(CHECK_START "Fetching Pybind11") |
40 | | - list(APPEND CMAKE_MESSAGE_INDENT " ") |
41 | | - FetchContent_Declare( |
42 | | - pybind11 |
43 | | - GIT_REPOSITORY "https://github.com/pybind/pybind11.git" |
44 | | - GIT_TAG "v2.13.6" |
45 | | - GIT_SHALLOW TRUE |
46 | | - FIND_PACKAGE_ARGS ${_pybind11_package_args} NAMES pybind11) |
47 | | - FetchContent_MakeAvailable(pybind11) |
48 | | - list(POP_BACK CMAKE_MESSAGE_INDENT) |
49 | | - message(CHECK_PASS "fetched") |
| 33 | + if(USE_SYSTEM_PYBIND) |
| 34 | + find_package(pybind11 2.13.6 REQUIRED) |
| 35 | + else() |
| 36 | + message(CHECK_START "Fetching pybind11") |
| 37 | + list(APPEND CMAKE_MESSAGE_INDENT " ") |
| 38 | + FetchContent_Declare( |
| 39 | + pybind11 |
| 40 | + GIT_REPOSITORY "https://github.com/pybind/pybind11.git" |
| 41 | + GIT_TAG "v2.13.6" |
| 42 | + GIT_SHALLOW TRUE) |
| 43 | + FetchContent_MakeAvailable(pybind11) |
| 44 | + list(POP_BACK CMAKE_MESSAGE_INDENT) |
| 45 | + message(CHECK_PASS "fetched") |
| 46 | + endif() |
50 | 47 | endif() |
51 | 48 |
|
52 | 49 | list(POP_BACK CMAKE_MESSAGE_INDENT) |
|
0 commit comments