forked from JJJollyjim/leveldb-mcpe
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
83 lines (72 loc) · 2.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.2)
if (WIN32)
# set windows 7 as the minimum version
add_definitions(-D_WIN32_WINNT=0x0601)
endif()
project(leveldb)
include(CheckCXXCompilerFlag)
list(APPEND SOURCES db/builder.cc)
list(APPEND SOURCES db/c.cc)
list(APPEND SOURCES db/db_impl.cc)
list(APPEND SOURCES db/db_iter.cc)
list(APPEND SOURCES db/dbformat.cc)
list(APPEND SOURCES db/filename.cc)
list(APPEND SOURCES db/log_reader.cc)
list(APPEND SOURCES db/log_writer.cc)
list(APPEND SOURCES db/memtable.cc)
list(APPEND SOURCES db/repair.cc)
list(APPEND SOURCES db/table_cache.cc)
list(APPEND SOURCES db/version_edit.cc)
list(APPEND SOURCES db/version_set.cc)
list(APPEND SOURCES db/write_batch.cc)
list(APPEND SOURCES table/block.cc)
list(APPEND SOURCES table/block_builder.cc)
list(APPEND SOURCES table/filter_block.cc)
list(APPEND SOURCES table/format.cc)
list(APPEND SOURCES table/iterator.cc)
list(APPEND SOURCES table/merger.cc)
list(APPEND SOURCES table/table.cc)
list(APPEND SOURCES table/table_builder.cc)
list(APPEND SOURCES table/two_level_iterator.cc)
list(APPEND SOURCES util/arena.cc)
list(APPEND SOURCES util/bloom.cc)
list(APPEND SOURCES util/cache.cc)
list(APPEND SOURCES util/coding.cc)
list(APPEND SOURCES util/comparator.cc)
list(APPEND SOURCES util/crc32c.cc)
list(APPEND SOURCES util/env.cc)
list(APPEND SOURCES util/filter_policy.cc)
list(APPEND SOURCES util/hash.cc)
list(APPEND SOURCES util/histogram.cc)
list(APPEND SOURCES util/logging.cc)
list(APPEND SOURCES util/options.cc)
list(APPEND SOURCES util/status.cc)
list(APPEND SOURCES db/zlib_compressor.cc)
list(APPEND SOURCES db/zstd_compressor.cc)
list(APPEND SOURCES port/port_posix_sse.cc)
include_directories(. include)
if (UNIX)
list(APPEND SOURCES port/port_posix.cc)
list(APPEND SOURCES util/env_posix.cc)
add_definitions(-DLEVELDB_PLATFORM_POSIX "-DDLLX=")
if(APPLE)
add_definitions(-DOS_MACOSX)
endif()
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
elseif (WIN32)
list(APPEND SOURCES port/port_win.cc)
list(APPEND SOURCES util/env_win.cc)
list(APPEND SOURCES util/win_logger.cc)
add_definitions(-DLEVELDB_PLATFORM_WINDOWS "-DDLLX=__declspec(dllexport)")
endif()
add_library(leveldb SHARED ${SOURCES})
find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
include_directories( ${ZLIB_INCLUDE_DIRS} )
target_link_libraries( leveldb ${ZLIB_LIBRARIES} )
endif(ZLIB_FOUND)