[CMake] Do not build targets whose dependencies are not available

Ansis Māliņš ansis.malins at gmail.com
Tue Mar 19 06:13:05 EDT 2013


find_package(a)
if(a_FOUND)
    ExternalProject_Add(b PREFIX blabla ...)
endif()


On Mon, Mar 18, 2013 at 7:57 PM, Chris Stankevitz <chrisstankevitz at gmail.com
> wrote:

> Hello,
>
> I have a library target ("a") that is a dependency of an executable
> ("b").  I have many more libraries and many more executable, some with
> "complex" dependencies on the others.  Sometimes target "a" cannot be
> built either because the user does not want it built or because
> FIND_PACKAGE failed to find a dependency of "a".
>
> Q: Can cmake automatically not build "b" when "a" is not available?
>
> I hope the answer is "yes" otherwise I will have to add IF(HAVE_A)
> code throughout my CMakeLists.txt file.  Worse, in my complex file I
> will have to add lots of IF(HAVE_C), IF(HAVE_D) etc.
>
> Thank you,
>
> Chris
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130319/5aac7ace/attachment.htm>


More information about the CMake mailing list