diff options
author | Miguel Costa <miguel.costa@qt.io> | 2020-01-31 15:02:00 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2020-03-09 11:42:32 +0000 |
commit | d4b2f77ae1f9b542c756d51f31a5ddc3fb6e3668 (patch) | |
tree | cfa330b1a09275219ae7c198980032a321cd82c1 /src/qtprojectlib/MsBuildProject.cs | |
parent | 22c67fa2253e386ea25a61aa018629040d6bf1f5 (diff) |
Add private module refs in .pro import
When importing qmake projects, if a *-private module name is specified,
this will now be reflected in the value of the "Qt Modules" property of
the resulting MSVC project. Previously, private module refs were ignored
when importing .pro files; only the "public" modules were considered.
Task-number: QTVSADDINBUG-704
Change-Id: I5a859c02852c18baa67344fdbc390089371f25e4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/qtprojectlib/MsBuildProject.cs')
-rw-r--r-- | src/qtprojectlib/MsBuildProject.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qtprojectlib/MsBuildProject.cs b/src/qtprojectlib/MsBuildProject.cs index 70aafd16..e8aa4b95 100644 --- a/src/qtprojectlib/MsBuildProject.cs +++ b/src/qtprojectlib/MsBuildProject.cs @@ -589,6 +589,12 @@ namespace QtProjectLib module.AdditionalLibrariesDebug.Select(x => Path.GetFileName(x))); moduleLibs.Add(module.LibRelease); moduleLibs.Add(module.LibDebug); + + if (IsPrivateIncludePathUsed(module, compiler)) { + // Qt private module names, to copy to QtModules property + moduleNames.UnionWith(module.proVarQT.Split(' ') + .Select(x => string.Format("{0}-private", x))); + } } } @@ -752,6 +758,24 @@ namespace QtProjectLib return false; } + bool IsPrivateIncludePathUsed( + QtModuleInfo module, + IEnumerable<XElement> compiler) + { + // Module private header path is present in compiler include dirs + var privateIncludePattern = new Regex(string.Format( + @"^\$\(QTDIR\)[\\\/]include[\\\/]{0}[\\\/]\d+\.\d+\.\d+", + module.LibraryPrefix)); + if (compiler.Elements(ns + "AdditionalIncludeDirectories") + .SelectMany(x => x.Value.Split(';')) + .Any(x => privateIncludePattern.IsMatch(x))) { + return true; + } + + // Private header path is not present + return false; + } + public bool SetDefaultWindowsSDKVersion(string winSDKVersion) { var xGlobals = this[Files.Project].xml |