Commit 1bd76817 authored by Brad King's avatar Brad King
Browse files

VS: Avoid VS 2017 toolset default use of /FC flag

VS 2017 toolsets now use this flag by default if `UseFullPaths` is
not explicitly set to `false` in the .vcxproj file.  Since there is
no negative form of this flag there is no way for projects to turn
it off through our flag map.  Also, the Makefile and Ninja generators
do not add this flag unless it is explicitly specified by the project.

Teach our generator to set `UseFullPaths` to `false` in VS 2017
unless the project or use has explicitly specified `/FC`.

Fixes: #18261
parent 91c9a522
......@@ -2490,6 +2490,16 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (this->MSTools) {
if (this->ProjectType == vcxproj) {
if (this->GlobalGenerator->GetVersion() >=
cmGlobalVisualStudioGenerator::VS15) {
// Toolsets that come with VS 2017 may now enable UseFullPaths
// by default and there is no negative /FC option that projects
// can use to switch it back. Older toolsets disable this by
// default anyway so this will not hurt them. If the project
// is using an explicit /FC option then parsing flags will
// replace this setting with "true" below.
clOptions.AddFlag("UseFullPaths", "false");
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
std::string asmLocation = configName + "/";
clOptions.AddFlag("AssemblerListingLocation", asmLocation);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment