MantisBT - CMake
View Issue Details
0015866CMakeCMakepublic2015-11-28 15:152016-06-10 14:31
temp4746 
Kitware Robot 
normalfeaturealways
closedmoved 
Windows
CMake 3.4 
 
0015866: CMake should work around D9025 when using NMake Makefiles generator
When using the Visual Studio IDE generators CMake maps compiler/linker flags supported by the IDE to the vcxproj properties. This as a side effect prevents passing multiple conflicting flags for most commonly used compiler/linker flags, such as "/W[0-4]".

This is not done for NMake Makefiles, this means when you use them and additionally use something like:
target_compile_options(target PRIVATE /W0)

You will receive D9025 warnings.

This warning is because the cl compiler is annoying and unlike gcc/clang will emit a warning (D9025) when there are conflicting flags and still use the later flag in the command line like expected.

I think CMake should work around this by removing conflicting flags leaving only the latest one on the command line, similar to what you get when you use the IDE project files. At least for the commonly used flags or ones that exist in the IDE project files as specific properties.
cmake_minimum_required(VERSION 3.4)
project(flags)
add_library(a STATIC a.cpp)
target_compile_options(a PRIVATE /W4)

Try this both with an MSVC IDE and NMake Makefiles.
No tags attached.
Issue History
2015-11-28 15:15temp4746New Issue
2016-06-10 14:29Kitware RobotNote Added: 0042894
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042894)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.