zyy37 commented on issue #19697: URL: https://github.com/apache/nuttx/issues/19697#issuecomment-5231732413
`CMAKE_SOURCE_DIR`: Refers to the top-level source code directory (i.e. the directory specified when executing cmake initially, usually containing the root CMakeLists.txt). `CMAKE_CURRENT_SOURCE_DIR`: Refers to the directory where the current processing location is located, named after the CMakeLists.txt file. When using `add_subdirectory()` to enter a subdirectories, its value will change to the path of that subdirectories. Similarly, there are corresponding variables for building directories: `CMAKE_BINARY_DIR`: Refers to the top-level build directory (i.e. the build directory specified when executing cmake, which corresponds to the root CMakeLists.txt). `CMAKE_CURRENT_BINARY_DIR`: Refers to the build directory corresponding to the current source code directory. In subdirectories, it is usually `CMAKE_BINARY_DIR` relative path of subdirectories. Simply put: Variables without CURRENT always point to the root position of the project. The variable with CURRENT points to the current location of CMakeLists.txt. -- 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]
