mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 12:49:50 -05:00
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.
This commit is contained in:
@@ -65,7 +65,8 @@ std::string cmFindPathCommand::FindHeader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string cmFindPathCommand::FindHeaderInFramework(
|
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 fileName = file;
|
||||||
std::string frameWorkName;
|
std::string frameWorkName;
|
||||||
@@ -88,11 +89,13 @@ std::string cmFindPathCommand::FindHeaderInFramework(
|
|||||||
std::string fpath = cmStrCat(dir, frameWorkName, ".framework");
|
std::string fpath = cmStrCat(dir, frameWorkName, ".framework");
|
||||||
std::string intPath = cmStrCat(fpath, "/Headers/", fileName);
|
std::string intPath = cmStrCat(fpath, "/Headers/", fileName);
|
||||||
if (cmSystemTools::FileExists(intPath)) {
|
if (cmSystemTools::FileExists(intPath)) {
|
||||||
|
debug.FoundAt(intPath);
|
||||||
if (this->IncludeFileInPath) {
|
if (this->IncludeFileInPath) {
|
||||||
return intPath;
|
return intPath;
|
||||||
}
|
}
|
||||||
return fpath;
|
return fpath;
|
||||||
}
|
}
|
||||||
|
debug.FailedAt(intPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if it is not found yet or not a framework header, then do a glob search
|
// 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();
|
std::vector<std::string> files = globIt.GetFiles();
|
||||||
if (!files.empty()) {
|
if (!files.empty()) {
|
||||||
std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
|
std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
|
||||||
|
debug.FoundAt(fheader);
|
||||||
if (this->IncludeFileInPath) {
|
if (this->IncludeFileInPath) {
|
||||||
return fheader;
|
return fheader;
|
||||||
}
|
}
|
||||||
fheader.resize(fheader.size() - file.size());
|
fheader.resize(fheader.size() - file.size());
|
||||||
return fheader;
|
return fheader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No frameworks matched the glob, so nothing more to add to debug.FailedAt()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +141,7 @@ std::string cmFindPathCommand::FindFrameworkHeader(cmFindBaseDebugState& debug)
|
|||||||
{
|
{
|
||||||
for (std::string const& n : this->Names) {
|
for (std::string const& n : this->Names) {
|
||||||
for (std::string const& sp : this->SearchPaths) {
|
for (std::string const& sp : this->SearchPaths) {
|
||||||
std::string fwPath = this->FindHeaderInFramework(n, sp);
|
std::string fwPath = this->FindHeaderInFramework(n, sp, debug);
|
||||||
fwPath.empty() ? debug.FailedAt(fwPath) : debug.FoundAt(fwPath);
|
|
||||||
if (!fwPath.empty()) {
|
if (!fwPath.empty()) {
|
||||||
return fwPath;
|
return fwPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string FindHeaderInFramework(std::string const& file,
|
std::string FindHeaderInFramework(std::string const& file,
|
||||||
std::string const& dir) const;
|
std::string const& dir,
|
||||||
|
cmFindBaseDebugState& debug) const;
|
||||||
std::string FindHeader();
|
std::string FindHeader();
|
||||||
std::string FindNormalHeader(cmFindBaseDebugState& debug);
|
std::string FindNormalHeader(cmFindBaseDebugState& debug);
|
||||||
std::string FindFrameworkHeader(cmFindBaseDebugState& debug);
|
std::string FindFrameworkHeader(cmFindBaseDebugState& debug);
|
||||||
|
|||||||
Reference in New Issue
Block a user