@ -148,6 +148,31 @@ if(WIN32 AND MSVC)
endif ( )
endif ( )
set ( BUILD_VERSION_CC ${ CMAKE_BINARY_DIR } /build_version.cc )
configure_file ( util/build_version.cc.in ${ BUILD_VERSION_CC } @ONLY )
add_library ( build_version OBJECT ${ BUILD_VERSION_CC } )
target_include_directories ( build_version PRIVATE
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / u t i l )
if ( MSVC )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W3 /wd4127 /wd4800 /wd4996 /wd4351" )
else ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers" )
if ( MINGW )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format" )
endif ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fno-omit-frame-pointer" )
include ( CheckCXXCompilerFlag )
CHECK_CXX_COMPILER_FLAG ( "-momit-leaf-frame-pointer" HAVE_OMIT_LEAF_FRAME_POINTER )
if ( HAVE_OMIT_LEAF_FRAME_POINTER )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -momit-leaf-frame-pointer" )
endif ( )
endif ( )
endif ( )
option ( PORTABLE "build a portable binary" OFF )
option ( FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF )
if ( PORTABLE )
@ -191,31 +216,6 @@ if(HAVE_THREAD_LOCAL)
add_definitions ( -DROCKSDB_SUPPORT_THREAD_LOCAL )
endif ( )
set ( BUILD_VERSION_CC ${ CMAKE_BINARY_DIR } /build_version.cc )
configure_file ( util/build_version.cc.in ${ BUILD_VERSION_CC } @ONLY )
add_library ( build_version OBJECT ${ BUILD_VERSION_CC } )
target_include_directories ( build_version PRIVATE
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / u t i l )
if ( MSVC )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W3 /wd4127 /wd4800 /wd4996 /wd4351" )
else ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers" )
if ( MINGW )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format" )
endif ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fno-omit-frame-pointer" )
include ( CheckCXXCompilerFlag )
CHECK_CXX_COMPILER_FLAG ( "-momit-leaf-frame-pointer" HAVE_OMIT_LEAF_FRAME_POINTER )
if ( HAVE_OMIT_LEAF_FRAME_POINTER )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -momit-leaf-frame-pointer" )
endif ( )
endif ( )
endif ( )
option ( FAIL_ON_WARNINGS "Treat compile warnings as errors" ON )
if ( FAIL_ON_WARNINGS )
if ( MSVC )
@ -325,6 +325,7 @@ endif()
option ( WITH_FALLOCATE "build with fallocate" ON )
if ( WITH_FALLOCATE )
set ( CMAKE_REQUIRED_FLAGS ${ CMAKE_C_FLAGS } )
include ( CheckCSourceCompiles )
CHECK_C_SOURCE_COMPILES ( "
# i n c l u d e < f c n t l . h >