Opened 7 years ago
Closed 7 years ago
#11408 closed Feature Requests (obsolete)
Need C++ standard option for ./b2 and Jamfile
Reported by: | Niall Douglas | Owned by: | Vladimir Prus |
---|---|---|---|
Milestone: | To Be Determined | Component: | build |
Version: | Boost 1.60.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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
Just learned off this list this is already implemented. Didn't know that before. Closing.