On 17. Mar, 2010, at 14:37 , Luigi Calori wrote:
> 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
He's not downloading with CMake, he just told git that in this directory is a
submodule. The user has then to fetch it himself with one command:
http://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
[...]
>>
>> 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?
You could pass every single cache variable using -D in CMAKE_ARGS, but that
becomes pretty tedious very soon... Currently I don't have any example, sorry.
>
>
> 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.
That's what you could do with the cache-initialization script, no need to
override the FindXXX modules. If more than one of the external projects use the
same FindXXX module, do it in the master and then communicate the results using
the initializer script. This way the user can easily override the results
during the configure-step and get consistent results in all the sub-projects.
Only thing that has me worried is when the user aborts the build, changes the
settings in the master cache and then restarts the build. You'd need to somehow
set up correct dependencies...
If sub-project B does a FIND_PACKAGE(A REQUIRED) and A is built as another
sub-project, then you can specify A_DIR to the B project containing the path to
the directory containing its A-config.cmake.
Michael
_______________________________________________
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