use find_packages in cmake files to for shared lib build#1084
use find_packages in cmake files to for shared lib build#1084yulin-li wants to merge 13 commits into
find_packages in cmake files to for shared lib build#1084Conversation
oh thanks, let me revert the changes in |
find_packages in cmake files to for shared lib build
This would be a problem if we install sqlite3 from (say) # dpkg-query -L libsqlite3-dev:amd64
/.
/usr
/usr/include
/usr/include/sqlite3.h
/usr/include/sqlite3ext.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libsqlite3.a
/usr/lib/x86_64-linux-gnu/libsqlite3.la
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/sqlite3.pc
/usr/share
/usr/share/doc
/usr/share/doc/libsqlite3-dev
/usr/share/doc/libsqlite3-dev/copyright
/usr/lib/x86_64-linux-gnu/libsqlite3.so
/usr/share/doc/libsqlite3-dev/changelog.Debian.gz
# dpkg-query -L libsqlite3-0:amd64
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
/usr/share
/usr/share/doc
/usr/share/doc/libsqlite3-0
/usr/share/doc/libsqlite3-0/README.Debian
/usr/share/doc/libsqlite3-0/changelog.Debian.gz
/usr/share/doc/libsqlite3-0/copyright
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0
# dpkg-query -L sqlite3
/.
/usr
/usr/bin
/usr/bin/sqldiff
/usr/bin/sqlite3
/usr/share
/usr/share/doc
/usr/share/doc/sqlite3
/usr/share/doc/sqlite3/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/sqldiff.1.gz
/usr/share/man/man1/sqlite3.1.gz
/usr/share/doc/sqlite3/changelog.Debian.gz |
|
@yulin-li - let us know if the PR is still valid ? |
sorry for this very late reply. The camke configurations is actually provided by cmake (https://github.com/Kitware/CMake/blob/master/Modules/FindSQLite3.cmake), not sqlite3 package. The problem without |
|
@ThomsonTan I saw you were updating this PR. Could it be reviewed and merge? So we can avoid patching it in our project. |
|
@yulin-li, is this PR still valid? Does the consuming of local install sqlite3 break other users who may not epect the local install? |
This is still valid. The local sqlite is only required if the user wants to build a shared lib. This won't change the behavior for static lib build. |
| add_library(sqlite3 SHARED IMPORTED GLOBAL) | ||
| add_library(z SHARED IMPORTED GLOBAL) | ||
| target_link_libraries(mat PUBLIC sqlite3 PUBLIC z ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" "${CMAKE_REQUIRED_LIBRARIES}") | ||
| find_package(SQLite3 REQUIRED) |
There was a problem hiding this comment.
yes, the current hard-coded name still works. But I think the find_package is a preferred way by cmake, and it will report a clearer error if sqlite3 is not installed
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>
No description provided.