<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Mike,<div>I'm back to this topic because the second solution create some problem with qt-creator parser of cmake project. If I import the project I have no source file loaded so the solution is not ok for me.</div><div>The first solution, &nbsp;"create the IMPORTED targets myself", means that I have to put something like the code below in my main CMakeList.txt?</div><div><br></div><div><div>#QXmppClient.cmake:</div><div># Generated by CMake 2.8.0</div><div><br></div><div>IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)</div><div>&nbsp;&nbsp; MESSAGE(FATAL_ERROR "CMake &gt;= 2.6.0 required")</div><div>ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)</div><div>CMAKE_POLICY(PUSH)</div><div>CMAKE_POLICY(VERSION 2.6)</div><div>#----------------------------------------------------------------</div><div># Generated CMake target import file.</div><div>#----------------------------------------------------------------</div><div><br></div><div># Commands may need to know the format version.</div><div>SET(CMAKE_IMPORT_FILE_VERSION 1)</div><div><br></div><div># Create imported target QXmppClient</div><div>ADD_LIBRARY(QXmppClient STATIC IMPORTED)</div><div><br></div><div># Load information for each installed configuration.</div><div>GET_FILENAME_COMPONENT(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)</div><div>FILE(GLOB CONFIG_FILES "${_DIR}/QXmppClient-*.cmake")</div><div>FOREACH(f ${CONFIG_FILES})</div><div>&nbsp;&nbsp;INCLUDE(${f})</div><div>ENDFOREACH(f)</div><div><br></div><div># Commands beyond this point should not need to know the version.</div><div>SET(CMAKE_IMPORT_FILE_VERSION)</div><div>CMAKE_POLICY(POP)</div><div><br></div><div><br></div><div><br></div><div>#QXmppClient-release.cmake&nbsp;</div><div>#----------------------------------------------------------------</div><div># Generated CMake target import file for configuration "Release".</div><div>#----------------------------------------------------------------</div><div><br></div><div># Commands may need to know the format version.</div><div>SET(CMAKE_IMPORT_FILE_VERSION 1)</div><div><br></div><div># Compute the installation prefix relative to this file.</div><div>GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)</div><div>GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)</div><div>GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)</div><div><br></div><div># Import target "QXmppClient" for configuration "Release"</div><div>SET_PROPERTY(TARGET QXmppClient APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)</div><div>SET_TARGET_PROPERTIES(QXmppClient PROPERTIES</div><div>&nbsp;&nbsp;IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"</div><div>&nbsp;&nbsp;IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "/devel/BIN/v4.6.1-git-phonon-dbg-release/lib/QtGui.framework;-framework Carbon;-framework AppKit;/devel/BIN/v4.6.1-git-phonon-dbg-release/lib/QtXml.framework;/devel/BIN/v4.6.1-git-phonon-dbg-release/lib/QtNetwork.framework;/devel/BIN/v4.6.1-git-phonon-dbg-release/lib/QtCore.framework;/usr/lib/libz.dylib;-framework ApplicationServices"</div><div>&nbsp;&nbsp;IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libQXmppClient.a"</div><div>&nbsp;&nbsp;)</div><div><br></div><div># Cleanup temporary variables.</div><div>SET(_IMPORT_PREFIX)</div><div><br></div><div># Commands beyond this point should not need to know the version.</div><div>SET(CMAKE_IMPORT_FILE_VERSION)</div><div><br></div><div><br></div></div><div><div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>On Mar 17, 2010, at 13:41 , Michael Wild wrote:</div></div></span></div></span></div></span></div></span></div></div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On 17. Mar, 2010, at 13:17 , Nicola Brisotto wrote:<br><br><blockquote type="cite">Hi!<br></blockquote><blockquote type="cite">I'm building a project that require a 3rd party library libqxmpp. Both project uses cmake <br></blockquote><blockquote type="cite">I want to build libqxmpp with ExternalProject_add, this the code I use:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">ExternalProject_add(<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>libqxmpp<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>#no download, i'm using git submodule<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>DOWNLOAD_COMMAND ""<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>CMAKE_ARGS -DQT_QMAKE_EXECUTABLE=/devel/BIN/v4.6.1-git-phonon-dbg-release/bin/qmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/3rdparty/qxmpp-read-only-git/source<br></blockquote><blockquote type="cite">)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The problem arise when I try to import a target from libqxmpp adding this to my project CMakeLists.txt:<br></blockquote><blockquote type="cite">#Import libQXmppClient <br></blockquote><blockquote type="cite">include(${CMAKE_BINARY_DIR}/include/QXmppClient/QXmppClient.cmake)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Cmake cannot find QXmppClient.cmake because it will be created when I'll build the project.<br></blockquote><blockquote type="cite">How can I solve this problem? Are there better solution to build and link an external project?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This is the libqxmpp snippet that export the target:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">INSTALL(TARGETS QXmppClient EXPORT QXmppClient DESTINATION lib)<br></blockquote><blockquote type="cite">INSTALL(EXPORT QXmppClient DESTINATION include/QXmppClient )<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Nicola Brisotto<br></blockquote><blockquote type="cite">vcard<br></blockquote><br>There are two ways of getting around this:<br><br>1) create the IMPORTED targets yourself.<br><br>2) also build your main project wit a ExternalProject_Add and drive the whole thing from a "master-CMakeLists.txt"<br><br>The first one is probably easier to set up, but requires you to guess the installation names and paths correctly. The second option requires you to restructure your whole build system and adds considerable complexity due to the communication between your master-project and the external projects. For this communication I'd try the following:<br><br>- In the master project do all the feature-detection and setting of cache variables (such as options etc)<br>- Write a cache-initializer script to the binary tree<br>- Do all the ExternalProject_Add calls and specify the cache-initializer script with the -C option in CMAKE_ARGS<br><br>HTH<br><br>Michael</div></blockquote></div><br></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Nicola Brisotto</div><div><a href="http://www.breezit.net/vcards/NicolaBrisotto.vcf">vcard</a></div></div><br class="Apple-interchange-newline"></div></div></body></html>