Skip to content

Commit 67d820d

Browse files
committed
build: Make finding bison work better on Apple Silicon Macs + homebrew (#1822)
Homebrew changes location by default on the new ARM-based Macs. Check the new paths, too. Signed-off-by: Larry Gritz <[email protected]>
1 parent ec83eef commit 67d820d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/cmake/flexbison.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121
# MacOS/xcode in /usr/bin, which seems to be too old for the reentrant
2222
# parser directives we use. Only do this if there is no BISON_ROOT
2323
# specifying a particular Bison to use.
24-
if (APPLE AND EXISTS /usr/local/opt
25-
AND NOT BISON_ROOT AND NOT DEFINED ENV{BISON_ROOT})
26-
find_program(BISON_EXECUTABLE NAMES /usr/local/opt/bison/bin/bison
24+
if (APPLE AND NOT BISON_ROOT AND NOT DEFINED ENV{BISON_ROOT}
25+
AND (EXISTS /usr/local/opt OR EXISTS /opt/homebrew
26+
OR DEFINED ENV{HOMEBREW_PREFIX}))
27+
find_program(BISON_EXECUTABLE
28+
NAMES
29+
ENV{HOMEBREW_PREFIX}/opt/bison/bin/bison
30+
/opt/homebrew/opt/bison/bin/bison
31+
/usr/local/opt/bison/bin/bison
2732
DOC "path to the bison executable")
2833
endif()
2934

0 commit comments

Comments
 (0)