[Cmake] problems with build order
Landshark
landshark9 at comcast . net
29 Dec 2003 16:11:00 -0600
Hello,
I'm trying to port my current Qt-based C++ project from QMake to CMake
and have run into a snag or two.
My project is laid out like this:
/root-src
CMakeLists.txt
file1.cpp
file1.h
file2.cpp
file2.h
file3.cpp
file3_needs_moc.h
/swig-wrappers
CMakeLists.txt
file1.i
file2.i
/ui
CMakeLists.txt
ui1.ui
So there are 2 sub-directories. I have the root-src CMakeLists.txt
setup and it appears to moc and compile those files just fine.
I also have swig-wrappers and ui listed with the SUBDIRS() command.
However, 2 different operations have to occur in swig-wrappers and ui.
In swig-wrappers, I have created custom commands to execute swig to
generate wrappers from the interface files and produce a .cpp file.
This is listed as a file in the root-src CMakeLists.txt.
In the ui directory, I have used the ADD_LIBRARY() command to add the
libraries and QT_WRAP_UI is used to convert the .ui files to .h and
.cxx.
The problem is that the main directory is built before the
subdirectories (eg: root-src is built before swig-wrappers and ui).
Some of the files in root-src depend on the resulting files from the ui
and swig-wrappers subdirectories.
I've tried adding dependencies on the executable to the ui library, but
this doesn't change the build order.
This is sort of a confusing mail, I apologize. But I really like the
CMake build system and would love to convert my project over to it.
If needed, I can post the CMakeLists.txt files.
-dave