Skip to content

Commit

Permalink
update CMakeLists.txt for fitting macOS and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kkli08 committed Oct 4, 2024
1 parent 111b7b9 commit 62dc8eb
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -20,44 +15,47 @@ 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)

# 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
Expand Down

0 comments on commit 62dc8eb

Please sign in to comment.