1
0
mirror of https://github.com/apple/foundationdb.git synced 2025-05-26 09:22:34 +08:00

Copy paste cmake code until it seems like it maybe downloads TOML11

This commit is contained in:
Alex Miller 2020-07-05 16:18:08 -07:00
parent dfca94d00f
commit f08f0255cc
3 changed files with 42 additions and 0 deletions

@ -113,6 +113,17 @@ else()
set(WITH_ROCKSDB_EXPERIMENTAL OFF)
endif()
################################################################################
# TOML11
################################################################################
find_package(TOML11)
if (TOML11_FOUND)
set(WITH_TOML ON)
else()
set(WITH_TOML OFF)
endif()
################################################################################
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
@ -131,6 +142,7 @@ function(print_components)
message(STATUS "Build Bindings (depends on Python): ${WITH_PYTHON}")
message(STATUS "Configure CTest (depends on Python): ${WITH_PYTHON}")
message(STATUS "Build with RocksDB: ${WITH_ROCKSDB_EXPERIMENTAL}")
message(STATUS "Build with TOML testspecs: ${WITH_TOML}")
message(STATUS "=========================================")
endfunction()

26
cmake/FindTOML11.cmake Normal file

@ -0,0 +1,26 @@
find_path(TOML11_INCLUDE_DIR
NAMES
toml.hpp
PATH_SUFFIXES
toml11
HINTS
"${_TOML11_HINTS}"
)
if (NOT TOML11_INCLUDE_DIR)
include(ExternalProject)
ExternalProject_add(toml11
URL "https://github.com/ToruNiina/toml11/archive/v3.4.0.tar.gz"
URL_HASH SHA256=bc6d733efd9216af8c119d8ac64a805578c79cc82b813e4d1d880ca128bd154d
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/toml11
-Dtoml11_BUILD_TEST:BOOL=OFF)
set(TOML11_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/toml11)
endif()
find_package_handle_standard_args(TOML11
REQUIRED_VARS
TOML11_INCLUDE_DIR
)

@ -253,6 +253,10 @@ else()
target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite)
endif()
if (WITH_TOML11)
add_dependencies(fdbserver toml11)
endif()
if (GPERFTOOLS_FOUND)
add_compile_definitions(USE_GPERFTOOLS)
target_link_libraries(fdbserver PRIVATE gperftools)