diff options
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b099277..49f951a 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); @@ -3055,9 +3065,14 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) { return; } + + const std::string& linkLanguage = + this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage; + std::string libflags; this->LocalGenerator->GetStaticLibraryFlags( - libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget); + libflags, cmSystemTools::UpperCase(config), linkLanguage, + this->GeneratorTarget); if (!libflags.empty()) { Elem e2(e1, "Lib"); cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; @@ -3777,31 +3792,29 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); - if (this->Managed) { - // If the dependency target is not managed (compiled with /clr or - // C# target) we cannot reference it and have to set - // 'ReferenceOutputAssembly' to false. - auto referenceNotManaged = - dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed; - // Workaround to check for manually set /clr flags. - if (referenceNotManaged) { - if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) { - std::string flagsStr = flags; - if (flagsStr.find("clr") != std::string::npos) { - // There is a warning already issued when building the flags. - referenceNotManaged = false; - } + + // If the dependency target is not managed (compiled with /clr or + // C# target) we cannot reference it and have to set + // 'ReferenceOutputAssembly' to false. + auto referenceNotManaged = + dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed; + // Workaround to check for manually set /clr flags. + if (referenceNotManaged) { + if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) { + std::string flagsStr = flags; + if (flagsStr.find("clr") != std::string::npos) { + // There is a warning already issued when building the flags. + referenceNotManaged = false; } } - // Workaround for static library C# targets - if (referenceNotManaged && - dt->GetType() == cmStateEnums::STATIC_LIBRARY) { - referenceNotManaged = !dt->HasLanguage("CSharp", ""); - } - if (referenceNotManaged) { - e2.Element("ReferenceOutputAssembly", "false"); - e2.Element("CopyToOutputDirectory", "Never"); - } + } + // Workaround for static library C# targets + if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) { + referenceNotManaged = !dt->HasLanguage("CSharp", ""); + } + if (referenceNotManaged) { + e2.Element("ReferenceOutputAssembly", "false"); + e2.Element("CopyToOutputDirectory", "Never"); } } } |