ENH: make this backwards compatible with older FindCurses
This commit is contained in:
parent
07cb082722
commit
cb1cdada76
|
@ -7,19 +7,20 @@
|
||||||
# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
|
# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
|
||||||
# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
|
# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
|
||||||
# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
|
# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
|
||||||
|
# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
|
||||||
#
|
#
|
||||||
# Set CURSES_NEED_NCURSES to TRUE before the FIND_PACKAGE() command if NCurses
|
# Set CURSES_NEED_NCURSES to TRUE before the FIND_PACKAGE() command if NCurses
|
||||||
# functionality is required.
|
# functionality is required.
|
||||||
|
|
||||||
FIND_LIBRARY(CURSES_CURSES_LIBRARY NAMES curses )
|
FIND_LIBRARY(CURSES_LIBRARY NAMES curses )
|
||||||
|
|
||||||
FIND_LIBRARY(CURSES_NCURSES_LIBRARY NAMES ncurses )
|
FIND_LIBRARY(CURSES_NCURSES_LIBRARY NAMES ncurses )
|
||||||
|
|
||||||
SET(CURSES_USE_NCURSES FALSE)
|
SET(CURSES_USE_NCURSES FALSE)
|
||||||
|
|
||||||
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
|
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_LIBRARY)
|
||||||
SET(CURSES_USE_NCURSES TRUE)
|
SET(CURSES_USE_NCURSES TRUE)
|
||||||
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
|
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
# Not sure the logic is correct here.
|
# Not sure the logic is correct here.
|
||||||
|
@ -33,9 +34,9 @@ ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
|
||||||
# So at first try ncurses.h, if not found, try to find curses.h under the same
|
# So at first try ncurses.h, if not found, try to find curses.h under the same
|
||||||
# prefix as the library was found, if still not found, try curses.h with the
|
# prefix as the library was found, if still not found, try curses.h with the
|
||||||
# default search paths.
|
# default search paths.
|
||||||
IF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
|
IF(CURSES_LIBRARY AND CURSES_NEED_NCURSES)
|
||||||
INCLUDE(CheckLibraryExists)
|
INCLUDE(CheckLibraryExists)
|
||||||
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
|
CHECK_LIBRARY_EXISTS("${CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
|
||||||
|
|
||||||
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
|
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
|
||||||
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
|
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
|
||||||
|
@ -44,7 +45,7 @@ IF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
|
||||||
ENDIF( CURSES_NCURSES_HAS_WSYNCUP)
|
ENDIF( CURSES_NCURSES_HAS_WSYNCUP)
|
||||||
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
|
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
|
||||||
|
|
||||||
ENDIF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
|
ENDIF(CURSES_LIBRARY AND CURSES_NEED_NCURSES)
|
||||||
|
|
||||||
|
|
||||||
IF(NOT CURSES_USE_NCURSES)
|
IF(NOT CURSES_USE_NCURSES)
|
||||||
|
@ -52,8 +53,7 @@ IF(NOT CURSES_USE_NCURSES)
|
||||||
FIND_PATH(CURSES_CURSES_H_PATH curses.h )
|
FIND_PATH(CURSES_CURSES_H_PATH curses.h )
|
||||||
SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}")
|
SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}")
|
||||||
|
|
||||||
SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
|
GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_LIBRARY}" PATH)
|
||||||
GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
|
|
||||||
GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
|
GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
|
||||||
ELSE(NOT CURSES_USE_NCURSES)
|
ELSE(NOT CURSES_USE_NCURSES)
|
||||||
# we need to find ncurses
|
# we need to find ncurses
|
||||||
|
@ -71,7 +71,7 @@ ELSE(NOT CURSES_USE_NCURSES)
|
||||||
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h)
|
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h)
|
||||||
|
|
||||||
SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}")
|
SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}")
|
||||||
SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
|
SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "path to curses")
|
||||||
ENDIF(NOT CURSES_USE_NCURSES)
|
ENDIF(NOT CURSES_USE_NCURSES)
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ MARK_AS_ADVANCED(
|
||||||
CURSES_INCLUDE_PATH
|
CURSES_INCLUDE_PATH
|
||||||
CURSES_LIBRARY
|
CURSES_LIBRARY
|
||||||
CURSES_CURSES_INCLUDE_PATH
|
CURSES_CURSES_INCLUDE_PATH
|
||||||
CURSES_CURSES_LIBRARY
|
CURSES_LIBRARY
|
||||||
CURSES_NCURSES_INCLUDE_PATH
|
CURSES_NCURSES_INCLUDE_PATH
|
||||||
CURSES_NCURSES_LIBRARY
|
CURSES_NCURSES_LIBRARY
|
||||||
CURSES_EXTRA_LIBRARY
|
CURSES_EXTRA_LIBRARY
|
||||||
|
|
Loading…
Reference in New Issue