mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
cmSourceFile: add accessors for PCH source files
`cmLocalGenerator::GetObjectFileNameWithoutTarget` used a heuristic to detect PCH sources. Use the new special source types to detect them reliably instead.
This commit is contained in:
@@ -4258,7 +4258,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
|
|||||||
objectName = cmSystemTools::GetFilenameName(source.GetFullPath());
|
objectName = cmSystemTools::GetFilenameName(source.GetFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool const isPchObject = objectName.find("cmake_pch") != std::string::npos;
|
bool const isPchObject = source.IsPchHeader() || source.IsPchSource();
|
||||||
|
|
||||||
// Short object path policy selected, use as little info as necessary to
|
// Short object path policy selected, use as little info as necessary to
|
||||||
// select an object name
|
// select an object name
|
||||||
|
@@ -34,6 +34,16 @@ void cmSourceFile::SetSpecialSourceType(cmSourceFile::SpecialSourceType type)
|
|||||||
this->SpecialSource = type;
|
this->SpecialSource = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmSourceFile::IsPchHeader() const
|
||||||
|
{
|
||||||
|
return this->SpecialSource == SpecialSourceType::PchHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cmSourceFile::IsPchSource() const
|
||||||
|
{
|
||||||
|
return this->SpecialSource == SpecialSourceType::PchSource;
|
||||||
|
}
|
||||||
|
|
||||||
std::string const& cmSourceFile::GetExtension() const
|
std::string const& cmSourceFile::GetExtension() const
|
||||||
{
|
{
|
||||||
return this->Extension;
|
return this->Extension;
|
||||||
|
@@ -67,6 +67,8 @@ public:
|
|||||||
QtAutogenSource,
|
QtAutogenSource,
|
||||||
};
|
};
|
||||||
void SetSpecialSourceType(SpecialSourceType type);
|
void SetSpecialSourceType(SpecialSourceType type);
|
||||||
|
bool IsPchHeader() const;
|
||||||
|
bool IsPchSource() const;
|
||||||
|
|
||||||
//! Set/Get a property of this source file
|
//! Set/Get a property of this source file
|
||||||
void SetProperty(std::string const& prop, cmValue value);
|
void SetProperty(std::string const& prop, cmValue value);
|
||||||
|
Reference in New Issue
Block a user