diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 3 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 84 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 31 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 9 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 111 | ||||
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 2 |
14 files changed, 209 insertions, 74 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cc412d0..daa96bc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180411) +set(CMake_VERSION_PATCH 20180413) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index bbbc998..72489bf 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -224,13 +224,14 @@ void cmExportBuildFileGenerator::SetImportLocationProperty( } // Add the import library for windows DLLs. - if (target->HasImportLibrary() && + if (target->HasImportLibrary(config) && mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { std::string prop = "IMPORTED_IMPLIB"; prop += suffix; std::string value = target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact); - target->GetImplibGNUtoMS(value, value, "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); + target->GetImplibGNUtoMS(config, value, value, + "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); properties[prop] = value; } } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 2dcbfa0..8894d44 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -777,6 +777,20 @@ void cmExportFileGenerator::SetImportDetailProperties( properties[prop] = m.str(); } } + + // Add information if this target is a managed target + if (target->GetManagedType(config) != + cmGeneratorTarget::ManagedType::Native) { + std::string prop = "IMPORTED_COMMON_LANGUAGE_RUNTIME"; + prop += suffix; + std::string propval; + if (auto* p = target->GetProperty("COMMON_LANGUAGE_RUNTIME")) { + propval = p; + } + // TODO: make sure propval is set to non-empty string for + // CSharp targets (i.e. force ManagedType::Managed). + properties[prop] = propval; + } } template <typename T> diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 09b7faf..89ed4f0 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1675,7 +1675,8 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> "executables with ENABLE_EXPORTS."); return std::string(); } - cmStateEnums::ArtifactType artifact = target->HasImportLibrary() + cmStateEnums::ArtifactType artifact = + target->HasImportLibrary(context->Config) ? cmStateEnums::ImportLibraryArtifact : cmStateEnums::RuntimeBinaryArtifact; return target->GetFullPath(context->Config, artifact); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 63bfbc6..0cb299c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4978,6 +4978,16 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, } } + // Get information if target is managed assembly. + { + std::string linkProp = "IMPORTED_COMMON_LANGUAGE_RUNTIME"; + if (auto pc = this->GetProperty(linkProp + suffix)) { + info.Managed = this->CheckManagedType(pc); + } else if (auto p = this->GetProperty(linkProp)) { + info.Managed = this->CheckManagedType(p); + } + } + // Get the cyclic repetition count. if (this->GetType() == cmStateEnums::STATIC_LIBRARY) { std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; @@ -5195,6 +5205,18 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, } } +bool cmGeneratorTarget::HasLanguage(std::string const& language, + std::string const& config, + bool exclusive) const +{ + std::set<std::string> languages; + this->GetLanguages(languages, config); + // add linker language (if it is different from compiler languages) + languages.insert(this->GetLinkerLanguage(config)); + return (languages.size() == 1 || !exclusive) && + languages.count(language) > 0; +} + void cmGeneratorTarget::ComputeLinkImplementationLanguages( const std::string& config, cmOptionalLinkImplementation& impl) const { @@ -5381,16 +5403,17 @@ std::string cmGeneratorTarget::GetPDBDirectory(const std::string& config) const return ""; } -bool cmGeneratorTarget::HasImplibGNUtoMS() const +bool cmGeneratorTarget::HasImplibGNUtoMS(std::string const& config) const { - return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS"); + return this->HasImportLibrary(config) && this->GetPropertyAsBool("GNUtoMS"); } -bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName, +bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& config, + std::string const& gnuName, std::string& out, const char* newExt) const { - if (this->HasImplibGNUtoMS() && gnuName.size() > 6 && + if (this->HasImplibGNUtoMS(config) && gnuName.size() > 6 && gnuName.substr(gnuName.size() - 6) == ".dll.a") { out = gnuName.substr(0, gnuName.size() - 6); out += newExt ? newExt : ".lib"; @@ -5405,11 +5428,14 @@ bool cmGeneratorTarget::IsExecutableWithExports() const this->GetPropertyAsBool("ENABLE_EXPORTS")); } -bool cmGeneratorTarget::HasImportLibrary() const +bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const { return (this->IsDLLPlatform() && (this->GetType() == cmStateEnums::SHARED_LIBRARY || - this->IsExecutableWithExports())); + this->IsExecutableWithExports()) && + // Assemblies which have only managed code do not have + // import libraries. + this->GetManagedType(config) != ManagedType::Managed); } std::string cmGeneratorTarget::GetSupportDirectory() const @@ -5462,3 +5488,49 @@ bool cmGeneratorTarget::IsCFBundleOnApple() const return (this->GetType() == cmStateEnums::MODULE_LIBRARY && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE")); } + +cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType( + std::string const& propval) const +{ + // The type of the managed assembly (mixed unmanaged C++ and C++/CLI, + // or only C++/CLI) does only depend on whether the property is an empty + // string or contains any value at all. In Visual Studio generators + // this propval is prepended with /clr[:] which results in: + // + // 1. propval does not exist: no /clr flag, unmanaged target, has import + // lib + // 2. empty propval: add /clr as flag, mixed unmanaged/managed + // target, has import lib + // 3. any value (safe,pure): add /clr:[propval] as flag, target with + // managed code only, no import lib + return propval.empty() ? ManagedType::Mixed : ManagedType::Managed; +} + +cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType( + const std::string& config) const +{ + // Only libraries and executables can be managed targets. + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { + return ManagedType::Undefined; + } + + // Check imported target. + if (this->IsImported()) { + if (cmGeneratorTarget::ImportInfo const* info = + this->GetImportInfo(config)) { + return info->Managed; + } + return ManagedType::Undefined; + } + + // Check for explicitly set clr target property. + if (auto* clr = this->GetProperty("COMMON_LANGUAGE_RUNTIME")) { + return this->CheckManagedType(clr); + } + + // TODO: need to check if target is a CSharp target here. + // If yes: return ManagedType::Managed. + return ManagedType::Native; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2f6ce33..d4a553a 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -364,6 +364,12 @@ public: void GetLanguages(std::set<std::string>& languages, std::string const& config) const; + // Evaluate if the target uses the given language for compilation + // and/or linking. If 'exclusive' is true, 'language' is expected + // to be the only language used for the target. + bool HasLanguage(std::string const& language, std::string const& config, + bool exclusive = true) const; + void GetObjectLibrariesCMP0026( std::vector<cmGeneratorTarget*>& objlibs) const; @@ -566,17 +572,17 @@ public: std::string GetLinkerLanguage(const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ - bool HasImplibGNUtoMS() const; + bool HasImplibGNUtoMS(std::string const& config) const; /** Convert the given GNU import library name (.dll.a) to a name with a new extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */ - bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, - const char* newExt = nullptr) const; + bool GetImplibGNUtoMS(std::string const& config, std::string const& gnuName, + std::string& out, const char* newExt = nullptr) const; bool IsExecutableWithExports() const; /** Return whether or not the target has a DLL import library. */ - bool HasImportLibrary() const; + bool HasImportLibrary(std::string const& config) const; /** Get a build-tree directory in which to place target support files. */ std::string GetSupportDirectory() const; @@ -597,6 +603,19 @@ public: /** Return whether this target is a CFBundle (plugin) on Apple. */ bool IsCFBundleOnApple() const; + /** Assembly types. The order of the values of this enum is relevant + because of smaller/larger comparison operations! */ + enum ManagedType + { + Undefined = 0, // target is no lib or executable + Native, // target compiles to unmanaged binary. + Mixed, // target compiles to mixed (managed and unmanaged) binary. + Managed // target compiles to managed binary. + }; + + /** Return the type of assembly this target compiles to. */ + ManagedType GetManagedType(const std::string& config) const; + struct SourceFileFlags GetTargetSourceFileFlags( const cmSourceFile* sf) const; @@ -741,10 +760,12 @@ private: { ImportInfo() : NoSOName(false) + , Managed(Native) , Multiplicity(0) { } bool NoSOName; + ManagedType Managed; unsigned int Multiplicity; std::string Location; std::string SOName; @@ -838,6 +859,8 @@ private: bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; + ManagedType CheckManagedType(std::string const& propval) const; + public: const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure( const std::string& config) const; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index a9b4908..e0afa2d 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -135,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); std::string targetNameImportLib; - if (this->Target->GetImplibGNUtoMS(targetNameImport, + if (this->Target->GetImplibGNUtoMS(config, targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); filesTo.push_back(toDir + targetNameImportLib); @@ -201,7 +201,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); std::string targetNameImportLib; - if (this->Target->GetImplibGNUtoMS(targetNameImport, + if (this->Target->GetImplibGNUtoMS(config, targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); filesTo.push_back(toDir + targetNameImportLib); @@ -398,7 +398,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename( targetNamePDB, config); if (nameType == NameImplib) { // Use the import library name. - if (!target->GetImplibGNUtoMS(targetNameImport, fname, + if (!target->GetImplibGNUtoMS(config, targetNameImport, fname, "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { fname = targetNameImport; } @@ -419,7 +419,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename( targetNameImport, targetNamePDB, config); if (nameType == NameImplib) { // Use the import library name. - if (!target->GetImplibGNUtoMS(targetNameImport, fname, + if (!target->GetImplibGNUtoMS(config, targetNameImport, fname, "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { fname = targetNameImport; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87cfc3b..9aeeb5c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3839,7 +3839,16 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef) std::ostringstream m; m << "Cannot set \"" << var << "\": current scope has no parent."; this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + return; } + +#ifdef CMAKE_BUILD_WITH_CMAKE + cmVariableWatch* vv = this->GetVariableWatch(); + if (vv) { + vv->VariableAccessed(var, cmVariableWatch::VARIABLE_MODIFIED_ACCESS, + varDef, this); + } +#endif } cmTarget* cmMakefile::AddImportedTarget(const std::string& name, diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 9bbc043..1e59f44 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -477,8 +477,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport)); std::string implib; - if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, - implib)) { + if (this->GeneratorTarget->GetImplibGNUtoMS( + this->ConfigName, targetFullPathImport, implib)) { exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 9299ffe..27fae04 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -641,8 +641,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport)); std::string implib; - if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, - implib)) { + if (this->GeneratorTarget->GetImplibGNUtoMS( + this->ConfigName, targetFullPathImport, implib)) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index abe5ff3..3998823 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1402,7 +1402,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule( const std::string& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); - if (this->GeneratorTarget->HasImplibGNUtoMS()) { + if (this->GeneratorTarget->HasImplibGNUtoMS(this->ConfigName)) { std::string ruleVar = "CMAKE_"; ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); ruleVar += "_GNUtoMS_RULE"; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 52e3677..542bb0a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -482,7 +482,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() const char* linkCmd = mf->GetDefinition(linkCmdVar); if (linkCmd) { std::string linkCmdStr = linkCmd; - if (this->GetGeneratorTarget()->HasImplibGNUtoMS()) { + if (this->GetGeneratorTarget()->HasImplibGNUtoMS(this->ConfigName)) { std::string ruleVar = "CMAKE_"; ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); ruleVar += "_GNUtoMS_RULE"; @@ -881,7 +881,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() targetOutputImplib, cmOutputConverter::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); - if (genTarget.HasImportLibrary()) { + if (genTarget.HasImportLibrary(cfgName)) { byproducts.push_back(targetOutputImplib); } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7c1d948..13af167 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -139,8 +139,11 @@ inline void cmVisualStudio10TargetGenerator::WriteElemEscapeXML( this->WriteElem(tag, cmVS10EscapeXML(val), indentLevel); } -static std::string cmVS10EscapeQuotes(std::string arg) +static std::string cmVS10EscapeAttr(std::string arg) { + cmSystemTools::ReplaceString(arg, "&", "&"); + cmSystemTools::ReplaceString(arg, "<", "<"); + cmSystemTools::ReplaceString(arg, ">", ">"); cmSystemTools::ReplaceString(arg, "\"", """); return arg; } @@ -555,7 +558,8 @@ void cmVisualStudio10TargetGenerator::Generate() "BuildCustomizations\\CUDA ", 2); (*this->BuildFileStream) - << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString()) + << cmVS10EscapeAttr( + this->GlobalGenerator->GetPlatformToolsetCudaString()) << ".props\" />\n"; } if (this->GlobalGenerator->IsMasmEnabled()) { @@ -575,7 +579,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(), false, true, true); std::string import = std::string("<Import Project=\"") + - cmVS10EscapeXML(propsLocal) + "\" />\n"; + cmVS10EscapeAttr(propsLocal) + "\" />\n"; this->WriteString(import.c_str(), 2); } this->WriteString("</ImportGroup>\n", 1); @@ -597,8 +601,8 @@ void cmVisualStudio10TargetGenerator::Generate() ConvertToWindowsSlash(props); this->WriteString("", 2); (*this->BuildFileStream) - << "<Import Project=\"" << cmVS10EscapeXML(props) << "\"" - << " Condition=\"exists('" << cmVS10EscapeXML(props) << "')\"" + << "<Import Project=\"" << cmVS10EscapeAttr(props) << "\"" + << " Condition=\"exists('" << cmVS10EscapeAttr(props) << "')\"" << " Label=\"LocalAppDataPlatform\" />\n"; } } @@ -633,7 +637,8 @@ void cmVisualStudio10TargetGenerator::Generate() "BuildCustomizations\\CUDA ", 2); (*this->BuildFileStream) - << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString()) + << cmVS10EscapeAttr( + this->GlobalGenerator->GetPlatformToolsetCudaString()) << ".targets\" />\n"; } if (this->GlobalGenerator->IsMasmEnabled()) { @@ -645,7 +650,7 @@ void cmVisualStudio10TargetGenerator::Generate() std::string nasmTargets = GetCMakeFilePath("Templates/MSBuild/nasm.targets"); std::string import = "<Import Project=\""; - import += cmVS10EscapeXML(nasmTargets) + "\" />\n"; + import += cmVS10EscapeAttr(nasmTargets) + "\" />\n"; this->WriteString(import.c_str(), 2); } this->WriteString("</ImportGroup>\n", 1); @@ -722,7 +727,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( std::string const& ref, std::string const& hint) { this->WriteString("<Reference Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(ref) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(ref) << "\">\n"; this->WriteElem("CopyLocalSatelliteAssemblies", "true", 3); this->WriteElem("ReferenceOutputAssembly", "true", 3); if (!hint.empty()) { @@ -969,7 +974,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences() this->WriteString("<ItemGroup>\n", 1); for (std::string const& ri : references) { this->WriteString("<Reference Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(ri) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(ri) << "\">\n"; this->WriteElem("IsWinMDFile", "true", 3); this->WriteString("</Reference>\n", 2); } @@ -1263,15 +1268,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( cmCustomCommandGenerator ccg(command, c, lg); std::string comment = lg->ConstructComment(ccg); comment = cmVS10EscapeComment(comment); - std::string script = cmVS10EscapeXML(lg->ConstructScript(ccg)); + std::string script = lg->ConstructScript(ccg); // input files for custom command std::stringstream inputs; - inputs << cmVS10EscapeXML(source->GetFullPath()); + inputs << source->GetFullPath(); for (std::string const& d : ccg.GetDepends()) { std::string dep; if (lg->GetRealDependency(d, c, dep)) { ConvertToWindowsSlash(dep); - inputs << ";" << cmVS10EscapeXML(dep); + inputs << ";" << dep; } } // output files for custom command @@ -1280,19 +1285,13 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( for (std::string const& o : ccg.GetOutputs()) { std::string out = o; ConvertToWindowsSlash(out); - outputs << sep << cmVS10EscapeXML(out); + outputs << sep << out; sep = ";"; } if (this->ProjectType == csproj) { std::string name = "CustomCommand_" + c + "_" + cmSystemTools::ComputeStringMD5(sourcePath); - std::string inputs_s = inputs.str(); - std::string outputs_s = outputs.str(); - comment = cmVS10EscapeQuotes(comment); - script = cmVS10EscapeQuotes(script); - inputs_s = cmVS10EscapeQuotes(inputs_s); - outputs_s = cmVS10EscapeQuotes(outputs_s); - this->WriteCustomRuleCSharp(c, name, script, inputs_s, outputs_s, + this->WriteCustomRuleCSharp(c, name, script, inputs.str(), outputs.str(), comment); } else { this->WriteCustomRuleCpp(c, script, inputs.str(), outputs.str(), @@ -1312,17 +1311,19 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp( this->WritePlatformConfigTag("Message", config, 3); (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n"; this->WritePlatformConfigTag("Command", config, 3); - (*this->BuildFileStream) << script << "</Command>\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(script) << "</Command>\n"; this->WritePlatformConfigTag("AdditionalInputs", config, 3); - (*this->BuildFileStream) << inputs; - (*this->BuildFileStream) << ";%(AdditionalInputs)</AdditionalInputs>\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(inputs); + (*this->BuildFileStream) << ";%(AdditionalInputs)" + "</AdditionalInputs>\n"; this->WritePlatformConfigTag("Outputs", config, 3); - (*this->BuildFileStream) << outputs << "</Outputs>\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(outputs) << "</Outputs>\n"; if (this->LocalGenerator->GetVersion() > cmGlobalVisualStudioGenerator::VS10) { // VS >= 11 let us turn off linking of custom command outputs. this->WritePlatformConfigTag("LinkObjects", config, 3); - (*this->BuildFileStream) << "false</LinkObjects>\n"; + (*this->BuildFileStream) << "false" + "</LinkObjects>\n"; } } @@ -1334,16 +1335,16 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp( this->CSharpCustomCommandNames.insert(name); std::stringstream attributes; attributes << "\n Name=\"" << name << "\""; - attributes << "\n Inputs=\"" << inputs << "\""; - attributes << "\n Outputs=\"" << outputs << "\""; + attributes << "\n Inputs=\"" << cmVS10EscapeAttr(inputs) << "\""; + attributes << "\n Outputs=\"" << cmVS10EscapeAttr(outputs) << "\""; this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str()); if (!comment.empty()) { this->WriteString("<Exec Command=\"", 2); - (*this->BuildFileStream) << "echo " << cmVS10EscapeXML(comment) + (*this->BuildFileStream) << "echo " << cmVS10EscapeAttr(comment) << "\" />\n"; } this->WriteString("<Exec Command=\"", 2); - (*this->BuildFileStream) << script << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(script) << "\" />\n"; this->WriteString("</Target>\n", 1); } @@ -1456,7 +1457,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string obj = oi->GetFullPath(); ConvertToWindowsSlash(obj); Elem e2(e1, "EmbeddedResource"); - e2.Attr("Include", cmVS10EscapeXML(obj)); + e2.Attr("Include", cmVS10EscapeAttr(obj)); Elem(e2).WriteElem("Filter", "Resource Files"); e2.EndElement(); } @@ -1554,7 +1555,7 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources( std::string path = this->ConvertPath(source, s.RelativePath); ConvertToWindowsSlash(path); Elem e2(e1, name.c_str()); - e2.Attr("Include", cmVS10EscapeXML(path)); + e2.Attr("Include", cmVS10EscapeAttr(path)); if (!filter.empty()) { Elem(e2).WriteElem("Filter", filter); } @@ -1872,7 +1873,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool, ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); (*this->BuildFileStream) << tool << " Include=\"" - << cmVS10EscapeXML(sourceFile) << "\""; + << cmVS10EscapeAttr(sourceFile) << "\""; ToolSource toolSource = { sf, forceRelative }; this->Tools[tool].push_back(toolSource); @@ -2185,8 +2186,8 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( this->WriteString("", 3); (*this->BuildFileStream) << "<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='" - << cmVS10EscapeXML(this->Configurations[ci]) << "|" - << cmVS10EscapeXML(this->Platform) << "'\">true</ExcludedFromBuild>\n"; + << cmVS10EscapeAttr(this->Configurations[ci]) << "|" + << cmVS10EscapeAttr(this->Platform) << "'\">true</ExcludedFromBuild>\n"; } } @@ -2417,6 +2418,22 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.AddFlag("AssemblerListingLocation", asmLocation); } } + + // check for managed C++ assembly compiler flag. This overrides any + // /clr* compiler flags which may be defined in the flags variable(s). + if (this->ProjectType != csproj) { + // TODO: add check here, if /clr was defined manually and issue + // warning that this is discouraged. + if (auto* clr = + this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) { + std::string clrString = clr; + if (!clrString.empty()) { + clrString = ":" + clrString; + } + flags += " /clr" + clrString; + } + } + clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector<std::string> targetDefines; @@ -3624,7 +3641,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() path += computeProjectFileExtension(dt, *this->Configurations.begin()); } ConvertToWindowsSlash(path); - (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(path) << "\">\n"; this->WriteElem("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}", 3); this->WriteElem("Name", name, 3); @@ -3692,7 +3709,7 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() hasWrittenItemGroup = true; for (std::string const& ri : sdkReferences) { this->WriteString("<SDKReference Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(ri) << "\"/>\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(ri) << "\"/>\n"; } } @@ -4034,7 +4051,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() std::string sourceFile = this->ConvertPath(manifestFile, false); ConvertToWindowsSlash(sourceFile); this->WriteString("<Xml Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n"; this->WriteElem("SubType", "Designer", 3); this->WriteString("</Xml>\n", 2); this->AddedFiles.push_back(sourceFile); @@ -4044,14 +4061,14 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() false); ConvertToWindowsSlash(smallLogo); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n"; this->AddedFiles.push_back(smallLogo); std::string logo = this->DefaultArtifactDir + "/Logo.png"; cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); ConvertToWindowsSlash(logo); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n"; this->AddedFiles.push_back(logo); std::string applicationIcon = @@ -4060,7 +4077,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() applicationIcon, false); ConvertToWindowsSlash(applicationIcon); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(applicationIcon) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(applicationIcon) << "\" />\n"; this->AddedFiles.push_back(applicationIcon); } @@ -4312,7 +4329,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( std::string sourceFile = this->ConvertPath(manifestFile, false); ConvertToWindowsSlash(sourceFile); this->WriteString("<AppxManifest Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n"; this->WriteElem("SubType", "Designer", 3); this->WriteString("</AppxManifest>\n", 2); this->AddedFiles.push_back(sourceFile); @@ -4322,7 +4339,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( false); ConvertToWindowsSlash(smallLogo); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n"; this->AddedFiles.push_back(smallLogo); std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png"; @@ -4330,14 +4347,14 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( false); ConvertToWindowsSlash(smallLogo44); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo44) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo44) << "\" />\n"; this->AddedFiles.push_back(smallLogo44); std::string logo = this->DefaultArtifactDir + "/Logo.png"; cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); ConvertToWindowsSlash(logo); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n"; this->AddedFiles.push_back(logo); std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png"; @@ -4345,7 +4362,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( false); ConvertToWindowsSlash(storeLogo); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(storeLogo) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(storeLogo) << "\" />\n"; this->AddedFiles.push_back(storeLogo); std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png"; @@ -4353,14 +4370,14 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( false); ConvertToWindowsSlash(splashScreen); this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(splashScreen) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(splashScreen) << "\" />\n"; this->AddedFiles.push_back(splashScreen); // This file has already been added to the build so don't copy it std::string keyFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; ConvertToWindowsSlash(keyFile); this->WriteString("<None Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(keyFile) << "\" />\n"; + (*this->BuildFileStream) << cmVS10EscapeAttr(keyFile) << "\" />\n"; } bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 2b9d7b1..7426816 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -94,7 +94,6 @@ typedef int siginfo_t; #endif #ifdef __APPLE__ -#include <fenv.h> #include <mach/host_info.h> #include <mach/mach.h> #include <mach/mach_types.h> @@ -114,7 +113,6 @@ typedef int siginfo_t; #endif #if defined(__linux) || defined(__sun) || defined(_SCO_DS) -#include <fenv.h> #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> |