|
Previously we added the language standard flag near the end of all
options, even after those added by `add_compile_options` and friends.
However, on some compilers such as MSVC, the `-std` flag may reset
defaults for flags that precede it on the command line. Move the
language standard flag to before all other flags that CMake adds for
other abstractions, and before those added by `add_compile_options`.
`CMAKE_<LANG>_FLAGS` should still precede the language flags though,
because they are meant to be treated as language-wide modifications to
the compiler defaults, similar to `$CC $CFLAGS`.
Fixes: #23860
Fixes: #24170
|