diff --git a/deps/Boost/Boost.cmake b/deps/Boost/Boost.cmake index 1526928094..80d0620a41 100644 --- a/deps/Boost/Boost.cmake +++ b/deps/Boost/Boost.cmake @@ -43,6 +43,8 @@ orcaslicer_add_cmake_project(Boost URL "https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz" URL_HASH SHA256=4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95 LIST_SEPARATOR | + # Lets Boost.Locale configure with CMake 4.5; see the script. + PATCH_COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR= -P ${CMAKE_CURRENT_LIST_DIR}/fix_locale_source_group.cmake CMAKE_ARGS -DBOOST_EXCLUDE_LIBRARIES:STRING=contract|fiber|numpy|stacktrace|wave|test -DBOOST_LOCALE_ENABLE_ICU:BOOL=OFF # do not link to libicu, breaks compatibility between distros diff --git a/deps/Boost/fix_locale_source_group.cmake b/deps/Boost/fix_locale_source_group.cmake new file mode 100644 index 0000000000..56f9b401e8 --- /dev/null +++ b/deps/Boost/fix_locale_source_group.cmake @@ -0,0 +1,21 @@ +# Boost.Locale lists include/boost/locale.hpp in a source_group(TREE) rooted at include/boost/locale. +# Before 4.5, CMake compared the two as strings and accepted it. CMake 4.5 reworked source_group() and +# compares path components, so it stops the configure with "is not a prefix of file". locale.hpp gets its own group on the +# following line of that file, so only the headers under include/boost/locale/ go into the tree. +# +# Run as the PATCH_COMMAND with -DSOURCE_DIR=. A second run leaves the file as it is. +set(_file "${SOURCE_DIR}/libs/locale/CMakeLists.txt") +set(_old [[list(FILTER sources_inc EXCLUDE REGEX "^src/")]]) +set(_new [[list(FILTER sources_inc INCLUDE REGEX "^include/boost/locale/")]]) + +file(READ "${_file}" _content) +string(FIND "${_content}" "${_new}" _patched) +if (_patched EQUAL -1) + string(FIND "${_content}" "${_old}" _found) + if (_found EQUAL -1) + message(FATAL_ERROR "${_file} no longer has the line this script replaces. Check whether this Boost " + "version still needs deps/Boost/fix_locale_source_group.cmake.") + endif () + string(REPLACE "${_old}" "${_new}" _content "${_content}") + file(WRITE "${_file}" "${_content}") +endif ()