-
Notifications
You must be signed in to change notification settings - Fork 1
Home
#CMakeTemplates
The CMakeTemplates repository contain two folders:
- π CMakeTemplates
- π CMakeProject
- π CMakeSuperBuildTemplate
- π README.md
CMakeProject configures executables, dynamic library or static library using CMake and creates the configuration folder structure for developing. On the other hand, CMakeSuperBuildTemplate is a template for a SuperBuild configuration folder structure. With minimal changes on the CMakeLists.txt files and adding your code files, configuration structure will be ready for your development, taking care of internal and external dependencies.
For more information about how to use this tool, please go to Tutorial and follow the instructions that you need.
This section describes in detail the folder CMakeSuperBuildTemplate and its CMakeLists.txt.
CMakeSuperBuildTemplate is a Template for developers that want to create a new project, executable or library that depends on other projects that are hosted on a git repository. Also allow user configure dependencies and export the compilation result with documentation and so on.
The structure is:
- π CMakeSuperBuildTemplate
- π CMake
- π InternalExecutable
- π InternalLibrary
- π Projects
- π CMakeLists.txt
π CMakeLists.txt file
CMakeLists works preparing your SuperBuild project using CMake. First, CMakeLists.txt file is loaded and during configuration time, Projects folder is open looking for *.cmake files. Each *.cmake file is readed and a subproject is added for each file.
As an example, two internal projects has been added to the Template in order to show the behaviour of the template: InternalExecutable and InternalLibrary. InternalExecutable has its source code in the folder with the same name and produces an executable that depends on InternalLibrary. InternalLibrary has its source code in the folder with the same name and produces a library with no dependencies. (Note that this library project will depends on Doxygen for building documentation)
Finally, inside Projects folder, user can see the *.cmake files for these projects. However, there are two project files more: ExternalExecutable and ExternalLibrary. CMake will download the source code automatically from the repository defined in *.cmake file of these projects and compile taking care of the dependencies.
For more information about how CMake files are organized, please refers to CMakeAll project.
In previous section, user could see the structure of a SuperBuild project. CMakeProject will help user to create a first skeleton version of a library or an executable. Every time user want to add a new library or a new executable to the SuperBuild, CMakeProject can be used to generate the skeleton and *.cmake file for the new project. This is not a template, it is a CMake-based program that allow user to create its own template according to his/her needs. Every t
CMakeAll is a solution built on CMake and its ExternalProject module to provide explicit and extensible management of dependencies. All this project is based on this amazing tool facilitating users during development and sharing their code on git repositories.