Files
MapLibreParticleLab/cmake/sqlite.cmake
Ander Conselvan de Oliveira 536652ca20 [build] Disable implicit fallthrough warnings for sqlite3 (#12855)
The sqlite3 source code has a lot of implicit fallthroughs in case
statements. They are documented with comments but even though gcc
provides options to use these comments to suppress the warnings, that's
not always reliable. For instance, it may fail if an #ifdef follows the
comment or if the comment is within a block scope used for a case.

With gcc version '(Ubuntu 7.3.0-16ubuntu3) 7.3.0' I get warnings similar
to the below:

../../../vendor/sqlite/src/sqlite3.c: In function ‘sqlite3_db_status’:
../../../vendor/sqlite/src/sqlite3.c:20251:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
       op = SQLITE_DBSTATUS_CACHE_WRITE+1;

So disable the implicit falltrhough warnings for that library. Note that
-Wno-error=implicit-fallthrough is not used to keep the build silent
since this is vendor library.
2018-09-11 12:18:26 +03:00

38 lines
1.1 KiB
CMake

add_vendor_target(sqlite STATIC)
target_compile_definitions(sqlite
PRIVATE "-DVERSION=\"3.24.0\""
PRIVATE "-DSTDC_HEADERS=int"
PRIVATE "-DHAVE_SYS_TYPES_H=1"
PRIVATE "-DHAVE_SYS_STAT_H=1"
PRIVATE "-DHAVE_STDLIB_H=1"
PRIVATE "-DHAVE_STRING_H=1"
PRIVATE "-DHAVE_MEMORY_H=1"
PRIVATE "-DHAVE_STRINGS_H=1"
PRIVATE "-DHAVE_INTTYPES_H=1"
PRIVATE "-DHAVE_STDINT_H=1"
PRIVATE "-DHAVE_UNISTD_H=1"
PRIVATE "-DHAVE_DLFCN_H=1"
PRIVATE "-DHAVE_FDATASYNC=1"
PRIVATE "-DHAVE_USLEEP=1"
PRIVATE "-DHAVE_LOCALTIME_R=1"
PRIVATE "-DHAVE_GMTIME_R=1"
PRIVATE "-DHAVE_DECL_STRERROR_R=1"
PRIVATE "-DHAVE_STRERROR_R=1"
PRIVATE "-DHAVE_ZLIB_H=1"
PRIVATE "-D_REENTRANT=1"
PRIVATE "-DSQLITE_THREADSAFE=1"
PRIVATE "-DSQLITE_HAVE_ZLIB"
# These are disabled on purpose, since we're not using these features.
# PRIVATE "-DSQLITE_ENABLE_FTS5"
# PRIVATE "-DSQLITE_ENABLE_JSON1"
# PRIVATE "-DSQLITE_ENABLE_FTS3"
# PRIVATE "-DSQLITE_ENABLE_RTREE"
)
target_compile_options(sqlite
PRIVATE "-Wno-int-conversion"
PRIVATE "-Wno-implicit-fallthrough"
)