Skip to content

Commit

Permalink
fix setting msvc compiler in profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
czoido committed Aug 8, 2024
1 parent d081863 commit c275684
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ConanProfilesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ private string getConanArch(string platform)
return archMap[platform];
}

private string getConanCompilerVersion(string platformToolset)
private string getConanCompilerVersion(string platformToolset, string vsVersion)
{
if (Version.TryParse(vsVersion, out Version parsedVersion))
{
// https://github.com/conan-io/conan/issues/16239
if (parsedVersion.Major == 17 && parsedVersion.Minor >= 10)
{
return "194";
}
}

var msvcVersionMap = new Dictionary<string, string>();
msvcVersionMap["v143"] = "193";
msvcVersionMap["v142"] = "192";
Expand Down Expand Up @@ -106,7 +115,8 @@ public void GenerateProfilesForProject(Project project)
string profilePath = System.IO.Path.Combine(conanProjectDirectory, profileName);

string toolset = vcConfig.Evaluate("$(PlatformToolset)").ToString();
string compilerVersion = getConanCompilerVersion(toolset);
string vsVersion = vcConfig.Evaluate("$(MSBuildVersion)").ToString();
string compilerVersion = getConanCompilerVersion(toolset, vsVersion);
string arch = getConanArch(vcConfig.Evaluate("$(PlatformName)").ToString());
IVCRulePropertyStorage generalRule = vcConfig.Rules.Item("ConfigurationGeneral") as IVCRulePropertyStorage;
string languageStandard = generalRule == null ? null : generalRule.GetEvaluatedPropertyValue("LanguageStandard");
Expand Down

0 comments on commit c275684

Please sign in to comment.