Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try harder to select ncurses if possible.
Issue #19 reports that cmake's FindCurses doesn't do this in all situations: an example is if you've set CMAKE_SYSTEM_PREFIX_PATH to point to a location containing libncurses, then FindCurses will choose the plain libcurses from the standard system directories in preference to the extra featureful libncurses from the path you configured. But we do want ncurses if we can get it. The documentation for FindCurses says: Set CURSES_NEED_NCURSES to TRUE before the find_package(Curses) call if NCurses functionality is required. which sounds as if it will cause a build failure if only vanilla curses is available. So I've been cautious: we try to find a curses library with that flag set, and then if that fails, fall back to trying again without. That way we should get _some_ curses library if cmake can find one at all, but prefer ncurses if one of those is available. (I'm not convinced that CURSES_NEED_NCURSES actually does this - in my own testing, it appears to behave more like 'prefer ncurses' than 'fail if you don't get ncurses'. But given its documentation, that might be accidental, and might get fixed in future. So I think what I've done here is still the safer approach.)
- Loading branch information