From 1bd768174a848b9bc12eeff73786407631c533cf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Aug 2018 14:05:00 -0400 Subject: 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 --- Source/cmVisualStudio10TargetGenerator.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 56d7243..aa43457 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2490,6 +2490,16 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( if (this->MSTools) { if (this->ProjectType == vcxproj) { clOptions.FixExceptionHandlingDefault(); + 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); -- cgit v0.12