stlab / libraries

ASL libraries will be migrated here in the stlab namespace, new libraries will be created here.
https://stlab.cc
Boost Software License 1.0
660 stars 65 forks source link

Make better defaults for STLAB_USE_BOOST_CPP17_SHIMS and STLAB_NO_STD_COROUTINES #468

Closed camio closed 2 years ago

camio commented 2 years ago

The defaults for STLAB_USE_BOOST_CPP17_SHIMS and STLAB_NO_STD_COROUTINES are OFF and FALSE. This reflects the strategy of assuming newer versions of compilers which has the tradeoff of less complexity in our build system, but more work for those using older compilers.

On the other hand, MacOS users, which represent a large and important portion of our development community, are stuck with a version of XCode that doesn't support coroutines so they frequently run into the stumbling block where builds don't work and STLAB_NO_STD_COROUTINES needs to be explicitly set ON.

This task is to give both of these parameters better defaults by empirically testing whether or not they are needed.

This involves the creation of two functions, stlab_detect_coroutines, and stlab_detect_optional_variant that live in cmake/StlabUtil.cmake. They will utilize check_cxx_source_runs with some simple test files that verify that the functionality works. These functions will be used to produce defaults for STLAB_USE_BOOST_CPP17_SHIMS and STLAB_NO_STD_COROUTINES in the same way that stlab_detect_thread_system produces a default for STLAB_THREAD_SYSTEM.

Acceptance Criteria