1 # How to build from source
5 ### Common requirements
7 In order to build cmocka, you need to install several components:
10 - [CMake](http://www.cmake.org) >= 2.8.0.
12 Note that these version numbers are version we know works correctly. If you
13 build and run cmocka successfully with an older version, please let us know.
16 First, you need to configure the compilation, using CMake. Go inside the
17 `build` dir. Create it if it doesn't exist.
19 GNU/Linux, MacOS X, MSYS/MinGW:
21 cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
24 On Windows you should choose a makefile gernerator with -G.
26 ### CMake standard options
27 Here is a list of the most interesting options provided out of the box by
30 - CMAKE_BUILD_TYPE: The type of build (can be Debug Release MinSizeRel
32 - CMAKE_INSTALL_PREFIX: The prefix to use when running make install (Default
33 to /usr/local on GNU/Linux and MacOS X)
34 - CMAKE_C_COMPILER: The path to the C compiler
35 - CMAKE_CXX_COMPILER: The path to the C++ compiler
37 ### CMake options defined for cmocka
39 Options are defined in the following files:
43 They can be changed with the -D option:
45 `cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON ..`
47 ### Browsing/editing CMake options
49 In addition to passing options on the command line, you can browse and edit
50 CMake options using `cmakesetup` (Windows), `cmake-gui` or `ccmake` (GNU/Linux
54 - On Windows: run `cmakesetup`
55 - On GNU/Linux and MacOS X: run `ccmake ..`
59 If you want to install cmocka after compilation run:
65 The cmocka library can be found in the `build/src` directory.
66 You can run the binaries in `build/examples/*` which is a
69 ## About this document
71 This document is written using [Markdown][] syntax, making it possible to
72 provide usable information in both plain text and HTML format. Whenever
73 modifying this document please use [Markdown][] syntax.
75 [markdown]: http://www.daringfireball.net/projects/markdown