Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Curl CMake to build stack for XP
CMAKE_MINIMUM_REQUIRED (VERSION 3.7)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: DEBUG, RELEASE, or MINSIZEREL." FORCE)
message(STATUS "No build type specified, defaulting to Release.")
endif()
include (ExternalProject)
ExternalProject_Add(zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.2.11
PATCH_COMMAND ""
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=Release
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
set(MBEDTLS_C_FLAGS "${CMAKE_C_FLAGS} -fPIC ")
endif()
ExternalProject_Add(mbedtls
GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git
GIT_TAG mbedtls-2.8.0
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_C_FLAGS=${MBEDTLS_C_FLAGS}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=Release
-DENABLE_TESTING=OFF
-DENABLE_PROGRAMS=OFF
-DENABLE_ZLIB_SUPPORT=ON
-DUSE_SHARED_MBEDTLS_LIBRARY=OFF
-DZLIB_INCLUDE_DIR=${CMAKE_INSTALL_PREFIX}/include
-DZLIB_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/zlib.lib
)
add_dependencies(mbedtls zlib)
ExternalProject_Add(curl
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG curl-7_60_0
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCURL_STATICLIB=OFF
-DBUILD_CURL_EXE=OFF
-DBUILD_TESTING=OFF
# -DHTTP_ONLY=ON
-DCURL_DISABLE_FTP=ON
-DCURL_DISABLE_LDAP=ON
-DCURL_DISABLE_LDAPS=ON
-DCURL_DISABLE_TELNET=ON
-DCURL_DISABLE_DICT=ON
-DCURL_DISABLE_FILE=ON
-DCURL_DISABLE_TFTP=ON
-DCURL_DISABLE_RTSP=ON
-DCURL_DISABLE_POP3=ON
-DCURL_DISABLE_IMAP=ON
-DCURL_DISABLE_SMTP=OFF
-DCURL_DISABLE_GOPHER=ON
-DENABLE_MANUAL=OFF
-DCMAKE_USE_MBEDTLS=ON
-DZLIB_INCLUDE_DIR=${CMAKE_INSTALL_PREFIX}/include
-DZLIB_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/zlib.lib
-DMBEDTLS_INCLUDE_DIRS=${CMAKE_INSTALL_PREFIX}/include
-DMBEDTLS_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/mbedtls.lib
-DMBEDX509_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/mbedx509.lib
-DMBEDCRYPTO_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/mbedcrypto.lib
-DNGHTTP2_INCLUDE_DIR=${CMAKE_INSTALL_PREFIX}/include
-DNGHTTP2_LIBRARY=${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib
-DCURL_ZLIB=ON
-DHAVE_GLIBC_STRERROR_R=1
-DHAVE_GLIBC_STRERROR_R__TRYRUN_OUTPUT="Output from TRY_RUN"
-DHAVE_POSIX_STRERROR_R=0
-DHAVE_POSIX_STRERROR_R__TRYRUN_OUTPUT="Output from TRY_RUN"
-DHAVE_FSETXATTR_5=0
-DHAVE_FSETXATTR_5__TRYRUN_OUTPUT="Output from TRY_RUN"
-DHAVE_POLL_FINE_EXITCODE=0
)
add_dependencies(curl mbedtls zlib)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.