[Cmake] QT_WRAP_CPP create files in the wrong place

Natros natros at gmail.com
Thu Aug 26 12:19:13 EDT 2004


I have the fallowing directory structure

/build/
/CMakeLists.txt
/main.cc
/subdir/view.h
/subdir/view.cc

and this is what I have in CMakeLists.txt

PROJECT(xyz)
FIND_PACKAGE(Qt)
QT_WRAP_CPP(xyz MocSources subdir/view.h)
ADD_EXECUTABLE(xyz ${MocSources} subdir/view.cc main.cc)
ADD_DEFINITIONS(${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(xyz ${QT_LIBRARIES})

When I run make in build directory, the generated Makefile instructs
moc to generate moc_view.cxx  in /build directory instead of 
/build/subdir. The view.cc is compiled in the right place
(subdir/view.o) as moc_view.cxx should be

$ cd build
$ make
Building QT Wrapped File /home/natros/xyz/build/moc_view.cxx...
Building dependencies cmake.check_depends...
Building object file moc_view.o...
Building object file subdir/view.o...
Building object file main.o...
Building executable /home/natros/xyz/cmakebug/build/xyz...
-- 
Natros


More information about the Cmake mailing list