From: Manuel Nickschas Date: Tue, 8 Jul 2008 15:30:41 +0000 (+0200) Subject: Fixing a stupid bugs in FindQt4.cmake X-Git-Tag: 0.3.0~293 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5be9872ecc1dd4eff6e220121b44eeb7208a1194 Fixing a stupid bugs in FindQt4.cmake The moc should not need -I options (since it does not include directories)... on the other hand, -D options make a lot of sense, since moc compiles conditionally then. --- diff --git a/cmake/modules/FindQt4.cmake b/cmake/modules/FindQt4.cmake index ebd01062..dc4969b2 100644 --- a/cmake/modules/FindQt4.cmake +++ b/cmake/modules/FindQt4.cmake @@ -1142,10 +1142,20 @@ IF (QT4_QMAKE_FOUND) ENDMACRO(QT4_GET_MOC_INC_DIRS) + # Added by Sput to provide definitions to moc calls + MACRO (QT4_GET_MOC_DEFINES _moc_DEFINES) + SET(${_moc_DEFINES}) + GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) + FOREACH(_current ${_defines}) + SET(${_moc_DEFINES} ${${_moc_DEFINES}} -D${_current}) + ENDFOREACH(_current ${_defines}) + + ENDMACRO(QT4_GET_MOC_DEFINES) MACRO (QT4_GENERATE_MOC infile outfile ) # get include dirs - QT4_GET_MOC_INC_DIRS(moc_includes) + # QT4_GET_MOC_INC_DIRS(moc_includes) # Not needed... + QT4_GET_MOC_DEFINES(moc_defines) GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) @@ -1161,7 +1171,7 @@ IF (QT4_QMAKE_FOUND) ELSE (MSVC_IDE) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_includes} -o ${outfile} ${abs_infile} + ARGS ${moc_includes} ${moc_defines} -o ${outfile} ${abs_infile} DEPENDS ${abs_infile}) ENDIF (MSVC_IDE) @@ -1175,7 +1185,8 @@ IF (QT4_QMAKE_FOUND) MACRO (QT4_WRAP_CPP outfiles ) # get include dirs - QT4_GET_MOC_INC_DIRS(moc_includes) + # QT4_GET_MOC_INC_DIRS(moc_includes) # Not needed + QT4_GET_MOC_DEFINES(moc_defines) QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) FOREACH (it ${moc_files}) @@ -1185,7 +1196,7 @@ IF (QT4_QMAKE_FOUND) SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_includes} ${moc_options} -o ${outfile} ${it} + ARGS ${moc_includes} ${moc_defines} ${moc_options} -o ${outfile} ${it} DEPENDS ${it}) SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH(it) @@ -1343,7 +1354,9 @@ IF (QT4_QMAKE_FOUND) ENDMACRO(QT4_ADD_DBUS_ADAPTOR) MACRO(QT4_AUTOMOC) - QT4_GET_MOC_INC_DIRS(_moc_INCS) + # QT4_GET_MOC_INC_DIRS(_moc_INCS) + QT4_GET_MOC_DEFINES(_moc_DEFINES) + SET(_matching_FILES ) FOREACH (_current_FILE ${ARGN}) @@ -1375,7 +1388,7 @@ IF (QT4_QMAKE_FOUND) SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) ADD_CUSTOM_COMMAND(OUTPUT ${_moc} COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_moc_INCS} ${_header} -o ${_moc} + ARGS ${_moc_INCS} ${_moc_DEFINES} ${_header} -o ${_moc} DEPENDS ${_header} ) diff --git a/cmake/modules/README b/cmake/modules/README index a9d951bd..fa122a85 100644 --- a/cmake/modules/README +++ b/cmake/modules/README @@ -1,7 +1,11 @@ These modules have been copied from KDE's repository as of 2008-06-17. FindQt4 has been adjusted to still contain the library deps and Qt config -stuff from the original FindQt4 (of cmake 2.4.7). +stuff from the original FindQt4 (of cmake 2.4.7). Also, I've fixed OpenSSL +detection (actually setting -DQT_NO_OPENSSL if it's not present) and +also provide -D to moc rather than -I. + +Files starting with Quassel* are solely created by us. Below is the contents of KDE's original README: