Boost logo

Boost-Build :

Subject: [Boost-build] Target OS preprocessor macro
From: mareq (mq_at_[hidden])
Date: 2012-09-04 17:15:35


I would like to conditionally execute parts of my code, depending on the
target OS. That means, that I need to define preprocessor macro (e.g.
BOOST_BUILD_TARGET_OS_LINUX), based on the value of <target-os> feature.

However, the only way how to do this, which is known to me by now is to
generate header file, containing appropriate #define directive and include
that header file into the sources. This is not very straightforward way, to
say the least.

Therefore, my question: What is the simplest way to add <define> property
into targets' property-set, which value (i.e. name of the preprocessor macro
being defined) is dependent on <target-os> property of the target in
question (e.g. <target-os>linux -> <define>BOOST_BUILD_TARGET_OS_LINUX,
<target-os>windows -> <define>BOOST_BUILD_TARGET_OS_WINDOWS, etc.).

Thanks.

--
View this message in context: http://boost.2283326.n4.nabble.com/Target-OS-preprocessor-macro-tp4635256.html
Sent from the Boost - Build mailing list archive at Nabble.com.

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