[Qt-interest] cmake: ui library?
Rui Maciel
rui.maciel at gmail.com
Mon Feb 13 22:16:33 CET 2012
I'm a cmake newbie and I've started a small pet project which relies on Qt
for the UI, and the project's build process is managed with cmake.
The project tree follows a deep structure, with the Qt source code and forms
stored in ~/src/ui, being ~ the project directory.
The UI has been designed following design by contract principles, and
therefore the remaining components only interact with the UI through a set
of interfaces which were defined previously.
Due to this, I would like to organize the UI part of this project as a
static library. With that in mind, I've added a CMakeLists.txt file to
~/src/ui, with the following content:
<example ~/src/ui/CMakeLists.txt>
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
set(libui_HEADERS
# some headers with Qt code
)
set(libui_SOURCES
# some sources which Qt code
)
set(libui_FORMS
#some Qt forms
)
</example>
Then, I proceeded to pass libui to the TARGET_LINK_LIBRARIES() command and
add ${libui_HEADERS} to the projec_HEADERS list.
Yet, when I try to compile the project, the compiler throws a series of
errors about "undefined reference to `vtable for <ui class name here>'".
So, does anyone know how to setup cmake to churn out a static library from
Qt code?
Thanks in advance,
Rui Maciel
More information about the Qt-interest-old
mailing list