File: cmake-httplib-pkgconfig.diff

package info (click to toggle)
indi 2.1.5.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 15,200 kB
  • sloc: cpp: 203,770; ansic: 33,419; xml: 1,131; sh: 308; makefile: 13
file content (26 lines) | stat: -rw-r--r-- 1,218 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
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 te Debian bug #1059737).
 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)