From 6e9d32f382f9864293fd9adae1e3a91ae5c19101 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 29 Jan 2023 14:41:45 +0100 Subject: Improve INSTALL.md Fixes #63 --- INSTALL.md | 39 ++++++++++++++++++++++++++++----------- README.md | 3 ++- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index d20a357..0f8718b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,8 +1,23 @@ -# How to build from source +# Installing cmocka -## Requirements +## Use a package manger (also on Windows) -### Common requirements +If you're using a BSD or Linux distribution, cmocka is already packaged and +you should find it in your package manager. + + install cmocka-devel + or + install libcmocka-devel + +For Windows it is recommended to use: https://vcpkg.io/ + + vcpkg install cmocka + +## Building from source + +### Requirements + +#### Common requirements In order to build cmocka, you need to install several components: @@ -12,7 +27,7 @@ In order to build cmocka, you need to install several components: Note that these version numbers are version we know works correctly. If you build and run cmocka successfully with an older version, please let us know. -## Building +### Building First, you need to configure the compilation, using CMake. Go inside the `build` dir. Create it if it doesn't exist. @@ -29,7 +44,7 @@ You can also use the CMake GUI which is shipped with CMake. It will list all available generators for MSVC on Windows. We only support Visual Studio 2013 or newer which supports C99. -### CMake standard options +#### CMake standard options Here is a list of the most interesting options provided out of the box by CMake. @@ -40,7 +55,7 @@ CMake. - CMAKE_C_COMPILER: The path to the C compiler - CMAKE_CXX_COMPILER: The path to the C++ compiler -### CMake options defined for cmocka +#### CMake options defined for cmocka Options are defined in the following files: @@ -50,29 +65,31 @@ They can be changed with the -D option: `cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON ..` -### Browsing/editing CMake options +#### Browsing/editing CMake options In addition to passing options on the command line, you can browse and edit -CMake options using `cmakesetup` (Windows), `cmake-gui` or `ccmake` (GNU/Linux +CMake options using `cmake-gui.exe` (Windows) or `ccmake` (GNU/Linux and MacOS X). - Go to the build dir - On Windows: run `cmakesetup` - On GNU/Linux and MacOS X: run `ccmake ..` -## Installing +More at https://cmake.org/runningcmake/ + +### Installing If you want to install cmocka after compilation run: make install -## Running +### Running The cmocka library can be found in the `build/src` directory. You can run the binaries in `build/examples/*` which is a are example tests. -## Testing +### Testing As mention above you can turn on the unit tests and make it possible to easily execute them: diff --git a/README.md b/README.md index 62d99cb..7558b13 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Compiling To compile the cmocka library and example applications run, create a build dir, and in the build dir call 'cmake /path/to/cmocka' followed by 'make'. On -Windows you can use the cmake gui. More details can be found in the INSTALL file. +Windows you can use the cmake gui. More details can be found in the INSTALL.md +file. Website ------- -- cgit v1.1