diff options
-rw-r--r-- | modules/KDE4Macros.cmake | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index e72c50d2..d17def4a 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -216,21 +216,23 @@ macro(KDE4_HANDLE_AUTOMOC _target_NAME _SRCS) endif(NOT _generated AND NOT _skip) endforeach (_current_FILE) - set(_automoc_source "${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_automoc.cpp") - GET_DIRECTORY_PROPERTY(_moc_incs INCLUDE_DIRECTORIES) - CONFIGURE_FILE(${KDE4_MODULE_DIR}/kde4automoc.files.in ${_automoc_source}.files) - add_custom_command(OUTPUT ${_automoc_source} - COMMAND ${KDE4_AUTOMOC_EXECUTABLE} - ${_automoc_source} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${QT_MOC_EXECUTABLE} - DEPENDS ${${_SRCS}} ${_moc_headers} ${_automoc_source}.files ${_KDE4_AUTOMOC_EXECUTABLE_DEP} - ) - # the OBJECT_DEPENDS is only necessary when a new moc file has to be generated that is included in a source file - # problem: the whole target is recompiled when the automoc.cpp file is touched - # set_source_files_properties(${${_SRCS}} PROPERTIES OBJECT_DEPENDS ${_automoc_source}) - set(${_SRCS} ${_automoc_source} ${${_SRCS}}) + if(_moc_files) + set(_automoc_source "${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_automoc.cpp") + GET_DIRECTORY_PROPERTY(_moc_incs INCLUDE_DIRECTORIES) + CONFIGURE_FILE(${KDE4_MODULE_DIR}/kde4automoc.files.in ${_automoc_source}.files) + add_custom_command(OUTPUT ${_automoc_source} + COMMAND ${KDE4_AUTOMOC_EXECUTABLE} + ${_automoc_source} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${QT_MOC_EXECUTABLE} + DEPENDS ${${_SRCS}} ${_moc_headers} ${_automoc_source}.files ${_KDE4_AUTOMOC_EXECUTABLE_DEP} + ) + # the OBJECT_DEPENDS is only necessary when a new moc file has to be generated that is included in a source file + # problem: the whole target is recompiled when the automoc.cpp file is touched + # set_source_files_properties(${${_SRCS}} PROPERTIES OBJECT_DEPENDS ${_automoc_source}) + set(${_SRCS} ${_automoc_source} ${${_SRCS}}) + endif(_moc_files) endmacro(KDE4_HANDLE_AUTOMOC) macro(KDE4_INSTALL_TS_FILES _lang _sdir) |