cmake_modules/utils.cmake
changeset 8686 d303da4568b7
child 8688 88a6114a318c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/utils.cmake	Thu Mar 07 10:14:12 2013 +0100
@@ -0,0 +1,19 @@
+
+macro(find_package_or_fail _PKG_NAME)
+    find_package(${_PKG_NAME})
+    string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP)
+    if(NOT ${_PKG_NAME_UP}_FOUND)
+        message(SEND_ERROR "Missing ${_PKG_NAME}! Please install it and rerun cmake.")
+    endif(NOT ${_PKG_NAME_UP}_FOUND)
+endmacro(find_package_or_fail _PKG_NAME)
+
+macro(find_package_or_disable _PKG_NAME _VAR_NAME)
+    find_package(${_PKG_NAME})
+    string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP)
+    if(NOT ${_PKG_NAME_UP}_FOUND)
+        message(SEND_ERROR "Missing ${_PKG_NAME}! Rerun cmake with -D${_VAR_NAME}=1 to build without it.")
+    endif(NOT ${_PKG_NAME_UP}_FOUND)
+endmacro(find_package_or_disable _PKG_NAME _VAR_NAME)
+
+#TODO: find_package_or_bundle
+