diff options
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 10 | ||||
-rw-r--r-- | nlohmann_json-config-version.cmake | 41 | ||||
-rw-r--r-- | nlohmann_json-config.cmake | 5 |
4 files changed, 59 insertions, 3 deletions
@@ -1,7 +1,7 @@ pkgbase = nlohmann-json-bin pkgdesc = Header-only JSON library for Modern C++ (quick installation without testing) pkgver = 3.7.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/nlohmann/json arch = any license = MIT @@ -10,8 +10,12 @@ pkgbase = nlohmann-json-bin conflicts = nlohmann-json-git source = include-3.7.0.zip::https://github.com/nlohmann/json/releases/download/v3.7.0/include.zip source = https://raw.githubusercontent.com/nlohmann/json/v3.7.0/LICENSE.MIT + source = nlohmann_json-config.cmake + source = nlohmann_json-config-version.cmake sha256sums = 541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP pkgname = nlohmann-json-bin @@ -2,7 +2,7 @@ pkgname=nlohmann-json-bin pkgver=3.7.0 -pkgrel=1 +pkgrel=2 pkgdesc='Header-only JSON library for Modern C++ (quick installation without testing)' arch=('any') url='https://github.com/nlohmann/json' @@ -10,12 +10,18 @@ license=('MIT') provides=('nlohmann-json') conflicts=('nlohmann-json' 'nlohmann-json-git') source=("include-${pkgver}.zip::https://github.com/nlohmann/json/releases/download/v${pkgver}/include.zip" - "https://raw.githubusercontent.com/nlohmann/json/v${pkgver}/LICENSE.MIT") + "https://raw.githubusercontent.com/nlohmann/json/v${pkgver}/LICENSE.MIT" + "nlohmann_json-config.cmake" + "nlohmann_json-config-version.cmake") sha256sums=('541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d' + 'SKIP' + 'SKIP' 'SKIP') package() { cd "${srcdir}" install -Dm644 LICENSE.MIT "${pkgdir}/usr/share/licenses/nlohmann-json/LICENSE.MIT" + install -Dm644 nlohmann_json-config.cmake "${pkgdir}/usr/lib/cmake/nlohmann_json/nlohmann_json-config.cmake" + install -Dm644 nlohmann_json-config-version.cmake "${pkgdir}/usr/lib/cmake/nlohmann_json/nlohmann_json-config-version.cmake" cp -R include "${pkgdir}/usr" } diff --git a/nlohmann_json-config-version.cmake b/nlohmann_json-config-version.cmake new file mode 100644 index 000000000000..72b564d192be --- /dev/null +++ b/nlohmann_json-config-version.cmake @@ -0,0 +1,41 @@ +set(PACKAGE_VERSION "3.7.0") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("3.7.0" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + else() + set(CVF_VERSION_MAJOR "3.7.0") + endif() + + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() + diff --git a/nlohmann_json-config.cmake b/nlohmann_json-config.cmake new file mode 100644 index 000000000000..46bbf8c6a395 --- /dev/null +++ b/nlohmann_json-config.cmake @@ -0,0 +1,5 @@ +add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED) + +set_target_properties(nlohmann_json::nlohmann_json PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES /usr/include +) |