Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/auneri/cmakeall
Dependency management using CMake and its ExternalProject module.
https://github.com/auneri/cmakeall
build-automation cmake
Last synced: 13 days ago
JSON representation
Dependency management using CMake and its ExternalProject module.
- Host: GitHub
- URL: https://github.com/auneri/cmakeall
- Owner: auneri
- License: mit
- Created: 2013-11-13T01:45:13.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2023-03-21T12:56:17.000Z (almost 2 years ago)
- Last Synced: 2024-11-18T18:31:23.886Z (3 months ago)
- Topics: build-automation, cmake
- Language: CMake
- Homepage: http://auneri.github.io/CMakeAll/
- Size: 216 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CMakeAll
Dependency management using [CMake](https://cmake.org) and its [ExternalProject module](https://cmake.org/cmake/help/latest/module/ExternalProject.html).
[![license](https://img.shields.io/github/license/auneri/CMakeAll.svg)](https://github.com/auneri/CMakeAll/blob/main/LICENSE.md)
[![release](https://img.shields.io/github/release/auneri/CMakeAll.svg)](https://github.com/auneri/CMakeAll/releases)
[![build](https://img.shields.io/github/actions/workflow/status/auneri/CmakeAll/main.yml)](https://github.com/auneri/CMakeAll/actions)## Getting started
```cmake
cmake_minimum_required(VERSION 2.8.7)
project(HelloWorld)find_package(CMakeAll 1.2 REQUIRED)
cma_add_projects("/source/dir/ProjectA.cmake")
cma_add_projects(ProjectB ProjectC ProjectD
PREFIX "${PROJECT_SOURCE_DIR}/"
SUFFIX ".cmake")cma_configure_projects()
cma_configure_launcher()
cma_print_projects()
```where a simple *project definition script* for `ProjectA` may contain:
```cmake
set(EP_REQUIRED_PROJECTS ProjectB)
set(EP_URL "https://github.com/organization/ProjectA.git")cma_end_definition()
ExternalProject_Add(${EP_NAME}
DEPENDS ${EP_REQUIRED_PROJECTS}
GIT_REPOSITORY ${EP_URL}
GIT_SHALLOW ON
GIT_TAG "v1.0"
SOURCE_DIR ${PROJECT_BINARY_DIR}/${EP_NAME}
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=Relase
BINARY_DIR ${PROJECT_BINARY_DIR}/${EP_NAME}-build
INSTALL_COMMAND "")
```Variables listed below can be used to define a project, and should be set prior to calling `cma_end_definition`.
```cmake
set(EP_NAME "${FILENAME}") # project name
set(EP_REQUIRED_PROJECTS "") # list of required projects
set(EP_REQUIRED_OPTIONS "") # list of required options
set(EP_URL) # URL(s) of remote location to be verified
set(EP_PATCH "") # patch file to applyset(EP_OPTION_NAME "${DIRNAME}_${EP_NAME}") # project CMake option
set(EP_OPTION_DEFAULT OFF) # default value of option
set(EP_OPTION_DEPENDENT OFF) # hide option until requirements are met
set(EP_OPTION_DESCRIPTION "") # option description
set(EP_OPTION_ADVANCED OFF) # mark option as advanced
```Each project may define its own environment variables using `cma_envvar`.
```cmake
cma_envvar(PATH PREPEND @BINARY_DIR@/@LIBDIR@/@INTDIR@)# variables that expand at build-time
set(INTDIR "@INTDIR@")
set(LIBDIR "@LIBDIR@")
set(SOURCE_DIR "@SOURCE_DIR@")
set(BINARY_DIR "@BINARY_DIR@")
set(INSTALL_DIR "@INSTALL_DIR@")
```which are then used to configure a *launcher script* that may be used as:
```shell
cmake -P /binary/dir/HelloWorld.cmake
```## Obtaining
**Option 1.** Standard method where CMake will request the path to your local copy.
```cmake
find_package(CMakeAll 1.2 REQUIRED)
```**Option 2.** Using [FindCMakeAll.cmake](https://github.com/auneri/CMakeAll/blob/v1.2/CMake/FindCMakeAll.cmake) where the project is automatically cloned from GitHub. If version number is not specified main branch is cloned and updated with each *configure*.
```cmake
list(APPEND CMAKE_MODULE_PATH "/path/to/FindCMakeAll.cmake")
find_package(CMakeAll 1.2 REQUIRED)
```