Skip to content

Files

Latest commit

 

History

History

samples

ConfigCat C++ Console Sample App

This is a sample application to demonstrate how to use the ConfigCat C++ SDK.

Table of Contents

Instructions for CMake

1. Install CMake

2. Install Vcpkg

  • On Windows:

    git clone https://github.com/microsoft/vcpkg
    .\vcpkg\bootstrap-vcpkg.bat
  • On Linux/Mac:

    git clone https://github.com/microsoft/vcpkg
    ./vcpkg/bootstrap-vcpkg.sh

3. Build with CMake

cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake
cmake --build build

4. Run

  • On Windows:

    .\build\example.exe
  • On Linux/Mac:

    ./build/example

Instructions for GNU Make

1. Install Vcpkg

git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh

2. Build

Makefile uses the VCPKG_ROOT environment variable to install the ConfigCat package and its dependencies.

(export VCPKG_ROOT=[path to vcpkg] && make)

3. Run

./example

Instructions for CLion

1. Install Vcpkg

  • On Windows:

    git clone https://github.com/microsoft/vcpkg
    .\vcpkg\bootstrap-vcpkg.bat
  • On Linux/Mac:

    git clone https://github.com/microsoft/vcpkg
    ./vcpkg/bootstrap-vcpkg.sh

2. Open the example folder with CLion

3. Update CLion Toolchain

Open the Toolchains settings (File > Settings on Windows and Linux, CLion > Preferences on macOS), and go to the CMake settings (Build, Execution, Deployment > CMake). Finally, in CMake options, add the following line:

-DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake

4. Build and Run the example project with CLion

Instructions for Visual Studio

1. Install Vcpkg

git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat

In order to use vcpkg with Visual Studio, run the following command (may require administrator elevation):

.\vcpkg\vcpkg integrate install

After this, you can now create a New non-CMake Project (or open an existing one). All installed libraries are immediately ready to be #include'd and used in your project without additional configuration.

2. Build and Run the example.sln with Visual Studio

Note

Make sure that on the project's property pages Use Vcpkg Manifest is turned on and C++ Language Standard is C++17.

Visual Studio Vcpkg Manifest

Visual Studio C++ 17

Documentation