Skip to content

database/sqlite: add CMake build support - #3856

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:cmake/sqlite-support
Oct 16, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:cmake/sqlite-support

Conversation

@Swatantra-66

@Swatantra-66 Swatantra-66 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses the CMake vs. Make build-system gap for database/sqlite identified in issue apache/nuttx#19549 ("[Analysis] CMake vs. Make Build-System Gap Analysis"):

  1. Top-Level Discovery: Added add_subdirectory(database) to apps/CMakeLists.txt in alphabetical order.
  2. Category Traversal & Kconfig: Created apps/database/CMakeLists.txt invoking nuttx_add_subdirectory() and nuttx_generate_kconfig(MENUDESC "Database") to automatically register the Database menu in Kconfig.
  3. SQLite CMake Build Infrastructure: Created apps/database/sqlite/CMakeLists.txt:
    • Guarded under if(CONFIG_LIB_SQLITE).
    • Automated source download of version-${CONFIG_LIB_SQLITE_VERSION} via CMake FetchContent.
    • Host amalgamation generation (sqlite3.c, sqlite3.h, and shell.c) via host ./configure and make.
    • Static library target declaration via nuttx_add_library(sqlite3 STATIC) with definitions (_HAVE_SQLITE_CONFIG_H, NDEBUG) and warning suppressions matching Makefile.
    • CLI application declaration via nuttx_add_application(NAME sqlite3) with stack size ${CONFIG_UTILS_SQLITE_STACKSIZE} and priority 100 when CONFIG_UTILS_SQLITE is enabled.
    • Clean target registration via ADDITIONAL_CLEAN_FILES.

Addresses apache/nuttx#19549

Impact

  • Is new feature added? YES (CMake build support for database/sqlite).
  • Impact on user? Enables building the SQLite library and CLI tool under CMake.
  • Impact on build? Closes the build-system gap for configurations enabling SQLite (e.g., sim:sqlite). GNU Make build remains completely untouched.
  • Impact on hardware? None.
  • Impact on documentation? None.
  • Impact on security? None.
  • Impact on compatibility? Forward- and backward-compatible.

Testing

  • cmake-format --check: Passed on all modified and newly created files.
  • cmake-lint: Passed with 0 convention, style, or line-length warnings.
  • codespell: Passed with 0 spelling errors.
  • cvt2utf: Passed (valid UTF-8 and LF line terminators).
  • checkpatch.sh -c -u -m -g: Passed with zero errors or warnings (✔️ All checks pass.).

- Add database subdirectory to apps/CMakeLists.txt.
- Add apps/database/CMakeLists.txt with nuttx_add_subdirectory() and
  nuttx_generate_kconfig().
- Add apps/database/sqlite/CMakeLists.txt to fetch SQLite release
  archive, generate amalgamation (sqlite3.c, sqlite3.h, and shell.c)
  via host configure and make, configure sqlite3 library target, and
  configure sqlite3 CLI application target.

Assisted-by: Google Gemini
Signed-off-by: Swatantra Yadav <[email protected]>

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Swatantra-66 :-)

Please remember to always attach build and runtime logs.. from a real world hardware where possible :-)

@Swatantra-66

Copy link
Copy Markdown
Contributor Author

Thank you @cederom for the review and advice :-)
Understood — I will make sure to include real hardware build and runtime logs in future PRs whenever possible.

Thanks as well to @xiaoxiang781216 and @acassis for the reviews.

@xiaoxiang781216
xiaoxiang781216 merged commit 8736061 into apache:master Oct 16, 2026
36 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants