CMake: compile with -O2

Summary:
Seems pretty important.
Closes https://github.com/facebook/rocksdb/pull/2161

Differential Revision: D4891097

Pulled By: yiwu-arbug

fbshipit-source-id: 16dc0149dc89d426407fabab4a5ba1d6d1562269
This commit is contained in:
Tamir Duberstein 2017-04-17 23:52:27 -07:00 committed by Facebook Github Bot
parent e67f0adf3a
commit a6439d797e

View file

@ -138,7 +138,7 @@ else()
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fno-omit-frame-pointer")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-momit-leaf-frame-pointer" HAVE_OMIT_LEAF_FRAME_POINTER) CHECK_CXX_COMPILER_FLAG("-momit-leaf-frame-pointer" HAVE_OMIT_LEAF_FRAME_POINTER)
if(HAVE_OMIT_LEAF_FRAME_POINTER) if(HAVE_OMIT_LEAF_FRAME_POINTER)