[cmake-developers] [CMake] Debugging find_package() search behavior?

Rolf Eike Beer eike at sf-mail.de
Tue Aug 29 13:12:02 EDT 2017


Am Dienstag, 29. August 2017, 11:21:42 schrieb Robert Dailey:
> Ok I debugged find_path() code in CMake and I determined the problem.
> First, let me explain what I'm doing a little more...
> 
> I build third party libraries on demand during configure step in
> CMake. I do so via execute_process() to invoke another CMake instance,
> that builds and installs a library. This is similar to how
> ExternalProject_Add() works, but forces it to happen at configure time
> so I can use find_package() afterwards to find the library I just
> built.

The trick with ExternalProject_Add is to also build your project with it, and 
not with add_subdirectory, i.e. the CMakeLists.txt that drives the build needs 
to be one level above your actual project. This way all things are done in 
order, so the dependencies are build before your main project.

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20170829/044c3c18/attachment.sig>


More information about the cmake-developers mailing list