Copilot commented on code in PR #3553:
URL: https://github.com/apache/brpc/pull/3553#discussion_r4049611596
##########
CMakeLists.txt:
##########
@@ -21,7 +21,12 @@ project(brpc C CXX)
option(WITH_GLOG "With glog" OFF)
option(WITH_MESALINK "With MesaLink" OFF)
option(WITH_BORINGSSL "With BoringSSL" OFF)
-option(DEBUG "Print debug logs" OFF)
+set(BRPC_DEBUG_DEFAULT OFF)
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(BRPC_DEBUG_DEFAULT ON)
+endif()
+option(DEBUG "Print debug logs" ${BRPC_DEBUG_DEFAULT})
Review Comment:
Because `option()` stores `DEBUG` in the CMake cache, this default is
evaluated only when the build directory is first configured. Reconfiguring a
directory from `CMAKE_BUILD_TYPE=Release` to `Debug` leaves the cached
`DEBUG=OFF` (and the reverse leaves it `ON`), so the defaults do not follow the
selected build type unless the cache is cleared; distinguish an explicit
override from the prior default or otherwise update the cached default on
build-type changes.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]