summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1f7aaaf..016705e 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1024,6 +1024,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 =
cmStrCat("Order-only phony target for ", this->GetTargetName());