Skip to content

Commit

Permalink
Add define that avoids using std::unary_function when using c++17 or …
Browse files Browse the repository at this point in the history
…newer standard.
  • Loading branch information
srherbener committed Oct 3, 2023
1 parent 12ad49f commit 68a6532
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion var/spack/repos/builtin/packages/boost/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ def determine_b2_options(self, spec, options):
cxxflags = []

# Deal with C++ standard.
cxxstd = spec.variants["cxxstd"].value
if spec.satisfies("@1.66:"):
options.append("cxxstd={0}".format(spec.variants["cxxstd"].value))
else: # Add to cxxflags for older Boost.
cxxstd = spec.variants["cxxstd"].value
flag = getattr(self.compiler, "cxx{0}_flag".format(cxxstd))
if flag:
cxxflags.append(flag)
Expand All @@ -607,6 +607,12 @@ def determine_b2_options(self, spec, options):
if not spec.satisfies("@:1.70 %intel"):
cxxflags.append("-DBOOST_PARAMETER_DISABLE_PERFECT_FORWARDING")

# std::unary_function was removed in C++17 so need to set the following
# flag for building boost
if (cxxstd == "17") or (cxxstd == "2a") or (cxxstd == "20") or
(cxxstd == "23") or (cxxstd == "26"):
cxxflags.append("-DBOOST_NO_CXX98_FUNCTION_BASE")

# clang is not officially supported for pre-compiled headers
# and at least in clang 3.9 still fails to build
# https://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html
Expand Down

0 comments on commit 68a6532

Please sign in to comment.