123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
- if(NOT CURSES_NEED_WIDE)
- set(NCURSES_LIBRARY_NAME "ncurses")
- else()
- set(NCURSES_LIBRARY_NAME "ncursesw")
-
-
- set(CURSES_NEED_NCURSES TRUE)
- endif()
- find_library(CURSES_CURSES_LIBRARY NAMES curses )
- find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" )
- set(CURSES_USE_NCURSES FALSE)
- if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
- set(CURSES_USE_NCURSES TRUE)
- endif()
- if(CYGWIN)
- if (CURSES_NEED_WIDE)
- if(NOT EXISTS /usr/include/ncursesw/curses.h)
- set(CURSES_USE_NCURSES TRUE)
- endif()
- else()
- if(NOT EXISTS /usr/include/curses.h)
- set(CURSES_USE_NCURSES TRUE)
- endif()
- endif()
- endif()
- if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
- include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
- cmake_push_check_state()
- set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
- CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
- wsyncup "" 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)
- if( CURSES_NCURSES_HAS_WSYNCUP)
- set(CURSES_USE_NCURSES TRUE)
- endif()
- endif()
- cmake_pop_check_state()
- endif()
- if(CURSES_USE_NCURSES)
- get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
- get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
-
- if(CURSES_NCURSES_INCLUDE_PATH)
- if (CURSES_NEED_WIDE)
- find_path(CURSES_INCLUDE_PATH
- NAMES ncursesw/ncurses.h ncursesw/curses.h
- PATHS ${CURSES_NCURSES_INCLUDE_PATH}
- NO_DEFAULT_PATH
- )
- else()
- find_path(CURSES_INCLUDE_PATH
- NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
- PATHS ${CURSES_NCURSES_INCLUDE_PATH}
- NO_DEFAULT_PATH
- )
- endif()
- endif()
- if (CURSES_NEED_WIDE)
- find_path(CURSES_INCLUDE_PATH
- NAMES ncursesw/ncurses.h ncursesw/curses.h
- HINTS "${_cursesParentDir}/include"
- )
- else()
- find_path(CURSES_INCLUDE_PATH
- NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
- HINTS "${_cursesParentDir}/include"
- )
- endif()
-
- if(NOT DEFINED CURSES_LIBRARY)
- set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
- endif()
- CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
- cbreak "" CURSES_NCURSES_HAS_CBREAK)
- if(NOT CURSES_NCURSES_HAS_CBREAK)
- find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}")
- find_library(CURSES_EXTRA_LIBRARY tinfo )
- endif()
- else()
- get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
- get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
-
-
- if(NOT CURSES_NEED_WIDE)
- find_path(CURSES_INCLUDE_PATH
- NAMES curses.h
- HINTS "${_cursesParentDir}/include"
- )
- endif()
-
- if(NOT DEFINED CURSES_CURSES_H_PATH)
- set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}")
- endif()
- if(NOT DEFINED CURSES_LIBRARY)
- set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
- endif()
- endif()
- if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
- if(CURSES_NEED_WIDE)
- if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h")
- set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h")
- endif()
- elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
- set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
- endif()
- if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
- set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
- endif()
- endif()
- if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
- if(CURSES_NEED_WIDE)
- if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/curses.h")
- set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/curses.h")
- endif()
- elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
- set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
- endif()
- if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
- set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
- endif()
- endif()
- if(NOT CURSES_NEED_WIDE)
-
- if(NOT DEFINED CURSES_HAVE_NCURSES_H)
- if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h")
- set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h")
- else()
- set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND")
- endif()
- endif()
- if(NOT DEFINED CURSES_HAVE_CURSES_H)
- if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h")
- set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h")
- else()
- set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND")
- endif()
- endif()
- endif()
- find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
- find_library(CURSES_FORM_LIBRARY form )
- if(NOT DEFINED FORM_LIBRARY)
- set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
- endif()
- set(CURSES_LIBRARIES ${CURSES_LIBRARY})
- if(CURSES_EXTRA_LIBRARY)
- set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY})
- endif()
- if(CURSES_FORM_LIBRARY)
- set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
- endif()
- set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
- set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
- CURSES_LIBRARY CURSES_INCLUDE_PATH)
- mark_as_advanced(
- CURSES_INCLUDE_PATH
- CURSES_CURSES_LIBRARY
- CURSES_NCURSES_LIBRARY
- CURSES_EXTRA_LIBRARY
- CURSES_FORM_LIBRARY
- )
|