1<!-- 2Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 4SPDX-License-Identifier: curl 5--> 6 7# Building with CMake 8 9This document describes how to configure, build and install curl and libcurl 10from source code using the CMake build tool. To build with CMake, you of 11course first have to install CMake. The minimum required version of CMake is 12specified in the file `CMakeLists.txt` found in the top of the curl source 13tree. Once the correct version of CMake is installed you can follow the 14instructions below for the platform you are building on. 15 16CMake builds can be configured either from the command line, or from one of 17CMake's GUIs. 18 19# Configuring 20 21A CMake configuration of curl is similar to the autotools build of curl. 22It consists of the following steps after you have unpacked the source. 23 24## Using `cmake` 25 26You can configure for in source tree builds or for a build tree 27that is apart from the source tree. 28 29 - Build in the source tree. 30 31 $ cmake -B . 32 33 - Build in a separate directory (parallel to the curl source tree in this 34 example). The build directory is created for you. 35 36 $ cmake -B ../curl-build 37 38### Fallback for CMake before version 3.13 39 40CMake before version 3.13 does not support the `-B` option. In that case, 41you must create the build directory yourself, `cd` to it and run `cmake` 42from there: 43 44 $ mkdir ../curl-build 45 $ cd ../curl-build 46 $ cmake ../curl 47 48If you want to build in the source tree, it is enough to do this: 49 50 $ cmake . 51 52### Build system generator selection 53 54You can override CMake's default by using `-G <generator-name>`. For example 55on Windows with multiple build systems if you have MinGW-w64 then you could use 56`-G "MinGW Makefiles"`. 57[List of generator names](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html). 58 59## Using `ccmake` 60 61CMake comes with a curses based interface called `ccmake`. To run `ccmake` 62on a curl use the instructions for the command line cmake, but substitute 63`ccmake` for `cmake`. 64 65This brings up a curses interface with instructions on the bottom of the 66screen. You can press the "c" key to configure the project, and the "g" key to 67generate the project. After the project is generated, you can run make. 68 69## Using `cmake-gui` 70 71CMake also comes with a Qt based GUI called `cmake-gui`. To configure with 72`cmake-gui`, you run `cmake-gui` and follow these steps: 73 74 1. Fill in the "Where is the source code" combo box with the path to 75 the curl source tree. 76 2. Fill in the "Where to build the binaries" combo box with the path to 77 the directory for your build tree, ideally this should not be the same 78 as the source tree, but a parallel directory called curl-build or 79 something similar. 80 3. Once the source and binary directories are specified, press the 81 "Configure" button. 82 4. Select the native build tool that you want to use. 83 5. At this point you can change any of the options presented in the GUI. 84 Once you have selected all the options you want, click the "Generate" 85 button. 86 87# Building 88 89Build (you have to specify the build directory). 90 91 $ cmake --build ../curl-build 92 93## Static builds 94 95The CMake build setup is primarily done to work with shared/dynamic third 96party dependencies. When linking with shared libraries, the dependency "chain" 97is handled automatically by the library loader - on all modern systems. 98 99If you instead link with a static library, you need to provide all the 100dependency libraries already at the link command line. 101 102Figuring out all the dependency libraries for a given library is hard, as it 103might involve figuring out the dependencies of the dependencies and they vary 104between platforms and can change between versions. 105 106When using static dependencies, the build scripts mostly assume that you, the 107user, provide all the necessary additional dependency libraries as additional 108arguments in the build. 109 110Building statically is not for the faint of heart. 111 112### Fallback for CMake before version 3.13 113 114CMake before version 3.13 does not support the `--build` option. In that 115case, you have to `cd` to the build directory and use the building tool that 116corresponds to the build files that CMake generated for you. This example 117assumes that CMake generates `Makefile`: 118 119 $ cd ../curl-build 120 $ make 121 122# Testing 123 124(The test suite does not yet work with the cmake build) 125 126# Installing 127 128Install to default location (you have to specify the build directory). 129 130 $ cmake --install ../curl-build 131 132### Fallback for CMake before version 3.15 133 134CMake before version 3.15 does not support the `--install` option. In that 135case, you have to `cd` to the build directory and use the building tool that 136corresponds to the build files that CMake generated for you. This example 137assumes that CMake generates `Makefile`: 138 139 $ cd ../curl-build 140 $ make install 141 142# CMake build options 143 144- `BUILD_CURL_EXE`: Build curl executable. Default: `ON` 145- `BUILD_EXAMPLES`: Build libcurl examples. Default: `ON` 146- `BUILD_LIBCURL_DOCS`: Build libcurl man pages. Default: `ON` 147- `BUILD_MISC_DOCS`: Build misc man pages (e.g. `curl-config` and `mk-ca-bundle`). Default: `ON` 148- `BUILD_SHARED_LIBS`: Build shared libraries. Default: `ON` 149- `BUILD_STATIC_CURL`: Build curl executable with static libcurl. Default: `OFF` 150- `BUILD_STATIC_LIBS`: Build static libraries. Default: `OFF` 151- `BUILD_TESTING`: Build tests. Default: `ON` 152- `CURL_CLANG_TIDY`: Run the build through `clang-tidy`. Default: `OFF` 153- `CURL_CLANG_TIDYFLAGS`: Custom options to pass to `clang-tidy`. Default: (empty) 154- `CURL_DEFAULT_SSL_BACKEND`: Override default TLS backend in MultiSSL builds. 155 Accepted values in order of default priority: 156 `wolfssl`, `gnutls`, `mbedtls`, `openssl`, `secure-transport`, `schannel`, `bearssl`, `rustls` 157- `CURL_ENABLE_EXPORT_TARGET`: Enable CMake export target. Default: `ON` 158- `CURL_HIDDEN_SYMBOLS`: Hide libcurl internal symbols (=hide all symbols that are not officially external). Default: `ON` 159- `CURL_LIBCURL_SOVERSION`: Enable libcurl SOVERSION. Default: `ON` for supported platforms 160- `CURL_LIBCURL_VERSIONED_SYMBOLS`: Enable libcurl versioned symbols. Default: `OFF` 161- `CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX`: Override default versioned symbol prefix. Default: `<TLS-BACKEND>_` or `MULTISSL_` 162- `CURL_LTO`: Enable compiler Link Time Optimizations. Default: `OFF` 163- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`). Default: `OFF` 164- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string. 165- `CURL_TEST_BUNDLES`: Bundle `libtest` and `unittest` tests into single binaries. Default: `OFF` 166- `CURL_WERROR`: Turn compiler warnings into errors. Default: `OFF` 167- `ENABLE_CURLDEBUG`: Enable TrackMemory debug feature. Default: =`ENABLE_DEBUG` 168- `ENABLE_CURL_MANUAL`: Build the man page for curl and enable its `-M`/`--manual` option. Default: `ON` 169- `ENABLE_DEBUG`: Enable curl debug features (for developing curl itself). Default: `OFF` 170- `IMPORT_LIB_SUFFIX`: Import library suffix. Default: `_imp` 171- `LIBCURL_OUTPUT_NAME`: Basename of the curl library. Default: `libcurl` 172- `PICKY_COMPILER`: Enable picky compiler options. Default: `ON` 173- `STATIC_LIB_SUFFIX`: Static library suffix. Default: (empty) 174 175## CA bundle options 176 177- `CURL_CA_BUNDLE`: Path to the CA bundle. Set `none` to disable or `auto` for auto-detection. Default: `auto` 178- `CURL_CA_EMBED`: Path to the CA bundle to embed in the curl tool. Default: (disabled) 179- `CURL_CA_FALLBACK`: Use built-in CA store of TLS backend. Default: `OFF` 180- `CURL_CA_PATH`: Location of default CA path. Set `none` to disable or `auto` for auto-detection. Default: `auto` 181- `CURL_CA_SEARCH_SAFE`: Enable safe CA bundle search (within the curl tool directory) on Windows. Default: `OFF` 182 183## Enabling features 184 185- `CURL_ENABLE_SSL`: Enable SSL support. Default: `ON` 186- `CURL_WINDOWS_SSPI`: Enable SSPI on Windows. Default: =`CURL_USE_SCHANNEL` 187- `ENABLE_IPV6`: Enable IPv6 support. Default: `ON` if target supports IPv6. 188- `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled and target supports threading. 189- `ENABLE_UNICODE`: Use the Unicode version of the Windows API functions. Default: `OFF` 190- `ENABLE_UNIX_SOCKETS`: Enable Unix domain sockets support. Default: `ON` 191- `USE_ECH`: Enable ECH support. Default: `OFF` 192- `USE_HTTPSRR`: Enable HTTPS RR support. Default: `OFF` 193- `USE_OPENSSL_QUIC`: Use OpenSSL and nghttp3 libraries for HTTP/3 support. Default: `OFF` 194- `USE_SSLS_EXPORT`: Enable experimental SSL session import/export. Default: `OFF` 195 196## Disabling features 197 198- `CURL_DISABLE_ALTSVC`: Disable alt-svc support. Default: `OFF` 199- `CURL_DISABLE_AWS`: Disable **aws-sigv4**. Default: `OFF` 200- `CURL_DISABLE_BASIC_AUTH`: Disable Basic authentication. Default: `OFF` 201- `CURL_DISABLE_BEARER_AUTH`: Disable Bearer authentication. Default: `OFF` 202- `CURL_DISABLE_BINDLOCAL`: Disable local binding support. Default: `OFF` 203- `CURL_DISABLE_CA_SEARCH`: Disable unsafe CA bundle search in PATH on Windows. Default: `OFF` 204- `CURL_DISABLE_COOKIES`: Disable cookies support. Default: `OFF` 205- `CURL_DISABLE_DICT`: Disable DICT. Default: `OFF` 206- `CURL_DISABLE_DIGEST_AUTH`: Disable Digest authentication. Default: `OFF` 207- `CURL_DISABLE_DOH`: Disable DNS-over-HTTPS. Default: `OFF` 208- `CURL_DISABLE_FILE`: Disable FILE. Default: `OFF` 209- `CURL_DISABLE_FORM_API`: Disable **form-api**. Default: =`CURL_DISABLE_MIME` 210- `CURL_DISABLE_FTP`: Disable FTP. Default: `OFF` 211- `CURL_DISABLE_GETOPTIONS`: Disable `curl_easy_options` API for existing options to `curl_easy_setopt`. Default: `OFF` 212- `CURL_DISABLE_GOPHER`: Disable Gopher. Default: `OFF` 213- `CURL_DISABLE_HEADERS_API`: Disable **headers-api** support. Default: `OFF` 214- `CURL_DISABLE_HSTS`: Disable HSTS support. Default: `OFF` 215- `CURL_DISABLE_HTTP`: Disable HTTP. Default: `OFF` 216- `CURL_DISABLE_HTTP_AUTH`: Disable all HTTP authentication methods. Default: `OFF` 217- `CURL_DISABLE_IMAP`: Disable IMAP. Default: `OFF` 218- `CURL_DISABLE_INSTALL`: Disable installation targets. Default: `OFF` 219- `CURL_DISABLE_IPFS`: Disable IPFS. Default: `OFF` 220- `CURL_DISABLE_KERBEROS_AUTH`: Disable Kerberos authentication. Default: `OFF` 221- `CURL_DISABLE_LDAP`: Disable LDAP. Default: `OFF` 222- `CURL_DISABLE_LDAPS`: Disable LDAPS. Default: =`CURL_DISABLE_LDAP` 223- `CURL_DISABLE_LIBCURL_OPTION`: Disable `--libcurl` option from the curl tool. Default: `OFF` 224- `CURL_DISABLE_MIME`: Disable MIME support. Default: `OFF` 225- `CURL_DISABLE_MQTT`: Disable MQTT. Default: `OFF` 226- `CURL_DISABLE_NEGOTIATE_AUTH`: Disable negotiate authentication. Default: `OFF` 227- `CURL_DISABLE_NETRC`: Disable netrc parser. Default: `OFF` 228- `CURL_DISABLE_NTLM`: Disable NTLM support. Default: `OFF` 229- `CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG`: Disable automatic loading of OpenSSL configuration. Default: `OFF` 230- `CURL_DISABLE_PARSEDATE`: Disable date parsing. Default: `OFF` 231- `CURL_DISABLE_POP3`: Disable POP3. Default: `OFF` 232- `CURL_DISABLE_PROGRESS_METER`: Disable built-in progress meter. Default: `OFF` 233- `CURL_DISABLE_PROXY`: Disable proxy support. Default: `OFF` 234- `CURL_DISABLE_RTSP`: Disable RTSP. Default: `OFF` 235- `CURL_DISABLE_SHA512_256`: Disable SHA-512/256 hash algorithm. Default: `OFF` 236- `CURL_DISABLE_SHUFFLE_DNS`: Disable shuffle DNS feature. Default: `OFF` 237- `CURL_DISABLE_SMB`: Disable SMB. Default: `OFF` 238- `CURL_DISABLE_SMTP`: Disable SMTP. Default: `OFF` 239- `CURL_DISABLE_SOCKETPAIR`: Disable use of socketpair for curl_multi_poll. Default: `OFF` 240- `CURL_DISABLE_SRP`: Disable TLS-SRP support. Default: `OFF` 241- `CURL_DISABLE_TELNET`: Disable Telnet. Default: `OFF` 242- `CURL_DISABLE_TFTP`: Disable TFTP. Default: `OFF` 243- `CURL_DISABLE_VERBOSE_STRINGS`: Disable verbose strings. Default: `OFF` 244- `CURL_DISABLE_WEBSOCKETS`: Disable WebSocket. Default: `OFF` 245- `HTTP_ONLY`: Disable all protocols except HTTP (This overrides all `CURL_DISABLE_*` options). Default: `OFF` 246 247## Environment 248 249- `CI`: Assume running under CI if set. 250- `CURL_BUILDINFO`: Print `buildinfo.txt` if set. 251- `CURL_CI`: Assume running under CI if set. 252 253## CMake options 254 255- `CMAKE_BUILD_TYPE`: (see CMake) 256- `CMAKE_DEBUG_POSTFIX`: Default: `-d` 257- `CMAKE_IMPORT_LIBRARY_SUFFIX` (see CMake) 258- `CMAKE_INSTALL_BINDIR` (see CMake) 259- `CMAKE_INSTALL_INCLUDEDIR` (see CMake) 260- `CMAKE_INSTALL_LIBDIR` (see CMake) 261- `CMAKE_INSTALL_PREFIX` (see CMake) 262- `CMAKE_STATIC_LIBRARY_SUFFIX` (see CMake) 263- `CMAKE_UNITY_BUILD_BATCH_SIZE`: Set the number of sources in a "unity" unit. Default: `0` (all) 264- `CMAKE_UNITY_BUILD`: Enable "unity" (aka jumbo) builds. Default: `OFF` 265 266Details via CMake 267[variables](https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html) and 268[install directories](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html). 269 270## Dependencies 271 272- `CURL_BROTLI`: Use brotli (`ON`, `OFF` or `AUTO`). Default: `AUTO` 273- `CURL_USE_BEARSSL`: Enable BearSSL for SSL/TLS. Default: `OFF` 274- `CURL_USE_GNUTLS`: Enable GnuTLS for SSL/TLS. Default: `OFF` 275- `CURL_USE_GSASL`: Use libgsasl. Default: `OFF` 276- `CURL_USE_GSSAPI`: Use GSSAPI implementation. Default: `OFF` 277- `CURL_USE_LIBPSL`: Use libpsl. Default: `ON` 278- `CURL_USE_LIBSSH2`: Use libssh2. Default: `ON` 279- `CURL_USE_LIBSSH`: Use libssh. Default: `OFF` 280- `CURL_USE_LIBUV`: Use libuv for event-based tests. Default: `OFF` 281- `CURL_USE_MBEDTLS`: Enable mbedTLS for SSL/TLS. Default: `OFF` 282- `CURL_USE_OPENSSL`: Enable OpenSSL for SSL/TLS. Default: `ON` if no other TLS backend was enabled. 283- `CURL_USE_PKGCONFIG`: Enable `pkg-config` to detect dependencies. Default: `ON` for Unix (except Android, Apple devices), vcpkg, MinGW if not cross-compiling. 284- `CURL_USE_RUSTLS`: Enable Rustls for SSL/TLS. Default: `OFF` 285- `CURL_USE_SCHANNEL`: Enable Windows native SSL/TLS (Schannel). Default: `OFF` 286- `CURL_USE_SECTRANSP`: Enable Apple OS native SSL/TLS (Secure Transport). Default: `OFF` 287- `CURL_USE_WOLFSSH`: Use wolfSSH. Default: `OFF` 288- `CURL_USE_WOLFSSL`: Enable wolfSSL for SSL/TLS. Default: `OFF` 289- `CURL_ZLIB`: Use zlib (`ON`, `OFF` or `AUTO`). Default: `AUTO` 290- `CURL_ZSTD`: Use zstd (`ON`, `OFF` or `AUTO`). Default: `AUTO` 291- `ENABLE_ARES`: Enable c-ares support. Default: `OFF` 292- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF` 293- `USE_LIBIDN2`: Use libidn2 for IDN support. Default: `ON` 294- `USE_LIBRTMP`: Enable librtmp from rtmpdump. Default: `OFF` 295- `USE_MSH3`: Use msh3/msquic library for HTTP/3 support. Default: `OFF` 296- `USE_NGHTTP2`: Use nghttp2 library. Default: `ON` 297- `USE_NGTCP2`: Use ngtcp2 and nghttp3 libraries for HTTP/3 support. Default: `OFF` 298- `USE_QUICHE`: Use quiche library for HTTP/3 support. Default: `OFF` 299- `USE_WIN32_IDN`: Use WinIDN for IDN support. Default: `OFF` 300- `USE_WIN32_LDAP`: Use Windows LDAP implementation. Default: `ON` 301 302## Dependency options (via CMake) 303 304- `OPENSSL_ROOT_DIR`: Set this variable to the root installation of OpenSSL (and forks). 305- `OPENSSL_USE_STATIC_LIBS`: Look for static OpenSSL libraries. 306- `ZLIB_INCLUDE_DIR`: The zlib include directory. 307- `ZLIB_LIBRARY`: Path to `zlib` library. 308 309## Dependency options 310 311- `CLANG_TIDY`: `clang-tidy` tool used with `CURL_CLANG_TIDY=ON`. Default: `clang-tidy` 312- `PERL_EXECUTABLE` Perl binary used throughout the build and tests. 313- `AMISSL_INCLUDE_DIR`: The AmiSSL include directory. 314- `AMISSL_STUBS_LIBRARY`: Path to `amisslstubs` library. 315- `AMISSL_AUTO_LIBRARY`: Path to `amisslauto` library. 316- `BEARSSL_INCLUDE_DIR`: The BearSSL include directory. 317- `BEARSSL_LIBRARY`: Path to `bearssl` library. 318- `BROTLI_INCLUDE_DIR`: The brotli include directory. 319- `BROTLICOMMON_LIBRARY`: Path to `brotlicommon` library. 320- `BROTLIDEC_LIBRARY`: Path to `brotlidec` library. 321- `CARES_INCLUDE_DIR`: The c-ares include directory. 322- `CARES_LIBRARY`: Path to `cares` library. 323- `DL_LIBRARY`: Path to `dl` library. (for Rustls) 324- `GSS_ROOT_DIR`: Set this variable to the root installation of GSS. (also supported as environment) 325- `LDAP_LIBRARY`: Name or full path to `ldap` library. Default: `ldap` 326- `LDAP_LBER_LIBRARY`: Name or full path to `lber` library. Default: `lber` 327- `LDAP_INCLUDE_DIR`: Path to LDAP include directory. 328- `LIBGSASL_INCLUDE_DIR`: The libgsasl include directory. 329- `LIBGSASL_LIBRARY`: Path to `libgsasl` library. 330- `LIBIDN2_INCLUDE_DIR`: The libidn2 include directory. 331- `LIBIDN2_LIBRARY`: Path to `libidn2` library. 332- `LIBPSL_INCLUDE_DIR`: The libpsl include directory. 333- `LIBPSL_LIBRARY`: Path to `libpsl` library. 334- `LIBRTMP_INCLUDE_DIR`: The librtmp include directory. 335- `LIBRTMP_LIBRARY`: Path to `librtmp` library. 336- `LIBSSH_INCLUDE_DIR`: The libssh include directory. 337- `LIBSSH_LIBRARY`: Path to `libssh` library. 338- `LIBSSH2_INCLUDE_DIR`: The libssh2 include directory. 339- `LIBSSH2_LIBRARY`: Path to `libssh2` library. 340- `LIBUV_INCLUDE_DIR`: The libuv include directory. 341- `LIBUV_LIBRARY`: Path to `libuv` library. 342- `MATH_LIBRARY`: Path to `m` library. (for Rustls, wolfSSL) 343- `MBEDTLS_INCLUDE_DIR`: The mbedTLS include directory. 344- `MBEDTLS_LIBRARY`: Path to `mbedtls` library. 345- `MBEDX509_LIBRARY`: Path to `mbedx509` library. 346- `MBEDCRYPTO_LIBRARY`: Path to `mbedcrypto` library. 347- `MSH3_INCLUDE_DIR`: The msh3 include directory. 348- `MSH3_LIBRARY`: Path to `msh3` library. 349- `NGHTTP2_INCLUDE_DIR`: The nghttp2 include directory. 350- `NGHTTP2_LIBRARY`: Path to `nghttp2` library. 351- `NGHTTP3_INCLUDE_DIR`: The nghttp3 include directory. 352- `NGHTTP3_LIBRARY`: Path to `nghttp3` library. 353- `NGTCP2_INCLUDE_DIR`: The ngtcp2 include directory. 354- `NGTCP2_LIBRARY`: Path to `ngtcp2` library. 355- `NETTLE_INCLUDE_DIR`: The nettle include directory. 356- `NETTLE_LIBRARY`: Path to `nettle` library. 357- `PTHREAD_LIBRARY`: Path to `pthread` library. (for Rustls) 358- `QUICHE_INCLUDE_DIR`: The quiche include directory. 359- `QUICHE_LIBRARY`: Path to `quiche` library. 360- `RUSTLS_INCLUDE_DIR`: The Rustls include directory. 361- `RUSTLS_LIBRARY`: Path to `rustls` library. 362- `WATT_ROOT`: Set this variable to the root installation of Watt-32. 363- `WOLFSSH_INCLUDE_DIR`: The wolfSSH include directory. 364- `WOLFSSH_LIBRARY`: Path to `wolfssh` library. 365- `WOLFSSL_INCLUDE_DIR`: The wolfSSL include directory. 366- `WOLFSSL_LIBRARY`: Path to `wolfssl` library. 367- `ZSTD_INCLUDE_DIR`: The zstd include directory. 368- `ZSTD_LIBRARY`: Path to `zstd` library. 369 370## Test tools 371 372- `APXS`: Default: `apxs` 373- `CADDY`: Default: `caddy` 374- `HTTPD_NGHTTPX`: Default: `nghttpx` 375- `HTTPD`: Default: `apache2` 376- `TEST_NGHTTPX`: Default: `nghttpx` 377- `VSFTPD`: Default: `vsftps` 378 379# Migrating from Visual Studio IDE Project Files 380 381We recommend CMake to build curl with MSVC. 382 383The project build files reside in project/Windows/VC\* for VS2010, VS2010 and 384VS2013 respectively. 385 386These CMake Visual Studio generators require CMake v3.24 or older. You can 387download them from <https://cmake.org/files/v3.24/>. 388 389You can also use `-G "NMake Makefiles"`, which is supported by all CMake 390versions. 391 392Configuration element | Equivalent CMake options 393:-------------------------------- | :-------------------------------- 394`VC10` | `-G "Visual Studio 10 2010"` 395`VC11` | `-G "Visual Studio 11 2012"` 396`VC12` | `-G "Visual Studio 12 2013"` 397`x64` | `-A x64` 398`Win32` | `-A Win32` 399`DLL` | `BUILD_SHARED_LIBS=ON`, `BUILD_STATIC_LIBS=OFF`, (default) 400`LIB` | `BUILD_SHARED_LIBS=OFF`, `BUILD_STATIC_LIBS=ON` 401`Debug` | `CMAKE_BUILD_TYPE=Debug` 402`Release` | `CMAKE_BUILD_TYPE=Release` 403`DLL Windows SSPI` | `CURL_USE_SCHANNEL=ON` (with SSPI enabled by default) 404`DLL OpenSSL` | `CURL_USE_OPENSSL=ON`, optional: `OPENSSL_ROOT_DIR`, `OPENSSL_USE_STATIC_LIBS=ON` 405`DLL libssh2` | `CURL_USE_LIBSSH2=ON`, optional: `LIBSSH2_INCLUDE_DIR`, `LIBSSH2_LIBRARY` 406`DLL WinIDN` | `USE_WIN32_IDN=ON` 407 408For example these commands: 409 410 > cd projects 411 > ./generate.bat VC12 412 > msbuild "-property:Configuration=DLL Debug - DLL Windows SSPI - DLL WinIDN" Windows/VC12/curl-all.sln 413 414translate to: 415 416 > cmake . -G "Visual Studio 12 2013" -A x64 -DCMAKE_BUILD_TYPE=Debug -DCURL_USE_SCHANNEL=ON -DUSE_WIN32_IDN=ON -DCURL_USE_LIBPSL=OFF 417 418# Migrating from winbuild builds 419 420We recommend CMake to build curl with MSVC. The winbuild build method is 421deprecated and may be dropped in a future release. 422 423In CMake you can customize the path of dependencies by passing the absolute 424header path and the full path of the library via `*_INCLUDE_DIR` and 425`*_LIBRARY` options (see the complete list in the option listing above). 426The full path to the library can point to a static library or an import 427library, which defines if the dependency is linked as a dll or statically. 428For OpenSSL this works 429[differently](https://cmake.org/cmake/help/latest/module/FindOpenSSL.html): 430You can pass the root directory of the OpenSSL installation via 431`OPENSSL_ROOT_DIR`, then pass `OPENSSL_USE_STATIC_LIBS=ON` to select static 432libs. 433 434winbuild options | Equivalent CMake options 435:-------------------------------- | :-------------------------------- 436`DEBUG` | `CMAKE_BUILD_TYPE=Debug` 437`GEN_PDB` | `CMAKE_EXE_LINKER_FLAGS=/Fd<path>`, `CMAKE_SHARED_LINKER_FLAGS=/Fd<path>` 438`LIB_NAME_DLL`, `LIB_NAME_STATIC` | `IMPORT_LIB_SUFFIX`, `LIBCURL_OUTPUT_NAME`, `STATIC_LIB_SUFFIX` 439`VC` | see CMake `-G` [options](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) 440`MACHINE`: `x64`, `x86` | `-A x64`, `-A Win32` 441`MODE`: `dll`, `static` | `BUILD_SHARED_LIBS=ON/OFF`, `BUILD_STATIC_LIBS=ON/OFF`, `BUILD_STATIC_CURL=ON/OFF` (default: dll) 442`RTLIBCFG`: `static` | `CURL_STATIC_CRT=ON` 443`ENABLE_IDN` | `USE_WIN32_IDN=ON` 444`ENABLE_IPV6` | `ENABLE_IPV6=ON` 445`ENABLE_MSH3` | `USE_MSH3=ON` 446`ENABLE_NGHTTP2` | `USE_NGHTTP2=ON` 447`ENABLE_OPENSSL_AUTO_LOAD_CONFIG` | `CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=OFF` (default) 448`ENABLE_SCHANNEL` | `CURL_USE_SCHANNEL=ON` 449`ENABLE_SSPI` | `CURL_WINDOWS_SSPI=ON` (default with Schannel) 450`ENABLE_UNICODE` | `ENABLE_UNICODE=ON` 451`WITH_PREFIX` | `CMAKE_INSTALL_PREFIX=<path>` 452`WITH_DEVEL` | see individual `*_INCLUDE_DIR` and `*_LIBRARY` options and `OPENSSL_ROOT_DIR` 453`WITH_CARES`, `CARES_PATH` | `ENABLE_ARES=ON`, optional: `CARES_INCLUDE_DIR`, `CARES_LIBRARY` 454`WITH_MBEDTLS`, `MBEDTLS_PATH` | `CURL_USE_MBEDTLS=ON`, optional: `MBEDTLS_INCLUDE_DIR`, `MBEDTLS_LIBRARY`, `MBEDX509_LIBRARY`, `MBEDCRYPTO_LIBRARY` 455`WITH_MSH3`, `MSH_PATH` | `USE_MSH3=ON`, optional: `MSH3_INCLUDE_DIR`, `MSH3_LIBRARY` 456`WITH_NGHTTP2`, `NGHTTP2_PATH` | `USE_NGHTTP2=ON`, optional: `NGHTTP2_INCLUDE_DIR`, `NGHTTP2_LIBRARY` 457`WITH_SSH`, `SSH_PATH` | `CURL_USE_LIBSSH=ON`, optional: `LIBSSH_INCLUDE_DIR`, `LIBSSH_LIBRARY` 458`WITH_SSH2`, `SSH2_PATH` | `CURL_USE_LIBSSH2=ON`, optional: `LIBSSH2_INCLUDE_DIR`, `LIBSSH2_LIBRARY` 459`WITH_SSL`, `SSL_PATH` | `CURL_USE_OPENSSL=ON`, optional: `OPENSSL_ROOT_DIR`, `OPENSSL_USE_STATIC_LIBS=ON` 460`WITH_WOLFSSL`, `WOLFSSL_PATH` | `CURL_USE_WOLFSSL=ON`, optional: `WOLFSSL_INCLUDE_DIR`, `WOLFSSL_LIBRARY` 461`WITH_ZLIB`, `ZLIB_PATH` | `CURL_ZLIB=ON`, optional: `ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY` 462 463For example this command-line: 464 465 > nmake -f Makefile.vc VC=17 MACHINE=x64 DEBUG=ON mode=dll SSL_PATH=C:\OpenSSL WITH_SSL=dll ENABLE_UNICODE=ON 466 467translates to: 468 469 > cmake . -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DOPENSSL_ROOT_DIR=C:\OpenSSL -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=ON -DCURL_USE_LIBPSL=OFF 470