Changeset View
Changeset View
Standalone View
Standalone View
src/leveldb/CMakeLists.txt
# Copyright 2017 The LEVELDB Authors. All rights reserved. | # Copyright 2017 The LEVELDB Authors. All rights reserved. | ||||
# Use of this source code is governed by a BSD-style license that can be | # Use of this source code is governed by a BSD-style license that can be | ||||
# found in the LICENSE file. See the AUTHORS file for names of contributors. | # found in the LICENSE file. See the AUTHORS file for names of contributors. | ||||
cmake_minimum_required(VERSION 3.5) | cmake_minimum_required(VERSION 3.5) | ||||
project(Leveldb VERSION 0.1.0 LANGUAGES C CXX) | project(Leveldb VERSION 0.1.0 LANGUAGES C CXX) | ||||
# This project can take advantage of C++11. | # This project can take advantage of C++11. | ||||
set(CMAKE_CXX_STANDARD 11) | set(CMAKE_CXX_STANDARD 11) | ||||
# Remove some warnings for leveldb as they can get noisy. | # Remove some warnings for leveldb as they can get noisy. | ||||
add_compiler_flag(-Wno-sign-compare -Wno-implicit-fallthrough) | add_compiler_flag(-Wno-sign-compare -Wno-implicit-fallthrough) | ||||
add_c_compiler_flag(-Wno-strict-prototypes) | add_c_compiler_flag(-Wno-strict-prototypes) | ||||
remove_compiler_flags(-Wstrict-prototypes) | remove_compiler_flags(-Wstrict-prototypes) | ||||
include(TestBigEndian) | |||||
test_big_endian(LEVELDB_IS_BIG_ENDIAN) | |||||
include(CheckIncludeFile) | |||||
check_include_file("unistd.h" HAVE_UNISTD_H) | |||||
include(CheckIncludeFileCXX) | include(CheckIncludeFileCXX) | ||||
check_include_file_cxx("atomic" LEVELDB_ATOMIC_PRESENT) | check_include_file_cxx("atomic" LEVELDB_ATOMIC_PRESENT) | ||||
include(CheckLibraryExists) | |||||
check_library_exists(crc32c crc32c_value "" HAVE_CRC32C) | |||||
check_library_exists(snappy snappy_compress "" HAVE_SNAPPY) | |||||
include(CheckSymbolExists) | |||||
check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC) | |||||
configure_file( | |||||
port/port_config.h.cmake.in | |||||
include/port/port_config.h | |||||
) | |||||
include_directories(.) | include_directories(.) | ||||
add_library(leveldb | add_library(leveldb | ||||
db/builder.cc | db/builder.cc | ||||
db/c.cc | db/c.cc | ||||
db/dbformat.cc | db/dbformat.cc | ||||
db/db_impl.cc | db/db_impl.cc | ||||
db/db_iter.cc | db/db_iter.cc | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
endif() | endif() | ||||
target_compile_definitions(leveldb | target_compile_definitions(leveldb | ||||
PUBLIC | PUBLIC | ||||
OS_${LEVELDB_OS} | OS_${LEVELDB_OS} | ||||
LEVELDB_PLATFORM_${LEVELDB_PLATFORM} | LEVELDB_PLATFORM_${LEVELDB_PLATFORM} | ||||
) | ) | ||||
# Right now this is not used but the latest version of leveldb uses this | |||||
# so we might as well be ready for it. | |||||
if (HAVE_CRC32C) | |||||
target_link_libraries(leveldb crc32c) | |||||
endif (HAVE_CRC32C) | |||||
if (HAVE_SNAPPY) | |||||
target_link_libraries(leveldb snappy) | |||||
endif (HAVE_SNAPPY) | |||||
# The libmemenv library. | # The libmemenv library. | ||||
add_library(memenv helpers/memenv/memenv.cc) | add_library(memenv helpers/memenv/memenv.cc) | ||||
target_include_directories(memenv PUBLIC include) | target_include_directories(memenv PUBLIC include) | ||||
target_compile_definitions(memenv | target_compile_definitions(memenv | ||||
PUBLIC | PUBLIC | ||||
OS_${LEVELDB_OS} | OS_${LEVELDB_OS} | ||||
LEVELDB_PLATFORM_${LEVELDB_PLATFORM} | LEVELDB_PLATFORM_${LEVELDB_PLATFORM} | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |