Trouble building 3.0.2 on NixOS

When trying to build the latest g’mic on NixOS I get the following error:

-- Build files have been written to: /build/gmic-3.0.2/build
cmake: enabled parallel building
building
build flags: -j8 -l8
[1/7] Building CXX object CMakeFiles/gmic.dir/src/gmic_cli.cpp.o
FAILED: CMakeFiles/gmic.dir/src/gmic_cli.cpp.o
/nix/store/j0lglxsmvrd3zyv9dlabffc0n0xnxbia-gcc-wrapper-10.3.0/bin/g++ -Dcimg_appname=\"gmic\" -Dcimg_display=0 -Dcimg_use_fftw3 -Dcimg_use_jpeg -Dcimg_use_magick -Dcimg_use_openexr -Dcimg_use_openmp -Dcimg_use_png -Dcimg_use_tiff -Dcimg_use_zlib -isystem /build/gmic-3.0.2/src -isystem /nix/store/j8za3yi0v0sfja8nmqj768mrjpdnbq0y-graphicsmagick-1.3.37/include/GraphicsMagick -isystem /nix/store/qf5wzv3y7vzfmi1m9yygwca93kmpminc-openexr-2.5.7-dev/include/OpenEXR -O3 -DNDEBUG -fPIE -Ofast -Dgmic_core -Dcimg_use_vt100 -Dgmic_is_parallel -Dcimg_use_abort -Wno-error=narrowing -fno-ipa-sra -fpermissive -fopenmp -std=gnu++11 -MD -MT CMakeFiles/gmic.dir/src/gmic_cli.cpp.o -MF CMakeFiles/gmic.dir/src/gmic_cli.cpp.o.d -o CMakeFiles/gmic.dir/src/gmic_cli.cpp.o -c /build/gmic-3.0.2/src/gmic_cli.cpp
In file included from /build/gmic-3.0.2/src/gmic_cli.cpp:53:
/build/gmic-3.0.2/src/gmic.h:196:2: error: #error "[gmic] *** Error *** File 'CImg.h' has been already included (should have been done first in file 'gmic.h')."
  196 | #error "[gmic] *** Error *** File 'CImg.h' has been already included (should have been done first in file 'gmic.h')."
      |  ^~~~~
/build/gmic-3.0.2/src/gmic.h:207: warning: "cimg_abort_init" redefined
  207 | #define cimg_abort_init bool *const gmic_is_abort = ::gmic_abort_ptr(0); cimg::unused(gmic_is_abort)
      |
In file included from /build/gmic-3.0.2/src/gmic_cli.cpp:52:
/build/gmic-3.0.2/src/CImg.h:360: note: this is the location of the previous definition
  360 | #define cimg_abort_init
      |
In file included from /build/gmic-3.0.2/src/gmic_cli.cpp:53:
/build/gmic-3.0.2/src/gmic.h:208: warning: "cimg_abort_test" redefined
  208 | #define cimg_abort_test if (*gmic_is_abort) throw CImgAbortException()
      |
In file included from /build/gmic-3.0.2/src/gmic_cli.cpp:52:
/build/gmic-3.0.2/src/CImg.h:363: note: this is the location of the previous definition
  363 | #define cimg_abort_test
      |

I think the CMakeList.txt file has errors with this version. Please try with the regular Makefile located in ‘src/’.
For the next version 3.1.0, I’m going to drop this file.