FMT_MODULE defaults on for subproject consumers and fails when clang-scan-deps is unavailable
envgap__fmtlib__fmt-4820
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
caf5e48b1c56c3dee14768ed7ce08a9d51d03b58- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
fmtlib/fmt #4820 · read the original issue
When fmt is added as a subdirectory in a C++20 project using CMake 3.28+, fmt may default `FMT_MODULE` to ON and add/build `fmt::fmt-module`, even when the parent project only consumes `fmt::fmt-header-only` or `fmt::fmt`. In Clang environments where `clang++` is available but `clang-scan-deps` is not found by CMake, the build generates a command like: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND -format=p1689 -- clang++ ... and fails with: /bin/sh: 1: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: not found Expected: fmt should not build the C++20 module target by default for add_subdirectory consumers that did not request modules, or the Clang native CMake modules path should require `CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS` to be found. Workaround: set(FMT_MODULE OFF CACHE BOOL "Build fmt module library." FORCE) before add_subdirectory(fmt). Caused issues for us when trying to upgrade fmtlib in PyTorch which uses CPP20, but not modules. The clang containers did not install clang-scan-deps and therefore the compile runs crashed. From PR: https://github.com/pytorch/pytorch/pull/187691
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]