INSTALL.cmake 3.7 KB

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