Compare commits

..

4 Commits
v0.17 ... v0.18

Author SHA1 Message Date
Lars Melchior
464ba554c2 suppress package not found warning in CPMFindPackage (#103) 2020-04-14 09:35:31 +02:00
Lars Melchior
90558aa9cb Add GitHub action to publish CPM on release (#102)
* add github action to publish cpm on release

* add checkout step

* update readme
2020-03-16 20:37:30 +01:00
Lars Melchior
95c5426d25 remove code artifact from previous PR (#101) 2020-03-16 20:09:15 +01:00
Lars Melchior
cea81872cf Add fmt example and document version from git tag (#100)
* add VERSION_PREFIX argument

* add fmt example

* add VERSION_PREFIX note to readme

* rollback, add info about determining version from git tag

* rollback version
2020-03-16 20:00:30 +01:00
6 changed files with 51 additions and 4 deletions

21
.github/workflows/publish.yaml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish CPM.cmake
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Upload CPM.cmake to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cmake/CPM.cmake
asset_name: CPM.cmake
tag: ${{ github.ref }}
overwrite: true

View File

@@ -36,6 +36,7 @@ CPMAddPackage(
The origin may be specified by a `GIT_REPOSITORY`, but other sources, such as direct URLs, are [also supported](https://cmake.org/cmake/help/v3.11/module/ExternalProject.html#external-project-definition).
If `GIT_TAG` hasn't been explicitly specified it defaults to `v(VERSION)`, a common convention for git projects.
On the other hand, if `VERSION` hasn't been explicitly specified, CPM can automatically identify the version from the git tag in some common cases.
`GIT_TAG` can also be set to a specific commit or a branch name such as `master` to always download the most recent version.
The optional argument `FIND_PACKAGE_ARGUMENTS` can be specified to a string of parameters that will be passed to `find_package` if enabled (see below).
@@ -80,7 +81,7 @@ To add CPM to your current project, simply add `cmake/CPM.cmake` to your project
```bash
mkdir -p cmake
wget -O cmake/CPM.cmake https://raw.githubusercontent.com/TheLartians/CPM.cmake/master/cmake/CPM.cmake
wget -O cmake/CPM.cmake https://github.com/TheLartians/CPM.cmake/releases/latest/download/CPM.cmake
```
You can also use CMake to download CPM for you. See the [wiki](https://github.com/TheLartians/CPM/wiki/Adding-CPM) for more details.

View File

@@ -28,7 +28,7 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
set(CURRENT_CPM_VERSION 0.17)
set(CURRENT_CPM_VERSION 0.18)
if(CPM_DIRECTORY)
if(NOT ${CPM_DIRECTORY} MATCHES ${CMAKE_CURRENT_LIST_DIR})
@@ -70,7 +70,7 @@ endif()
function(cpm_find_package NAME VERSION)
string(REPLACE " " ";" EXTRA_ARGS "${ARGN}")
find_package(${NAME} ${VERSION} ${EXTRA_ARGS})
find_package(${NAME} ${VERSION} ${EXTRA_ARGS} QUIET)
if(${CPM_ARGS_NAME}_FOUND)
message(STATUS "${CPM_INDENT} using local package ${CPM_ARGS_NAME}@${${CPM_ARGS_NAME}_VERSION}")
CPMRegisterPackage(${CPM_ARGS_NAME} "${${CPM_ARGS_NAME}_VERSION}")
@@ -124,7 +124,7 @@ function(CPMAddPackage)
OPTIONS
)
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
if(CPM_USE_LOCAL_PACKAGES OR CPM_LOCAL_PACKAGES_ONLY)
cpm_find_package(${CPM_ARGS_NAME} "${CPM_ARGS_VERSION}" ${CPM_ARGS_FIND_PACKAGE_ARGUMENTS})

0
examples/build_all.py Normal file → Executable file
View File

View File

@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(CPMJSONExample)
# ---- Dependencies ----
include(../../cmake/CPM.cmake)
CPMAddPackage(
NAME fmt
GIT_TAG 6.1.2
GITHUB_REPOSITORY fmtlib/fmt
)
# ---- Executable ----
add_executable(CPMFmtExample "main.cpp")
set_target_properties(CPMFmtExample PROPERTIES CXX_STANDARD 17)
target_link_libraries(CPMFmtExample fmt)

6
examples/fmt/main.cpp Normal file
View File

@@ -0,0 +1,6 @@
#include <fmt/format.h>
int main(){
fmt::print("Hello, {}!\n", "world");
return 0;
}