mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +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());
|
||||
}
|
||||
}
|
||||
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
|
||||
// select an object name
|
||||
|
@@ -34,6 +34,16 @@ void cmSourceFile::SetSpecialSourceType(cmSourceFile::SpecialSourceType 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
|
||||
{
|
||||
return this->Extension;
|
||||
|
@@ -67,6 +67,8 @@ public:
|
||||
QtAutogenSource,
|
||||
};
|
||||
void SetSpecialSourceType(SpecialSourceType type);
|
||||
bool IsPchHeader() const;
|
||||
bool IsPchSource() const;
|
||||
|
||||
//! Set/Get a property of this source file
|
||||
void SetProperty(std::string const& prop, cmValue value);
|
||||
|
Reference in New Issue
Block a user