From be1c5cab96b060a0f22fb79a66a971b5c5b447eb Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 4 Jan 2023 21:48:34 +0100 Subject: [PATCH] Fix static build of Qt Creator When is QTC_STATIC_BUILD set to ON add_qtc_library will add a _STATIC_LIBRARY define, otherwise _LIBRARY is added. Since Sqlite uses two libraries now both SQLITE_STATIC_LIBRARY and SQLITEC_STATIC_LIBRARY need to be checked. Change-Id: I07c4de01627754534da7e37d1261db37779df296 Reviewed-by: Marco Bubke Reviewed-by: Reviewed-by: Qt CI Bot --- src/libs/3rdparty/sqlite/config.h | 2 +- src/libs/3rdparty/sqlite/sqlite_static_config.h | 2 +- src/libs/sqlite/CMakeLists.txt | 6 ++++-- src/libs/sqlite/sqlite3_fwd.h | 2 +- src/libs/sqlite/sqlitedatabasebackend.h | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libs/3rdparty/sqlite/config.h b/src/libs/3rdparty/sqlite/config.h index 44daecedfc8..3672f4c5ddf 100644 --- a/src/libs/3rdparty/sqlite/config.h +++ b/src/libs/3rdparty/sqlite/config.h @@ -27,7 +27,7 @@ #include -#ifdef SQLITE_STATIC_LIBRARY +#if defined(SQLITE_STATIC_LIBRARY) || defined(SQLITEC_STATIC_LIBRARY) #include "sqlite_static_config.h" #endif diff --git a/src/libs/3rdparty/sqlite/sqlite_static_config.h b/src/libs/3rdparty/sqlite/sqlite_static_config.h index f34dc7bcb6e..011fd25657c 100644 --- a/src/libs/3rdparty/sqlite/sqlite_static_config.h +++ b/src/libs/3rdparty/sqlite/sqlite_static_config.h @@ -195,7 +195,7 @@ #define sqlite3_stmt_status qtc_sqlite3_stmt_status #define sqlite3_str_append qtc_sqlite3_str_append #define sqlite3_str_appendall qtc_sqlite3_str_appendall -#define sqlite3_str_appendchar qtc_sqlite3_str_appendchastruct r +#define sqlite3_str_appendchar qtc_sqlite3_str_appendchar #define sqlite3_str_appendf qtc_sqlite3_str_appendf #define sqlite3_str_errcode qtc_sqlite3_str_errcode #define sqlite3_str_finish qtc_sqlite3_str_finish diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index 5f0d073813f..0b23a7db126 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -2,6 +2,9 @@ add_qtc_library(SqliteC OBJECT PROPERTIES AUTOMOC OFF AUTOUIC OFF QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON POSITION_INDEPENDENT_CODE ON CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 DEFINES SQLITE_CORE SQLITE_CUSTOM_INCLUDE=config.h $<$:SQLITE_DEBUG> + PROPERTIES COMPILE_OPTIONS $,/FIconfig.h,-includeconfig.h> + PUBLIC_INCLUDES + ../3rdparty/sqlite SOURCES ../3rdparty/sqlite ../3rdparty/sqlite/sqlite3.c @@ -18,8 +21,7 @@ add_qtc_library(Sqlite CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}" - ../3rdparty/sqlite - DEFINES SQLITE_LIBRARY SQLITE_CUSTOM_INCLUDE=config.h $<$:SQLITE_REVERSE> + DEFINES SQLITE_CUSTOM_INCLUDE=config.h $<$:SQLITE_REVERSE> SOURCES constraints.h createtablesqlstatementbuilder.h diff --git a/src/libs/sqlite/sqlite3_fwd.h b/src/libs/sqlite/sqlite3_fwd.h index 1075719f2c4..7d1dc016ad8 100644 --- a/src/libs/sqlite/sqlite3_fwd.h +++ b/src/libs/sqlite/sqlite3_fwd.h @@ -3,7 +3,7 @@ #pragma once -#ifdef SQLITE_STATIC_LIBRARY +#if defined(SQLITE_STATIC_LIBRARY) || defined(SQLITEC_STATIC_LIBRARY) using sqlite3 = struct qtc_sqlite3; using sqlite3_stmt = struct qtc_sqlite3_stmt; using sqlite3_session = struct qtc_sqlite3_session; diff --git a/src/libs/sqlite/sqlitedatabasebackend.h b/src/libs/sqlite/sqlitedatabasebackend.h index 67556cc77e7..70b1db12f37 100644 --- a/src/libs/sqlite/sqlitedatabasebackend.h +++ b/src/libs/sqlite/sqlitedatabasebackend.h @@ -40,7 +40,7 @@ public: void close(); void closeWithoutException(); - struct sqlite3 *sqliteDatabaseHandle() const; + sqlite3 *sqliteDatabaseHandle() const; void setJournalMode(JournalMode journalMode); JournalMode journalMode();