Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for LevelDB to Current! #965

Open
wants to merge 2 commits into
base: stable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ cmake_minimum_required(VERSION 3.14.1)

project(cmake_trivial_2023 C CXX)

set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
find_package(Threads REQUIRED)

# Settings for `googletest`. It builds faste without `gmock`.
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
option(BUILD_GMOCK OFF)
if(NOT DEFINED ENV{CURRENT_WITH_LEVELDB})
message(STATUS "Disabling gmock.")
# Settings for `googletest`. It builds faste without `gmock`.
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
option(BUILD_GMOCK OFF)
else()
message(STATUS "Using Current with LevelDB.")
endif()

# The helper to clone a dependency, or use it from a sibling dir if available.
function(UseOrGitClone dep remote branch)
Expand All @@ -27,7 +32,7 @@ function(UseOrGitClone dep remote branch)
message(STATUS "Using `${dep}` from `CMAKE_CURRENT_SOURCE_DIR/../${dep}': Configured.")
else()
message(STATUS "Cloning `${dep}` from `${remote}:${branch}` ...")
execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 -b ${branch} ${remote})
execute_process(OUTPUT_QUIET ERROR_QUIET COMMAND git clone --depth 1 --recurse-submodules --shallow-submodules -b ${branch} ${remote})
file(TOUCH .gitignore)
file(APPEND .gitignore "${dep}/\n")
add_subdirectory("${CMAKE_SOURCE_DIR}/${dep}" ${dep})
Expand All @@ -36,9 +41,18 @@ function(UseOrGitClone dep remote branch)
endfunction()

UseOrGitClone(current https://github.com/c5t/current stable)
UseOrGitClone(googletest https://github.com/c5t/googletest v1.14)

set(C5T_LIBRARIES "Threads::Threads" "C5T")
if(NOT DEFINED ENV{CURRENT_WITH_LEVELDB})
UseOrGitClone(googletest https://github.com/c5t/googletest v1.14)
else()
UseOrGitClone(leveldb https://github.com/c5t/leveldb main)
endif()

if(NOT DEFINED ENV{CURRENT_WITH_LEVELDB})
set(C5T_LIBRARIES "Threads::Threads" "C5T")
else()
set(C5T_LIBRARIES "Threads::Threads" "C5T" "leveldb")
endif()

# Declare shared libraries as shared library targets. Do not link them against anything external.
file(GLOB_RECURSE BINARY_SOURCE_FILES "src/dlib_*.cc")
Expand Down
Loading