Add support to USE_LANGUAGES for C++ standards from c++0x to gnu++14.
This allows packages to specify the version of the standard that they require, and the infrastructure then distils that down in a similar way to GCC_REQD to the newest standard, avoiding clashes with different -std requirements based on CXXFLAGS. Broad concensus on tech-pkg and tested in bulk builds.
This commit is contained in:
parent
0a5b40bb74
commit
6004c83509
1 changed files with 21 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: compiler.mk,v 1.83 2016/11/10 20:59:43 joerg Exp $
|
||||
# $NetBSD: compiler.mk,v 1.84 2017/05/03 08:34:23 jperkin Exp $
|
||||
#
|
||||
# This Makefile fragment implements handling for supported C/C++/Fortran
|
||||
# compilers.
|
||||
|
@ -42,8 +42,9 @@
|
|||
# USE_LANGUAGES
|
||||
# Lists the languages used in the source code of the package,
|
||||
# and is used to determine the correct compilers to install.
|
||||
# Valid values are: c, c99, c++, fortran, fortran77, java, objc,
|
||||
# obj-c++, and ada. The default is "c".
|
||||
# Valid values are: c, c99, c++, c++0x, gnu++0x, c++11, gnu++11,
|
||||
# c++14, gnu++14, fortran, fortran77, java, objc, obj-c++, and
|
||||
# ada. The default is "c".
|
||||
#
|
||||
# The following variables are defined, and available for testing in
|
||||
# package Makefiles:
|
||||
|
@ -157,6 +158,23 @@ ${_var_}:= ${${_var_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//:T} ${${_var_}:C/^/_asdf_
|
|||
. endif
|
||||
.endfor
|
||||
|
||||
# Pass the compiler flag based on the most recent version of the C++ standard
|
||||
# required. We currently assume that each standard is a superset of all that
|
||||
# come after it.
|
||||
#
|
||||
# If and when the flags differ between compilers we can push this down into
|
||||
# the respective mk/compiler/*.mk files.
|
||||
#
|
||||
_CXX_VERSION_REQD=
|
||||
.for _version_ in gnu++14 c++14 gnu++11 c++11 gnu++0x c++0x
|
||||
. if empty(_CXX_VERSION_REQD) && !empty(USE_LANGUAGES:M${_version_})
|
||||
USE_LANGUAGES+= c++
|
||||
_CXX_VERSION_REQD= ${_version_}
|
||||
_WRAP_EXTRA_ARGS.CXX+= -std=${_CXX_VERSION_REQD}
|
||||
CWRAPPERS_PREPEND.cxx+= -std=${_CXX_VERSION_REQD}
|
||||
. endif
|
||||
.endfor
|
||||
|
||||
.if defined(ABI) && !empty(ABI)
|
||||
_WRAP_EXTRA_ARGS.CC+= ${_COMPILER_ABI_FLAG.${ABI}}
|
||||
_WRAP_EXTRA_ARGS.CXX+= ${_COMPILER_ABI_FLAG.${ABI}}
|
||||
|
|
Loading…
Reference in a new issue