summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Xinwei <1326710505@qq.com>2021-03-29 12:58:17 +0800
committerDaniel Stenberg <daniel@haxx.se>2021-03-29 09:50:55 +0200
commit9d4f21b190e90174d19e8c9f00ad63778814a5f0 (patch)
tree78a4cf1c3f73d6af9434cf77b881653fc76da2ea
parent6bb028dbda6cbfe83f66de773544f71e4813160f (diff)
downloadcurl-9d4f21b190e90174d19e8c9f00ad63778814a5f0.tar.gz
cmake: support WinIDN
Closes #6807
-rw-r--r--CMakeLists.txt10
-rw-r--r--lib/curl_config.h.cmake6
2 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1477e357..f75815af2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -619,6 +619,14 @@ if(USE_LIBIDN2)
check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2)
endif()
+if(WIN32)
+ option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF)
+ if(USE_WIN32_IDN)
+ list(APPEND CURL_LIBS "Normaliz")
+ set(WANT_IDN_PROTOTYPES ON)
+ endif()
+endif()
+
# Check for symbol dlopen (same as HAVE_LIBDL)
check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN)
@@ -1363,7 +1371,7 @@ _add_if("libz" HAVE_LIBZ)
_add_if("brotli" HAVE_BROTLI)
_add_if("zstd" HAVE_ZSTD)
_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
-_add_if("IDN" HAVE_LIBIDN2)
+_add_if("IDN" HAVE_LIBIDN2 OR USE_WIN32_IDN)
_add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND
((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
# TODO SSP1 (Schannel) check is missing
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
index 01c4ded1f..fc1857ebb 100644
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -1073,3 +1073,9 @@ ${SIZEOF_TIME_T_CODE}
/* Define to 1 if you have the mach_absolute_time function. */
#cmakedefine HAVE_MACH_ABSOLUTE_TIME 1
+
+/* to enable Windows IDN */
+#cmakedefine USE_WIN32_IDN 1
+
+/* to make the compiler know the prototypes of Windows IDN APIs */
+#cmakedefine WANT_IDN_PROTOTYPES 1