summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-23 18:05:00 (GMT)
committerBrad King <brad.king@kitware.com>2018-08-23 18:05:00 (GMT)
commit1bd768174a848b9bc12eeff73786407631c533cf (patch)
treeaf1263b2b7747fb2967a37ca4531210a9856ce6a /Source/cmVisualStudio10TargetGenerator.cxx
parent91c9a5227384b374c80f1e6453bb830e3de68a4a (diff)
downloadCMake-1bd768174a848b9bc12eeff73786407631c533cf.zip
CMake-1bd768174a848b9bc12eeff73786407631c533cf.tar.gz
CMake-1bd768174a848b9bc12eeff73786407631c533cf.tar.bz2
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
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx10
1 files changed, 10 insertions, 0 deletions
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);