If you want to have Fortran call your C++, you might want to try out SWIG. It's a code generator that will automatically make all that extern "C" wrappers for you and can easily be called from you build scripts.
Main SWIG does not have Fortran support, but there's a fork at https://github.com/swig-fortran