update more examples to use shorthand syntax (#223)

* update more examples to use shorthand syntax

* revert google-benchmark as tests require googletest to be installed

* update comments

* always quote single-arguments

* undo accidental deletion
This commit is contained in:
Lars Melchior
2021-02-25 08:53:28 +01:00
committed by GitHub
parent a3d1048ad6
commit 8afc2af4f9
6 changed files with 14 additions and 48 deletions

View File

@@ -266,43 +266,25 @@ See the [wiki](https://github.com/cpm-cmake/CPM.cmake/wiki/More-Snippets) for mo
### [Catch2](https://github.com/catchorg/Catch2) ### [Catch2](https://github.com/catchorg/Catch2)
```cmake ```cmake
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 (via boost-cmake)](https://github.com/Orphis/boost-cmake)
```CMake ```CMake
CPMAddPackage(gh:Orphis/boost-cmake@1.67.0) CPMAddPackage("gh:Orphis/boost-cmake@1.67.0")
``` ```
### [cxxopts](https://github.com/jarro2783/cxxopts) ### [cxxopts](https://github.com/jarro2783/cxxopts)
```cmake ```cmake
CPMAddPackage( CPMAddPackage("gh:jarro2783/cxxopts@2.2.0")
NAME cxxopts
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 2.2.0
OPTIONS
"CXXOPTS_BUILD_EXAMPLES Off"
"CXXOPTS_BUILD_TESTS Off"
)
``` ```
### [Yaml-cpp](https://github.com/jbeder/yaml-cpp) ### [Yaml-cpp](https://github.com/jbeder/yaml-cpp)
```CMake ```CMake
CPMAddPackage( CPMAddPackage("gh:jbeder/yaml-cpp#yaml-cpp-0.6.3@0.6.3")
NAME yaml-cpp
GITHUB_REPOSITORY jbeder/yaml-cpp
# 0.6.2 uses deprecated CMake syntax
VERSION 0.6.3
# 0.6.3 is not released yet, so use a recent commit
GIT_TAG 012269756149ae99745b6dafefd415843d7420bb
OPTIONS
"YAML_CPP_BUILD_TESTS Off"
"YAML_CPP_BUILD_CONTRIB Off"
"YAML_CPP_BUILD_TOOLS Off"
)
``` ```
### [google/benchmark](https://github.com/google/benchmark) ### [google/benchmark](https://github.com/google/benchmark)
@@ -311,14 +293,13 @@ CPMAddPackage(
CPMAddPackage( CPMAddPackage(
NAME benchmark NAME benchmark
GITHUB_REPOSITORY google/benchmark GITHUB_REPOSITORY google/benchmark
VERSION 1.4.1 VERSION 1.5.2
OPTIONS OPTIONS "BENCHMARK_ENABLE_TESTING Off"
"BENCHMARK_ENABLE_TESTING Off"
) )
if (benchmark_ADDED) if(benchmark_ADDED)
# compile with C++17 # enable c++11 to avoid compilation errors
set_target_properties(benchmark PROPERTIES CXX_STANDARD 17) set_target_properties(benchmark PROPERTIES CXX_STANDARD 11)
endif() endif()
``` ```

View File

@@ -8,12 +8,7 @@ include(../../cmake/CPM.cmake)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
CPMAddPackage( CPMAddPackage("gh:chriskohlhoff/asio#asio-1-18-1@1.18.1")
NAME asio
VERSION 1.18.1
GITHUB_REPOSITORY chriskohlhoff/asio
GIT_TAG asio-1-18-1 # asio uses non-standard version tag, we must specify GIT_TAG
)
# ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on Windows: # ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on Windows:
# #

View File

@@ -16,7 +16,7 @@ CPMAddPackage(
) )
if(benchmark_ADDED) if(benchmark_ADDED)
# Don't use C++14 because it doesn't work in some configurations. # enable c++11 to avoid compilation errors
set_target_properties(benchmark PROPERTIES CXX_STANDARD 11) set_target_properties(benchmark PROPERTIES CXX_STANDARD 11)
endif() endif()

View File

@@ -15,6 +15,7 @@ CPMFindPackage(
NAME Boost NAME Boost
GITHUB_REPOSITORY Orphis/boost-cmake GITHUB_REPOSITORY Orphis/boost-cmake
VERSION 1.67.0 VERSION 1.67.0
# setting FIND_PACKAGE_ARGUMENTS allow usage with `CPM_USE_LOCAL_PACKAGES`
FIND_PACKAGE_ARGUMENTS "COMPONENTS system" FIND_PACKAGE_ARGUMENTS "COMPONENTS system"
) )

View File

@@ -6,12 +6,7 @@ project(CPMExampleCXXOpts)
include(../../cmake/CPM.cmake) include(../../cmake/CPM.cmake)
CPMAddPackage( CPMAddPackage("gh:jarro2783/cxxopts@2.2.0")
NAME cxxopts
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 2.2.0
OPTIONS "CXXOPTS_BUILD_EXAMPLES Off" "CXXOPTS_BUILD_TESTS Off"
)
# ---- Create binary ---- # ---- Create binary ----

View File

@@ -6,13 +6,7 @@ project(CPMYamlExample)
include(../../cmake/CPM.cmake) include(../../cmake/CPM.cmake)
CPMAddPackage( CPMAddPackage("gh:jbeder/yaml-cpp#yaml-cpp-0.6.3@0.6.3")
NAME yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
VERSION 0.6.3
GIT_TAG yaml-cpp-0.6.3
OPTIONS "YAML_CPP_BUILD_TESTS Off" "YAML_CPP_BUILD_CONTRIB Off" "YAML_CPP_BUILD_TOOLS Off"
)
# ---- Executable ---- # ---- Executable ----