# AUTOMOC is applied to SQLite3 sources when added as dependency resulting in compile error

**URL:** https://discourse.cmake.org/t/automoc-is-applied-to-sqlite3-sources-when-added-as-dependency-resulting-in-compile-error/14371
**Category:** Usage
**Created:** [July 15, 2025, 8:04am UTC](https://discourse.cmake.org/t/automoc-is-applied-to-sqlite3-sources-when-added-as-dependency-resulting-in-compile-error/14371 "2025-07-15T08:04:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![snoriman](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@snoriman](https://discourse.cmake.org/u/snoriman)
#### Post date: [July 15, 2025, 8:04am UTC](https://discourse.cmake.org/t/automoc-is-applied-to-sqlite3-sources-when-added-as-dependency-resulting-in-compile-error/14371/1 "2025-07-15T08:04:04Z")

</div>

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:

```auto
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.

```auto
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`?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [July 15, 2025, 9:12pm UTC](https://discourse.cmake.org/t/automoc-is-applied-to-sqlite3-sources-when-added-as-dependency-resulting-in-compile-error/14371/2 "2025-07-15T21:12:19Z")

</div>

Based on just the code sample provided (we can’t see what the rest of your project is doing, such as how anything Qt-related is being set up), I’d guess it relates to the `include_directories(${sqlite_prefix}/)` call as well. If you remove that, what happens?
