CMakeLists: Add QCoreApplication to SQLite test

Fixes #1471
This commit is contained in:
Jonas Kvinge 2024-06-27 18:15:53 +02:00
parent 93660bfc81
commit e0be15cf01
1 changed files with 3 additions and 1 deletions

View File

@ -455,9 +455,11 @@ if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_REQUIRED_FLAGS "-std=c++17") set(CMAKE_REQUIRED_FLAGS "-std=c++17")
set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql) set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql)
check_cxx_source_runs(" check_cxx_source_runs("
#include <QCoreApplication>
#include <QSqlDatabase> #include <QSqlDatabase>
#include <QSqlQuery> #include <QSqlQuery>
int main() { int main(int argc, char *argv[]) {
QCoreApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase(\"QSQLITE\"); QSqlDatabase db = QSqlDatabase::addDatabase(\"QSQLITE\");
db.setDatabaseName(\":memory:\"); db.setDatabaseName(\":memory:\");
if (!db.open()) { return 1; } if (!db.open()) { return 1; }