diff --git a/README.md b/README.md index 4d7d4e1..d5ae16b 100644 --- a/README.md +++ b/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() ``` diff --git a/examples/asio-standalone/CMakeLists.txt b/examples/asio-standalone/CMakeLists.txt index 680ec84..dd3a276 100644 --- a/examples/asio-standalone/CMakeLists.txt +++ b/examples/asio-standalone/CMakeLists.txt @@ -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: # diff --git a/examples/benchmark/CMakeLists.txt b/examples/benchmark/CMakeLists.txt index b09d375..f09ada5 100644 --- a/examples/benchmark/CMakeLists.txt +++ b/examples/benchmark/CMakeLists.txt @@ -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() diff --git a/examples/boost/CMakeLists.txt b/examples/boost/CMakeLists.txt index 8c37bb2..9bb2f22 100644 --- a/examples/boost/CMakeLists.txt +++ b/examples/boost/CMakeLists.txt @@ -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" ) diff --git a/examples/cxxopts/CMakeLists.txt b/examples/cxxopts/CMakeLists.txt index 4cb6b7e..2c815d6 100644 --- a/examples/cxxopts/CMakeLists.txt +++ b/examples/cxxopts/CMakeLists.txt @@ -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 ---- diff --git a/examples/yaml/CMakeLists.txt b/examples/yaml/CMakeLists.txt index 62e7a8c..e91ba27 100644 --- a/examples/yaml/CMakeLists.txt +++ b/examples/yaml/CMakeLists.txt @@ -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 ----