A CMake-based project that automatically fetches, patches, and builds the QSQLCIPHER plugin.
- Supports all Qt 6.x.x versions;
- Fully cross-platform;
- Supports both static and dynamic linking of SQLCipher and OpenSSL;
- Isolated from the default
QSQLITEdriver; - Easy to audit: You can easily verify the exact code modifications by reviewing patch files.
- Git
- Qt 6.x.x
- CMake 3.24 and higher with Ninja CMake Generator
- SQLCipher
- OpenSSL
First, ensure that SQLCipher and OpenSSL are resolvable via find_package. You can use any package manager you prefer or rely on system packages.
You need to set CMAKE_FIND_PACKAGE_TARGETS_GLOBAL=TRUE before find_package to avoid target promotion error when building Qt plugins from source.
Note: This variable is required because the target promotion error occurs not only with SQLCipher and OpenSSL, but also with internal system dependencies that Qt resolves during the plugin build process (such as Threads::Threads or WrapAtomic::WrapAtomic).
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
find_package(OpenSSL REQUIRED)
find_package(sqlcipher REQUIRED)
add_subdirectory(qsqlcipher-qt6)Use it just like a standard QSqlDatabase, but pass the key with QSqlDatabase::setPassword or PRAGMA key before opening.
This project is licensed under the MIT License.
See the LICENSE file for details.
This project includes third-party software components, each subject to its own license terms. Full copyright and licensing information is provided in the NOTICE file.