delay load rule

Added by Kevin Thacker over 6 years ago

A rule for setting delay load on exe/dll for windows:

rule SetDelayLoad TARGET : SOURCES : CONFIG : PLATFORM 
{
    local SOURCE_DATA = /DELAYLOAD:$(SOURCES) ;

    local _isset = [ on $(TARGET) Var DELAY_LOAD_SET ] ;

    # Visual Studio appears to add this library automatically.
    # the variable stops it being added multiple times
    if $(_isset) = "" 
    {
        DELAY_LOAD_SET on $(TARGET) = true ;

        C.LinkPrebuiltLibraries $(TARGET) : delayimp ;
    }

    C.LinkFlags $(TARGET) : $(SOURCE_DATA) : $(CONFIG:E=*) : $(PLATFORM:E=*) ;
}