mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 06:37:43 -05:00
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:
37
README.md
37
README.md
@@ -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)
|
||||
|
||||
```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)
|
||||
|
||||
```CMake
|
||||
CPMAddPackage(gh:Orphis/boost-cmake@1.67.0)
|
||||
CPMAddPackage("gh:Orphis/boost-cmake@1.67.0")
|
||||
```
|
||||
|
||||
### [cxxopts](https://github.com/jarro2783/cxxopts)
|
||||
|
||||
```cmake
|
||||
CPMAddPackage(
|
||||
NAME cxxopts
|
||||
GITHUB_REPOSITORY jarro2783/cxxopts
|
||||
VERSION 2.2.0
|
||||
OPTIONS
|
||||
"CXXOPTS_BUILD_EXAMPLES Off"
|
||||
"CXXOPTS_BUILD_TESTS Off"
|
||||
)
|
||||
CPMAddPackage("gh:jarro2783/cxxopts@2.2.0")
|
||||
```
|
||||
|
||||
### [Yaml-cpp](https://github.com/jbeder/yaml-cpp)
|
||||
|
||||
```CMake
|
||||
CPMAddPackage(
|
||||
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"
|
||||
)
|
||||
CPMAddPackage("gh:jbeder/yaml-cpp#yaml-cpp-0.6.3@0.6.3")
|
||||
```
|
||||
|
||||
### [google/benchmark](https://github.com/google/benchmark)
|
||||
@@ -311,14 +293,13 @@ CPMAddPackage(
|
||||
CPMAddPackage(
|
||||
NAME benchmark
|
||||
GITHUB_REPOSITORY google/benchmark
|
||||
VERSION 1.4.1
|
||||
OPTIONS
|
||||
"BENCHMARK_ENABLE_TESTING Off"
|
||||
VERSION 1.5.2
|
||||
OPTIONS "BENCHMARK_ENABLE_TESTING Off"
|
||||
)
|
||||
|
||||
if (benchmark_ADDED)
|
||||
# compile with C++17
|
||||
set_target_properties(benchmark PROPERTIES CXX_STANDARD 17)
|
||||
if(benchmark_ADDED)
|
||||
# enable c++11 to avoid compilation errors
|
||||
set_target_properties(benchmark PROPERTIES CXX_STANDARD 11)
|
||||
endif()
|
||||
```
|
||||
|
||||
|
||||
@@ -8,12 +8,7 @@ include(../../cmake/CPM.cmake)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
CPMAddPackage(
|
||||
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
|
||||
)
|
||||
CPMAddPackage("gh:chriskohlhoff/asio#asio-1-18-1@1.18.1")
|
||||
|
||||
# ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on Windows:
|
||||
#
|
||||
|
||||
@@ -16,7 +16,7 @@ CPMAddPackage(
|
||||
)
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ CPMFindPackage(
|
||||
NAME Boost
|
||||
GITHUB_REPOSITORY Orphis/boost-cmake
|
||||
VERSION 1.67.0
|
||||
# setting FIND_PACKAGE_ARGUMENTS allow usage with `CPM_USE_LOCAL_PACKAGES`
|
||||
FIND_PACKAGE_ARGUMENTS "COMPONENTS system"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,12 +6,7 @@ project(CPMExampleCXXOpts)
|
||||
|
||||
include(../../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME cxxopts
|
||||
GITHUB_REPOSITORY jarro2783/cxxopts
|
||||
VERSION 2.2.0
|
||||
OPTIONS "CXXOPTS_BUILD_EXAMPLES Off" "CXXOPTS_BUILD_TESTS Off"
|
||||
)
|
||||
CPMAddPackage("gh:jarro2783/cxxopts@2.2.0")
|
||||
|
||||
# ---- Create binary ----
|
||||
|
||||
|
||||
@@ -6,13 +6,7 @@ project(CPMYamlExample)
|
||||
|
||||
include(../../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
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"
|
||||
)
|
||||
CPMAddPackage("gh:jbeder/yaml-cpp#yaml-cpp-0.6.3@0.6.3")
|
||||
|
||||
# ---- Executable ----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user