Skip to content

Commit 0faedfd

Browse files
committed
[build] Allow searching for external FreeType on MacOS
And fallback to using the builtin if the external can't be found. Useful when there is an externally-provided FreeType library on MacOS, such as on conda-forge. This is an upstream of https://github.com/conda-forge/root-feedstock/blob/df86316b299d8214d3181d76c31925696f076d5e/recipe/patches/0009-disable-builtin-freetype-macos.patch
1 parent 1f1c820 commit 0faedfd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,15 @@ endif()
105105
if(cocoa)
106106
if(APPLE)
107107
set(x11 OFF CACHE BOOL "Disabled because cocoa requested (${x11_description})" FORCE)
108-
set(builtin_freetype ON CACHE BOOL "Enabled because needed for Cocoa graphics (${builtin_freetype_description})" FORCE)
108+
# We allow using an external FreeType library
109+
if(NOT builtin_freetype)
110+
find_package(Freetype)
111+
if(NOT FREETYPE_FOUND)
112+
# FreeType is needed on MacOS, fallback to enabling builtin if it was not found
113+
message(STATUS "FreeType not found. Switching on builtin_freetype option")
114+
set(builtin_freetype ON CACHE BOOL "Enabled because needed for Cocoa graphics (${builtin_freetype_description})" FORCE)
115+
endif()
116+
endif()
109117
else()
110118
message(STATUS "Cocoa option can only be enabled on MacOSX platform")
111119
set(cocoa OFF CACHE BOOL "Disabled because only available on MacOSX (${cocoa_description})" FORCE)

0 commit comments

Comments
 (0)