[CMake] Install Export and include
Michael Wild
themiwi at gmail.com
Thu Apr 22 08:52:44 EDT 2010
On 22. Apr, 2010, at 14:44 , Nicola Brisotto wrote:
> Hi,
> I'm building a library QXmppClient that export properties with INSTALL (EXPORT ...)
> How can I also export a variable with the include path of the library?
>
> In the executable project I use find_package(QXmppClient). The target QXmppClient is imported so I can link with:
> TARGET_LINK_LIBRARIES(myexecutable QXmppClient )
>
> This is a snippet from the QXmppClient CMakeLists.txt:
>
> ADD_LIBRARY(QXmppClient ${SRC})
> TARGET_LINK_LIBRARIES( QXmppClient ${LIB} )
>
> INSTALL(TARGETS QXmppClient EXPORT QXmppClientConfig
> DESTINATION lib/QXmppClient )
> INSTALL(FILES
> ${Qt4_MOC}
> DESTINATION include/QXmppClient)
> #Export Target into include dir
> INSTALL(EXPORT QXmppClientConfig DESTINATION lib/QXmppClient )
>
>
> Nicola Brisotto
Call your export file QXmppClientExports instead, create a file QXmppClientConfig.cmake.in in which you include the QXmppClientExports.cmake file and configure it appropriately. In that same file you can then set QXMPPCLIENT_INCLUDE_DIR, QXMPPCLIENT_LIBRARIES etc.
HTH
Michael
More information about the CMake
mailing list