summaryrefslogtreecommitdiff
path: root/Source/cmFindPathCommand.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-02-28 18:17:50 +1100
committerCraig Scott <craig.scott@crascit.com>2022-03-01 09:28:22 +1100
commit3354d52e3d875e897e9bc8222c7d19ac484f23e8 (patch)
tree178d43cca803c2e9261445f8b583c2954496bea9 /Source/cmFindPathCommand.cxx
parent07a7772968a17e804fc7c450a0a3a00a7203410d (diff)
downloadcmake-3354d52e3d875e897e9bc8222c7d19ac484f23e8.tar.gz
find_file: Fix blank line instead of framework path in debug output
There's no point printing a blank line if FindHeaderInFramework() returns an empty string. Pass in the debug object to that function instead so it can record the actual paths it tests in the debug output directly.
Diffstat (limited to 'Source/cmFindPathCommand.cxx')
-rw-r--r--Source/cmFindPathCommand.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index a0a857033c..27074ff31b 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -65,7 +65,8 @@ std::string cmFindPathCommand::FindHeader()
}
std::string cmFindPathCommand::FindHeaderInFramework(
- std::string const& file, std::string const& dir) const
+ std::string const& file, std::string const& dir,
+ cmFindBaseDebugState& debug) const
{
std::string fileName = file;
std::string frameWorkName;
@@ -88,11 +89,13 @@ std::string cmFindPathCommand::FindHeaderInFramework(
std::string fpath = cmStrCat(dir, frameWorkName, ".framework");
std::string intPath = cmStrCat(fpath, "/Headers/", fileName);
if (cmSystemTools::FileExists(intPath)) {
+ debug.FoundAt(intPath);
if (this->IncludeFileInPath) {
return intPath;
}
return fpath;
}
+ debug.FailedAt(intPath);
}
}
// if it is not found yet or not a framework header, then do a glob search
@@ -103,12 +106,15 @@ std::string cmFindPathCommand::FindHeaderInFramework(
std::vector<std::string> files = globIt.GetFiles();
if (!files.empty()) {
std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
+ debug.FoundAt(fheader);
if (this->IncludeFileInPath) {
return fheader;
}
fheader.resize(fheader.size() - file.size());
return fheader;
}
+
+ // No frameworks matched the glob, so nothing more to add to debug.FailedAt()
return "";
}
@@ -135,8 +141,7 @@ std::string cmFindPathCommand::FindFrameworkHeader(cmFindBaseDebugState& debug)
{
for (std::string const& n : this->Names) {
for (std::string const& sp : this->SearchPaths) {
- std::string fwPath = this->FindHeaderInFramework(n, sp);
- fwPath.empty() ? debug.FailedAt(fwPath) : debug.FoundAt(fwPath);
+ std::string fwPath = this->FindHeaderInFramework(n, sp, debug);
if (!fwPath.empty()) {
return fwPath;
}