Skip to content

This example project provides the boilerplate and a potential starting point for a C++ project that utilizes the CMAKE build system, VCPKG package manager, and PPM package manager manager.

License

Notifications You must be signed in to change notification settings

ariveron/boilerplate-pmm-vcpkg-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boilerplate-pmm-vcpkg-cmake

Introduction

This example project provides the boilerplate and a potential starting point for a C++ project that utilizes the CMAKE build system, VCPKG package manager, and PMM package manager manager.

This sample project uses PMM to automatically bootstrap VCPKG, download the required packages, and integrate the packages into CMAKE when CMAKE is run. The main build target executable source code, which utilizes the FMT library, can be found in src/main.cpp.

Please consult the documentation for CMAKE, VCPKG, PMM, and FMT for more details.

Quick Start

Prerequisites

  • Git
  • CMAKE version 3.2 or later
  • C++17 compiler

Building the project

The following steps assume you're using a Linux OS, but the steps for a Windows OS should be similar, except for potentially the directory structure generated by the build.

  1. Clone the repository

    $ git clone https://github.com/ariveron/boilerplate-pmm-vcpkg-cmake

  2. Go into the repo directory

    $ cd boilerplate-pmm-vcpkg-cmake

  3. Run CMAKE to create the build files

    $ cmake .

  4. Use CMAKE to build the project

    $ cmake --build .

  5. You should now be able to run the program

    $ ./bin/main

    The answer is 42

Adding and removing packages

In the root level CMakeLists.txt file, within the pmm CMAKE function, you can see where the VCPKG REVISION is specified as the master branch of the VCPKG repositor. You can change this to a revision or a tag so that the VCPKG version used is the same on every build.

Within the pmm cmake function you'll also notice the list of required VCPKG packages after the REQUIRES keyword. In this example the only package specified is fmt. This should be a space-seperated list of VCPKG names.

You should consult the documentation for each package. Typically, you'll be able to bring in the package into CMAKE by using the find_package cmake function. In the case of the FMT library, we can add it to the main target (src/CMakeLists) using the target_link_libraries CMAKE function.

If you're going to be using this template as a starting point for your project, simply add and remove packages and libraries from the CMakeLists.txt files as needed. You may also want to change the CMAKE project name and create a new git repository for it at the very least.

About

This example project provides the boilerplate and a potential starting point for a C++ project that utilizes the CMAKE build system, VCPKG package manager, and PPM package manager manager.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published