|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -set(GOOGLE_CLOUD_CPP_CCTZ_PROVIDER "module" CACHE STRING "How to find the cctz libraries") |
16 | | -set_property(CACHE GOOGLE_CLOUD_CPP_CCTZ_PROVIDER PROPERTY STRINGS "module" "package") |
| 15 | +# While the documentation is not clear as to whether cctz can be used as an |
| 16 | +# installed library, we only use it as part of Abseil, which is supposed to |
| 17 | +# be included as a module. |
17 | 18 |
|
18 | | -if ("${GOOGLE_CLOUD_CPP_CCTZ_PROVIDER}" STREQUAL "module") |
19 | | - if (NOT CCTZ_ROOT_DIR) |
20 | | - set(CCTZ_ROOT_DIR ${PROJECT_SOURCE_DIR}/third_party/cctz) |
21 | | - endif () |
22 | | - if (NOT EXISTS "${CCTZ_ROOT_DIR}/CMakeLists.txt") |
23 | | - message(ERROR "GOOGLE_CLOUD_CPP_CCTZ_PROVIDER is \"module\" but CCTZ_ROOT_DIR is wrong") |
24 | | - endif () |
25 | | - # cctz will include the `CTest` module and always compile the cctz tests, we want to disable that. The only way is |
26 | | - # to include the module first, disable the tests, and then include the cctz CMakeLists.txt files. |
27 | | - include(CTest) |
28 | | - set(BUILD_TESTING OFF) |
29 | | - add_subdirectory(${CCTZ_ROOT_DIR} third_party/cctz EXCLUDE_FROM_ALL) |
30 | | - set(CCTZ_LIBRARIES cctz) |
31 | | - set(CCTZ_INCLUDE_DIRS ${CCTZ_ROOT_DIR}/absl) |
32 | | -elseif ("${GOOGLE_CLOUD_CPP_CCTZ_PROVIDER}" STREQUAL "package") |
33 | | - if (WIN32) |
34 | | - # On Windows we will probably use the vcpkg port (github.com/Microsoft/vcpkg). |
35 | | - message(ERROR "TODO() - configure cctz under Windows") |
36 | | - else () |
37 | | - # Use pkg-config on Unix and macOS. |
38 | | - include(FindPkgConfig) |
39 | | - pkg_check_modules(CCTZ REQUIRED cctz) |
40 | | - link_directories(${CCTZ_LIBRARY_DIRS}) |
41 | | - endif () |
| 19 | +if (NOT CCTZ_ROOT_DIR) |
| 20 | + set(CCTZ_ROOT_DIR ${PROJECT_SOURCE_DIR}/third_party/cctz) |
42 | 21 | endif () |
| 22 | + |
| 23 | +if (NOT EXISTS "${CCTZ_ROOT_DIR}/CMakeLists.txt") |
| 24 | + message(ERROR "expected a CMakeLists.txt in CCTZ_ROOT_DIR") |
| 25 | +endif () |
| 26 | + |
| 27 | +# cctz will include the `CTest` module and always compile the cctz tests, we |
| 28 | +# want to disable that. The only way is to include the module first, disable |
| 29 | +# the tests, and then include the cctz CMakeLists.txt files. |
| 30 | +include(CTest) |
| 31 | +set(BUILD_TESTING OFF) |
| 32 | + |
| 33 | +add_subdirectory(${CCTZ_ROOT_DIR} third_party/cctz EXCLUDE_FROM_ALL) |
| 34 | +set(CCTZ_LIBRARIES cctz) |
| 35 | +set(CCTZ_INCLUDE_DIRS ${CCTZ_ROOT_DIR}/absl) |
0 commit comments