mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
Automoc: Fix support of files with the same name (#12873)
This commit is contained in:
committed by
Brad King
parent
8dfb6f8b37
commit
9beb2744d7
@@ -1104,10 +1104,39 @@ void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
|
||||
std::cout << "AUTOGEN: Checking " << headerName << std::endl;
|
||||
}
|
||||
|
||||
const std::string basename = cmsys::SystemTools::
|
||||
GetFilenameWithoutLastExtension(headerName);
|
||||
std::string headerDirectory;
|
||||
if (cmsys::SystemTools::IsSubDirectory(headerName,
|
||||
this->ProjectSourceDir))
|
||||
{
|
||||
headerDirectory = this->ProjectSourceDir;
|
||||
}
|
||||
else if (cmsys::SystemTools::IsSubDirectory(headerName,
|
||||
this->ProjectBinaryDir))
|
||||
{
|
||||
headerDirectory = this->ProjectBinaryDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmsys::SystemTools::SplitPathRootComponent(headerName,
|
||||
&headerDirectory);
|
||||
}
|
||||
|
||||
const std::string currentMoc = "moc_" + basename + ".cpp";
|
||||
std::string baseHeaderName =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName);
|
||||
|
||||
headerDirectory = cmsys::SystemTools::RelativePath(
|
||||
headerDirectory, cmsys::SystemTools::GetParentDirectory(headerName));
|
||||
|
||||
if (!headerDirectory.empty())
|
||||
{
|
||||
headerDirectory += "/";
|
||||
}
|
||||
|
||||
std::string mocName = headerDirectory + baseHeaderName;
|
||||
|
||||
cmSystemTools::ReplaceString(mocName, "/", "_");
|
||||
|
||||
const std::string currentMoc = "moc_" + mocName + ".cpp";
|
||||
std::string macroName;
|
||||
if (requiresMocing(contents, macroName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user