Hi Michael and Nicola,
I'm in a similar situation as I' m trying to build up a cmake based
dependency builder for OpenSceneGraph based projects:
So I' m really interested in any "best practice" advice
Michael Wild wrote:
On 17. Mar, 2010, at 13:17 , Nicola Brisotto wrote:
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
)
Means there is a way to instruct
ExternalProject_add
to download from GIT repos? I was not aware of and starting to hack it to
add... let me know if one is available:
I have already added Bazaar download similarly to SVN ... so if there is a way
to share hacking on it
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 )
Sorry my ignorance, this is part of the install step of QXmppClient ?
Nicola Brisotto
vcard
There are two ways of getting around this:
1) create the IMPORTED targets yourself.
2) also build your main project wit a ExternalProject_Add and drive the whole thing from
a "master-CMakeLists.txt"
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:
- In the master project do all the feature-detection and setting of cache
variables (such as options etc)
- Write a cache-initializer script to the binary tree
- Do all the ExternalProject_Add calls and specify the cache-initializer script
with the -C option in CMAKE_ARGS
This suggestion is really interesting: the purpouse is to let any
config options in the "master" projects to be passed to the "slaves"?
Have you any examples?
I came up with a schema like 2:
any project is built as external, dependencies are resolved by
ExternalProject_Add and I have used CMAKE_ARGS to communicate settings:
As most of cmake projects were based on FindXXX stuff for finding deps,
I have overridden the necessary modules in order to make the projects
find the good components at configure time.
As I did not yet need a lot of interactive customization, I just passed
common parameters using CMAKE_ARGS
Would not something similar work for you:
keep your project separate from libqxmpp, add to it a
find_package(QXmppClient)
then build a "master" project where you do:
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
)
ExternalProject_Add(<your_project_name>
DEPENDS libqxmpp
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/<your project subsource dir>
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
HTH
Luigi
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake