PragmaTwice commented on code in PR #586:
URL: https://github.com/apache/incubator-kvrocks/pull/586#discussion_r875493570
##########
CMakeLists.txt:
##########
@@ -50,351 +46,60 @@ include(cmake/rocksdb.cmake)
include(cmake/libevent.cmake)
include(cmake/lua.cmake)
+find_package(Threads REQUIRED)
+
list(APPEND EXTERNAL_LIBS PRIVATE glog)
list(APPEND EXTERNAL_LIBS PRIVATE snappy)
-
list(APPEND EXTERNAL_LIBS PRIVATE rocksdb_with_headers)
-
list(APPEND EXTERNAL_LIBS PRIVATE event_with_headers)
-
list(APPEND EXTERNAL_LIBS PRIVATE lua)
-
-# End dependencies
+list(APPEND EXTERNAL_LIBS PRIVATE Threads::Threads)
# Add git sha to version.h
find_package(Git REQUIRED)
execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_SHA)
string(STRIP "${GIT_SHA}" GIT_SHA)
configure_file(src/version.h.in ${PROJECT_BINARY_DIR}/version.h)
-# Main target
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
endif()
-find_library(UNWIND_LIB unwind)
+find_library(HAS_UNWIND_LIB unwind)
-add_executable(kvrocks)
-target_compile_features(kvrocks PRIVATE cxx_std_11)
-target_compile_options(kvrocks PRIVATE -Wall -Wpedantic -g -Wsign-compare
-Wreturn-type -fno-omit-frame-pointer -O0)
-option(ENABLE_ASAN "enable ASAN santinizer" OFF)
-if(ENBALE_ASAN)
- target_compile_options(kvrocks PRIVATE -fsanitize=address)
- target_link_libraries(kvrocks PRIVATE -fsanitize=address)
-endif()
+set(WARNING_FLAGS -Wall -Wpedantic -Wsign-compare -Wreturn-type)
Review Comment:
CMake will add `-O3 -DNDEBUG ...` for `CMAKE_BUILD_TYPE=Release`, `-O2
-DNDEBUG -g` for `RelWithDebInfo` and `-O0 -g ...` for `Debug` in the makefile
generator.
I wonder why use `-O2 -g` for `Release`, since it is rare for C++ projects.
You can use `RelWithDebInfo` directly without changing the semantics of Release
mode.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]