# Strange errors while build examples with CXX\_MODULEs on main branch

**URL:** https://discourse.cmake.org/t/strange-errors-while-build-examples-with-cxx-modules-on-main-branch/14181
**Category:** Development
**Tags:** os:macos, gen:ninja
**Created:** [May 30, 2025, 1:14pm UTC](https://discourse.cmake.org/t/strange-errors-while-build-examples-with-cxx-modules-on-main-branch/14181 "2025-05-30T13:14:13Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 1, 2025, 5:13am UTC](https://discourse.cmake.org/t/strange-errors-while-build-examples-with-cxx-modules-on-main-branch/14181/5 "2025-06-01T05:13:14Z")

</div>

## somethings goes wrong on master within Ninja Generator!

snipped of `git diff v4.0.2 Source/cmNinjaTargetGenerator.cxx`:

```diff
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8d936525b0..ac87c0d32b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -490,38 +478,20 @@ std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
   std::string const ppName =
     cmStrCat(objName.substr(0, objName.size() - objExt.size()), "-pp.", ppExt);
 
- std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty()) {
- path += '/';
- }
- path +=
- cmStrCat(this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
- this->GetGlobalGenerator()->ConfigDirectory(config), '/', ppName);
- return path;
+ return cmStrCat(this->GetObjectFileDir(config), '/', ppName);
 }
 
 std::string cmNinjaTargetGenerator::GetDyndepFilePath(
   std::string const& lang, std::string const& config) const
 {
- std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty()) {
- path += '/';
- }
- path += cmStrCat(
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
- this->GetGlobalGenerator()->ConfigDirectory(config), '/', lang, ".dd");
- return path;
+ return cmStrCat(this->GetObjectFileDir(config), '/', lang, ".dd");
 }
 
 std::string cmNinjaTargetGenerator::GetTargetDependInfoPath(
   std::string const& lang, std::string const& config) const
 {
- std::string path =
- cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/',
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
- this->GetGlobalGenerator()->ConfigDirectory(config), '/', lang,
- "DependInfo.json");
- return path;
+ return cmStrCat(this->GetObjectFileDir(config), '/', lang,
+ "DependInfo.json");
 }
 
 std::string cmNinjaTargetGenerator::GetTargetOutputDir(
``
```

---

_[View the full topic](https://discourse.cmake.org/t/strange-errors-while-build-examples-with-cxx-modules-on-main-branch/14181)._
