summaryrefslogtreecommitdiffstats
path: root/cmake/modules/MacroOptionalFindPackage.cmake
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
commit36ebfd411b358fb4797d31d23f945e8f6844d15a (patch)
tree9c8982d1da82fdffea8d2a741dba82e927874869 /cmake/modules/MacroOptionalFindPackage.cmake
parent4ceb86d29a68ebe52b20c8c090bc90c68a58f8c8 (diff)
* cmake: new directory, contains cmake build support.
See http://www.cmake.org for more informations. Currently only unix will be buildable because some win32 required files are still missing.
Diffstat (limited to 'cmake/modules/MacroOptionalFindPackage.cmake')
-rw-r--r--cmake/modules/MacroOptionalFindPackage.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/modules/MacroOptionalFindPackage.cmake b/cmake/modules/MacroOptionalFindPackage.cmake
new file mode 100644
index 00000000..70681312
--- /dev/null
+++ b/cmake/modules/MacroOptionalFindPackage.cmake
@@ -0,0 +1,22 @@
+# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
+# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
+# This macro is a combination of OPTION() and FIND_PACKAGE(), it
+# works like FIND_PACKAGE(), but additionally it automatically creates
+# an option name WITH_<name>, which can be disabled via the cmake GUI.
+# or via -DWITH_<name>=OFF
+# The standard <name>_FOUND variables can be used in the same way
+# as when using the normal FIND_PACKAGE()
+
+MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
+ OPTION(WITH_${_name} "Search for ${_name} package" ON)
+ if (WITH_${_name})
+ FIND_PACKAGE(${_name} ${ARGN})
+ else (WITH_${_name})
+ set(${_name}_FOUND)
+ set(${_name}_INCLUDE_DIR)
+ set(${_name}_INCLUDES)
+ set(${_name}_LIBRARY)
+ set(${_name}_LIBRARIES)
+ endif (WITH_${_name})
+ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
+