[CMake] dependencies/partial installs between add_subdirectories

Philip Lowman philip at yhbt.com
Fri Mar 6 02:47:14 EST 2009


On Thu, Mar 5, 2009 at 7:10 PM, Bill O'Hara <billtohara at gmail.com> wrote:

> Hi
>
> I'm writing a grand top-level CMakeLists.txt that delegates to a number of
> CMakeLists.txt in various subdirectories:
>
> add_subdirectories(foo)
> add_subdirectories(bar)
>
> Is there a straightforward to get cmake to do a make install for foo before
> continuing on to do bar? And to prevent a parallel build from starting in
> bar until this is completed for foo?


"bar" depending on the make installed form of "foo"?  Are you sure you want
this?  If bar depends on foo you probably want to use include_directories()
and target_link_libraries() to link against the compiled form of foo, not
what's make installed.



To answer your question though one way would be to use a variable for this:

if(USE_BAR)
   add_subdirectory(bar)
endif()

cmake ..
make install
cmake -DUSE_BAR=ON ..
make install

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090306/4235660e/attachment.htm>


More information about the CMake mailing list