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