1
0
mirror of synced 2025-04-20 11:47:43 +03:00
cpp-httplib/httplibConfig.cmake.in
KTGH 9505a76491
Bringing Cmake back (#470)
* Revert "Removed CMakeLists.txt. (Fix #421)"

This reverts commit 8674555b88f3b1eb9721eafdf690eeb8e99491af.

* Fail if cmake version too old

Previous behaviour is just a warning.

* Improve CMakeLists

Adds automatic dependency finding (if they were used).
Adds a way to require a specific version in the find_package(httplib) call.

You should link against the httplib::httplib IMPORTED target, which is
created automatically.

Add options to allow for strictly requiring OpenSSL/ZLIB

HTTPLIB_REQUIRE_OPENSSL & HTTPLIB_REQUIRE_ZLIB require the libs be found, or the build fails.

HTTPLIB_USE_OPENSSL_IF_AVAILABLE & HTTPLIB_USE_ZLIB_IF_AVAILABLE silently search for the libs.
If they aren't found, the build still continues, but shuts off support for those features.

* Add documentation to CMakeLists.txt

Has info on all the available options and what targets are produced.

Also put some things about installation on certain platforms.
2020-05-19 19:07:18 -04:00

39 lines
1.4 KiB
CMake

# Generates a macro to auto-configure everything
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# We add find_dependency calls here to not make the end-user have to call them.
find_dependency(Threads REQUIRED)
if(@HTTPLIB_REQUIRE_OPENSSL@)
find_dependency(OpenSSL @_HTTPLIB_OPENSSL_MIN_VER@ REQUIRED)
# Lets you check if these options were correctly enabled for your install
set(HTTPLIB_IS_USING_OPENSSL TRUE)
elseif(@HTTPLIB_USE_OPENSSL_IF_AVAILABLE@)
# Look quietly since it's optional
find_dependency(OpenSSL @_HTTPLIB_OPENSSL_MIN_VER@ QUIET)
# Lets you check if these options were correctly enabled for your install
set(HTTPLIB_IS_USING_OPENSSL @OPENSSL_FOUND@)
else()
set(HTTPLIB_IS_USING_OPENSSL FALSE)
endif()
if(@HTTPLIB_REQUIRE_ZLIB@)
find_dependency(ZLIB REQUIRED)
# Lets you check if these options were correctly enabled for your install
set(HTTPLIB_IS_USING_ZLIB TRUE)
elseif(@HTTPLIB_USE_ZLIB_IF_AVAILABLE@)
# Look quietly since it's optional
find_dependency(ZLIB QUIET)
# Lets you check if these options were correctly enabled for your install
set(HTTPLIB_IS_USING_ZLIB @ZLIB_FOUND@)
else()
set(HTTPLIB_IS_USING_ZLIB FALSE)
endif()
# Lets the end-user find the header path if needed
# This is helpful if you're using Cmake's pre-compiled header feature
set_and_check(HTTPLIB_HEADER_PATH "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/httplib.h")
# Brings in the target library
include("${CMAKE_CURRENT_LIST_DIR}/httplibTargets.cmake")