# clang-tidy and CXX\_MODULES: error: module 'fmt' not found?

**URL:** <https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268>\
**Category:** Code\
**Created:** [December 27, 2024, 1:06pm UTC](https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268 "2024-12-27T13:06:53Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [December 27, 2024, 1:06pm UTC](https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268/1 "2024-12-27T13:06:53Z")

</div>

```auto
/usr/local/bin/cmake -E __run_co_compile --tidy="clang-tidy-18;--header-filter=^/home/runner/work/fmt-module/fmt-module/;--extra-arg-before=--driver-mode=g++" --source=/home/runner/work/fmt-module/fmt-module/tests/header-only-test.cc -- /usr/bin/clang++-18 -DFMT_MODULE -I/home/runner/work/fmt-module/fmt-module/build/sanitize/_deps/fmt-src/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Wfloat-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast -O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common -std=gnu++23 -MD -MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -MF tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.d @tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.modmap -o tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -c /home/runner/work/fmt-module/fmt-module/tests/header-only-test.cc
/home/runner/work/fmt-module/fmt-module/tests/header-only-test.cc:6:8: error: module 'fmt' not found [clang-diagnostic-error]

```

My project may be found here: [GitHub - ClausKlein/fmt-module: Modern cmake project to show CXX\_MODULES builds](https://github.com/ClausKlein/fmt-module)

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [December 29, 2024, 8:53pm UTC](https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268/2 "2024-12-29T20:53:31Z")

</div>

Please do not expect forum users to look at your project. Formulate your question in a concise manner, minimise the problem down to a bare minimum demonstrator project, and ask a clear question you want people to help you with. The process of producing the minimal demonstrator usually reveals the problem.

---

<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:** [December 30, 2024, 1:20am UTC](https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268/3 "2024-12-30T01:20:16Z")

</div>

Is it a CMake or a clang-tidy problem?

Without `CXX_CLANG_TIDY` set the project builds fine.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [December 31, 2024, 2:46pm UTC](https://discourse.cmake.org/t/clang-tidy-and-cxx-modules-error-module-fmt-not-found/13268/4 "2024-12-31T14:46:13Z")

</div>

It’s not clear to me where the root problem is, but co-compilation is definitely unmarked waters for CMake so far (while it _may_ work if the tooling shares a module implementation with the compiler, it is not guaranteed). That said, the `.modmap` response file in the command line is of interest. The state of files it references are also of interest.
