This boilerplate creates a unit-tested C++ application/library which uses CMake for cross-platform builds.
CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice - CMake
This boilerplate aims to keep things simple, use modern CMake features, and provide a good starting point for developers new to cmake.
- A C++ application/library that can be edited, built and tested on Windows/Linux
- Uses powerful CMake functionality to minimise the use of platform specific code
- Testing with Google Test/Mock.
- Use of Docker for easy Linux debugging from a Windows environment.
- C++ build tools
- CMake 3.4.3 or newer
- Git
- Docker for Windows (optional)
mkdir -p build-linux && cd "$_" && cmake .. && make
OR
./build-scripts/setup_build_linux.sh && cd build-linux && ./build_all.sh
Full CMake build support without a project file is supported in most common IDEs:
- Visual Studio 2017 (Windows)
- JetBrains CLion (Cross-platform)
- QTCreator (Cross-platform)
- Visual Studio Code (Cross-platform) with CMake Tools
- See link for more
Google test produces executables which cleanly indicate test results, so IDE integration is not essential.
Simply run the generated test executable and you will see output as below:
In-editor Google Test integration is not common at this stage, but it is available in
- JetBrains CLion
- QTCreator with this plugin
- Visual Studio 2017 with ReSharper, although this functionality is not currently working for CMake projects in Visual Studio 2017 RC
The docker_build
script create an Ubuntu 14.04 container with c++ build tools/CMake.
The docker_start
script mounts the project directory and sets it as the working directory.
cd docker
docker_build.bat
docker_start.bat
cd docker
./docker_build.sh
./docker_start.sh
- Not tested on Mac or any flavours of Linux aside from Ubuntu 14.04