v31.1-roots.1 · Commit 13: [PATCH 13/17] fix(build): preserve Homebrew Boost system header classification
cmake/module/AddBoostIfNeeded.cmake
Before: cmake/module/AddBoostIfNeeded.cmake · After: cmake/module/AddBoostIfNeeded.cmake
File metadata
index 80a6d2e8911720e1d63990b342d624245d7d7492..606894d2a61b1a2796164032c51ebcce294fd0e4 100644
Download original patch · Release notes
Diff rows 1–32 of 32. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
cmake/module/AddBoostIfNeeded.cmake
CHANGED
|
@@ -31,6 +31,32 @@ function(add_boost_if_needed)
|
|
|
31
31
|
|
|
32
32
|
find_package(Boost 1.74.0 REQUIRED CONFIG)
|
|
33
33
|
mark_as_advanced(Boost_INCLUDE_DIR boost_headers_DIR)
|
|
34
|
+
if(CMAKE_HOST_APPLE AND HOMEBREW_EXECUTABLE)
|
|
35
|
+
execute_process(
|
|
36
|
+
COMMAND ${HOMEBREW_EXECUTABLE} --prefix
|
|
37
|
+
OUTPUT_VARIABLE _homebrew_prefix
|
|
38
|
+
RESULT_VARIABLE _homebrew_status
|
|
39
|
+
ERROR_QUIET
|
|
40
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
41
|
+
)
|
|
42
|
+
# An earlier search path can select Homebrew's linked headers instead of
|
|
43
|
+
# the Cellar path exported by Boost's config. Classify that spelling as
|
|
44
|
+
# system too, but only when it resolves to the same Boost installation.
|
|
45
|
+
if(_homebrew_status EQUAL 0 AND IS_DIRECTORY "${_homebrew_prefix}/include/boost")
|
|
46
|
+
file(REAL_PATH "${_homebrew_prefix}/include/boost" _linked_boost_headers)
|
|
47
|
+
get_target_property(_boost_include_dirs Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
|
48
|
+
foreach(_boost_include_dir IN LISTS _boost_include_dirs)
|
|
49
|
+
if(IS_DIRECTORY "${_boost_include_dir}/boost")
|
|
50
|
+
file(REAL_PATH "${_boost_include_dir}/boost" _configured_boost_headers)
|
|
51
|
+
if(_linked_boost_headers STREQUAL _configured_boost_headers)
|
|
52
|
+
target_include_directories(Boost::headers SYSTEM INTERFACE "${_homebrew_prefix}/include")
|
|
53
|
+
message(STATUS "Using matching Homebrew Boost header alias: ${_homebrew_prefix}/include")
|
|
54
|
+
break()
|
|
55
|
+
endif()
|
|
56
|
+
endif()
|
|
57
|
+
endforeach()
|
|
58
|
+
endif()
|
|
59
|
+
endif()
|
|
34
60
|
# Workaround for a bug in NetBSD pkgsrc.
|
|
35
61
|
# See https://gnats.netbsd.org/59856.
|
|
36
62
|
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|