[CMake] How to differ?

Eric Noulard eric.noulard at gmail.com
Fri Oct 29 12:56:14 EDT 2010


2010/10/29 Thomas Lehmann <t.lehmann at rtsgroup.net>:
> At the end you can see a version which was working well
> but we found it somewhat complicated with the paths.

I did not see any attachment or inline copy of CMakeLists.txt

[...]

>> and for each app there will be some
>> projects/apps/YYYY/CMakeLists.txt which contains
>> add_executable(YYYY <list of source>)
>> target_link_library(YYYY XXXX)
>> include_directories(${CMAKE_SOURCE_DIR}/libs/XXXX)
>
> Yes. But how do that program generate the libraries
> when they are not build yet?

Because CMake should handle the dependency because
of the target_link_library.

By the way which CMake version do you use?
And which CMake Generator (Makefile, Visual Studio project...)
on which platform (Linux, Windows, MacOS etc...)

>> from this structure you should be able to build part or all of the
>> target
>> just by calling the appropriate one. CMake should take care of building
>> the dependencies using the "target_link_library" links.
>>
>
> cmake can be used for different paths in a source tree.
>
> Trying to create both apps both are trying to build both
> libraries on different locations - cmake complains.

What do you mean by "complains"?
Could you copy/paste the complain you get from CMake?

> The command after here fails without handling to use
> "link_directories" or "add_subdirectory" properly:
>
> /tmp/obj> cmake /projects/apps

You could do:

/tmp/obj> cmake /projects

the

1) rebuild all
2) build a set of applications
3) build just one application


> 1) I can rebuild all
> 2) I can build a set of applications
> 3) I can build just one application
>
> Independent on what scenario I use I want to ensure that
> all dependencies are built and used.

Then you should launch CMake on the whole set of (lib, apps etc...)
and only build what you want.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list