ExternalProject and libraries again

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ExternalProject and libraries again

Bruce Stephens
(This is really a continuation of a discussion from 25/26 January.)

I'm still confused about ExternalProject_Add and libraries.

I'd like to get to the point where I (or more likely a process
somewhere) can check out a project, then run cmake and ninja (or make
or whatever) and have that build the project and its dependencies.

Concretely, suppose I have a trivial project that uses libcrypto from
OpenSSL and I have a local repository with OpenSSL with some patches
to build it with cmake.

One suggestion is that I can use ExternalProject_Add to download and
build this openssl which can then export a FindOpenSSL.cmake script.
But that happens too late, doesn't it?

When I run cmake on my project it can't use find_library and things to
find the right library files since those won't exist until I actually
build the project?

Hence hunter's approach of downloading and building projects during
the cmake process, I imagine. Which feels a bit icky, but maybe it's
really the most straightforward way to do it?

I think I might resort to some trickery: build the various dependent
things on the platforms I care about, and then have my main project
just know about where the interesting targets are relative to
BINARY_DIR for each of the external projects. (Or use the approach of
hunter, or use some build script.)

Am I missing something obvious? It feels like I must be somehow.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProject and libraries again

Nicholas Braden
I'm not sure which discussion you're referring to, so forgive me if
this was already mentioned - but are you using a superproject to
ensure that dependencies are built and installed before your own
project? That is, all dependencies as well as your own project are
built via ExternalProject_Add and you use the DEPENDS option to ensure
build order. This is generally the easiest way to do things, in my
experience.

On Wed, Mar 9, 2016 at 3:22 PM, Bruce Stephens
<[hidden email]> wrote:

> (This is really a continuation of a discussion from 25/26 January.)
>
> I'm still confused about ExternalProject_Add and libraries.
>
> I'd like to get to the point where I (or more likely a process
> somewhere) can check out a project, then run cmake and ninja (or make
> or whatever) and have that build the project and its dependencies.
>
> Concretely, suppose I have a trivial project that uses libcrypto from
> OpenSSL and I have a local repository with OpenSSL with some patches
> to build it with cmake.
>
> One suggestion is that I can use ExternalProject_Add to download and
> build this openssl which can then export a FindOpenSSL.cmake script.
> But that happens too late, doesn't it?
>
> When I run cmake on my project it can't use find_library and things to
> find the right library files since those won't exist until I actually
> build the project?
>
> Hence hunter's approach of downloading and building projects during
> the cmake process, I imagine. Which feels a bit icky, but maybe it's
> really the most straightforward way to do it?
>
> I think I might resort to some trickery: build the various dependent
> things on the platforms I care about, and then have my main project
> just know about where the interesting targets are relative to
> BINARY_DIR for each of the external projects. (Or use the approach of
> hunter, or use some build script.)
>
> Am I missing something obvious? It feels like I must be somehow.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProject and libraries again

Bruce Stephens
On Wed, Mar 9, 2016 at 9:27 PM, Nicholas Braden
<[hidden email]> wrote:
> I'm not sure which discussion you're referring to, so forgive me if
> this was already mentioned - but are you using a superproject to
> ensure that dependencies are built and installed before your own
> project? That is, all dependencies as well as your own project are
> built via ExternalProject_Add and you use the DEPENDS option to ensure
> build order. This is generally the easiest way to do things, in my
> experience.

Ah! That makes sense. So I have a project (say a single
CMakeLists.txt) which just contains one or more ExternalProject_Add
(maybe other things too, but not much else), and then the subprojects
can sensibly get at previous subprojects. And those can be ordered
using DEPENDS.

OK, I see how that can work. Thanks (and apologies, I'm sure I've read
that advice before but probably I didn't understand it then).
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake