This repository was archived by the owner on Apr 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 14
14
15
15
-------------------------------------------------------------------------------
16
16
17
- After installation with Cmake, a find_package(httplib) is available.
18
- This creates a httplib::httplib target (if found).
17
+ After installation with Cmake, a find_package(httplib COMPONENTS OpenSSL ZLIB Brotli ) is available.
18
+ This creates a httplib::httplib target (if found and if listed components are supported ).
19
19
It can be linked like so:
20
20
21
21
target_link_libraries(your_exe httplib::httplib)
@@ -235,8 +235,6 @@ configure_package_config_file("${PROJECT_NAME}Config.cmake.in"
235
235
INSTALL_DESTINATION "${_TARGET_INSTALL_CMAKEDIR} "
236
236
# Passes the includedir install path
237
237
PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR
238
- # There aren't any components, so don't use the macro
239
- NO_CHECK_REQUIRED_COMPONENTS_MACRO
240
238
)
241
239
242
240
if (HTTPLIB_COMPILE )
Original file line number Diff line number Diff line change @@ -42,8 +42,17 @@ set_and_check(HTTPLIB_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
42
42
# This is helpful if you're using Cmake's pre-compiled header feature
43
43
set_and_check (HTTPLIB_HEADER_PATH "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/httplib.h" )
44
44
45
- # Brings in the target library
46
- include ("${CMAKE_CURRENT_LIST_DIR} /httplibTargets.cmake" )
45
+ # Consider each library support as a "component"
46
+ set (httplib_OpenSSL_FOUND @HTTPLIB_IS_USING_OPENSSL@ )
47
+ set (httplib_ZLIB_FOUND @HTTPLIB_IS_USING_ZLIB@ )
48
+ set (httplib_Brotli_FOUND @HTTPLIB_IS_USING_BROTLI@ )
49
+
50
+ check_required_components (httplib )
51
+
52
+ # Brings in the target library, but only if all required components are found
53
+ if (NOT DEFINED httplib_FOUND OR httplib_FOUND )
54
+ include ("${CMAKE_CURRENT_LIST_DIR} /httplibTargets.cmake" )
55
+ endif ()
47
56
48
57
# Ouputs a "found httplib /usr/include/httplib.h" message when using find_package(httplib)
49
58
include (FindPackageMessage )
You can’t perform that action at this time.
0 commit comments