Skip to content

Basic C++ project using CMake & Conan

Notifications You must be signed in to change notification settings

gtroshin/cpp-cmake-conan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic C++ project using CMake & Conan

CMake 3.25.2 Build and Test

The application being built is an MD5 hash calculator using the Poco Libraries. Inspired by this project.

Requirements

The following tools are in the foundation to be able to develop this project.

Please follow the linked official guides with a installation instructions depending on your platform.

This project has been tested on Linux and macOS.

Development

This project can be built and run locally on Linux and macOS and you can decide to use a Docker environment.

Run the following command to launch the bash environment with pre-installed CMake and Conan in a container. More details are here.

# start up a docker container
docker run -it --rm --name conangcc11 conanio/gcc11-ubuntu16.04 /bin/bash

Run the following commands to build and execute test in the project (macOS/Debug).

# create a build folder
mkdir build && cd build
# install the dependencies using conan
conan install -s build_type=Debug .. --build=missing
# build
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
cmake --build .
# test
ctest -C Debug

CI/CD

The Continues Integration uses GitHub Actions workflow that includes build and test jobs run in an OS matrix to cover the latest available Linux and macOS distributives. As well as the release job that is only triggered when the new release is published and attaches binaries to the relevant release. Additionally, the workflow can be triggered via workflow_dispatch event, manually.

Release process

The release can be created via the GitHub UI where an engineer can create a tag at the same time. Local tag creation and pushing it to remote will not trigger a workflow.

Usefull links

GoogleTest Testing framework that is used to tun tests in this project