[CMake] Qt - Private implementation slot and required cmake special rules

John Drescher drescherjm at gmail.com
Wed Mar 3 13:59:46 EST 2010


On Wed, Mar 3, 2010 at 1:37 PM, Olaf Peter <ope-devel at gmx.de> wrote:
> I try to use Qt's internal Stuff for my own purpose. I want to compile
> the moc file separately which is with cmake very simple. Anyway, I have
> to tweak moc for this.
>
> I have to add the private type to the moc file generated otherwise I get
> an compiler error about incomplete type (the "public" header forwards
> only the private), in this case simple by e.g.
>
> /usr/bin/moc-qt4 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
> -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
> -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. slotTest.h
> -fslotTest_p.h -o moc_slotTest.cpp
>
> Note the -fslotTest_p.h
>
> Now I've the private header included, but how to say this for cmake for
> the general case?? QT4_WRAP_CPP allows addition options, but how to get
> the private header?
>

Use QT4_AUTOMOC in these cases.

SET( wwWidgets_SRCS
	./widgets/qwwnumpad/qwwnumpad.cpp
	./widgets/wwglobal_p.cpp
	./widgets/qwwbuttonlineedit.cpp
	./widgets/qwwfilechooser/qwwfilechooser.cpp
)

SET( wwWidgets_EXT_HDRS
	./widgets/qwwnumpad/qwwnumpad.h
	./widgets/wwglobal.h
	./widgets/wwglobal_p.h
	./widgets/qwwbuttonlineedit.h
	./widgets/qwwbuttonlineedit_p.h
	./widgets/qwwfilechooser/qwwfilechooser.h
)

# some .ui files
SET( wwWidgets_UIS
)

# and finally an resource file
SET( wwWidgets_RCS
)

SET( wwWidgets_INT_HDRS

)


QT4_AUTOMOC(${wwWidgets_SRCS} ${wwWidgets_EXT_HDRS})

include_directories(
	${PROJECT_BINARY_DIR}
	${PROJECT_BINARY_DIR}/..
	${wwWidgets_TREE_INCLUDE}
)

add_library(wwWidgets
	${wwWidgets_SRCS}
	${wwWidgets_EXT_HDRS}
	${wwWidgets_INT_HDRS}
)

John


More information about the CMake mailing list