Fix macOS release build: locate Homebrew's wide-char ncurses
CMake 4.x FindCurses with CURSES_NEED_WIDE finds the macOS SDK's libcurses.tbd but no matching wide-char header, so configure failed with "Could NOT find Curses (missing: CURSES_INCLUDE_PATH)". Homebrew's ncurses is keg-only, so it is not on the default search path either. Existing build directories only worked by accident, via a hand-passed -DCURSES_INCLUDE_PATH left in their CMakeCache; a clean configure failed, which broke make-app-release. Query `brew --prefix ncurses` on APPLE and prepend it to CMAKE_PREFIX_PATH when present. A clean configure now succeeds with no manual flags and links the real libncursesw.dylib instead of the SDK's narrow libcurses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,23 @@ endif ()
|
||||
# NCurses for terminal mode
|
||||
set(CURSES_NEED_NCURSES TRUE)
|
||||
set(CURSES_NEED_WIDE TRUE)
|
||||
|
||||
# macOS ships only a narrow-char ncurses in the SDK, and Homebrew's wide-char
|
||||
# build is keg-only, so FindCurses can't see it without a hint.
|
||||
if (APPLE)
|
||||
find_program(BREW_EXECUTABLE brew)
|
||||
if (BREW_EXECUTABLE)
|
||||
execute_process(COMMAND "${BREW_EXECUTABLE}" --prefix ncurses
|
||||
OUTPUT_VARIABLE HOMEBREW_NCURSES_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
if (HOMEBREW_NCURSES_PREFIX AND IS_DIRECTORY "${HOMEBREW_NCURSES_PREFIX}")
|
||||
message(STATUS "Using Homebrew ncursesw: ${HOMEBREW_NCURSES_PREFIX}")
|
||||
list(PREPEND CMAKE_PREFIX_PATH "${HOMEBREW_NCURSES_PREFIX}")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
find_package(Curses REQUIRED)
|
||||
include_directories(${CURSES_INCLUDE_DIR})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user