toku-mac commented on PR #18886:
URL: https://github.com/apache/nuttx/pull/18886#issuecomment-4467648392

   Hello. Regarding `arch/sim/src/sim/CMakeLists.txt`.
   
   ```
     add_custom_command(
       TARGET nuttx
       POST_BUILD
       COMMAND
         ${Python3_EXECUTABLE}
         ${CMAKE_CURRENT_SOURCE_DIR}/../patch_macho_initsection.py
         $<TARGET_FILE:nuttx>
       COMMENT "Patching Mach-O init section type flags")
   endif()
   ```
   
   `add_custom_command(TARGET ...)` can only be used in the directory where the 
target was created.
   Since the `nuttx` executable is created in the top-level CMakeLists.txt, 
attaching a POST_BUILD command to it from here would not work.
   Please use a custom target hooked into `nuttx_post` instead.
   
   ```
     add_custom_target(
       sim_patch_macho_initsection ALL
       COMMAND
         ${Python3_EXECUTABLE}
         ${CMAKE_CURRENT_SOURCE_DIR}/../patch_macho_initsection.py
         $<TARGET_FILE:nuttx>
       DEPENDS nuttx
       COMMENT "Patching Mach-O init section type flags")
     add_dependencies(nuttx_post sim_patch_macho_initsection)
   endif()
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to