warning MSB4011: masm.props cannot be imported again.


I’m using cmake to create the .sln/.vcxproj files for our Windows driver. Everything is working fine, except I get the following MSBUILD warning which I’d like to suppress or eliminate.

  • warning MSB4011: “…\BuildCustomizations\masm.props” cannot be imported again.
  • It was already imported at "…\Kits\10\build\WindowsDriver.Shared.props (352,3)

The driver has one .asm file which I add to the project using project(${PROJECT_NAME} C CXX ASM_MASM) and then adding the .asm as a source file.

When I do this, cmake adds masm.props to the project file.

	  <ImportGroup Label="ExtensionSettings">
	    <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />

This causes a problem as this new import is conflicting with the Windows driver imports (WindowsDriver.Shared.props) which has already included masm.props.

I was able to partially eliminate the warning by adding “-- -noWarn:MSB4011” to the cmake build command line.

The problem with this approach is

  • it doesn’t eliminate all warnings. There is still a bunch of warning at the start of the project build (the main project has ~20 project dependencies)
  • it doesn’t fix the warnings when building with Visual Studio (Microsoft documentation says that MSB4011 cannot be suppressed using project properties).

I was wondering if anyone has encountered this issue and if there is a way to solve it.
Ideally, I would like to prevent cmake from adding “import masm.props” to the project files.