[CMake] ExternalProjects_Add limitations

Bill Hoffman bill.hoffman at kitware.com
Mon Jan 6 10:05:42 EST 2014


On 1/5/2014 12:14 PM, Rob McDonald wrote:
>
> I have since tried moving to a two-class system, where my main project
> is not ExternalProject_Add'ed, but the big dependencies are.  This of
> course runs into the problem where the libraries are not built when the
> FindXXX.cmake modules go looking for them, the configure phase fails and
> nothing ever gets built.
>
> I believe the solution to this is prolific use of ADD_DEPENDENCIES, but
> I also believe that solution requires setting XXX_INCLUDE_DIR and
> XXX_LIBRARIES manually rather than through FindXXX.cmake.  That seems
> fragile and difficult to me.
>
>
There is not a good way to make this work.  Everything HAS to be 
external project including your project.  You have a couple of options:

1. leave it with your project as an external project along with the 
other depends.  Then instruct your developers to use this to build the 
project the first time.  After that they should be able to open your 
project directly in the IDE and all will look normal.


2. Break it into two parts:
    - your projects depends
    - your project

   Have your project find the projectdepends project and get all the 
find stuff to work that way.

-Bill



More information about the CMake mailing list