Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorKyle Manna <kyle@kylemanna.com>2014-05-26 11:41:54 +0400
committerKyle Manna <kyle@kylemanna.com>2017-01-08 10:18:59 +0300
commit82aed2caabf94836a13dfb476601b5640e60d4c2 (patch)
treef13b066cbd13f3a41474978f2d8379f36639c712 /cmake
parentadd4846d799315d4149b96ca09c65db0dd7675eb (diff)
keys: yk: Add YubiKey hardware driver support
* Use compile time detection of the YubiKey libraries and link against the libraries if present. Can be disabled with: $ cmake -DCMAKE_DISABLE_FIND_PACKAGE_YubiKey=FALSE * A stub file provides empty calls for all the function calls integrated in to the UI to support this. In the future a more modular approach maybe better, but opting for simplicity initially. Signed-off-by: Kyle Manna <kyle@kylemanna.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindYubiKey.cmake29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/FindYubiKey.cmake b/cmake/FindYubiKey.cmake
new file mode 100644
index 000000000..297b68387
--- /dev/null
+++ b/cmake/FindYubiKey.cmake
@@ -0,0 +1,29 @@
+# Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+#
+# 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 or (at your option)
+# version 3 of the License.
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+find_path(YUBIKEY_CORE_INCLUDE_DIR yubikey.h)
+find_path(YUBIKEY_PERS_INCLUDE_DIR ykcore.h PATH_SUFFIXES ykpers-1)
+set(YUBIKEY_INCLUDE_DIRS ${YUBIKEY_CORE_INCLUDE_DIR} ${YUBIKEY_PERS_INCLUDE_DIR})
+
+find_library(YUBIKEY_CORE_LIBRARY yubikey)
+find_library(YUBIKEY_PERS_LIBRARY ykpers-1)
+set(YUBIKEY_LIBRARIES ${YUBIKEY_CORE_LIBRARY} ${YUBIKEY_PERS_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(YubiKey DEFAULT_MSG YUBIKEY_LIBRARIES YUBIKEY_INCLUDE_DIRS)
+
+# TODO: Is mark_as_advanced() necessary? It's used in many examples with
+# little explanation. Disable for now in favor of simplicity.
+#mark_as_advanced(YUBIKEY_LIBRARIES YUBIKEY_INCLUDE_DIRS)