Skip to content

Commit

Permalink
curl-cmake.sh: apply upstream PR and adapt build config [ci skip]
Browse files Browse the repository at this point in the history
Sync up OS target selection settings with autotools and m32.

Ref: curl/curl#9046
  • Loading branch information
vszakats committed Jun 27, 2022
1 parent 45bb88a commit 53cba6c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 1 addition & 3 deletions curl-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ _VER="$1"
export CURL_LDFLAG_EXTRAS_EXE
export CURL_LDFLAG_EXTRAS_DLL
if [ "${_CPU}" = 'x86' ]; then
options="${options} -DCURL_TARGET_WINDOWS_VERSION=0x0501" # For Windows XP compatibility
_CFLAGS="${_CFLAGS} -DHAVE_ATOMIC"
_CFLAGS="${_CFLAGS} -D_WIN32_WINNT=0x0501 -DHAVE_ATOMIC" # For Windows XP compatibility
CURL_LDFLAG_EXTRAS_EXE='-Wl,--pic-executable,-e,_mainCRTStartup'
CURL_LDFLAG_EXTRAS_DLL=''
else
options="${options} -DCURL_TARGET_WINDOWS_VERSION=0x0600"
CURL_LDFLAG_EXTRAS_EXE='-Wl,--pic-executable,-e,mainCRTStartup'
CURL_LDFLAG_EXTRAS_DLL='-Wl,--image-base,0x150000000'
CURL_LDFLAG_EXTRAS="${CURL_LDFLAG_EXTRAS} -Wl,--high-entropy-va"
Expand Down
25 changes: 25 additions & 0 deletions curl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45d763d5a9c1d..4df2393063dd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,20 +78,11 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
if(WIN32)
option(CURL_STATIC_CRT "Set to ON to build libcurl with static CRT on Windows (/MT)." OFF)
- option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON)
option(ENABLE_UNICODE "Set to ON to use the Unicode version of the Windows API functions" OFF)
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
if(CURL_TARGET_WINDOWS_VERSION)
add_definitions(-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION})
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
- elseif(ENABLE_INET_PTON)
- # _WIN32_WINNT_VISTA (0x0600)
- add_definitions(-D_WIN32_WINNT=0x0600)
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0600")
- else()
- # _WIN32_WINNT_WINXP (0x0501)
- add_definitions(-D_WIN32_WINNT=0x0501)
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0501")
endif()
if(ENABLE_UNICODE)
add_definitions(-DUNICODE -D_UNICODE)
1 change: 1 addition & 0 deletions curl.test.patch

0 comments on commit 53cba6c

Please sign in to comment.