Add CMake test for Qt sqlite support
This commit is contained in:
parent
efcd35d4a1
commit
5bdbc9f40d
|
@ -374,11 +374,26 @@ if(APPLE)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
||||||
|
|
||||||
# Check that we have sqlite3 with FTS5
|
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
# Check that we have Qt with sqlite driver
|
||||||
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
|
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${QtCore_LIBRARIES} ${QtSql_LIBRARIES})
|
set(CMAKE_REQUIRED_LIBRARIES ${QtCore_LIBRARIES} ${QtSql_LIBRARIES})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <QSqlDatabase>
|
||||||
|
#include <QSqlQuery>
|
||||||
|
int main() {
|
||||||
|
QSqlDatabase db = QSqlDatabase::addDatabase(\"QSQLITE\");
|
||||||
|
db.setDatabaseName(\":memory:\");
|
||||||
|
if (!db.open()) { return 1; }
|
||||||
|
QSqlQuery q(db);
|
||||||
|
q.prepare(\"CREATE TABLE test (test TEXT);\");
|
||||||
|
if (!q.exec()) return 1;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
QT_SQLITE_TEST
|
||||||
|
)
|
||||||
|
if(QT_SQLITE_TEST)
|
||||||
|
# Check that we have sqlite3 with FTS5
|
||||||
check_cxx_source_runs("
|
check_cxx_source_runs("
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
@ -391,9 +406,10 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
if (!q.exec()) return 1;
|
if (!q.exec()) return 1;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
SQLITE3_FTS5
|
SQLITE_FTS5_TEST
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set up definitions
|
# Set up definitions
|
||||||
|
|
||||||
|
@ -439,8 +455,14 @@ elseif(NOT HAVE_GSTREAMER)
|
||||||
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
|
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SQLITE3_FTS5 AND NOT CMAKE_CROSSCOMPILING)
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
message(WARNING "sqlite3 must be enabled with FTS5. See: https://www.sqlite.org/fts5.html")
|
if(QT_SQLITE_TEST)
|
||||||
|
if(NOT SQLITE_FTS5_TEST)
|
||||||
|
message(WARNING "sqlite must be enabled with FTS5. See: https://www.sqlite.org/fts5.html")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "The Qt sqlite driver test failed.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT TAGLIB_VERSION VERSION_GREATER_EQUAL 1.12)
|
if(NOT TAGLIB_VERSION VERSION_GREATER_EQUAL 1.12)
|
||||||
|
|
Loading…
Reference in New Issue