aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSahana Prasad <sahana@redhat.com>2019-12-10 18:20:55 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-12-20 14:36:20 +0100
commitac22e51e5a53013d243e90db94803978d6bc7c5a (patch)
treec305d4e356a4b3f90621fc7aacc99dd18615b5bd
parentfa6fb83c87b51417442420f2a51b61fdccc7953e (diff)
downloadlibssh-ac22e51e5a53013d243e90db94803978d6bc7c5a.tar.gz
libssh-ac22e51e5a53013d243e90db94803978d6bc7c5a.tar.xz
libssh-ac22e51e5a53013d243e90db94803978d6bc7c5a.zip
cmake: Add cmake module to find softhsm
Signed-off-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--CMakeLists.txt7
-rw-r--r--cmake/Modules/Findsofthsm.cmake36
2 files changed, 43 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6375f9dd..b3335225 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,13 @@ if (WITH_GSSAPI)
find_package(GSSAPI)
endif (WITH_GSSAPI)
+if (WITH_PKCS11_URI)
+ find_package(softhsm)
+ if (NOT SOFTHSM_FOUND)
+ message(SEND_ERROR "Could not find softhsm module!")
+ endif (NOT SOFTHSM_FOUND)
+endif (WITH_PKCS11_URI)
+
if (WITH_NACL)
find_package(NaCl)
if (NOT NACL_FOUND)
diff --git a/cmake/Modules/Findsofthsm.cmake b/cmake/Modules/Findsofthsm.cmake
new file mode 100644
index 00000000..3a29b6d0
--- /dev/null
+++ b/cmake/Modules/Findsofthsm.cmake
@@ -0,0 +1,36 @@
+# - Try to find softhsm
+# Once done this will define
+#
+# SOFTHSM_FOUND - system has softhsm
+# SOFTHSM_LIBRARIES - Link these to use softhsm
+#
+#=============================================================================
+# Copyright (c) 2019 Sahana Prasad <sahana@redhat.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+#
+
+
+find_library(SOFTHSM2_LIBRARY
+ NAMES
+ softhsm2
+)
+
+if (SOFTHSM2_LIBRARY)
+ set(SOFTHSM_LIBRARIES
+ ${SOFTHSM_LIBRARIES}
+ ${SOFTHSM2_LIBRARY}
+ )
+endif (SOFTHSM2_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(softhsm DEFAULT_MSG SOFTHSM_LIBRARIES)
+
+# show the SOFTHSM_INCLUDE_DIR and SOFTHSM_LIBRARIES variables only in the advanced view
+mark_as_advanced(SOFTHSM_LIBRARIES)