mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-27 22:57:21 -05:00
Add CPM_RESET (#4)
* added CPM_RESET option * update readme * Update README.md
This commit is contained in:
@@ -29,12 +29,16 @@ add_executable(my-parser my-parser.cpp)
|
|||||||
target_link_libraries(cpm-test LarsParser)
|
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
|
# 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.
|
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
|
```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
|
# Limitations
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ set(_CPM_Dir "${CMAKE_CURRENT_LIST_DIR}")
|
|||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
include(${_CPM_Dir}/DownloadProject.cmake)
|
include(${_CPM_Dir}/DownloadProject.cmake)
|
||||||
|
|
||||||
function(CPMHasPackage)
|
option(CPM_RESET "reset CPM" OFF)
|
||||||
|
|
||||||
endfunction()
|
if(${CPM_RESET})
|
||||||
|
message(STATUS "CPM: resetting packages")
|
||||||
|
set(CPM_PACKAGES "" CACHE INTERNAL "CPM Packages")
|
||||||
|
endif()
|
||||||
|
|
||||||
function(CPMAddPackage)
|
function(CPMAddPackage)
|
||||||
set(options QUIET)
|
set(options QUIET)
|
||||||
@@ -16,6 +19,7 @@ function(CPMAddPackage)
|
|||||||
VERSION
|
VERSION
|
||||||
GIT_TAG
|
GIT_TAG
|
||||||
BINARY_DIR
|
BINARY_DIR
|
||||||
|
UPDATE_DISCONNECTED
|
||||||
)
|
)
|
||||||
|
|
||||||
set(multiValueArgs "")
|
set(multiValueArgs "")
|
||||||
@@ -30,6 +34,15 @@ function(CPMAddPackage)
|
|||||||
set(CPM_ARGS_BINARY_DIR ${CMAKE_BINARY_DIR}/CPM-projects/${CPM_ARGS_NAME})
|
set(CPM_ARGS_BINARY_DIR ${CMAKE_BINARY_DIR}/CPM-projects/${CPM_ARGS_NAME})
|
||||||
endif()
|
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)
|
if (NOT CPM_PROJECT_DIR)
|
||||||
set(CPM_PROJECT_DIR "${CPM_ARGS_BINARY_DIR}")
|
set(CPM_PROJECT_DIR "${CPM_ARGS_BINARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ else()
|
|||||||
PROJ @CPM_ARGS_NAME@
|
PROJ @CPM_ARGS_NAME@
|
||||||
GIT_REPOSITORY @CPM_ARGS_GIT_REPOSITORY@
|
GIT_REPOSITORY @CPM_ARGS_GIT_REPOSITORY@
|
||||||
GIT_TAG @CPM_ARGS_GIT_TAG@
|
GIT_TAG @CPM_ARGS_GIT_TAG@
|
||||||
UPDATE_DISCONNECTED 1
|
UPDATE_DISCONNECTED @CPM_ARGS_UPDATE_DISCONNECTED@
|
||||||
GIT_SHALLOW 1
|
GIT_SHALLOW 1
|
||||||
PREFIX @CPM_ARGS_BINARY_DIR@/dl
|
PREFIX @CPM_ARGS_BINARY_DIR@/dl
|
||||||
QUIET
|
QUIET
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/CPM.cmake)
|
|||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME LHC
|
NAME LHC
|
||||||
GIT_REPOSITORY https://github.com/TheLartians/LHC.git
|
GIT_REPOSITORY https://github.com/TheLartians/LHC.git
|
||||||
VERSION 0.3
|
VERSION 0.4
|
||||||
)
|
)
|
||||||
|
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
|
|||||||
Reference in New Issue
Block a user