With WITH_ASAN, b2 runs as `b2 context-impl=ucontext headers stage` for the
build step and `b2 context-impl=ucontext install` for the install step. The
`context-impl` feature is declared in libs/context/build/Jamfile.v2, which
neither the headers/stage nor the install targets load, so b2 aborts with:
error: unknown feature "<context-impl>"
Name the context project as a target in both commands so its Jamfile (and the
feature) loads before the build request is expanded.
This works around https://github.com/boostorg/context/issues/297, fixed
upstream in
https://github.com/boostorg/context/commit/
12ac945158ae3c2373ec0c888899373218aa209f
and first released in Boost 1.88; drop it once the bundled Boost is bumped to
1.88 or newer.
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
if(WITH_BOOST_VALGRIND)
list(APPEND b2 valgrind=on)
endif()
+ set(b2_targets headers stage)
+ set(b2_install_targets install)
if(WITH_ASAN)
list(APPEND b2 context-impl=ucontext)
+ # `context-impl` is declared in libs/context/build/Jamfile.v2; the headers/stage
+ # and install targets never load it, so b2 aborts with `unknown feature
+ # "<context-impl>"`. Name the context project as a target so its Jamfile loads
+ # the feature first.
+ list(PREPEND b2_targets libs/context/build)
+ list(PREPEND b2_install_targets libs/context/build)
endif()
set(build_command
- ${b2} headers stage
+ ${b2} ${b2_targets}
#"--buildid=ceph" # changes lib names--can omit for static
${boost_features})
set(install_command
- ${b2} install)
+ ${b2} ${b2_install_targets})
if(EXISTS "${PROJECT_SOURCE_DIR}/src/boost/bootstrap.sh")
check_boost_version("${PROJECT_SOURCE_DIR}/src/boost" ${version})
set(source_dir