legends2k / cpp-vcpkg-seed

C++ base project using CMake + vcpkg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ executable using CMake + vcpkg

Cross-platform, cross-toolchain C++ project using CMake as meta-build system and vcpkg as package manager. Useful as seed to germinate further projects from.

Tools

Make sure the following tools are installed:

  • C++ compiler toolchain
    • Windows: VC++ (Visual Studio 2017+), MinGW (GCC on Windows), Clang
    • Linux: GCC, Clang
    • Mac: Clang (Xcode), GCC
  • CMake
  • vcpkg

cmake should be in $PATH / %PATH%. Verify if cmake --version displays the version properly.

Build

Fix vcpkg’s path in the cmake command below to the right location on your machine.

git clone https://github.com/legends2k/cpp-vcpkg-seed

cd cpp-vcpkg-seed

cmake -B build -DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake

cmake --build build

This should build the seed executable under //build.

IDE

CMake can generate project/solution files for different IDEs including

  • Visual Studio
  • QtCreator
  • Eclipse
  • Sublime Text
  • CodeBlocks
  • Codelite

Locate project files at //build directory after project is built from command line. Use -G in the cmake -B command above to change from default IDE; refer cmake --help for details.

Dependencies

Project dependencies are listed in vcpkg.json manifest. Add/Remove libraries as needed. Check available packages in vcpkg when doing it. By default fltk and spdlog are listed as dependencies for GUI programming and logging.

  "dependencies": [
    "spdlog",
    "fltk"
  ]

Refer vcpkg manifest documentation for details.

References

About

C++ base project using CMake + vcpkg

License:The Unlicense


Languages

Language:C++ 49.6%Language:CMake 47.4%Language:C 2.9%