[CMake] 1 tricky question, 1 bug report

Bill Hoffman bill.hoffman at kitware.com
Fri Mar 13 13:13:36 EDT 2009


Denis Scherbakov wrote:
> Eric,
> 
> Your solution requires a developer to know too much about the
> project,
which is not always true and basically to answer a full-scale
questionnaire before compilation. What if it is a new developer? What if
it is not a developer, but a user who expects everything to compile
automatically?
> 
> My question is simple:
> 
> What is the way to get some code executed not during
cmake-compilation, but when a user types "gmake something" and it
becomes clear which dependencies are needed.

What you can do is something like this:

IF ( LIBXML2_FOUND )
   # add executables and sub_directories that use libxml2 in here
ELSE()
    MESSAGE(STATUS "libxml2 was not found, X, Y, and Z will not be built")
ENDIF ()


If you have a FATAL_ERROR, nothing will get built.

-Bill


More information about the CMake mailing list