[arch-dev-public] RFC: Dropping -DCMAKE_BUILD_TYPE from packages using cmake

Antonio Rojas arojas at archlinux.org
Sun Mar 11 09:00:43 UTC 2018

El domingo, 11 de marzo de 2018 1:44:07 (CET) Eli Schwartz via arch-dev-public escribió:
> This theoretically sounds like a fantastic idea, but I'm not really sure
> what CMake's deal with build flags are in the first place. What is the
> default build type, and does CMake even look at build flags from the
> environment at all (at least in a sane manner)?

This is very poorly documented, so you have to dig into the cmake code to figure it out. The default build type is None, which means CMAKE_C(XX)_FLAGS is used (see /usr/share/cmake-3.10/Modules/CMakeCInformation.cmake:117), whose value is taken from the environment C(XX)FLAGS (see /usr/share/cmake-3.10/Modules/CMakeCXXInformation.cmake:198). So yes, not setting CMAKE_BUILD_TYPE will simply use the build flags from C(XX)FLAGS. If you want to test yourself, run cmake with the -LAH flag and check the output for CMAKE_C(XX)_FLAGS.

 > For example, I am currently the maintainer of a package that has,
> apparently, historically used:

The first two lines should not be necessary (see above)

More information about the arch-dev-public mailing list