Skip to content

Raise CMake floor to 3.15...3.31 and use find_package(SQLite3) (subsumes #1084)#1478

Open
bmehta001 wants to merge 1 commit into
microsoft:mainfrom
bmehta001:bhamehta/cmake-min-3.15-sqlite-findpackage
Open

Raise CMake floor to 3.15...3.31 and use find_package(SQLite3) (subsumes #1084)#1478
bmehta001 wants to merge 1 commit into
microsoft:mainfrom
bmehta001:bhamehta/cmake-min-3.15-sqlite-findpackage

Conversation

@bmehta001

Copy link
Copy Markdown
Contributor

What

Raise the CMake floor for every repo-owned CMakeLists.txt to the range 3.15...3.31, and switch the legacy (non-vcpkg) Linux/macOS SQLite link to find_package(SQLite3) + the imported SQLite::SQLite3 target.

Why

CMake 4.0 removed support for cmake_minimum_required(VERSION <3.5). The repo still shipped wrappers/obj-c/CMakeLists.txt declaring 2.8.2, so configuring with CMake 4.x fails with:

CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

Normalizing all repo-owned floors to 3.15...3.31 makes the project configure under CMake 4.x while pinning a predictable policy ceiling. 3.15 is chosen as the floor because:

  • the built-in FindSQLite3 module (used here) requires CMake >= 3.14, and
  • several files already required 3.15.

This also subsumes #1084: in the legacy non-vcpkg Linux/macOS path, the bare "sqlite3" link name is replaced with find_package(SQLite3 REQUIRED) and SQLite::SQLite3, which carries its own include directories. The static-.a fallbacks (/usr/local, homebrew) and the vcpkg / Android-bundled / Windows .vcxproj paths are unchanged.

Vendored zlib/** CMakeLists are intentionally left untouched (already >= 3.5, so CMake-4.0-safe).

Files

  • CMakeLists.txt (root)
  • examples/{c/SampleC-Guest,cpp/EventSender,cpp/MacProxy,cpp/SampleCpp,cpp/SampleCppMini,objc/cocoa-app}/CMakeLists.txt
  • lib/CMakeLists.txt (floor + find_package(SQLite3))
  • lib/android_build/{app,maesdk}/src/main/cpp/CMakeLists.txt (maesdk was 3.10.2)
  • tests/{vcpkg,functests,unittests}/CMakeLists.txt (functests/unittests: find_package(SQLite3))
  • wrappers/{obj-c,swift}/CMakeLists.txt (obj-c was the 2.8.2 breakage)

Validation

  • A real CMake 4.3.3 rejects the old 2.8.2 floor (Compatibility with CMake < 3.5 has been removed) and accepts 3.15...3.31 (Configuring done).
  • Repo root configures cleanly under CMake 4.3.3 (Windows, vcpkg dependency path, MATSDK_USE_VCPKG_DEPS=ON).
  • find_package(SQLite3 REQUIRED) + SQLite::SQLite3 resolves on Linux; the repo's legacy-Linux configure reaches the library target and find_package(ZLIB) cleanly.

Resolves #1339. Supersedes #1084.

CMake 4.0 removed compatibility with cmake_minimum_required < 3.5, which
broke configuration of this repo: wrappers/obj-c/CMakeLists.txt still
declared 2.8.2. Normalize every repo-owned CMakeLists.txt to the range
3.15...3.31 so the project both configures under CMake 4.x and pins a
predictable policy ceiling. 3.15 is the floor because the built-in
FindSQLite3 module (used below) requires >= 3.14, and several existing
files already required 3.15.

Subsume microsoft#1084: in the legacy (non-vcpkg) Linux/macOS dependency path,
replace the bare "sqlite3" link name with find_package(SQLite3 REQUIRED)
and the imported SQLite::SQLite3 target, which carries its own include
directories. Applied in lib, functests, and unittests; the static-.a
fallbacks and the vcpkg/Android/Windows paths are unchanged.

Vendored zlib CMakeLists are left untouched (already >= 3.5).

Validated:
- CMake 4.3.3 rejects the old 2.8.2 floor and accepts 3.15...3.31.
- Repo root configures cleanly under CMake 4.3.3 (Windows, vcpkg deps).
- find_package(SQLite3 REQUIRED) + SQLite::SQLite3 resolves on Linux.

Files: CMakeLists.txt; 6 examples/*/CMakeLists.txt; lib/CMakeLists.txt;
lib/android_build/{app,maesdk}/src/main/cpp/CMakeLists.txt;
tests/{vcpkg,functests,unittests}/CMakeLists.txt;
wrappers/{obj-c,swift}/CMakeLists.txt

Resolves microsoft#1339. Supersedes microsoft#1084.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 requested a review from a team as a code owner June 11, 2026 05:15
@bmehta001 bmehta001 self-assigned this Jun 11, 2026
@bmehta001 bmehta001 requested a review from Copilot June 11, 2026 08:04

Copilot AI 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.

Pull request overview

This pull request updates the project’s CMake compatibility to configure cleanly with CMake 4.x by raising cmake_minimum_required() across repo-owned CMake projects to 3.15...3.31, and modernizes legacy (non-vcpkg) sqlite linking on Linux/macOS by using find_package(SQLite3) and the SQLite::SQLite3 imported target.

Changes:

  • Raised the CMake policy/version floor across multiple repo-owned CMakeLists.txt files to 3.15...3.31 (CMake 4.x compatible while pinning a policy ceiling).
  • Replaced legacy "sqlite3" link-name usage with find_package(SQLite3 REQUIRED) + SQLite::SQLite3 in legacy (non-vcpkg) build paths for the library and test targets.
  • Normalized Android sample/app CMake floors to match the repo-wide baseline.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
CMakeLists.txt Raises the root project’s CMake minimum/policy range to 3.15...3.31 for CMake 4.x compatibility.
lib/CMakeLists.txt In legacy non-vcpkg mode, resolves SQLite via find_package(SQLite3) and links SQLite::SQLite3 instead of bare sqlite3.
tests/functests/CMakeLists.txt Uses find_package(SQLite3) + SQLite::SQLite3 for the fallback legacy sqlite link path.
tests/unittests/CMakeLists.txt Uses find_package(SQLite3) + SQLite::SQLite3 for the fallback legacy sqlite link path.
tests/vcpkg/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31 for vcpkg integration test project.
wrappers/obj-c/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31 to avoid CMake 4.x configure failure.
wrappers/swift/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
lib/android_build/maesdk/src/main/cpp/CMakeLists.txt Raises Android CMake minimum/policy range to 3.15...3.31.
lib/android_build/app/src/main/cpp/CMakeLists.txt Raises Android CMake minimum/policy range to 3.15...3.31.
examples/c/SampleC-Guest/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
examples/cpp/EventSender/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
examples/cpp/MacProxy/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
examples/cpp/SampleCpp/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
examples/cpp/SampleCppMini/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.
examples/objc/cocoa-app/CMakeLists.txt Raises CMake minimum/policy range to 3.15...3.31.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cpp_client_telemetry fails to build with CMake 4.0

2 participants