CMAKE_ARGS should contain -DCMAKE_BUILD_TYPE=None, else builds picks up -O3 instead -O2
Conda-forge documentation
- [X] I could not solve my problem using the conda-forge documentation.
Installed packages
latest builds on conda-forge:
eg https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/623322/logs/69
Environment info
linux/mac
Issue
in every package that use cmake for C/C++, C/CXXFLAGS look like that and want -O2 on linux/mac:
CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem $PREFIX/include -fdebug-prefix-map=... -fdebug-prefix-map=...
CXXFLAGS=-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=... -fdebug-prefix-map=...
but some cmake projects might default their CMAKE_BUILD_TYPE to Release and pick up the default CMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" which are appended conda forge's CXXFLAGS, and so override the -O2 (or Debug and pickup -g flag)
one solution is to add -DCMAKE_BUILD_TYPE=None, like Debian does
What's the issue with builds picking up -O3?
There are packages that don't support CMAKE_BUILD_TYPE=None, and this would break them. Also the clang conda compilers in macOS sets CMAKE_BUILD_TYPE=Release.