Skip to content

Commit c6c7ab6

Browse files
committed
[build] Move handling of Cocoa option after FreeType
When building on Apple with Cocoa graphics, FreeType is required. Previously, there were two separate ways to check for FreeType availability: * The "standard" checks for builtins, forcing availability when `fail-on-missing` is ON, otherwise falling back to activating the builtin if the external package is not found * An injected check in the section related to Cocoa, which happened before the section for the builtin, which practically meant that on Apple with Cocoa enabled ROOT was always built with the builtin FreeType library. This commit proposes to move the section related to Cocoa after the section related to FreeType. This way, the build on Cocoa can only: * Fail if FreeType is not found, when `fail-on-missing` is ON * Use the FreeType seen by the rest of the build, the result of the checks in the FreeType section. As a result, MacOS builds can also now use an externally provided FreeType, useful e.g. for conda-forge builds. This commit removes the need for the following conda-forge patch: https://github.com/conda-forge/root-feedstock/blob/df86316b299d8214d3181d76c31925696f076d5e/recipe/patches/0009-disable-builtin-freetype-macos.patch
1 parent 2947b9c commit c6c7ab6

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ if(NOT shared)
100100
endif()
101101
endif()
102102

103-
104-
#---Check for Cocoa/Quartz graphics backend (MacOS X only)---------------------------
105-
if(cocoa)
106-
if(APPLE)
107-
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)
109-
else()
110-
message(STATUS "Cocoa option can only be enabled on MacOSX platform")
111-
set(cocoa OFF CACHE BOOL "Disabled because only available on MacOSX (${cocoa_description})" FORCE)
112-
endif()
113-
endif()
114-
115103
#---Check for Zlib ------------------------------------------------------------------
116104
if(NOT builtin_zlib)
117105
message(STATUS "Looking for ZLib")
@@ -285,6 +273,18 @@ if(builtin_freetype)
285273
set(FREETYPE_TARGET FREETYPE)
286274
endif()
287275

276+
#---Check for Cocoa/Quartz graphics backend (MacOS X only)---------------------------
277+
# Note that this check happens *after* the above check for FreeType because that
278+
# library is needed for builds on Apple with Cocoa graphics
279+
if(cocoa)
280+
if(APPLE)
281+
set(x11 OFF CACHE BOOL "Disabled because cocoa requested (${x11_description})" FORCE)
282+
else()
283+
message(STATUS "Cocoa option can only be enabled on MacOSX platform")
284+
set(cocoa OFF CACHE BOOL "Disabled because only available on MacOSX (${cocoa_description})" FORCE)
285+
endif()
286+
endif()
287+
288288
#---Check for PCRE-------------------------------------------------------------------
289289
if(NOT builtin_pcre)
290290
message(STATUS "Looking for PCRE")

0 commit comments

Comments
 (0)