Skip to content

Add CMake custom commands for generated contents - #630

Closed
gemmaro wants to merge 5 commits into
commonmark:masterfrom
gemmaro:scanner
Closed

gemmaro wants to merge 5 commits into
commonmark:masterfrom
gemmaro:scanner

Conversation

@gemmaro

@gemmaro gemmaro commented Sep 11, 2026

Copy link
Copy Markdown

Hello, this addresses #580 by using CMake features to generate some support files.

The existing workflow doesn't change.
Makefile tasks for src/{scanners.c,case_fold.inc,entities.inc} are kept as is, and the added CMake custom commands are only invoked when python3, re2c, and clang-format are installed.

I added the .clang-format file to let clang-format share the consistent behavior across Makefile and tool scripts.

I referred the following resources:

Thank you,

@nwellnhof

Copy link
Copy Markdown
Contributor

AFAICT, this will rebuild the generated code on each build (if the tools could be found.) This is not what we want. Also see my comments in #580.

@AndersonTorres

Copy link
Copy Markdown

@gemmaro have you tried to use add_custom_target instead?
For us at Nixpkgs and Guix, it would be sufficient. IIRC they generate targets in the backend that can be called independently later via Make or Ninja.

@gemmaro

gemmaro commented Sep 16, 2026

Copy link
Copy Markdown
Author

@AndersonTorres Yes I have. I think it is a good idea if it is more or less valuable for cmark maintainers as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants