[CMake] How to build and link Externa Project with exported target

Nicola Brisotto nicolabrisotto at gmail.com
Wed Mar 17 08:17:00 EDT 2010


Hi!
I'm building a project that require a 3rd party library libqxmpp. Both project uses cmake 
I want to build libqxmpp with ExternalProject_add, this the code I use:

ExternalProject_add(
	libqxmpp
	#no download, i'm using git submodule
	DOWNLOAD_COMMAND ""
	CMAKE_ARGS -DQT_QMAKE_EXECUTABLE=/devel/BIN/v4.6.1-git-phonon-dbg-release/bin/qmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
	SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/3rdparty/qxmpp-read-only-git/source
)

The problem arise when I try to import a target from libqxmpp adding this to my project CMakeLists.txt:
#Import libQXmppClient 
include(${CMAKE_BINARY_DIR}/include/QXmppClient/QXmppClient.cmake)

Cmake cannot find QXmppClient.cmake because it will be created when I'll build the project.
How can I solve this problem? Are there better solution to build and link an external project?

This is the libqxmpp snippet that export the target:

INSTALL(TARGETS QXmppClient EXPORT QXmppClient DESTINATION lib)
INSTALL(EXPORT QXmppClient DESTINATION include/QXmppClient )

Nicola Brisotto
vcard







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100317/03c943cc/attachment.htm>


More information about the CMake mailing list