[CMake] Dependencies and libraries..How does it work?

David Springate david.springate at gmail.com
Fri Jun 17 05:06:02 EDT 2011


Hi,

Thanks for the reply - but I think you might have misunderstood my question.

I want to setup CMake so that when I call Cmake like so (for MY_APP):
mkdir build && cd build
cmake .. -G Xcode

that the cmake call will be able to 'know' that it needs MY_LIB, find where
the MY_LIB CMakeLists.txt file is, build it, and then continue with the
cmake call for MY_APP.

Any ideas?

David

On 17 June 2011 08:18, J.S. van Bethlehem <j.s.van.bethlehem at astro.rug.nl>wrote:

> Hej David,
>
> From your description I think all your build script needs to do is:
>
> mkdir build && cd build
> cmake ..
> make MY_APP
>
> Further, assuming your library also gets build with CMake, you probably
> have an add_directory(../MY_LIB ../MY_LIB) in your main lists-file
> (otherwise you should) and then the link_directories() command is not
> needed. I created sort of a 'standard' machinery for building a list of
> 'sub-packages' using CMake. It's not well documented and probably still has
> many issues, but I could mail it to you if you think it may help you get
> started and if you're interested.
>
> Greetsz,
> Jakob
>
> On 06/16/2011 11:54 PM, David Springate wrote:
>
>> Hi,
>>
>> I am new to CMake - and whilst I am immediately impressed with it's
>> relative ease of use - I have a 'noob' question, I'm sure!
>>
>> I have the following:
>> A library called MY_LIB that builds with a cmake command (I have created a
>> nice CMakeLists.txt file)
>> An application called MY_APP that builds a nice application - and even
>> links in MY_LIB using:
>> link_directories("../MY_LIB")
>> target_link_libraries(MY_APP MY_LIB)
>>
>> Now, first of all I know that I'm not supposed to use relative paths.. but
>> we'll call a side issue.. (though I'd be happy to hear the correct way of
>> doing things!) - the real problem that I have is this:
>>
>> Give than MY_LIB is built using CMake and MY_APP is built using CMake..
>> how can I setup my build scripts so that I can call CMake once for MY_APP,
>> it'll realise that it needs MY_LIB, which hasn't yet been built, invoke
>> CMake for MY_LIB and then link itself with MY_APP?
>>
>> I ask because I use libraries heavily to organise my code (and reuse) and
>> would love to switch to CMake for all my building (XCode 4 has forced my
>> hand!) but I can't seem to figure this out.
>>
>> Please help a newcomer out - any help is greatly appreciated!
>>
>> Thanks,
>>
>> David
>>
> ______________________________**_________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<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<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>



-- 
David Springate
david.springate at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110617/47dc4391/attachment.htm>


More information about the CMake mailing list