mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-25 05:37:28 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fed5f8e8a2 | ||
|
|
d65613e860 | ||
|
|
718ea71759 | ||
|
|
6491382204 |
11
README.md
11
README.md
@@ -1,4 +1,3 @@
|
|||||||
[](https://travis-ci.com/cpm-cmake/CPM.cmake)
|
|
||||||
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
||||||
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
||||||
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
[](https://github.com/cpm-cmake/CPM.cmake/actions)
|
||||||
@@ -275,11 +274,15 @@ See the [wiki](https://github.com/cpm-cmake/CPM.cmake/wiki/More-Snippets) for mo
|
|||||||
CPMAddPackage("gh:catchorg/Catch2@2.5.0")
|
CPMAddPackage("gh:catchorg/Catch2@2.5.0")
|
||||||
```
|
```
|
||||||
|
|
||||||
### [Boost (via boost-cmake)](https://github.com/Orphis/boost-cmake)
|
### [Boost ](https://github.com/boostorg/boost)
|
||||||
|
|
||||||
```CMake
|
```CMake
|
||||||
# boost-cmake currently doesn't tag versions, so we use the according boost version
|
CPMAddPackage(
|
||||||
CPMAddPackage("gh:Orphis/boost-cmake#7f97a08b64bd5d2e53e932ddf80c40544cf45edf@1.71.0")
|
NAME Boost
|
||||||
|
VERSION 1.77.0
|
||||||
|
GITHUB_REPOSITORY "boostorg/boost"
|
||||||
|
GIT_TAG "boost-1.77.0"
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### [Yaml-cpp](https://github.com/jbeder/yaml-cpp)
|
### [Yaml-cpp](https://github.com/jbeder/yaml-cpp)
|
||||||
|
|||||||
@@ -57,6 +57,13 @@ See https://github.com/cpm-cmake/CPM.cmake for more information."
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CURRENT_CPM_VERSION MATCHES "development-version")
|
||||||
|
message(WARNING "Your project is using an unstable development version of CPM.cmake. \
|
||||||
|
Please update to a recent release if possible. \
|
||||||
|
See https://github.com/cpm-cmake/CPM.cmake for details."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY CPM_INITIALIZED true)
|
set_property(GLOBAL PROPERTY CPM_INITIALIZED true)
|
||||||
|
|
||||||
option(CPM_USE_LOCAL_PACKAGES "Always try to use `find_package` to get dependencies"
|
option(CPM_USE_LOCAL_PACKAGES "Always try to use `find_package` to get dependencies"
|
||||||
@@ -819,8 +826,8 @@ function(
|
|||||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||||
|
|
||||||
foreach(OPTION ${OPTIONS})
|
foreach(OPTION ${OPTIONS})
|
||||||
cpm_parse_option(${OPTION})
|
cpm_parse_option("${OPTION}")
|
||||||
set(${OPTION_KEY} ${OPTION_VALUE})
|
set(${OPTION_KEY} "${OPTION_VALUE}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
set(CPM_OLD_INDENT "${CPM_INDENT}")
|
set(CPM_OLD_INDENT "${CPM_INDENT}")
|
||||||
@@ -866,15 +873,15 @@ endfunction()
|
|||||||
|
|
||||||
# splits a package option
|
# splits a package option
|
||||||
function(cpm_parse_option OPTION)
|
function(cpm_parse_option OPTION)
|
||||||
string(REGEX MATCH "^[^ ]+" OPTION_KEY ${OPTION})
|
string(REGEX MATCH "^[^ ]+" OPTION_KEY "${OPTION}")
|
||||||
string(LENGTH ${OPTION} OPTION_LENGTH)
|
string(LENGTH "${OPTION}" OPTION_LENGTH)
|
||||||
string(LENGTH ${OPTION_KEY} OPTION_KEY_LENGTH)
|
string(LENGTH "${OPTION_KEY}" OPTION_KEY_LENGTH)
|
||||||
if(OPTION_KEY_LENGTH STREQUAL OPTION_LENGTH)
|
if(OPTION_KEY_LENGTH STREQUAL OPTION_LENGTH)
|
||||||
# no value for key provided, assume user wants to set option to "ON"
|
# no value for key provided, assume user wants to set option to "ON"
|
||||||
set(OPTION_VALUE "ON")
|
set(OPTION_VALUE "ON")
|
||||||
else()
|
else()
|
||||||
math(EXPR OPTION_KEY_LENGTH "${OPTION_KEY_LENGTH}+1")
|
math(EXPR OPTION_KEY_LENGTH "${OPTION_KEY_LENGTH}+1")
|
||||||
string(SUBSTRING ${OPTION} "${OPTION_KEY_LENGTH}" "-1" OPTION_VALUE)
|
string(SUBSTRING "${OPTION}" "${OPTION_KEY_LENGTH}" "-1" OPTION_VALUE)
|
||||||
endif()
|
endif()
|
||||||
set(OPTION_KEY
|
set(OPTION_KEY
|
||||||
"${OPTION_KEY}"
|
"${OPTION_KEY}"
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ target_compile_features(CPMExampleBoost PRIVATE cxx_std_17)
|
|||||||
|
|
||||||
include(../../cmake/CPM.cmake)
|
include(../../cmake/CPM.cmake)
|
||||||
|
|
||||||
# boost-cmake currently doesn't tag versions, so we use the according boost version
|
CPMAddPackage(
|
||||||
CPMAddPackage("gh:Orphis/boost-cmake#7f97a08b64bd5d2e53e932ddf80c40544cf45edf@1.71.0")
|
NAME Boost
|
||||||
|
VERSION 1.77.0
|
||||||
|
GITHUB_REPOSITORY "boostorg/boost"
|
||||||
|
GIT_TAG "boost-1.77.0"
|
||||||
|
)
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
target_link_libraries(CPMExampleBoost PRIVATE Boost::asio)
|
||||||
|
|
||||||
target_link_libraries(CPMExampleBoost PRIVATE Boost::system Threads::Threads)
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ include(@CPM_PATH@/CPM.cmake)
|
|||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME Dependency
|
NAME Dependency
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/dependency
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/dependency
|
||||||
OPTIONS "DEFINE_ALTERNATIVE_FUNCTION YES"
|
OPTIONS
|
||||||
|
"DEFINE_ALTERNATIVE_FUNCTION YES"
|
||||||
|
"LIST_ARGUMENT a\\\\;b\\\\;c"
|
||||||
EXCLUDE_FROM_ALL YES
|
EXCLUDE_FROM_ALL YES
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ if(NOT DEFINE_ALTERNATIVE_FUNCTION)
|
|||||||
message("called external method")
|
message("called external method")
|
||||||
endfunction()
|
endfunction()
|
||||||
else()
|
else()
|
||||||
|
|
||||||
|
# check if list was passed correctly
|
||||||
|
if(NOT "${LIST_ARGUMENT}" STREQUAL "a;b;c")
|
||||||
|
message(FATAL_ERROR "list argument not properly passed to dependency: '${LIST_ARGUMENT}'")
|
||||||
|
endif()
|
||||||
|
|
||||||
function(alternative_dependency_function)
|
function(alternative_dependency_function)
|
||||||
message("called alternative external method")
|
message("called alternative external method")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user