8 stdenv.mkDerivation rec {
12 src = fetchFromGitHub {
16 hash = "sha256-Zt53Qtry99RAheeh7V24Csg/aMW25DT/3CN/h+BaeoM=";
23 hardeningDisable = [ "trivialautovarinit" ];
26 "-DCATCH_DEVELOPMENT_BUILD=ON"
27 "-DCATCH_BUILD_TESTING=${if doCheck then "ON" else "OFF"}"
28 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && doCheck) [
29 # test has a faulty path normalization technique that won't work in
30 # our darwin build environment https://github.com/catchorg/Catch2/issues/1691
31 "-DCMAKE_CTEST_ARGUMENTS=-E;ApprovalTests"
34 env = lib.optionalAttrs stdenv.hostPlatform.isx86_32 {
35 # Tests fail on x86_32 if compiled with x87 floats: https://github.com/catchorg/Catch2/issues/2796
36 NIX_CFLAGS_COMPILE = "-msse2 -mfpmath=sse";
37 } // lib.optionalAttrs (stdenv.hostPlatform.isRiscV || stdenv.hostPlatform.isAarch32) {
38 # Build failure caused by -Werror: https://github.com/catchorg/Catch2/issues/2808
39 NIX_CFLAGS_COMPILE = "-Wno-error=cast-align";
49 description = "Modern, C++-native, test framework for unit-tests";
50 homepage = "https://github.com/catchorg/Catch2";
51 changelog = "https://github.com/catchorg/Catch2/blob/${src.rev}/docs/release-notes.md";
52 license = lib.licenses.boost;
53 maintainers = with lib.maintainers; [ dotlambda ];
54 platforms = with lib.platforms; unix ++ windows;