mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
Autogen: Fix ambiguity in header file detection on Windows
On Windows, `CollapseFullPath` called with a path that ends with a dot might return a file with the same base name but any extension. To make sure we get only the file with the requested header extension, pass the complete file name to `CollapseFullPath`. Fixes: #19892
This commit is contained in:
committed by
Brad King
parent
92780281c2
commit
90d643c312
@@ -1342,10 +1342,9 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader(
|
||||
auto findHeader = [this,
|
||||
&headerHandle](std::string const& basePath) -> bool {
|
||||
bool found = false;
|
||||
std::string const baseCollapsed =
|
||||
this->Gen()->CollapseFullPathTS(cmStrCat(basePath, '.'));
|
||||
for (std::string const& ext : this->BaseConst().HeaderExtensions) {
|
||||
std::string const testPath = cmStrCat(baseCollapsed, ext);
|
||||
std::string const testPath =
|
||||
this->Gen()->CollapseFullPathTS(cmStrCat(basePath, '.', ext));
|
||||
cmFileTime fileTime;
|
||||
if (!fileTime.Load(testPath)) {
|
||||
// File not found
|
||||
@@ -1377,8 +1376,7 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader(
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this->SearchLocations.emplace_back(
|
||||
cmQtAutoGen::ParentDir(baseCollapsed));
|
||||
this->SearchLocations.emplace_back(cmQtAutoGen::ParentDir(basePath));
|
||||
}
|
||||
return found;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user