mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-19 04:34:36 +03:00
68 lines
2.3 KiB
Plaintext
68 lines
2.3 KiB
Plaintext
|
|
= CMake Examples
|
|
:toc:
|
|
:toc-placement!:
|
|
|
|
toc::[]
|
|
|
|
# Introduction
|
|
|
|
https://cmake.org/[CMake] is a cross-platform open-source build system which can build, test and package
|
|
software. It can be used to support multiple native build environments including
|
|
make, Apple's xcode and Microsoft Visual Studio.
|
|
|
|
This repository includes some example CMake configurations which I have picked up
|
|
when exploring it's usage for various projects. The examples are laid out in a tutorial like format.
|
|
The first examples are very basic and slowly increase in complexity drawing on previous examples to show
|
|
more complex use cases.
|
|
|
|
These examples have been tested on Ubuntu 14.04 but should work under any Linux system that supports CMake.
|
|
|
|
|
|
# Requirements
|
|
|
|
The basic requirements for most examples are:
|
|
|
|
* CMake
|
|
* A c++ compiler (defaults to gcc)
|
|
* make
|
|
|
|
The easiest way to install the above on Ubuntu is as follows
|
|
|
|
[source,bash]
|
|
----
|
|
$ sudo apt-get install build-essential
|
|
$ sudo apt-get install cmake
|
|
----
|
|
|
|
Some specific examples may require other tools including:
|
|
|
|
* http://www.boost.org/[boost]
|
|
|
|
`$ sudo apt-get libboost-all-dev`
|
|
|
|
* https://github.com/google/protobuf[protobuf]
|
|
|
|
`$ sudo apt-get install libprotobuf-dev`
|
|
|
|
* http://cppcheck.sourceforge.net/[cppcheck]
|
|
|
|
`$ sudo apt-get install cppcheck`
|
|
|
|
|
|
# Other Links
|
|
|
|
There are many CMake tutorials and examples online. The list below includes links
|
|
to some of these which I have found helpful in my CMake journey.
|
|
|
|
* https://cmake.org/cmake-tutorial/[Official CMake Tutorial]
|
|
* https://cmake.org/Wiki/Main_Page[Official CMake Wiki]
|
|
* https://cmake.org/Wiki/CMake_Useful_Variables[CMake Useful Variables]
|
|
* http://derekmolloy.ie/hello-world-introductions-to-cmake/[Derek Molloy - Intro to CMake]
|
|
* http://techminded.net/blog/modular-c-projects-with-cmake.html[Modular C++ Projects]
|
|
* http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/[Common CMake Anti-Patterns]
|
|
* http://baptiste-wicht.com/posts/2014/04/install-use-clang-static-analyzer-cmake.html[Using clang static analyser with CMake]
|
|
* https://cmake.org/pipermail/cmake/2011-April/043709.html[Static Analysis with CDash] - Includes some info about using CppCheck with CMake
|
|
* https://www.openfoundry.org/svn/cms/trunk/cmake/CppcheckTargets.cmake[CppCheck Targets]
|
|
* https://samthursfield.wordpress.com/2015/10/20/some-cmake-tips/[CMake Tips]
|