aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2007-11-20 11:19:18 +0000
committerMatthias Kretz <kretz@kde.org>2007-11-20 11:19:18 +0000
commit4b274a9927bf2d5d42de69c63703d4284663a8c9 (patch)
tree9576b7ab97ae42df55f909fe28966b310cd7721a /modules
parentafc0b5adb7fcb1b62ba50c4bc1cc28b3364cc8f2 (diff)
downloadextra-cmake-modules-4b274a9927bf2d5d42de69c63703d4284663a8c9.tar.gz
extra-cmake-modules-4b274a9927bf2d5d42de69c63703d4284663a8c9.tar.bz2
if there's nothing to moc, don't add automoc source which is C++, then a lib with only C sources remains a C lib
svn path=/trunk/KDE/kdelibs/; revision=739064
Diffstat (limited to 'modules')
-rw-r--r--modules/KDE4Macros.cmake32
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)