I suggest a test in the CML itself: After `project` you can add:
if(DEFINED BOOST_SUPERPROJECT_VERSION AND NOT BOOST_SUPERPROJECT_VERSION EQUAL PROJECT_VERSION) message(FATAL_ERROR "The version of the project (${PROJECT_VERSION}) needs to be updated to the version of the Boost project ${BOOST_SUPERPROJECT_VERSION}) endif()
This avoids compiling a new binary just for this at the expense of some boilerplate at the top of the CML. However this way the project won't even configure allowing to detect this issue very early. Alex
Dear boost developers,
Subprojects like `math` define CMAKE_PROJECT_VERSION in terms of BOOST_SUPERPROJECT_VERSION via:
``` project(boost_math VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) ```
This is clearly handy to save a few seconds in the release process, but it means that if one wants to use the subproject standalone (where BOOST_SUPERPROJECT_VERSION is undefined), CMAKE_PROJECT_VERSION is also undefined.
This is a problem for me as I am trying to make boost_math a Meson-CMake subproject of SciPy. This would enable us to un-vendor boost_math from SciPy, such that a distro can instead use SciPy with boost_math as a system library. We would only fall back to embedding the boost_math source when it is not installed as a system library.
When the boost_math source is embedded, CMAKE_PROJECT_VERSION is parsed to check that we have the correct version to work with SciPy, but we get an error that the version is undefined. This could be solved by defining the version directly in the math subproject instead of in terms of BOOST_SUPERPROJECT_VERSION. The alternative solution of embedding the entire boost source is not suitable for us, since all we need is math.
Would it be possible to switch to defining CMAKE_PROJECT_VERSION directly in subprojects? Or is there a more compelling reason to define it in terms of BOOST_SUPERPROJECT_VERSION?
Cheers, Lucas
—
For context: https://github.com/mesonbuild/meson/pull/11730#issuecomment-2351619977, https://github.com/scipy/scipy/pull/21270
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost