Skip to content

Commit 84e507b

Browse files
committed
Add block in src/qt/CMakeLists.txt to clear stale in-tree MOC files
1 parent dd78947 commit 84e507b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/qt/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
# ============
33
add_subdirectory(locale)
44

5+
# Cleanup: Remove stale Qt MOC files
6+
# ==================================
7+
# Autotools (and older build methods) generate .moc and moc_*.cpp files
8+
# directly in the source tree. These conflict with CMake's AUTOMOC.
9+
file(GLOB_RECURSE STALE_MOC_FILES
10+
"${CMAKE_CURRENT_SOURCE_DIR}/*.moc"
11+
"${CMAKE_CURRENT_SOURCE_DIR}/moc_*.cpp"
12+
)
13+
14+
if(STALE_MOC_FILES)
15+
message(STATUS "Detected stale Qt MOC files in source tree. Cleaning up...")
16+
foreach(STALE_FILE ${STALE_MOC_FILES})
17+
message(STATUS " Removing: ${STALE_FILE}")
18+
file(REMOVE "${STALE_FILE}")
19+
endforeach()
20+
endif()
521

622
# libgridcoinqt
723
# =============

0 commit comments

Comments
 (0)