diff options
Diffstat (limited to 'CMakeModules/Findhttplib.cmake')
| -rw-r--r-- | CMakeModules/Findhttplib.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CMakeModules/Findhttplib.cmake b/CMakeModules/Findhttplib.cmake new file mode 100644 index 000000000..861207eb5 --- /dev/null +++ b/CMakeModules/Findhttplib.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # SPDX-FileCopyrightText: 2022 Andrea Pappacoda <andrea@pappacoda.it> | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: GPL-2.0-or-later | ||
| 4 | |||
| 5 | include(FindPackageHandleStandardArgs) | ||
| 6 | |||
| 7 | find_package(httplib QUIET CONFIG) | ||
| 8 | if (httplib_CONSIDERED_CONFIGS) | ||
| 9 | find_package_handle_standard_args(httplib CONFIG_MODE) | ||
| 10 | else() | ||
| 11 | find_package(PkgConfig QUIET) | ||
| 12 | pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET cpp-httplib) | ||
| 13 | find_package_handle_standard_args(httplib | ||
| 14 | REQUIRED_VARS HTTPLIB_INCLUDEDIR | ||
| 15 | VERSION_VAR HTTPLIB_VERSION | ||
| 16 | ) | ||
| 17 | endif() | ||
| 18 | |||
| 19 | if (httplib_FOUND AND NOT TARGET httplib::httplib) | ||
| 20 | add_library(httplib::httplib ALIAS PkgConfig::HTTPLIB) | ||
| 21 | endif() | ||