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

Chris Stankevitz chrisstankevitz at gmail.com
Mon Mar 18 13:57:17 EDT 2013


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


More information about the CMake mailing list