From f7dd89b2adc1e43addfdf554a04d20253cf504dc Mon Sep 17 00:00:00 2001 From: xavi92 Date: Mon, 12 Aug 2024 23:59:58 +0000 Subject: [PATCH] cmake: Add Findrhash.cmake git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9540 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 95341c293c88b1d8d45e351336983b3b152b238d Former-commit-id: c834c4137793fb5d7e4e22ede64bf02c4e8686d0 --- cmake/Findrhash.cmake | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cmake/Findrhash.cmake diff --git a/cmake/Findrhash.cmake b/cmake/Findrhash.cmake new file mode 100644 index 00000000..53c9bc3e --- /dev/null +++ b/cmake/Findrhash.cmake @@ -0,0 +1,39 @@ +# Copyright (C) 2024 Xavier Del Campo Romero +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +find_path(rhash_INCLUDE_DIRS + NAMES + rhash.h + rhash_torrent.h + HINTS + ENV rhash_PATH + PATH_SUFFIXES + include +) + +find_library(rhash_LIBRARIES + NAMES + rhash + HINTS + ENV rhash_PATH + PATH_SUFFIXES + lib +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(rhash + REQUIRED_VARS + rhash_LIBRARIES rhash_INCLUDE_DIRS +) + +if(rhash_FOUND) + if(NOT TARGET rhash::rhash) + add_library(rhash::rhash INTERFACE IMPORTED) + target_include_directories(rhash::rhash + INTERFACE "${rhash_INCLUDE_DIRS}") + set_target_properties(rhash::rhash PROPERTIES + IMPORTED_LOCATION "${rhash_LIBRARIES}") + endif() +endif()