From 62dc8ebaca6755631c41e09e3ba585eb431dad23 Mon Sep 17 00:00:00 2001 From: Damian Ubuntu arm64 Date: Fri, 4 Oct 2024 04:10:02 -0400 Subject: [PATCH] update CMakeLists.txt for fitting macOS and Linux --- CMakeLists.txt | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4365b22..12429ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,5 @@ cmake_minimum_required(VERSION 3.14) -# Set CMake policies -if(POLICY CMP0135) - cmake_policy(SET CMP0135 NEW) -endif() - # Project name project(VeloxDB) @@ -20,28 +15,17 @@ endif() # Find the required Protobuf package find_package(Protobuf REQUIRED) -# Specify the path to the .proto files -set(PROTO_FILES - ${PROJECT_SOURCE_DIR}/protobuf/KeyValue.proto -) - -# Generate .pb.cc and .pb.h files from .proto files -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) - -# Ensure that the generated files are placed in the protobuf directory -set(GENERATED_PROTO_DIR ${PROJECT_SOURCE_DIR}/protobuf) - # Include FetchContent module include(FetchContent) -# Set Abseil option -set(ABSL_PROPAGATE_CXX_STD ON) - # Fetch Abseil library FetchContent_Declare( abseil GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git GIT_TAG 20230802.0 # Use the latest stable release tag + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE + GIT_CLONE_TIMEOUT 300 # Increase timeout as needed DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) FetchContent_MakeAvailable(abseil) @@ -49,15 +33,29 @@ FetchContent_MakeAvailable(abseil) # Fetch GoogleTest FetchContent_Declare( googletest - URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE + GIT_CLONE_TIMEOUT 300 # Increase timeout as needed DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) # Enable testing enable_testing() +# Specify the path to the .proto files +set(PROTO_FILES + ${PROJECT_SOURCE_DIR}/protobuf/KeyValue.proto +) + +# Generate .pb.cc and .pb.h files from .proto files +protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) + +# Ensure that the generated files are placed in the protobuf directory +set(GENERATED_PROTO_DIR ${PROJECT_SOURCE_DIR}/protobuf) + # ---- DEFINE SHARED LIBRARY ---- add_library(veloxdb_lib STATIC # kv