clangformat-cmake icon indicating copy to clipboard operation
clangformat-cmake copied to clipboard

Does not work with C++ modules target

Open Diltsman opened this issue 9 months ago • 0 comments

When formatting a target with C++20 modules, I get the following error message:

[1/1] Formatting elf with /usr/bin/clang-format ...
FAILED: src/elf/CMakeFiles/elf_clangformat /home/diltsman/src/elf2/.build/src/elf/CMakeFiles/elf_clangformat
cd /home/diltsman/src/elf2 && /usr/bin/clang-format -style=file -i /home/diltsman/src/elf2/src/elf/target_sources-NOTFOUND
No such file or directory
ninja: build stopped: subcommand failed.

This is running the generate_build.sh and then build.sh in this repository: Example

Note, if you move main.cpp from the PUBLIC to PRIVATE section of the target_sources(), then things format.

Diltsman avatar Feb 04 '25 06:02 Diltsman