Update range v3 (#56)

* update range-v3 example as the projects CMakeLists messes up the configuration

* add comment

* add range-v3 snipplet back
This commit is contained in:
Lars Melchior
2019-05-23 12:25:00 +02:00
committed by GitHub
parent 3659fa581c
commit 4952fd3d48
2 changed files with 25 additions and 14 deletions

View File

@@ -123,18 +123,6 @@ CPMAddPackage(
See [here](https://github.com/TheLartians/CPM/blob/master/examples/doctest/CMakeLists.txt) for doctest example.
Note that we can shorten Github and Gitlab URLs by using `GITHUB_REPOSITORY` or `GITLAB_REPOSITORY`, respectively.
### [Range-v3](https://github.com/ericniebler/range-v3)
For very large repositories it is usually best to add the release archive.
```cmake
CPMAddPackage(
NAME range-v3
URL https://github.com/ericniebler/range-v3/archive/0.5.0.zip
VERSION 0.5.0
)
```
### [google/benchmark](https://github.com/google/benchmark.git)
Has a CMakeLists.txt that supports `add_subdirectory`, but needs some configuring to work without external dependencies.
@@ -166,13 +154,30 @@ CPMAddPackage(
)
if (nlohmann_json_ADDED)
add_library(nlohmann_json INTERFACE)
add_library(nlohmann_json INTERFACE IMPORTED)
target_include_directories(nlohmann_json INTERFACE ${nlohmann_json_SOURCE_DIR})
endif()
```
Note the check for `nlohmann_json_ADDED`, before creating the target. This ensures that the target hasn't been added before by another dependency.
### [Range-v3](https://github.com/ericniebler/range-v3)
```Cmake
CPMAddPackage(
NAME range-v3
URL https://github.com/ericniebler/range-v3/archive/0.5.0.zip
VERSION 0.5.0
# the range-v3 CMakeLists screws with configuration options
DOWNLOAD_ONLY True
)
if(range-v3_ADDED)
add_library(range-v3 INTERFACE IMPORTED)
target_include_directories(range-v3 INTERFACE "${range-v3_SOURCE_DIR}/include")
endif()
```
### [Lua](https://www.lua.org)
Lua does not oficially support CMake, so we query the sources and create our own target.

View File

@@ -8,11 +8,17 @@ CPMAddPackage(
NAME range-v3
URL https://github.com/ericniebler/range-v3/archive/0.5.0.zip
VERSION 0.5.0
# the range-v3 CMakeLists screws with configuration options
DOWNLOAD_ONLY True
)
if(range-v3_ADDED)
add_library(range-v3 INTERFACE IMPORTED)
target_include_directories(range-v3 INTERFACE "${range-v3_SOURCE_DIR}/include")
endif()
# ---- Executable ----
add_executable(CPMRangev3Example "main.cpp")
set_target_properties(CPMRangev3Example PROPERTIES CXX_STANDARD 17)
target_link_libraries(CPMRangev3Example range-v3)