Skip to content

Commit c7d18ff

Browse files
committed
Improve HTTPLIB_IS_USING_X vars for OpenSSL & ZLIB
If building in-tree, these vars might incorrectly be true. So this avoids that weird corner-case.
1 parent 64e01b9 commit c7d18ff

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

httplibConfig.cmake.in

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,32 @@ include(CMakeFindDependencyMacro)
77
find_dependency(Threads REQUIRED)
88
if(@HTTPLIB_REQUIRE_OPENSSL@)
99
find_dependency(OpenSSL @_HTTPLIB_OPENSSL_MIN_VER@ REQUIRED)
10+
# Lets you check if these options were correctly enabled for your install
11+
set(HTTPLIB_IS_USING_OPENSSL TRUE)
1012
elseif(@HTTPLIB_USE_OPENSSL_IF_AVAILABLE@)
1113
# Look quietly since it's optional
1214
find_dependency(OpenSSL @_HTTPLIB_OPENSSL_MIN_VER@ QUIET)
15+
# Lets you check if these options were correctly enabled for your install
16+
set(HTTPLIB_IS_USING_OPENSSL @OPENSSL_FOUND@)
17+
else()
18+
set(HTTPLIB_IS_USING_OPENSSL FALSE)
1319
endif()
1420
if(@HTTPLIB_REQUIRE_ZLIB@)
1521
find_dependency(ZLIB REQUIRED)
22+
# Lets you check if these options were correctly enabled for your install
23+
set(HTTPLIB_IS_USING_ZLIB TRUE)
1624
elseif(@HTTPLIB_USE_ZLIB_IF_AVAILABLE@)
1725
# Look quietly since it's optional
1826
find_dependency(ZLIB QUIET)
27+
# Lets you check if these options were correctly enabled for your install
28+
set(HTTPLIB_IS_USING_ZLIB @ZLIB_FOUND@)
29+
else()
30+
set(HTTPLIB_IS_USING_ZLIB FALSE)
1931
endif()
2032

2133
# Lets the end-user find the header path if needed
2234
# This is helpful if you're using Cmake's pre-compiled header feature
2335
set_and_check(HTTPLIB_HEADER_PATH "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/httplib.h")
24-
# Lets you check if these options were correctly enabled for your install
25-
set(HTTPLIB_IS_USING_OPENSSL @OPENSSL_FOUND@)
26-
set(HTTPLIB_IS_USING_ZLIB @ZLIB_FOUND@)
2736

2837
# Brings in the target library
2938
include("${CMAKE_CURRENT_LIST_DIR}/httplibTargets.cmake")

0 commit comments

Comments
 (0)