Skip to content

Commit 68dc51d

Browse files
committed
[Build][CMake] Use CMake internal instead of custom command for moc
CMake has an internal function (`qt5_generate_moc`) that can be used to forcibly generate a `.moc` file. Use that instead of the generic `execute_process` function. This fixes an issue on systems (fe, Arch Linux) where Qt's moc binary are placed in a different location than debian based distros.
1 parent 5a7b514 commit 68dc51d

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/qt/CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ if (QRCODE_FOUND)
4949
link_directories ( ${QRCODE_LIBRARY_DIRS} )
5050
endif()
5151

52-
find_program(MOC_BIN NAMES moc moc-qt5 qt5-moc
53-
PATHS /usr/lib/qt5/bin /usr/lib/x86_64-linux-gnu/qt5/bin /usr/local/opt/qt/bin /usr/local/opt/qt5/bin /opt/homebrew/opt/qt5/bin
54-
NO_DEFAULT_PATH
55-
NO_SYSTEM_ENVIRONMENT_PATH)
56-
if (MOC_BIN)
57-
MESSAGE(STATUS "FOUND MOC ${MOC_BIN}")
58-
endif ()
59-
6052
add_compile_options("-DQT_NO_KEYWORDS")
6153

6254
# Why isn't this done automatically??
@@ -165,10 +157,7 @@ SET(QT_SOURCES
165157
${CMAKE_CURRENT_SOURCE_DIR}/pivx/governancemodel.cpp
166158
)
167159

168-
execute_process(
169-
COMMAND ${MOC_BIN} -o moc_pfborderimage.cpp pfborderimage.h
170-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pivx
171-
)
160+
qt5_generate_moc(pivx/pfborderimage.h ${CMAKE_CURRENT_SOURCE_DIR}/pivx/moc_pfborderimage.cpp)
172161
list(APPEND QT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/pivx/moc_pfborderimage.cpp)
173162

174163
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

0 commit comments

Comments
 (0)