mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
cmNinjaTargetGenerator: ensure that the object output directory exists
If a target has no object compilations within it, nothing ensures that the directory exists yet it is still mentioned as an order-only dependency within the build files. While `ninja` is OK with this, `samu`, an alternate `ninja` implementation, is not. Make sure the directory always exists for consistency. Fixes: #25526
This commit is contained in:
@@ -1023,6 +1023,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Ensure that the object directory exists. If there are no objects in the
|
||||
// target (e.g., an empty `OBJECT` library), the directory is still listed
|
||||
// as an order-only depends in the build files. Alternate `ninja`
|
||||
// implementations may not allow this (such as `samu`). See #25526.
|
||||
auto const objectDir = this->GetObjectFileDir(config);
|
||||
this->EnsureDirectoryExists(objectDir);
|
||||
}
|
||||
|
||||
{
|
||||
cmNinjaBuild build("phony");
|
||||
build.Comment =
|
||||
|
||||
Reference in New Issue
Block a user