[CMake] Project dependencies
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Apr 18 04:52:17 EDT 2010
Hi Benjamin,
On Friday 16 April 2010, Benjamin Eikel wrote:
> Hello,
>
> maybe my first post was not clear enough.
> I created a minimal example to demonstrate what I mean (see attached
> files). That example contains a library called MyLib and a binary called
> MyBin. The enclosed shell script can be used to build the binary on Linux.
> At first the library will be configured such that the file
> "MyLibConfig.cmake" will be created. After that the binary will be
> configured and a build will be started. The build will fail because the
> library was intentionally not build before. After that another way of
> including the library is used. The second "CMakeLists.txt" file uses
> add_subdirectory to reference the library.
Yes, that's the normal way to do it.
> When issuing a make command now,
> the library will be built automatically. My question is if it is possible
> to achieve this behavior when using the approach mentioned first. This
> would make things easier in our projects when there are multiple
> dependencies to different libraries which will be changed often and a build
> of the binary should be triggered automatically.
The normal and recommended way to to add all that (via add_subdirectory) into
one CMake project. What is speaking against this in your case ?
If you really want to have it separated, you may try how far you can get with
externalproject_add(), but I would assume that the straightforward approach
(add_subdirectory) will work much better.
Alex
More information about the CMake
mailing list