This is kind of a silly one. Whenever I add SQLite via FetchContent and I’m building a Qt project I run into the following error:
sqlite\version(1,1): error C2059: syntax error: 'constant'
It seems that automoc is applied to the the sqlite sources somehow. Using a custom SOURCE_DIR
seems to trigger this behavior. Removing SOURCE_DIR
fixes the issue.
set(sqlite_prefix ${CMAKE_CURRENT_BINARY_DIR}/sqlite)
include(FetchContent)
FetchContent_Declare(
sqlite-sources
URL https://www.sqlite.org/2025/sqlite-autoconf-3500100.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
SOURCE_DIR ${sqlite_prefix}
)
FetchContent_MakeAvailable(sqlite-sources)
include_directories(${sqlite_prefix}/)
add_library(sqlite STATIC ${sqlite_prefix}/sqlite3.c)
Why is automoc run over sqlite when I use SOURCE_DIR
?