summaryrefslogtreecommitdiff
path: root/Modules/FindCurses.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-05-10 19:07:47 -0400
committerAlexander Neundorf <neundorf@kde.org>2008-05-10 19:07:47 -0400
commitb837ade9445ff74a5b59239eaa2a65b97256b426 (patch)
tree9f7abca473c06be1735b44992ab08ef1760dffb2 /Modules/FindCurses.cmake
parent071725a1c1c419f8d00770364e6345ed300fa5a1 (diff)
downloadcmake-b837ade9445ff74a5b59239eaa2a65b97256b426.tar.gz
BUG: fix #6993
FindCurses.cmake is now almost exactly reverted back to the state when CURSES_LIBRARY and CURSES_INCLUDE_PATH where set for compatibility but not in the cache. It is important that CURSES_CURSES_LIBRARY and CURSES_NCURSES_LIBRARY really contain the path to these files. Later on CURSES_LIBRARY is set to the one of the two which will be used as curses library. This is now done in the cache, without FORCE. So preloading the cache still seems to work (at least what I tested). Alex
Diffstat (limited to 'Modules/FindCurses.cmake')
-rw-r--r--Modules/FindCurses.cmake43
1 files changed, 24 insertions, 19 deletions
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 3eb54e5f5c..c854ba8e54 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -12,15 +12,15 @@
# Set CURSES_NEED_NCURSES to TRUE before the FIND_PACKAGE() command if NCurses
# functionality is required.
-FIND_LIBRARY(CURSES_LIBRARY NAMES curses )
+FIND_LIBRARY(CURSES_CURSES_LIBRARY NAMES curses )
FIND_LIBRARY(CURSES_NCURSES_LIBRARY NAMES ncurses )
SET(CURSES_USE_NCURSES FALSE)
-IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_LIBRARY)
+IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
SET(CURSES_USE_NCURSES TRUE)
-ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_LIBRARY)
+ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
# Not sure the logic is correct here.
@@ -34,9 +34,9 @@ ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_LIBRARY)
# 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
# default search paths.
-IF(CURSES_LIBRARY AND CURSES_NEED_NCURSES)
+IF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
INCLUDE(CheckLibraryExists)
- CHECK_LIBRARY_EXISTS("${CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
+ 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)
@@ -45,15 +45,19 @@ IF(CURSES_LIBRARY AND CURSES_NEED_NCURSES)
ENDIF( CURSES_NCURSES_HAS_WSYNCUP)
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
-ENDIF(CURSES_LIBRARY AND CURSES_NEED_NCURSES)
+ENDIF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
IF(NOT CURSES_USE_NCURSES)
FIND_FILE(CURSES_HAVE_CURSES_H curses.h )
- FIND_PATH(CURSES_INCLUDE_PATH curses.h )
-
- GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_LIBRARY}" PATH)
+ FIND_PATH(CURSES_CURSES_H_PATH curses.h )
+ GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
+
+ # for compatibility with older FindCurses.cmake this has to be in the cache
+ # FORCE must not be used since this would break builds which preload a cache wqith these variables set
+ SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" CACHE FILEPATH "The curses include path")
+ SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" CACHE FILEPATH "The curses library")
ELSE(NOT CURSES_USE_NCURSES)
# we need to find ncurses
GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
@@ -69,21 +73,25 @@ ELSE(NOT CURSES_USE_NCURSES)
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h PATHS "${_cursesParentDir}/include" NO_DEFAULT_PATH)
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h)
- SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}")
- SET(FORCE_ARG "")
- IF("${CURSES_LIBRARY}" STREQUAL "CURSES_LIBRARY-NOTFOUND")
- SET(FORCE_ARG "FORCE")
- ENDIF("${CURSES_LIBRARY}" STREQUAL "CURSES_LIBRARY-NOTFOUND")
- SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "path to curses" ${FORCE_ARG})
+ # for compatibility with older FindCurses.cmake this has to be in the cache
+ # FORCE must not be used since this would break builds which preload a cache wqith these variables set
+ SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" CACHE FILEPATH "The curses include path")
+ SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "The curses library")
ENDIF(NOT CURSES_USE_NCURSES)
+
FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr PATHS "${_cursesLibDir}" NO_DEFAULT_PATH)
FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr )
FIND_LIBRARY(CURSES_FORM_LIBRARY form PATHS "${_cursesLibDir}" NO_DEFAULT_PATH)
FIND_LIBRARY(CURSES_FORM_LIBRARY form )
+# for compatibility with older FindCurses.cmake this has to be in the cache
+# FORCE must not be used since this would break builds which preload a cache wqith these variables set
+SET(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" CACHE FILEPATH "The curses form library")
+
+
# Need to provide the *_LIBRARIES
SET(CURSES_LIBRARIES ${CURSES_LIBRARY})
@@ -103,14 +111,11 @@ SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG CURSES_LIBRARY CURSES_INCLUDE_PATH)
-# for compatibility
-SET(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
-
MARK_AS_ADVANCED(
CURSES_INCLUDE_PATH
CURSES_LIBRARY
CURSES_CURSES_INCLUDE_PATH
- CURSES_LIBRARY
+ CURSES_CURSES_LIBRARY
CURSES_NCURSES_INCLUDE_PATH
CURSES_NCURSES_LIBRARY
CURSES_EXTRA_LIBRARY