This small library shows you how to create a basic C++ application with dependencies.
This file defines the project, updates submodules, adds other parts of the project as subdirectories and provides the installation rules.
This file defines the library target.
Adds all of the apps as subdirectories. This file helps keeping the root CMake file clean.
Defines the documentation target. See the guide in the "references" section for more information.
Defines the test target. See Catch2's documentation (link in the references).
This is where we store the project's dependencies, like Catch2.
Headers storage.
Run this command to configure the project:
cmake -B build -S .
cmake --build build
cmake --build build --target install
Note that this command requires root privilege.
Run the following command to perform tests
cmake --build build --target test
To disable documentation generation (in case you don't have doxygen installed):
-DMATHIC_BUILD_DOCS=OFF
To disable building apps:
-DMATHIC_BUILD_APPS=OFF
Both of this options are defaulted to ON, you should pass the above options to cmake in the configuration phase.
Published under GNU GPL v3.0, visit LICENSE.md
I hope this example helps you with CMake, if you have any questions, in case google has failed you, feel free to send me a message! (En/Fa)
E-mail: alirashidi127@gmail.com
Telegram, twitter, linkedin: @codenegaar
Easy dependency management tutorial