Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 56 lines 1.4 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, ninja 6# Enable C++17 support 7# https://github.com/google/googletest/issues/3081 8# Projects that require a higher standard can override this package. 9# For an example why that may be necessary, see: 10# https://github.com/mhx/dwarfs/issues/188#issuecomment-1907574427 11# Setting this to `null` does not pass any flags to set this. 12, cxx_standard ? ( 13 if ( 14 (stdenv.cc.isGNU && (lib.versionOlder stdenv.cc.version "11.0")) 15 || 16 (stdenv.cc.isClang && (lib.versionOlder stdenv.cc.version "16.0")) 17 ) 18 then "17" 19 else null 20 ) 21, static ? stdenv.hostPlatform.isStatic, 22}: 23 24stdenv.mkDerivation rec { 25 pname = "gtest"; 26 version = "1.14.0"; 27 28 outputs = [ "out" "dev" ]; 29 30 src = fetchFromGitHub { 31 owner = "google"; 32 repo = "googletest"; 33 rev = "v${version}"; 34 hash = "sha256-t0RchAHTJbuI5YW4uyBPykTvcjy90JW9AOPNjIhwh6U="; 35 }; 36 37 patches = [ 38 ./fix-cmake-config-includedir.patch 39 ]; 40 41 nativeBuildInputs = [ cmake ninja ]; 42 43 cmakeFlags = [ 44 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" 45 ] ++ lib.optionals (cxx_standard != null) [ 46 "-DCMAKE_CXX_STANDARD=${cxx_standard}" 47 ]; 48 49 meta = with lib; { 50 description = "Google's framework for writing C++ tests"; 51 homepage = "https://github.com/google/googletest"; 52 license = licenses.bsd3; 53 platforms = platforms.all; 54 maintainers = with maintainers; [ ivan-tkatchev ]; 55 }; 56}