Compare commits

...

11 Commits
v0.1 ... v0.4

Author SHA1 Message Date
Lars Melchior
e4bbd6e215 remove CPM_RESET in favor of CPM_OFFLINE (#6)
* remove CPM_RESET in favor of CPM_OFFLINE

* Update README.md (#5)

* Update README.md

* Update README.md

* Update README.md
2019-04-10 16:43:57 +02:00
Lars Melchior
e368fce6c3 Add CPM_RESET (#4)
* added CPM_RESET option

* update readme

* Update README.md
2019-04-09 20:01:27 +02:00
Lars Melchior
f8e571e416 Merge pull request #3 from TheLartians/dev
update parser version
2019-04-09 18:04:44 +02:00
Lars Melchior
e565e35397 Merge branch 'master' into dev 2019-04-09 17:30:48 +02:00
Lars Melchior
702f413801 update Parser lib 2019-04-09 17:30:18 +02:00
Lars Melchior
03b2dd0cb9 Merge pull request #2 from TheLartians/dev
update readme
2019-04-09 17:19:53 +02:00
Lars Melchior
4badcddc5d update readme 2019-04-09 17:10:44 +02:00
Lars Melchior
72371bcc8b Merge pull request #1 from TheLartians/dev
remove test log
2019-04-09 17:07:51 +02:00
Lars Melchior
0798050d6d Merge branch 'master' into dev 2019-04-09 17:00:22 +02:00
Lars Melchior
ffa310199a remove test log 2019-04-09 16:59:49 +02:00
Lars Melchior
cd3cdfd197 Update README.md 2019-04-09 16:49:19 +02:00
5 changed files with 34 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
# CPM
CPM is a very simple package manager written in Cmake based on the amazing [DownloadProject](https://github.com/Crascit/DownloadProject) script. It is extremely easy to use and drastically simplifies the inclusion of other Cmake-based projects from github.
CPM is a minimalistic package manager written in Cmake based on the amazing [DownloadProject](https://github.com/Crascit/DownloadProject) script. It is extremely easy to use and drastically simplifies the inclusion of other Cmake-based projects from github.
# Usage
@@ -18,7 +18,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake)
CPMAddPackage(
NAME LarsParser
VERSION 1.2
VERSION 1.4
GIT_REPOSITORY https://github.com/TheLartians/Parser.git
GIT_TAG master # optional
)
@@ -29,7 +29,25 @@ add_executable(my-parser my-parser.cpp)
target_link_libraries(cpm-test LarsParser)
```
# Offline mode
After including CPM CMake will try to update remote repositories at every new buld. To continue working offline, set the parameter `CPM_OFFLINE=On`.
# Installation
To add CPM to your current project, copy the scripts in the `cmake` directory into you current project project. The command below will perform this automatically.
```bash
wget -qO- https://github.com/TheLartians/CPM/releases/download/v0.4/cmake.zip | bsdtar -xvf-
```
# Advantages
- **Auto handle dependencies** Users of your projects do not need to worry about dependencies, everything is handled automatically.
- **Reproducable builds** Using git tags it is ensured that a project will always be in the same state everywhere.
- **No installation required** No need to install any third-party package managers. Just copy the files from the CMake directory and you're good to go.
# Limitations
- First version used: in diamond dependency graphs (e.g. `A` depends on `C`(v1.1) and `A` depends on `B` depends on `C`(v1.2)) the first added dependency will be used (in this case `C`@1.1).
- No possibility not automatically update dependencies. To update a dependency, version numbers or git tags in the cmake scripts must be adapted manually.
- **First version used** In diamond-shaped dependency graphs (e.g. `A` depends on `C`(v1.1) and `A` depends on `B` depends on `C`(v1.2)) the first added dependency will be used (in this case `C`@1.1).
- **No auto-update** To update a dependency, version numbers or git tags in the cmake scripts must be adapted manually.

View File

@@ -2,10 +2,12 @@ set(_CPM_Dir "${CMAKE_CURRENT_LIST_DIR}")
include(CMakeParseArguments)
include(${_CPM_Dir}/DownloadProject.cmake)
function(CPMHasPackage)
endfunction()
option(CPM_OFFLINE "CPM offline mode" OFF)
if(NOT ${CPM_OFFLINE})
set(CPM_PACKAGES "" CACHE INTERNAL "CPM Packages")
endif()
function(CPMAddPackage)
set(options QUIET)
@@ -16,6 +18,7 @@ function(CPMAddPackage)
VERSION
GIT_TAG
BINARY_DIR
UPDATE_DISCONNECTED
)
set(multiValueArgs "")
@@ -30,8 +33,6 @@ function(CPMAddPackage)
set(CPM_ARGS_BINARY_DIR ${CMAKE_BINARY_DIR}/CPM-projects/${CPM_ARGS_NAME})
endif()
message("test: ${CPM_ARGS_BINARY_DIR}")
if (NOT CPM_PROJECT_DIR)
set(CPM_PROJECT_DIR "${CPM_ARGS_BINARY_DIR}")
endif()

View File

@@ -17,7 +17,7 @@ else()
PROJ @CPM_ARGS_NAME@
GIT_REPOSITORY @CPM_ARGS_GIT_REPOSITORY@
GIT_TAG @CPM_ARGS_GIT_TAG@
UPDATE_DISCONNECTED 1
UPDATE_DISCONNECTED @CPM_OFFLINE@
GIT_SHALLOW 1
PREFIX @CPM_ARGS_BINARY_DIR@/dl
QUIET

View File

@@ -7,7 +7,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/CPM.cmake)
CPMAddPackage(
NAME LHC
GIT_REPOSITORY https://github.com/TheLartians/LHC.git
VERSION 0.3
VERSION 0.4
)
CPMAddPackage(
@@ -21,14 +21,14 @@ CPMAddPackage(
CPMAddPackage(
NAME LarsParser
GIT_REPOSITORY https://github.com/TheLartians/Parser.git
VERSION 1.3
VERSION 1.4
)
# add project twice
# add project twice (will be ignored)
CPMAddPackage(
NAME LHC
GIT_REPOSITORY https://github.com/TheLartians/LHC.git
VERSION 0.3
VERSION 0.1
)
# add executable

View File

@@ -8,7 +8,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/CPM.cmake)
CPMAddPackage(
NAME LarsParser
GIT_REPOSITORY https://github.com/TheLartians/Parser.git
VERSION 1.3
VERSION 1.4
)
# add executable