summaryrefslogtreecommitdiffstats
path: root/cmake/CheckHasModule.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:06:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:06:32 +0000
commit2dad5357405ad33cfa792f04b3ab62a5d188841e (patch)
treeb8f8893942060fe3cfb04ac374cda96fdfc8f453 /cmake/CheckHasModule.cmake
parentInitial commit. (diff)
downloadremmina-2dad5357405ad33cfa792f04b3ab62a5d188841e.tar.xz
remmina-2dad5357405ad33cfa792f04b3ab62a5d188841e.zip
Adding upstream version 1.4.34+dfsg.upstream/1.4.34+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--cmake/CheckHasModule.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/cmake/CheckHasModule.cmake b/cmake/CheckHasModule.cmake
new file mode 100644
index 0000000..df160d0
--- /dev/null
+++ b/cmake/CheckHasModule.cmake
@@ -0,0 +1,47 @@
+# Remmina - The GTK+ Remote Desktop Client
+#
+# Taken from stackoverflow https://stackoverflow.com/questions/15706318/check-if-cmake-module-exists
+#
+# This makes use of the fact that if a package configuration file isn't found for VAR, then a cache variable VAR_DIR is set to VAR_DIR-NOTFOUND. So if the package configuration file is found, either this variable isn't defined, or it's set to a valid path (regardless of whether the find_package finds the requested package).
+#
+# So, if you do
+#
+# CheckHasModule(Spurious)
+# CheckHasModule(Threads)
+# message("\${HAS_MODULE_Spurious} - ${HAS_MODULE_Spurious}")
+# message("\${HAS_MODULE_Threads} - ${HAS_MODULE_Threads}")
+#
+# your output should be:
+#
+# ${HAS_MODULE_Spurious} - FALSE
+# ${HAS_MODULE_Threads} - TRUE
+#
+#
+#
+# Copyright (C) 2019 Antenore Gatta, Giovanni Panozzo
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+function(CheckHasModule Module)
+ find_package(${Module} QUIET)
+ if(NOT DEFINED ${Module}_DIR)
+ set(HAS_MODULE_${Module} TRUE PARENT_SCOPE)
+ elseif(${Module}_DIR)
+ set(HAS_MODULE_${Module} TRUE PARENT_SCOPE)
+ else()
+ set(HAS_MODULE_${Module} FALSE PARENT_SCOPE)
+ endif()
+endfunction()