def smart_link(source, target, env, for_signature): has_cplusplus = cplusplus.iscplusplus(source) has_fortran = isfortran(env, source) if has_cplusplus and has_fortran: global issued_mixed_link_warning if not issued_mixed_link_warning: msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \ "This may generate a buggy executable if the '%s'\n\t" + \ "compiler does not know how to deal with Fortran runtimes." SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning, msg % env.subst('$CXX')) issued_mixed_link_warning = True return '$CXX' elif has_fortran: return '$FORTRAN' elif has_cplusplus: return '$CXX' return '$CC'
def smart_link(source, target, env, for_signature): has_cplusplus = cplusplus.iscplusplus(source) has_fortran = isfortran(env, source) has_d = isD(env, source) if has_cplusplus and has_fortran and not has_d: global issued_mixed_link_warning if not issued_mixed_link_warning: msg = ( "Using $CXX to link Fortran and C++ code together.\n\t" + "This may generate a buggy executable if the '%s'\n\t" + "compiler does not know how to deal with Fortran runtimes." ) SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning, msg % env.subst("$CXX")) issued_mixed_link_warning = True return "$CXX" elif has_d: env["LINKCOM"] = env["DLINKCOM"] env["SHLINKCOM"] = env["SHDLINKCOM"] return "$DC" elif has_fortran: return "$FORTRAN" elif has_cplusplus: return "$CXX" return "$CC"