mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-12-30 00:01:32 -05:00
Add CPM_RESET (#4)
* added CPM_RESET option * update readme * Update README.md
This commit is contained in:
parent
f8e571e416
commit
e368fce6c3
@ -29,12 +29,16 @@ add_executable(my-parser my-parser.cpp)
|
||||
target_link_libraries(cpm-test LarsParser)
|
||||
```
|
||||
|
||||
# Update packages
|
||||
|
||||
To update packages, run cmake with the additional option `-DCPM_RESET=ON`. To keep the project working offline after the update, set `-DCPM_RESET=OFF` afterwards.
|
||||
|
||||
# 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.2/cmake.zip | bsdtar -xvf-
|
||||
wget -qO- https://github.com/TheLartians/CPM/releases/download/v0.3/cmake.zip | bsdtar -xvf-
|
||||
```
|
||||
|
||||
# Limitations
|
||||
|
||||
@ -2,10 +2,13 @@ set(_CPM_Dir "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(${_CPM_Dir}/DownloadProject.cmake)
|
||||
|
||||
function(CPMHasPackage)
|
||||
|
||||
endfunction()
|
||||
option(CPM_RESET "reset CPM" OFF)
|
||||
|
||||
if(${CPM_RESET})
|
||||
message(STATUS "CPM: resetting packages")
|
||||
set(CPM_PACKAGES "" CACHE INTERNAL "CPM Packages")
|
||||
endif()
|
||||
|
||||
function(CPMAddPackage)
|
||||
set(options QUIET)
|
||||
@ -16,6 +19,7 @@ function(CPMAddPackage)
|
||||
VERSION
|
||||
GIT_TAG
|
||||
BINARY_DIR
|
||||
UPDATE_DISCONNECTED
|
||||
)
|
||||
|
||||
set(multiValueArgs "")
|
||||
@ -30,6 +34,15 @@ function(CPMAddPackage)
|
||||
set(CPM_ARGS_BINARY_DIR ${CMAKE_BINARY_DIR}/CPM-projects/${CPM_ARGS_NAME})
|
||||
endif()
|
||||
|
||||
if (NOT CPM_ARGS_UPDATE_DISCONNECTED)
|
||||
if (${CPM_RESET})
|
||||
set(CPM_ARGS_UPDATE_DISCONNECTED OFF)
|
||||
else()
|
||||
set(CPM_ARGS_UPDATE_DISCONNECTED ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT CPM_PROJECT_DIR)
|
||||
set(CPM_PROJECT_DIR "${CPM_ARGS_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
@ -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_ARGS_UPDATE_DISCONNECTED@
|
||||
GIT_SHALLOW 1
|
||||
PREFIX @CPM_ARGS_BINARY_DIR@/dl
|
||||
QUIET
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user