Commit f88ad0ce authored by Daniel Teske's avatar Daniel Teske

CMake: Fine tune finding a suitable targets for files

Ignore targets that have no include directories, those are in general
not targets that are very useful.

Change-Id: I1cd1f7dffc73eace2f7a0897bc15dea7e6bc5fee
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 8455efa2
......@@ -874,6 +874,8 @@ void CMakeCbpParser::sortFiles()
int bestIncludeCount = -1;
for (int i = 0; i < m_buildTargets.size(); ++i) {
const CMakeBuildTarget &target = m_buildTargets.at(i);
if (target.includeFiles.isEmpty())
continue;
if (target.sourceDirectory == m_sourceDirectory
&& target.includeFiles.count() > bestIncludeCount) {
bestIncludeCount = target.includeFiles.count();
......@@ -893,6 +895,8 @@ void CMakeCbpParser::sortFiles()
for (int i = 0; i < m_buildTargets.size(); ++i) {
const CMakeBuildTarget &target = m_buildTargets.at(i);
if (target.includeFiles.isEmpty())
continue;
if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory)) &&
(target.sourceDirectory.size() > bestLength ||
(target.sourceDirectory.size() == bestLength &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment