A flexible, extensible and cross-platform CMake Template to compile small and large C and C++ Projects
Create a new repository from the Template on Github:
git clone https://github.com/TheMagehawk/CMakeTemplate.git
Now you can write custom source files in the src
directory.
Source files need to be added in the CMakeLists.txt:
list(APPEND SOURCE_FILES ...)
External dependencies can be added as Git submodules or Local Copies into the external
directory.
The target name for each dependency needs to be addressed in the CMakeLists.txt:
list(APPEND LIBS ...)
Additional flags or variables can be set directly in the Root CMakeLists.txt!
This Template is provided with Github Workflow Jobs to automate compilation.
To enable the jobs remove if: False
or replace it with if: True
for each desired job.
- Initialize and update all submodules in this project (including external modules/dependencies):
git submodule update --init --recursive --depth=1
- Configure the CMake Project (and delete and regenerate Cache if needed or error)
- Run one of the available Configurations
- Run
chmod +x build.sh && ./build.sh [FLAGS]
- Run
./build.bat [FLAGS]
- Run
chmod +x build.sh && ./build.sh [FLAGS]
- Cross Compile on Windows:
./build.bat --android [NDK_PATH]
- Cross Compile on Linux:
./build.sh --android [NDK_PATH]
- Maybe someday...
./build.sh --help
or ./build.bat --help
as flags to print out all available build flags