vcpkg/ports/leveldb/CMakeLists.txt

93 lines
1.9 KiB
CMake
Raw Normal View History

2017-10-25 20:05:17 +08:00
cmake_minimum_required(VERSION 3.8)
project(leveldb C CXX)
option(INSTALL_HEADERS "Install header files" ON)
2018-06-19 15:24:55 +08:00
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2018-05-17 13:23:53 +08:00
IF (MSVC)
2017-10-25 20:05:17 +08:00
add_definitions(
2018-05-17 13:23:53 +08:00
-DWIN32
-D_CRT_NONSTDC_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS
-DNOMINMAX
-DLEVELDB_PLATFORM_WINDOWS
-DLEVELDB_ATOMIC_PRESENT
2017-10-25 20:05:17 +08:00
)
2018-05-17 13:23:53 +08:00
else ()
add_definitions(
-DLEVELDB_PLATFORM_POSIX
-DLEVELDB_ATOMIC_PRESENT
)
endif()
set(SRCS
db/builder.cc
2017-10-25 20:05:17 +08:00
db/c.cc
db/dbformat.cc
db/db_impl.cc
db/db_iter.cc
db/dumpfile.cc
db/filename.cc
db/log_reader.cc
db/log_writer.cc
db/memtable.cc
db/repair.cc
db/table_cache.cc
db/version_edit.cc
db/version_set.cc
db/write_batch.cc
helpers/memenv/memenv.cc
port/port_posix_sse.cc
table/block.cc
table/block_builder.cc
table/filter_block.cc
table/format.cc
table/iterator.cc
table/merger.cc
table/table.cc
table/table_builder.cc
table/two_level_iterator.cc
util/arena.cc
util/bloom.cc
util/cache.cc
util/coding.cc
util/comparator.cc
util/crc32c.cc
util/env.cc
util/filter_policy.cc
util/hash.cc
util/histogram.cc
util/logging.cc
util/options.cc
util/status.cc
)
2018-05-17 13:23:53 +08:00
if (MSVC)
set(SRCS ${SRCS} port/port_win.cc util/env_win.cc)
else ()
set(SRCS ${SRCS} port/port_posix.cc util/env_posix.cc)
ENDIF()
add_library(leveldb ${SRCS})
target_include_directories(leveldb
PUBLIC include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
2017-10-25 20:05:17 +08:00
2018-05-17 13:23:53 +08:00
target_link_libraries(leveldb PUBLIC Iphlpapi.lib Shlwapi.lib)
2017-10-25 20:05:17 +08:00
2018-05-17 13:23:53 +08:00
install(TARGETS leveldb
2017-10-25 20:05:17 +08:00
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
if(INSTALL_HEADERS)
file(GLOB HEADERS include/leveldb/*.h)
install(FILES ${HEADERS} DESTINATION include/leveldb)
install(FILES helpers/memenv/memenv.h DESTINATION include)
2018-05-17 13:23:53 +08:00
endif()