root/sandbox/sigis/christian.gonzalez/trunk/cmake/MacroOptionalFindPackage.cmake

Revision 43, 1.0 KB (checked in by anton, 3 years ago)

trunk replaced with 1.0RC1

Line 
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
16MACRO (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})
27ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
28
Note: See TracBrowser for help on using the browser.