anchao opened a new pull request, #15594:
URL: https://github.com/apache/nuttx/pull/15594

   ## Summary
   
   cmake/mkconfig: add support of set custom command options to config.h
   
   add support of set custom command options to config.h
   Use the -D parameter to pass the config to header file.
   NOTE which must start with the CONFIG_ prefix.
   eg:
   ```
     cmake -DCONFIG_AAA=1 -DCONFIG_BBB=1 -B build -DBOARD_CONFIG=sim/nsh -GNinja
   ```
   
   
   source file:
   ```
   #include <nuttx/config.h>
   
   int main(int argc, FAR char *argv[])
   {
   #ifdef CONFIG_AAA
     printf("Hello, World!! AAA: %d\n", CONFIG_AAA);
   #endif
   #ifdef CONFIG_BBB
     printf("Hello, World!! BBB: %d\n", CONFIG_BBB);
   #endif
     return 0;
   }
   ```
   
   output:
   ```
   $ ./build/nuttx 
   
   NuttShell (NSH) NuttX-10.4.0
   nsh> hello
   Hello, World!! AAA: 1
   Hello, World!! BBB: 1
   nsh> 
   ```
   
   Signed-off-by: chao an <anchao.arc...@bytedance.com>
   
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci-check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to