Subject: [Boost-bugs] [Boost C++ Libraries] #11408: Need C++ standard option for ./b2 and Jamfile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-21 10:11:41
#11408: Need C++ standard option for ./b2 and Jamfile
------------------------------+---------------------------
Reporter: ned14 | Owner: vladimir_prus
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: build
Version: Boost 1.60.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------
A problem shortly forthcoming will be Boost libraries that can only build
on some revisions of the C++ standard, but not others. In such a
situation, let us imagine that a Boost.Hana which can only compile
currently on some versions of clang ought not to be attempted on C++ 98
compilers as it makes no sense to do so.
I would suggest a two part solution.
The first is that ./b2 gets a std=98|03|11|14|1z parameter which adds
-std=c++<val> on gcc and clang, and second that Jamfile gains an extra
requirements option e.g.
{{{
project boost/afio
: requirements
<threading>multi
<toolset><check-macro>__cplusplus > 201103L # <-- This is
new
<link>shared:<define>BOOST_AFIO_DYN_LINK=1
<link>shared:<define>BOOST_AFIO_SOURCE=1
<link>static:<define>BOOST_AFIO_SOURCE=1
<include>../../../boost/afio
<toolset>gcc:<cxxflags>"-fvisibility-inlines-hidden -fstrict-
aliasing -Wstrict-aliasing -Wno-unused -fargument-noalias
-fvisibility=hidden -fasynchronous-unwind-tables"
...
}}}
If a <toolset><check-macro> appears, the compiler is executed with the
code
{{{
#include "boost/config.hpp"
#if <insert check-macro>
#else
#error Not supported
#endif
}}}
And if the compiler compiles that without error, the library is enabled
for this build. One can also, of course, check Boost.Config macros for
compiler features.
For even more flexible build enable detection, I'd also have a:
{{{
<toolset><check-header>custom_header.hpp
}}}
This tries to compile custom_header.hpp, and if that succeeds the build is
enabled.
Niall
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11408> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC