Skip to content

How is Kconfig output used by CMake? #47510

Closed Answered by yashi
HumblePresent asked this question in Q&A
Discussion options

You must be logged in to vote

How and when is the .config file, which I believe is in Makefile format, translated and included in the CMake build process?

It's here:
https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v3.1.0/cmake/modules/kconfig.cmake#L325-L326

How are those definitions exposed without including the header in any source files?

Compilers have a flag for special include files. For GCC,

-imacros file
Exactly like -include, except that any output produced by scanning file is thrown away. Macros it defines remain defined. This allows you to acquire all the macros from a header without also processing its declarations.

All files specified by -imacros are processed before all files specified by -i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yashi
Comment options

yashi Jul 12, 2022
Collaborator

Answer selected by HumblePresent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants