[CMake] Need some directions for non-trivial setup

Marcel Loose loose at astron.nl
Wed Dec 8 04:20:18 EST 2010


>>> On 7-12-2010 at 11:59, in message
<AANLkTimSsr9MQjgkhkZ9XDTgh=1b9vSU1UTLB90vbkPq at mail.gmail.com>, Klaim
<mjklaim at gmail.com> wrote: 
>> 
>> I would try to start with just one (base-)project, try to get
>> everything in place and building the way you want it. If you're new
to
>> CMake, that's really the way to go. Once you have this base-project
>> ready, you can think of starting a second project, using the
>> base-project as EXTERNAL_PROJECT(), etc.
>>
>>
> Yes, I started like that exactly.
> I've setup a simple library project, with the minimum CMakeLists.txt
file.
> It generates correctly, find all required sources, correctly build
when I
> try to build with MSVC2010.
> 
> Now I tried to setup an executable project using this library
project.
> Maybe I'm kind of stupid but I can't find a clear
exlpaination/documentation
> about using EXTERNAL_PROJECT() so I failed so far to use it. Do you
have a
> simple example somewhere? I'm sure I missed something in the doc but
can't
> find what.
> 
> I'm also looking for a way to provide/retreive the include paths of
those
> external projects.

Hi Klaim,

I would suggest that you use the FIND_XXX commands when building
against your CMakeified library project. EXTERNAL_PROJECT() really is
meant for downloading, configuring, building, etc. of non-CMake
packages.

Since you have full control over all your different CMake projects,
your life is (much) easier. All you have to do is to generate
ConfigXXX.cmake files for your XXX library. These ConfigXXX.cmake files
should set the same variables as a FindXXX.cmake file would. Only
difference is that you can generate the ConfigXXX.cmake file using the
information about XXX availabe to CMake.

Hope this helps,
Marcel Loose.





More information about the CMake mailing list