Well, if you insist to do it using the CXXFLAGS/LDFLAGS way, we need a plan to handle situations like openmpi, which needs "-stdlib=libc++" to be passed to C++ compiler but not Fortran compiler during linking. LDFLAGS will definitely not work in this case as I stated multiple times.