mapleFU commented on code in PR #15022:
URL: https://github.com/apache/arrow/pull/15022#discussion_r1104016368


##########
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:
   I think you're right, but here I think that, why no 
   
   ```
   if (CMAKE_CXX_FLAGS_RELEASE NOT MATCHES "-O3")
     string(APPEND CXX_RELEASE_FLAGS " -O2")
   endif()
   ```
   
   If I want to test O3, maybe we should have ability to use it?



-- 
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]

Reply via email to