[CMake] CMake Error: Qt5::moc target not found ?

Nils Gladitz nilsgladitz at gmail.com
Thu Mar 20 08:36:03 EDT 2014


On 20.03.2014 12:18, Martin Koller wrote:
> However bulding on CentOS 6 gives me the following error
> (and a lot others like this) which I have no idea what cmake
> wants to tell me with:
> CMake Error: Qt5::moc target not found ui_automoc
>
> what does that mean ?

It means it is trying to use "Qt::moc" which is an IMPORTED executable 
defined by the Qt5 configuration files rather than the QT_MOC_EXECUTABLE 
variable.

It is setup with code similar to:
     add_executable(Qt5::moc IMPORTED)

     set_target_properties(Qt5::moc PROPERTIES
         IMPORTED_LOCATION "/path/to/moc"
     )

For a smoother experience I'd use find_package() (and CMAKE_PREFIX_PATH) 
for local builds as well rather than trying to mimic the behavior of the 
configuration files.

Nils


More information about the CMake mailing list