This is a template for static and shared library which give a good starter point for new C++ project. It has been designed to use Modern CMake practices in mind, and should be a good starting point for both people willing to learn it and those who want to update their own project.
- Reproducible dependency management via CPM.cmake.
 - Clean separation of code, tests and documentation.
 - Integrated test suite with Catch2.
 - Automatic documentation and deployment with Doxygen and GitHub Pages.
 - Code formatting enforced by clang-format and cmake-format from script.
 - Code coverage via codecov.
 - Code coverage and analysis via sonarcloud.
 - CI workflows for Windows, Linux and MacOS using GitHub Actions.
 
- Add include-what-you-use
 - Add Ccache
 
All source code can be found in the following directories :
include\mlt:- Replace the mlt directory according to the PROJECT_ID defined in CMakeLists.txt
 - Add your own source code.
 
src:- Add your own source code.
 
then add you files to CMakeLists_files.cmake.
Use the following commands to build as a static library.
cmake -S . -B build/static -DBUILD_SHARED_LIBS=NO -DMLT_PACKAGE=YES -DCMAKE_INSTALL_PREFIX=install
cmake --build build/static --target installUse the following commands to build as a shared library.
cmake -S . -B build/shared -DBUILD_SHARED_LIBS=YES -DMLT_PACKAGE=YES -DCMAKE_INSTALL_PREFIX=install
cmake --build build/shared --target installUse the following commands to run the test suite.
cmake -S test -B build/test
cmake --build build/test
cmake --build build/test --target test
# for more details, run:
./build/test/ModernSharedLibTemplateTestUse the following commands to manually build the documentation.
cmake -S doc -B build/doc
cmake --build build/doc --target GenerateDocsCppMfLibTemplate got inspired from the following :
- alexreinking/SharedStaticStarter: A simple starter project showing how to distribute both static and shared libraries in CMake.
 - TheLartians/ModernCppStarter: A popular C++ starter project.
 - Doxygen Awesome: A custom CSS theme for doxygen html-documentation with lots of customization parameters..