1                                  _   _ ____  _
2                              ___| | | |  _ \| |
3                             / __| | | | |_) | |
4                            | (__| |_| |  _ <| |___
5                             \___|\___/|_| \_\_____|
6
7                                How To Compile with CMake
8
9Building with CMake
10==========================
11   This document describes how to compile, build and install curl and libcurl
12   from source code using the CMake build tool. To build with CMake, you will
13   of course have to first install CMake.  The minimum required version of
14   CMake is specified in the file CMakeLists.txt found in the top of the curl
15   source tree. Once the correct version of CMake is installed you can follow
16   the instructions below for the platform you are building on.
17
18   CMake builds can be configured either from the command line, or from one
19   of CMake's GUI's.
20
21Current flaws in the curl CMake build
22=====================================
23
24   Missing features in the cmake build:
25
26   - Builds libcurl without large file support
27   - Does not support all SSL libraries (only OpenSSL, Schannel,
28     Secure Transport, and mbed TLS, NSS, WolfSSL)
29   - Doesn't allow different resolver backends (no c-ares build support)
30   - No RTMP support built
31   - Doesn't allow build curl and libcurl debug enabled
32   - Doesn't allow a custom CA bundle path
33   - Doesn't allow you to disable specific protocols from the build
34   - Doesn't find or use krb4 or GSS
35   - Rebuilds test files too eagerly, but still can't run the tests
36   - Doesn't detect the correct strerror_r flavor when cross-compiling (issue #1123)
37
38
39Command Line CMake
40==================
41   A CMake build of curl is similar to the autotools build of curl. It
42   consists of the following steps after you have unpacked the source.
43
44    1. Create an out of source build tree parallel to the curl source
45       tree and change into that directory
46
47    $ mkdir curl-build
48    $ cd curl-build
49
50    2. Run CMake from the build tree, giving it the path to the top of
51       the curl source tree.  CMake will pick a compiler for you. If you
52       want to specify the compile, you can set the CC environment
53       variable prior to running CMake.
54
55    $ cmake ../curl
56    $ make
57
58    3. Install to default location:
59
60    $ make install
61
62    (The test suite does not work with the cmake build)
63
64ccmake
65=========
66     CMake comes with a curses based interface called ccmake.  To run ccmake on
67     a curl use the instructions for the command line cmake, but substitute
68     ccmake ../curl for cmake ../curl.  This will bring up a curses interface
69     with instructions on the bottom of the screen. You can press the "c" key
70     to configure the project, and the "g" key to generate the project. After
71     the project is generated, you can run make.
72
73cmake-gui
74=========
75     CMake also comes with a Qt based GUI called cmake-gui. To configure with
76     cmake-gui, you run cmake-gui and follow these steps:
77        1. Fill in the "Where is the source code" combo box with the path to
78        the curl source tree.
79        2. Fill in the "Where to build the binaries" combo box with the path
80        to the directory for your build tree, ideally this should not be the
81        same as the source tree, but a parallel directory called curl-build or
82        something similar.
83        3. Once the source and binary directories are specified, press the
84        "Configure" button.
85        4. Select the native build tool that you want to use.
86        5. At this point you can change any of the options presented in the
87        GUI.  Once you have selected all the options you want, click the
88        "Generate" button.
89        6. Run the native build tool that you used CMake to generate.
90