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.
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.
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
.
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.
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.