kou commented on code in PR #15022:
URL: https://github.com/apache/arrow/pull/15022#discussion_r1104022223
##########
cpp/cmake_modules/SetupCxxFlags.cmake:
##########
@@ -604,76 +604,42 @@ endif()
# For all builds:
# For CMAKE_BUILD_TYPE=Debug
# -ggdb: Enable gdb debugging
-# For CMAKE_BUILD_TYPE=FastDebug
-# Same as Debug, except with some optimizations on.
# For CMAKE_BUILD_TYPE=Release
-# -O2: Enable all compiler optimizations
+# -O2 (not -O3): Enable compiler optimizations
# Debug symbols are stripped for reduced binary size.
# For CMAKE_BUILD_TYPE=RelWithDebInfo
# Same as Release, except with debug symbols enabled.
if(NOT MSVC)
- string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-
- set(RELEASE_FLAGS "-O2 -DNDEBUG")
+ set(C_RELEASE_FLAGS "")
+ if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
+ string(APPEND C_RELEASE_FLAGS " -O2")
Review Comment:
If this uses the condition, `-O3 -DNDEBUG` isn't change. We want to use `-O3
-DNDEBUG -O2` here.
We need to comment out the code when we try `-O3`. Sorry. We may want to add
an option to force using `-O3`.
--
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]