FILE(REMOVE) and FILE(APPEND) don't resolve relative filenames the same way

Brad King brad.king at kitware.com
Fri Mar 6 16:15:30 CET 2009


David Faure wrote:
> => Before QT4_CREATE_MOC_COMMAND calls 
> FILE(REMOVE ${_moc_parameters_file}), could you make it check that
> ${_moc_parameters_file} is an absolute path and not a relative one,
> since that's bound to fail and give unexpected results?

Please file a feature request in the bug tracker.

> (And the reason for all this: there doesn't seem to be a way to generate
> a foo.moc when foo.cpp defines a Q_OBJECT itself (rather than the header file)
> and foo.cpp includes foo.moc. Well, kde4automoc handles this, but I'm abusing
> this list to ask questions about a qt-only project ;) ). So I wrote this macro
> macro(macro_included_moc cppfile)
>   GET_FILENAME_COMPONENT(_basename ${cppfile} NAME_WE)
>   SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
>   qt4_generate_moc(${cppfile} ${_moc})
>   macro_add_file_dependencies(${cppfile} ${_moc})
> endmacro(macro_included_moc)
> 
> Alternative solution: including kde4automoc into cmake. I know we discussed
> it in the past and it was rejected, but this is another argument for it.
> My boss wouldn't let me add it as dependency, he wanted an
> "off-the-shelf cmake" solution: importing kde4automoc and integrating it
> into the compilation properly sounded like a bit too much trouble 
> for a single cpp file that defined a Q_OBJECT...)

If every Qt project needs something like this, wouldn't it make more sense for
Qt itself to provide an executables with the capabilities of kde4automoc?

-Brad


More information about the Kde-buildsystem mailing list