Add_subdirectory() fails with ‘-features=no%anachronisms’

I started working on my own loadable module based on Extension Wizard. My module has a subfolder containing a library that my module depends on. This library is a CMake project. But in my module’s CMakeLists.txt, the line add_subdirectory( path-to-library ) fails during cmake:

Determining if the CXX compiler accepts the flag -features=no%anachronisms passed with the following output:
Change Dir: /opt/e/SlicerNDOF-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_27b52/fast && /Applications/  -f CMakeFiles/cmTC_27b52.dir/build.make CMakeFiles/cmTC_27b52.dir/build
Building CXX object CMakeFiles/cmTC_27b52.dir/src.cxx.o
/Applications/   -features=no%anachronisms -arch x86_64 -isysroot /Applications/ -mmacosx-version-min=10.15 -std=c++11 -o CMakeFiles/cmTC_27b52.dir/src.cxx.o -c /opt/e/SlicerNDOF-debug/CMakeFiles/CMakeTmp/src.cxx
clang: error: unknown argument: '-features=no%anachronisms'
make[1]: *** [CMakeFiles/cmTC_27b52.dir/src.cxx.o] Error 1
make: *** [cmTC_27b52/fast] Error 2

Source file was:
int main() { return 0;}

This compiler check seems to be something that the Slicer build introduces (?) and something that my library’s cmake doesn’t like. The library builds with no problem on its own.

Do you know how to fix this?