You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/02/13 05:04:12 UTC

[GitHub] [arrow] mapleFU commented on a diff in pull request #15022: ARROW-18231: [C++][CMake] Add support for overriding optimization level

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


##########
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:
   Hi, kou, does this patch means, when we use release, the default build is "-O3 -DNDEBUG -O2", would it use O2 to final build it rather than O3? @kou 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org