The latest stable version of app-doc/doxygen does not build with CMAKE_MAKEFILE_GENERATOR set to 'ninja', with the compile stage failing immediately with the error mentioned in the summary. The offending line in build.ninja is COMMAND = cd /var/tmp/portage/app-doc/doxygen-1.8.11-r2/work/doxygen-1.8.11/src && /usr/bin/flex $(LEX_FLAGS) -PscannerYY -o/var/tmp/portage/app-doc/doxygen-1.8.11-r2/work/doxygen-1.8.11_build/generated_src/scanner.cpp scanner.l suggesting the way flags are passed to flex is currently not Ninja-compatible. There doesn't seem to be an upstream bug for this yet.
This seems to be fixed in 1.8.12, but I think this should get fixed in stable and this issue should block bug 557992 To fix the issue in stable ebuilds simply add CMAKE_MAKEFILE_GENERATOR="emake" before inheriting cmake-utils.
Thanks for the report! commit a3b422bb8f238e832d5978ae33d5658fc58600f4 Author: Matthias Maier <tamiko@gentoo.org> Date: Tue Jan 17 07:38:33 2017 -0600 app-doc/doxygen: force emake for 1.8.10,1.8.11, bug #591386 Package-Manager: Portage-2.3.0, Repoman-2.3.1