diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 6ca0f32985..d9b78ba412 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -308,16 +308,30 @@ if(wxUSE_LIBLZMA) endif() endif() -if(wxUSE_WEBREQUEST_CURL) - find_package(CURL) - if(NOT CURL_FOUND) - message(WARNING "CURL not found, wxWebSessionBackendCURL won't be available") - wx_option_force_value(wxUSE_WEBREQUEST_CURL OFF) +if (wxUSE_WEBREQUEST) + if(wxUSE_WEBREQUEST_CURL) + find_package(CURL) + if(NOT CURL_FOUND) + message(WARNING "CURL not found, wxWebSessionBackendCURL won't be available") + wx_option_force_value(wxUSE_WEBREQUEST_CURL OFF) + endif() + endif() + + if(wxUSE_WEBREQUEST_WINHTTP) + check_c_source_compiles("#include + #include + int main(){return 0;}" + HAVE_WINHTTP_H) + if(NOT HAVE_WINHTTP_H) + message(WARNING "winhttp.h not found, wxWebSessionBackendWinHTTP won't be available") + wx_option_force_value(wxUSE_WEBREQUEST_WINHTTP OFF) + endif() + endif() + + if (NOT(wxUSE_WEBREQUEST_WINHTTP OR wxUSE_WEBREQUEST_URLSESSION OR wxUSE_WEBREQUEST_CURL)) + message(WARNING "wxUSE_WEBREQUEST requires at least one backend, it won't be available") + wx_option_force_value(wxUSE_WEBREQUEST OFF) endif() -endif() -if (wxUSE_WEBREQUEST AND NOT (wxUSE_WEBREQUEST_WINHTTP OR wxUSE_WEBREQUEST_URLSESSION OR wxUSE_WEBREQUEST_CURL)) - message(WARNING "wxUSE_WEBREQUEST requires at least one backend, it won't be available") - wx_option_force_value(wxUSE_WEBREQUEST OFF) endif() if(UNIX)