Boost logo

Boost-Build :

From: Daniel Einspanjer (deinspanjer_at_[hidden])
Date: 2006-02-09 16:54:58


I was looking at this piece of Jamfile again:

========== Example 1 ==========
alias linux ;
obj linux
    : # sources
        linux.cpp
    : # requirements
        <os>LINUX
    ;

alias osxppc ;
obj osxppc
    : # sources
        osxppc.cpp
    : # requirements
        <os>OSXPPC
    ;

exe example1 : linux osxppc ;
========== End Example 1 ==========

And wondering if there wasn't a different/better way.
I thought about using a rule like this:

========== Example 2 ==========
rule platform-specific-source ( )
{
    import os ;
    local files ;
    switch [ os.name ]
    {
        case NT : ;
        case LINUX :
            files += linux.cpp
            ;
        case OSXPPC :
            files += osxppc.cpp
            ;
    }
    return $(files) ;
}

exe example2 : [ platform-specific-source ] ;
========== End Example 2 ==========

and it almost works, but since we don't have any NT specific files, the rule
bombs out.

Is the rule better? If so, how can I work around the empty case?

Daniel


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk