From 08fab0c110fe2d4421b6716ce9b3b03105df439c Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 11 Jun 2026 00:14:57 -0500 Subject: [PATCH] Raise CMake floor to 3.15...3.31 and use find_package(SQLite3) 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 #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 #1339. Supersedes #1084. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 2 +- examples/c/SampleC-Guest/CMakeLists.txt | 2 +- examples/cpp/EventSender/CMakeLists.txt | 2 +- examples/cpp/MacProxy/CMakeLists.txt | 2 +- examples/cpp/SampleCpp/CMakeLists.txt | 2 +- examples/cpp/SampleCppMini/CMakeLists.txt | 2 +- examples/objc/cocoa-app/CMakeLists.txt | 2 +- lib/CMakeLists.txt | 5 ++++- lib/android_build/app/src/main/cpp/CMakeLists.txt | 2 +- lib/android_build/maesdk/src/main/cpp/CMakeLists.txt | 2 +- tests/functests/CMakeLists.txt | 3 ++- tests/unittests/CMakeLists.txt | 3 ++- tests/vcpkg/CMakeLists.txt | 2 +- wrappers/obj-c/CMakeLists.txt | 2 +- wrappers/swift/CMakeLists.txt | 2 +- 15 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea843b23..7a0ba0e82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(MSTelemetry LANGUAGES C CXX) ################################################################################################ diff --git a/examples/c/SampleC-Guest/CMakeLists.txt b/examples/c/SampleC-Guest/CMakeLists.txt index 1092f1f19..06a7d85b5 100644 --- a/examples/c/SampleC-Guest/CMakeLists.txt +++ b/examples/c/SampleC-Guest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(SampleC-Guest) # Uncomment for building i386 binary on x86_64 system diff --git a/examples/cpp/EventSender/CMakeLists.txt b/examples/cpp/EventSender/CMakeLists.txt index deeae0729..223ebb785 100644 --- a/examples/cpp/EventSender/CMakeLists.txt +++ b/examples/cpp/EventSender/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(EventSender) # Uncomment for building i386 binary on x86_64 system diff --git a/examples/cpp/MacProxy/CMakeLists.txt b/examples/cpp/MacProxy/CMakeLists.txt index 030725fee..04dfa5d01 100644 --- a/examples/cpp/MacProxy/CMakeLists.txt +++ b/examples/cpp/MacProxy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(MacProxy) # Uncomment for building i386 binary on x86_64 system diff --git a/examples/cpp/SampleCpp/CMakeLists.txt b/examples/cpp/SampleCpp/CMakeLists.txt index 2fbdaeb81..bfa90995e 100644 --- a/examples/cpp/SampleCpp/CMakeLists.txt +++ b/examples/cpp/SampleCpp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(SampleCpp) # Uncomment for building i386 binary on x86_64 system diff --git a/examples/cpp/SampleCppMini/CMakeLists.txt b/examples/cpp/SampleCppMini/CMakeLists.txt index 908465570..a2c33224f 100644 --- a/examples/cpp/SampleCppMini/CMakeLists.txt +++ b/examples/cpp/SampleCppMini/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(SampleCppMini) # Uncomment for building i386 binary on x86_64 system diff --git a/examples/objc/cocoa-app/CMakeLists.txt b/examples/objc/cocoa-app/CMakeLists.txt index 629f20ee0..353098e92 100644 --- a/examples/objc/cocoa-app/CMakeLists.txt +++ b/examples/objc/cocoa-app/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) project(foo) include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 533144c06..584c678ec 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -421,7 +421,10 @@ else() elseif(EXISTS "/opt/homebrew/opt/sqlite/lib/libsqlite3.a") set(MATSDK_SQLITE3_LIB "/opt/homebrew/opt/sqlite/lib/libsqlite3.a") else() - set(MATSDK_SQLITE3_LIB "sqlite3") + # find_package(SQLite3) needs CMake >= 3.14, guaranteed by the project floor; + # SQLite::SQLite3 is an imported target carrying its own include dirs. + find_package(SQLite3 REQUIRED) + set(MATSDK_SQLITE3_LIB SQLite::SQLite3) endif() find_package(ZLIB REQUIRED) diff --git a/lib/android_build/app/src/main/cpp/CMakeLists.txt b/lib/android_build/app/src/main/cpp/CMakeLists.txt index 2e86b5a54..362a14233 100644 --- a/lib/android_build/app/src/main/cpp/CMakeLists.txt +++ b/lib/android_build/app/src/main/cpp/CMakeLists.txt @@ -3,7 +3,7 @@ # Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.5...3.29) +cmake_minimum_required(VERSION 3.15...3.31) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt b/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt index f53d5403a..fc2dad035 100644 --- a/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt +++ b/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt @@ -3,7 +3,7 @@ # Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.15...3.31) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 61863ff5f..d09e31f62 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -83,7 +83,8 @@ else() elseif(EXISTS "/usr/local/opt/sqlite/lib/libsqlite3.a") set (SQLITE3_LIB "/usr/local/opt/sqlite/lib/libsqlite3.a") else() - set (SQLITE3_LIB "sqlite3") + find_package(SQLite3 REQUIRED) + set (SQLITE3_LIB SQLite::SQLite3) endif() if(TARGET zlib_bundled) diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index efba3d67a..97e323def 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -145,7 +145,8 @@ else() # Apple Silicon homebrew installs to /opt/homebrew instead of /usr/local set (SQLITE3_LIB "/opt/homebrew/opt/sqlite/lib/libsqlite3.a") else() - set (SQLITE3_LIB "sqlite3") + find_package(SQLite3 REQUIRED) + set (SQLITE3_LIB SQLite::SQLite3) endif() if(TARGET zlib_bundled) diff --git a/tests/vcpkg/CMakeLists.txt b/tests/vcpkg/CMakeLists.txt index da7826f3d..709b3038c 100644 --- a/tests/vcpkg/CMakeLists.txt +++ b/tests/vcpkg/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.15...3.31) project(cpp-client-telemetry_vcpkg_test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) diff --git a/wrappers/obj-c/CMakeLists.txt b/wrappers/obj-c/CMakeLists.txt index 81bb430f4..e20b5a158 100644 --- a/wrappers/obj-c/CMakeLists.txt +++ b/wrappers/obj-c/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2) +cmake_minimum_required(VERSION 3.15...3.31) PROJECT(ObjC_Wrapper) diff --git a/wrappers/swift/CMakeLists.txt b/wrappers/swift/CMakeLists.txt index 2410a238b..cc751726e 100644 --- a/wrappers/swift/CMakeLists.txt +++ b/wrappers/swift/CMakeLists.txt @@ -15,7 +15,7 @@ # and linking the static libs to generate the executable. # ------------------------------------------------------------------------------------------------------------ -CMAKE_MINIMUM_REQUIRED(VERSION 3.15) +cmake_minimum_required(VERSION 3.15...3.31) # Set build and path related variables string(TOLOWER ${CMAKE_BUILD_TYPE} LOWER_BUILD_TYPE)