Home | History | Annotate | Download | only in modules
      1 # - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
      2 # MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
      3 # This macro is a combination of OPTION() and FIND_PACKAGE(), it
      4 # works like FIND_PACKAGE(), but additionally it automatically creates
      5 # an option name WITH_<name>, which can be disabled via the cmake GUI.
      6 # or via -DWITH_<name>=OFF
      7 # The standard <name>_FOUND variables can be used in the same way
      8 # as when using the normal FIND_PACKAGE()
      9 
     10 MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
     11    OPTION(WITH_${_name} "Search for ${_name} package" ON)
     12    if (WITH_${_name})
     13       FIND_PACKAGE(${_name} ${ARGN})
     14    else (WITH_${_name})
     15       set(${_name}_FOUND)
     16       set(${_name}_INCLUDE_DIR)
     17       set(${_name}_INCLUDES)
     18       set(${_name}_LIBRARY)
     19       set(${_name}_LIBRARIES)
     20    endif (WITH_${_name})
     21 ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
     22 
     23