Visual Studio 2017 comes with full CMake integration. To learn about this combination, I was starting with this basic sample:
# CMakeLists.txt
cmake_minimum_
In CMake 3.15, CMake introduced a fix for this MSVC-specific warning:
cl : Command line warning D9025: overriding '/W3' with '/W4'
and the compiler warning flags (like /W3
) are no longer automatically added. So by upgrading to CMake 3.15 or greater, this warning should no longer appear. From the docs:
When using MSVC-like compilers in CMake 3.14 and below, warning flags like
/W3
are added toCMAKE_
by default. This is problematic for projects that want to choose a different warning level programmatically. In particular, it requires string editing of the_FLAGS CMAKE_
variables with knowledge of the CMake builtin defaults so they can be replaced._FLAGS CMake 3.15 and above prefer to leave out warning flags from the value of
CMAKE_
by default._FLAGS
Along with this fix, CMake introduced policy CMP0092, which allows you to switch back to the OLD
behavior (adding the warning flags by default) if necessary.