mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 02:33:25 +00:00
854d16d74e
`cmake` should be in `nativeBuildInputs` as it is only required at build time. For obvious reasons we can't have the tests running during a cross-compile. I figured I'd update the package version while I was at it, though these changes have also been tested independently of the version update.
33 lines
793 B
Nix
33 lines
793 B
Nix
{ stdenv, fetchFromGitHub, cmake }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "nlohmann_json-${version}";
|
|
version = "2.0.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "nlohmann";
|
|
repo = "json";
|
|
rev = "v${version}";
|
|
sha256 = "192mg2y93g9q0jdn3fdffydpxk19nsrcv92kfip6srkdkwja18ri";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
doCheck = true;
|
|
checkTarget = "test";
|
|
|
|
crossAttrs = {
|
|
cmakeFlags = "-DBuildTests=OFF";
|
|
doCheck = false;
|
|
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
|
|
cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows";
|
|
};
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "Header only C++ library for the JSON file format";
|
|
homepage = https://github.com/nlohmann/json;
|
|
license = licenses.mit;
|
|
platforms = platforms.all;
|
|
};
|
|
}
|