Skip to content

Commit f1522a6

Browse files
committed
cmake: only validate component when the required library is found
1 parent c765584 commit f1522a6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cmake/httplibConfig.cmake.in

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ if(@HTTPLIB_IS_USING_OPENSSL@)
2222
# Since we use both, we need to search for both.
2323
find_dependency(OpenSSL @_HTTPLIB_OPENSSL_MIN_VER@ COMPONENTS Crypto SSL)
2424
endif()
25+
set(httplib_OpenSSL_FOUND ${OpenSSL_FOUND})
2526
endif()
2627
if(@HTTPLIB_IS_USING_ZLIB@)
2728
find_dependency(ZLIB)
29+
set(httplib_ZLIB_FOUND ${ZLIB_FOUND})
2830
endif()
2931

3032
if(@HTTPLIB_IS_USING_BROTLI@)
@@ -33,10 +35,12 @@ if(@HTTPLIB_IS_USING_BROTLI@)
3335
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
3436
set(BROTLI_USE_STATIC_LIBS @BROTLI_USE_STATIC_LIBS@)
3537
find_dependency(Brotli COMPONENTS common encoder decoder)
38+
set(httplib_Brotli_FOUND ${Brotli_FOUND})
3639
endif()
3740

3841
if(@HTTPLIB_IS_USING_ZSTD@)
3942
find_dependency(zstd)
43+
set(httplib_zstd_FOUND ${zstd_FOUND})
4044
endif()
4145

4246
# Mildly useful for end-users
@@ -46,12 +50,6 @@ set_and_check(HTTPLIB_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
4650
# This is helpful if you're using Cmake's pre-compiled header feature
4751
set_and_check(HTTPLIB_HEADER_PATH "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/httplib.h")
4852

49-
# Consider each library support as a "component"
50-
set(httplib_OpenSSL_FOUND @HTTPLIB_IS_USING_OPENSSL@)
51-
set(httplib_ZLIB_FOUND @HTTPLIB_IS_USING_ZLIB@)
52-
set(httplib_Brotli_FOUND @HTTPLIB_IS_USING_BROTLI@)
53-
set(httplib_zstd_FOUND @HTTPLIB_IS_USING_ZSTD@)
54-
5553
check_required_components(httplib)
5654

5755
# Brings in the target library, but only if all required components are found

0 commit comments

Comments
 (0)