Created
August 4, 2015 19:40
-
-
Save Rubisk/c622df3a213a31903b14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8) | |
## section: Macro | |
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar) | |
IF(MSVC) | |
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE) | |
SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch") | |
SET(Sources ${${SourcesVar}}) | |
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource} | |
PROPERTIES COMPILE_FLAGS "/Yc/" ${PrecompiledHeader}/" /Fp/"${PrecompiledBinary}/"" | |
OBJECT_OUTPUTS "${PrecompiledBinary}") | |
SET_SOURCE_FILES_PROPERTIES(${Sources} | |
PROPERTIES COMPILE_FLAGS "/Yu/" ${PrecompiledBinary}/" /FI/"${PrecompiledBinary}/" /Fp/"${PrecompiledBinary}/"" | |
OBJECT_DEPENDS "${PrecompiledBinary}") | |
# Add precompiled header to SourcesVar | |
LIST(APPEND ${SourcesVar} ${PrecompiledSource}) | |
ENDIF(MSVC) | |
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER) | |
## start setting | |
SET (this_target ) | |
## section: include directory | |
INCLUDE_DIRECTORIES( | |
"./" | |
"./include" | |
%(AdditionalIncludeDirectories) | |
) | |
## section: source files | |
# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance | |
SET (${this_target}_SOURCE_FILES | |
db/builder.cc | |
db/c.cc | |
db/dbformat.cc | |
db/db_impl.cc | |
db/db_iter.cc | |
db/dumpfile.cc | |
db/filename.cc | |
db/leveldb_main.cc | |
db/log_reader.cc | |
db/log_writer.cc | |
db/memtable.cc | |
db/repair.cc | |
db/snappy_compressor.cc | |
db/table_cache.cc | |
db/version_edit.cc | |
db/version_set.cc | |
db/write_batch.cc | |
db/zlib_compressor.cc | |
helpers/memenv/memenv.cc | |
port/port_win.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/env_win.cc | |
util/filter_policy.cc | |
util/hash.cc | |
util/histogram.cc | |
util/logging.cc | |
util/options.cc | |
util/status.cc | |
util/testharness.cc | |
util/testutil.cc | |
util/win_logger.cc | |
) | |
## section: header files | |
# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance! | |
SET(${this_target}_HEADER_FILES | |
db/builder.h | |
db/dbformat.h | |
db/db_impl.h | |
db/db_iter.h | |
db/filename.h | |
db/log_format.h | |
db/log_reader.h | |
db/log_writer.h | |
db/memtable.h | |
db/skiplist.h | |
db/snapshot.h | |
db/table_cache.h | |
db/version_edit.h | |
db/version_set.h | |
db/write_batch_internal.h | |
helpers/memenv/memenv.h | |
include/leveldb/c.h | |
include/leveldb/cache.h | |
include/leveldb/comparator.h | |
include/leveldb/compressor.h | |
include/leveldb/db.h | |
include/leveldb/dumpfile.h | |
include/leveldb/env.h | |
include/leveldb/filter_policy.h | |
include/leveldb/iterator.h | |
include/leveldb/options.h | |
include/leveldb/slice.h | |
include/leveldb/snappy_compressor.h | |
include/leveldb/status.h | |
include/leveldb/table.h | |
include/leveldb/table_builder.h | |
include/leveldb/write_batch.h | |
include/leveldb/zlib_compressor.h | |
port/atomic_pointer.h | |
port/port.h | |
port/port_example.h | |
port/port_posix.h | |
port/port_win.h | |
port/thread_annotations.h | |
port/win/stdint.h | |
table/block.h | |
table/block_builder.h | |
table/filter_block.h | |
table/format.h | |
table/iterator_wrapper.h | |
table/merger.h | |
table/two_level_iterator.h | |
util/arena.h | |
util/coding.h | |
util/crc32c.h | |
util/hash.h | |
util/histogram.h | |
util/logging.h | |
util/mutexlock.h | |
util/posix_logger.h | |
util/random.h | |
util/testharness.h | |
util/testutil.h | |
util/win_logger.h | |
) | |
SOURCE_GROUP("Resource Files" FILES | |
) | |
SOURCE_GROUP("Header Files" FILES | |
db/builder.h | |
db/dbformat.h | |
db/db_impl.h | |
db/db_iter.h | |
db/filename.h | |
db/log_format.h | |
db/log_reader.h | |
db/log_writer.h | |
db/memtable.h | |
db/skiplist.h | |
db/snapshot.h | |
db/table_cache.h | |
db/version_edit.h | |
db/version_set.h | |
db/write_batch_internal.h | |
helpers/memenv/memenv.h | |
include/leveldb/c.h | |
include/leveldb/cache.h | |
include/leveldb/comparator.h | |
include/leveldb/compressor.h | |
include/leveldb/db.h | |
include/leveldb/dumpfile.h | |
include/leveldb/env.h | |
include/leveldb/filter_policy.h | |
include/leveldb/iterator.h | |
include/leveldb/options.h | |
include/leveldb/slice.h | |
include/leveldb/snappy_compressor.h | |
include/leveldb/status.h | |
include/leveldb/table.h | |
include/leveldb/table_builder.h | |
include/leveldb/write_batch.h | |
include/leveldb/zlib_compressor.h | |
port/atomic_pointer.h | |
port/port.h | |
port/port_example.h | |
port/port_posix.h | |
port/port_win.h | |
port/thread_annotations.h | |
port/win/stdint.h | |
table/block.h | |
table/block_builder.h | |
table/filter_block.h | |
table/format.h | |
table/iterator_wrapper.h | |
table/merger.h | |
table/two_level_iterator.h | |
util/arena.h | |
util/coding.h | |
util/crc32c.h | |
util/hash.h | |
util/histogram.h | |
util/logging.h | |
util/mutexlock.h | |
util/posix_logger.h | |
util/random.h | |
util/testharness.h | |
util/testutil.h | |
util/win_logger.h | |
) | |
SOURCE_GROUP("Source Files" FILES | |
db/builder.cc | |
db/c.cc | |
db/dbformat.cc | |
db/db_impl.cc | |
db/db_iter.cc | |
db/dumpfile.cc | |
db/filename.cc | |
db/leveldb_main.cc | |
db/log_reader.cc | |
db/log_writer.cc | |
db/memtable.cc | |
db/repair.cc | |
db/snappy_compressor.cc | |
db/table_cache.cc | |
db/version_edit.cc | |
db/version_set.cc | |
db/write_batch.cc | |
db/zlib_compressor.cc | |
helpers/memenv/memenv.cc | |
port/port_win.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/env_win.cc | |
util/filter_policy.cc | |
util/hash.cc | |
util/histogram.cc | |
util/logging.cc | |
util/options.cc | |
util/status.cc | |
util/testharness.cc | |
util/testutil.cc | |
util/win_logger.cc | |
) | |
## section: precompiled header | |
#ADD_MSVC_PRECOMPILED_HEADER("precompiled.h" "precompiled.cpp" MySources) | |
#ADD_LIBRARY(MyLibrary ${MySources}) | |
SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES | |
PROPERTIES HEADER_FILE_ONLY TRUE) | |
LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES}) | |
## section: add definitions | |
# add prefix -D. example> -DSHP | |
# - DO NOT add the following definitions(already defined in ${OSP_DEFINITIONS}: | |
# -DSHP, -DWIN32, -D_WINDOWS, -D_DEBUG, -D_USRDLL, -D_CRT_SECURE_NO_DEPRECATE | |
ADD_DEFINITIONS( | |
-DWIN32 | |
-D_DEBUG | |
-D_WINDOWS | |
-DLEVELDB_PLATFORM_WINDOWS | |
-DOS_WIN | |
-DDLLX= | |
-D_snprintf=snprintf | |
) | |
## section: add target | |
set_property(TARGET ${this_target} PROPERTY CXX_STANDARD 11) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
ADD_LIBRARY(${this_target} STATIC ${${this_target}_SOURCE_FILES} ) | |
## section: add dependency | |
# dependency determines overall build order. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment