Document these variables.
Change our convention for setting these variables from:
set(CMAKE_C_FLAGS_INIT "...")
to
string(APPEND CMAKE_C_FLAGS_INIT " ...")
so that any value previously set by a toolchain file will be used.
Automate the conversion with:
sed -i 's/set *(\(CMAKE_\(C\|CXX\|Fortran\|RC\|ASM\|${[^}]\+}\)_FLAGS\(_[^_]\+\)\?_INIT \+"\)/string(APPEND \1 /' \
Modules/Compiler/*.cmake Modules/Platform/*.cmake
and follow up with some manual fixes (e.g. to cases that already
meant to append). Also revert the automated changes to contexts
that are not protected from running multiple times.
We define `NDEBUG` without a space after the `-D` option for most
compilers. Remove the space for MSVC (and Intel Fortran) for
consistency. The MS compiler technically does not document that
the `-D` argument may be separated from its value, though every
version to date supports it.
Fix typo introduced in commit 66a08c10 (more uniform approach to enable
language, 2004-08-26). The optimization option should be /O2 for
Release configurations and /O1 for MinSizeRel.
Suggested-by: He Yuqi <yuqi.he@gmail.com>
This moves Intel compiler info on Windows into new-style modules
Platform/Windows-Intel-<lang>.cmake
using language-independent helper module
Platform/Windows-Intel.cmake
to define macros consolidating the information.