File: cmake-httplib-pkgconfig.diff

package info (click to toggle)
indi 2.1.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 15,768 kB
  • sloc: cpp: 213,071; ansic: 33,427; xml: 1,147; sh: 308; makefile: 13
file content (28 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Author: Pino Toscano <pino@debian.org>
Description: Find httplib without a CMake config module
 Depending on how httplib is built, there may be no CMake config file available,
 preventing "find_package(httplib)" to work (see also the Debian bug #1059737).
 httplib in Debian is built using autotools, which means it does not have a
 CMake config module. Hence, switch to manually search for it using its
 pkg-config file.
Last-Update: 2024-06-07
Forwarded: not-needed
Origin: vendor

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,10 +173,11 @@ install(FILES
 # ####################################  bundled libs  ##############################################
 # ##################################################################################################
 if(INDI_SYSTEM_HTTPLIB)
-    find_package(httplib REQUIRED)
-    include_directories(${HTTPLIB_INCLUDE_DIR})
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(httplib REQUIRED IMPORTED_TARGET cpp-httplib)
     set(SYSTEM_HTTPLIB 1)
-    message(STATUS "Using system provided httplib version ${HTTPLIB_VERSION}")
+    message(STATUS "Using system provided httplib version ${httplib_VERSION}")
+    set(HTTPLIB_LIBRARY PkgConfig::httplib)
 else()
     include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/httplib)
     set(SYSTEM_HTTPLIB 0)