Hello I've noticed some lake of features inside FindQt4.cmake qt4_automoc macro This patch intend to fix this. (patch against CMake 2.6.0)
How current qt4_automoc works: Looks for files that contain string: #include "*.moc" Issues: - With QMake, it is possible to specify also #include "moc_*.cpp" Current qt4_automoc does not handle this. Here the fix: - STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") + STRING(REGEX MATCHALL "#include +([^ ]+\\.moc[\">])|(\"moc_+[^ ]+\\.cpp[\">])" _match "${_contents}") - Current qt4_automoc doesn't check if the .h corresponding to the *.moc file exists. Sometimes the Q_OBJECT macro is directly inside the .cpp file and there is no .h file Here the fix: + IF(NOT EXISTS ${_header}) + SET(_header ${_abs_PATH}/${_basename}.cpp) + ENDIF(NOT EXISTS ${_header}) As you see .cpp extension is hardcoded but I don't think there is the need for using CMAKE_CXX_SOURCE_FILE_EXTENSIONS as QMake probably don't support it. Test: I managed to compile Phonon library that relies exclusively on #include "moc_*.cpp" and #include "*.moc" feature -- Tanguy Krotoff <[EMAIL PROTECTED]> +33 6 68 42 70 24
qt4automoc.patch
Description: Binary data
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake