pitrou commented on code in PR #35924:
URL: https://github.com/apache/arrow/pull/35924#discussion_r1234963044
##########
docs/source/developers/cpp/building.rst:
##########
@@ -254,6 +254,34 @@ Several build types are possible:
* ``Release``: applies compiler optimizations and removes debug information
from the binary.
+.. note::
+
+ These built types provide suitable optimization/debug flags by
+ default but you can change them by specifying
+ ``-DARROW_C_FLAGS_${BUILD_TYPE}=...`` and/or
+ ``-DARROW_CXX_FLAGS_${BUILD_TYPE}=...``. ``${BUILD_TYPE}`` is upper
+ case of build type. For example, ``DEBUG``
+ (``-DARROW_C_FLAGS_DEBUG=...`` / ``-DARROW_CXX_FLAGS_DEBUG=...``) for the
+ ``Debug`` build type and ``RELWITHDEBINFO``
+ (``-DARROW_C_FLAGS_RELWITHDEBINFO=...`` /
+ ``-DARROW_CXX_FLAGS_RELWITHDEBINFO=...``) for the ``RelWithDebInfo``
+ build type.
+
+ For example, you can use ``-O3`` as an optimization flag by
+ specifying ``-DARROW_CXX_FLAGS_RELEASE=-O3`` for the ``Release``
+ build type. You can use ``-g3`` as a debug flag by specifying
+ ``-DARROW_CXX_FLAGS_DEBUG=-g3`` for the ``Debug`` build type.
+
+ You can also use the standard ``-DCMAKE_C_FLAGS_${BUILD_TYPE}=...``
+ and ``-DCMAKE_CXX_FLAGS_${BUILD_TYPE}=...`` style but
+ ``-DARROW_C_FLAGS_${BUILD_TYPE`` and
+ ``-DARROW_CXX_FLAGS_${BUILD_TYPE}=...`` style is
+ recommended. Because ``-DCMAKE_C_FLAGS_${BUILD_TYPE}=...`` and
+ ``-DCMAKE_CXX_FLAGS_${BUILD_TYPE}=...`` style replaces all default
+ flags provided by CMake. ``-DARROW_C_FLAGS_${BUILD_TYPE`` and
+ ``-DARROW_CXX_FLAGS_${BUILD_TYPE}=...`` style just overrides the
+ default flags specified instead of replacing them.
Review Comment:
```suggestion
the ``ARROW_C_FLAGS_${BUILD_TYPE}`` and
``ARROW_CXX_FLAGS_${BUILD_TYPE}`` variables are
recommended. The ``CMAKE_C_FLAGS_${BUILD_TYPE}`` and
``CMAKE_CXX_FLAGS_${BUILD_TYPE}`` variables replace all default
flags provided by CMake, while ``ARROW_C_FLAGS_${BUILD_TYPE}`` and
``ARROW_CXX_FLAGS_${BUILD_TYPE}`` just append the
flags specified, which allows selectively overriding some of the defaults.
```
--
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]