The {C,CXX,CPP,LD}FLAGS
are build type-agnostic. Therefore, if any of them is specified, it should be assigned to a non-type-specific variable.
This PR is split from #30454. It is required because CMake distinguishes build type-specific variables. For instance, CMake assumes that CXXFLAGS
affects the content of the CMAKE_CXX_FLAGS
variable. However, without this change, the CMAKE_CXX_FLAGS_RELEASE
or CMAKE_CXX_FLAGS_DEBUG
will be affected instead.
No behaviour change for packages in depends:
- on the master branch @ efbf4e71ce8e3cd49ccdfb5e55e14fa4b338453c
0$ make -C depends print-libevent_cxxflags CXXFLAGS="-std=c++20 -O0 -Wall" 2>&1 | grep libevent
1libevent_cxxflags= -std=c++20 -O0 -Wall
2$ make -C depends print-libevent_cxxflags CXXFLAGS="-std=c++20 -O0 -Wall" DEBUG=1 2>&1 | grep libevent
3libevent_cxxflags= -std=c++20 -O0 -Wall
- with this PR:
0$ make -C depends print-libevent_cxxflags CXXFLAGS="-std=c++20 -O0 -Wall" 2>&1 | grep libevent
1libevent_cxxflags=-std=c++20 -O0 -Wall
2$ make -C depends print-libevent_cxxflags CXXFLAGS="-std=c++20 -O0 -Wall" DEBUG=1 2>&1 | grep libevent
3libevent_cxxflags=-std=c++20 -O0 -Wall
Also there is zero diff for the generated share/config.site
file.