Patch Boost.Locale to configure with CMake 4.5 (#17725)

This commit is contained in:
Rodrigo Faselli authored and GitHub committed 2026-11-19 21:21:25 -03:00
1 parent 5cf5ef881e
commit a53663cddf
2 files changed
+23

No files matched your search

+2
View File
@@ -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=<SOURCE_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
+21
View File
@@ -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=<Boost source>. 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 ()