]> git.sesse.net Git - vlc/blob - bindings/phonon/cmake/modules/MacroOptionalFindPackage.cmake
816cdb7e8723f54c6ffc4bda2349dd56fb544a8c
[vlc] / bindings / phonon / cmake / modules / MacroOptionalFindPackage.cmake
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 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
11 #
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
15
16 MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
17    OPTION(WITH_${_name} "Search for ${_name} package" ON)
18    if (WITH_${_name})
19       FIND_PACKAGE(${_name} ${ARGN})
20    else (WITH_${_name})
21       set(${_name}_FOUND)
22       set(${_name}_INCLUDE_DIR)
23       set(${_name}_INCLUDES)
24       set(${_name}_LIBRARY)
25       set(${_name}_LIBRARIES)
26    endif (WITH_${_name})
27 ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
28