diff options
author | Cristian Morales Vega <cristian@samknows.com> | 2020-11-19 07:54:09 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-11-19 13:38:47 +0100 |
commit | f21cc62832a9d5c521d10da9177b075bfed43f2f (patch) | |
tree | 13c3f34d01fc4f3e980c462dac2d0a0cf765e0a6 /CMake/Macros.cmake | |
parent | 73b63876b1d7ede288f38b35ad664b2f9d058825 (diff) | |
download | curl-f21cc62832a9d5c521d10da9177b075bfed43f2f.tar.gz |
cmake: make CURL_ZLIB a tri-state variable
By differentiating between ON and AUTO it can make a missing zlib
library a hard error when CURL_ZLIB=ON is used.
Reviewed-by: Jakub Zakrzewski
Closes #6221
Fixes #6173
Diffstat (limited to 'CMake/Macros.cmake')
-rw-r--r-- | CMake/Macros.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake index 6c29856c4..d57dd6ad5 100644 --- a/CMake/Macros.cmake +++ b/CMake/Macros.cmake @@ -107,3 +107,14 @@ macro(curl_nroff_check) message(WARNING "Found no *nroff program") endif() endmacro() + +macro(optional_dependency DEPENDENCY) + set(CURL_${DEPENDENCY} AUTO CACHE STRING "Build curl with ${DEPENDENCY} support (AUTO, ON or OFF)") + set_property(CACHE CURL_${DEPENDENCY} PROPERTY STRINGS AUTO ON OFF) + + if(CURL_${DEPENDENCY} STREQUAL AUTO) + find_package(${DEPENDENCY}) + elseif(CURL_${DEPENDENCY}) + find_package(${DEPENDENCY} REQUIRED) + endif() +endmacro() |