This project demonstrates a robust CMake-based build system that showcases the creation and utilization of a custom library within an application. Written in year 2024.
This project demonstrates a robust CMake-based build system that showcases the creation and utilization of a custom library within an application. The template is structured as follows:
The CMake configuration orchestrates a two-stage build process:
Library Compilation: MyLibrary is compiled as a standalone unit, generating either a static or dynamic library based on project requirements.
Application Linking: MyApp is subsequently built, with CMake managing the necessary linkage to MyLibrary.
This template serves as an excellent starting point for projects requiring a clear separation between core library functionality and application-specific code, while maintaining a cohesive build system.
Commands are supposed to be run from the root directory of project.
First we need to clone VCPKG to our local drive, with the correspondig commit hash used in vcpkg.json. We use VCPKG to as our package manager for all 'potentially' used external libraries.
git clone https://github.com/microsoft/vcpkg.git vcpkg
cd vcpkg
git checkout 91d888703f251c13111c1b889be1f350c4ceb7ab # Corresponds to ID in vcpkg.json
From within your desired build directory, in most cases 'build/' in the project root. This well genereate project files for the default generator.
mkdir build
cd build/
cmake ..
you can also specify a specific generator using cmake .. -G <replace_with_other_generator>
instead of the default one.