I have a cmake project which uses FetchContent to pull in google test from a github mirror. There are also some custom targets for optionally enabling and disabling bullseye coverage on the build. This all worked well up to 3.23.5, but as soon as I move to 3.24.0-rc1 and above, the build step results in a linker error:
Command line fatal error c1083: cannot open source file: ‘<Build_Path_Removed>/_deps/googletest-src/googletest/include’: Permission denied
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(687,5): error MSB6006: “CL.exe” exited with code 1. [<Path_To_VS_Project_Removed>.vcxproj]
When I disable the bullseye coverage build, the build succeeds as expected. I presume this is something to do with what happens when bullseye is enabled, specifically the system PATH is updated so that it’s version of the CL.exe is discovered first and used to instrument the source files, which are then passed to the real compiler.
I’m presuming something has changed internally with CMake in terms of how it handles the path to the CL.exe, but I am at a loss to understand what…or how to fix this?
Could you try to bisect the problem in git to track it down more specifically? Or provide a project that shows the problem so that someone else could bisect.
I’ve been able to reproduce the issue on a cut down project and isolate what I think is the problematic difference. The 3.23.5 visual studio project contains the following:
That has obviously stripped out the xml tags…
In the 3.23.5 build the first line is in an AdditionalIncludeDirectories tag, with the second being in an AdditionalOptions tag. With the later build, all the options are in an AdditionalOptions tag only.
You can unset CMAKE_INCLUDE_SYSTEM_FLAG_${lang} after the project() call to hide support from CMake generators for /external:I. I suggest reporting the unsupported flag to Bullseye.