CMake + Qt: define moc / ui output directory

I am currently migrating a project built with qmake to CMake.

In the version with qmake, the .pri file was

MOC_DIR = .moc/$${PLATFORM_NAME}

which allows the creation of temporary MOC files in a given directory, while keeping the sources clean. How to do the same with CMake?

Note: with CMake I use the package FindQt4.cmakeand command QT4_WRAP_CPP().

+5
source share
1 answer

, - , CMake "out-of-source" . Windows, " " , " ". Unix, :

cd <source directory>
mkdir build
cd build
cmake ..
make

CMake , , . (: . . CMake wiki.

" " , . , Qt4Macros.cmake, CMake 2.8, . :

SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})

MOC include, , .

#include "moc/mainwindow.moc"

moc , MOC .

+4

All Articles