acassis commented on PR #3711: URL: https://github.com/apache/nuttx-apps/pull/3711#issuecomment-5227986358
> Thank you @acassis :-) git subject too long and no test logs here nor in referenced [apache/nuttx#19697](https://github.com/apache/nuttx/issues/19697).. we should keep thing clean and let the ci pass :-P Tomek, come on, I asked another AI to simplify it, do you want the original: ``` Subject: [PATCH] cmake: Use NUTTX_DIR/NUTTX_BINARY_DIR instead of CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR. Companion to the matching nuttx change (same topic line). apps/ is add_subdirectory()'d from NuttX's own top-level CMakeLists.txt, so CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR inside apps' CMakeLists.txt files never meant "the apps directory" in the first place; they were already reused to mean "NuttX's own root" the same way NuttX's own tree used them, and inherited the same bug: those variables are defined by CMake to be the outermost project's directories, so they only happen to resolve correctly when NuttX itself is top-level. When a parent project pulls NuttX in via add_subdirectory(), both resolve to the parent's root instead, which broke building apps that way (apache/nuttx#19697). NUTTX_DIR and NUTTX_BINARY_DIR are set once in NuttX's top-level CMakeLists.txt and are visible here through normal CMake directory scoping (apps is add_subdirectory()'d from that same file). This replaces every self-referencing use of CMAKE_BINARY_DIR / CMAKE_SOURCE_DIR across apps/ with them. Left untouched: * testing/cxx-oot-build/, which is explicitly excluded from the normal add_subdirectory tree (nuttx_add_subdirectory(EXCLUDE cxx-oot-build)) and built as its own standalone example project, where CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR correctly refer to itself. * netutils/connectedhomeip's COMMON_CMAKE_SOURCE_DIR, a distinct custom variable that only contains CMAKE_SOURCE_DIR as a substring. * Pre-existing, unrelated hardcoding of the literal "apps" binary directory name in several ExternalProject_Add-based CMakeLists.txt (e.g. interpreters/quickjs), which does not depend on CMAKE_BINARY_DIR pointing at the wrong root and is out of scope here. Since NUTTX_DIR / NUTTX_BINARY_DIR equal CMAKE_SOURCE_DIR / CMAKE_BINARY_DIR exactly whenever NuttX is the top-level project, this is behavior-preserving for the normal standalone build and only changes behavior when NuttX (and therefore apps) is embedded via add_subdirectory(). Impact: CMake build system only. No change to the Make build. Testing: built together with the matching nuttx change, sim:nsh, both standalone and embedded via a parent project's add_subdirectory(nuttx); apps builtins (hello, ostest, etc.) build and are present in the resulting nsh shell in both cases. See the nuttx commit for full testing details. Fixes #19697. Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Alan Carvalho de Assis <[email protected]> ``` -- 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]
