mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user