[Cmake-commits] CMake branch, next, updated. v3.0.0-4182-gef1a3b5

Brad King brad.king at kitware.com
Thu Jul 10 14:19:02 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  ef1a3b5951d834299eea6400949c2a94fdf3ad0a (commit)
       via  fcca1eb90e6d1383e27ceb30c03b739ea30fe180 (commit)
      from  5d14a037105ba9074afab1b134af91aa8edeabd0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef1a3b5951d834299eea6400949c2a94fdf3ad0a
commit ef1a3b5951d834299eea6400949c2a94fdf3ad0a
Merge: 5d14a03 fcca1eb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 10 14:19:01 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jul 10 14:19:01 2014 -0400

    Merge topic 'FindCurses-overhaul' into next
    
    fcca1eb9 FindCurses: Overhaul Curses and NCurses search logic


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcca1eb90e6d1383e27ceb30c03b739ea30fe180
commit fcca1eb90e6d1383e27ceb30c03b739ea30fe180
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 10 14:06:45 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jul 10 14:13:11 2014 -0400

    FindCurses: Overhaul Curses and NCurses search logic
    
    Simplify the logic by never finding "ncurses/ncurses.h" or
    "ncurses/curses.h".  Instead always find either "ncurses.h" or
    "curses.h" and report the include directory as ".../ncurses" if
    necessary.  This also avoids asking applications to provide conditional
    inclusion of both "ncurses/ncurses.h" and "ncurses.h".  Furthermore, it
    produces a more consistent result by finding only a single location for
    headers and never claiming that both "ncurses.h" and "ncurses/ncurses.h"
    exist.  They might be from separate and incompatible packages.
    
    While at it, provide the CURSES_INCLUDE_DIRS result variable to be
    consistent with other modules.

diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 9b633c7..5c61090 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -2,28 +2,46 @@
 # FindCurses
 # ----------
 #
-# Find the curses include file and library
+# Find the curses or ncurses include file and library.
 #
+# Result Variables
+# ^^^^^^^^^^^^^^^^
 #
+# This module defines the following variables:
 #
-# ::
+# ``CURSES_FOUND``
+#   True if Curses is found.
+# ``CURSES_INCLUDE_DIRS``
+#   The include directories needed to use Curses.
+# ``CURSES_LIBRARIES``
+#   The libraries needed to use Curses.
+# ``CURSES_HAVE_CURSES_H``
+#   True if curses.h is available.
+# ``CURSES_HAVE_NCURSES_H``
+#   True if ncurses.h is available.
 #
-#   CURSES_FOUND - system has Curses
-#   CURSES_INCLUDE_DIR - the Curses include directory
-#   CURSES_LIBRARIES - The libraries needed to use Curses
-#   CURSES_HAVE_CURSES_H - true if curses.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_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(Curses)`` call if NCurses functionality is required.
 #
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
 #
+# The following variable are provided for backward compatibility:
 #
-# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if
-# NCurses functionality is required.
+# ``CURSES_HAVE_NCURSES_NCURSES_H``
+#   Always false.  Used to be true if ``ncurses/ncurses.h`` is available.
+# ``CURSES_HAVE_NCURSES_CURSES_H``
+#   Always false.  Used to be true if ``ncurses/curses.h`` is available.
+# ``CURSES_INCLUDE_DIR``
+#   Path to Curses include.  Use ``CURSES_INCLUDE_DIRS`` instead.
+# ``CURSES_LIBRARY``
+#   Path to Curses library.  Use ``CURSES_LIBRARIES`` instead.
+#
+# Currently if the headers are in a ``ncurses/`` directory the
+# path(s) in ``CURSES_INCLUDE_DIRS`` will simply point at that.
 
 #=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -84,61 +102,38 @@ if(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)
 
 endif()
 
-
-if(NOT CURSES_USE_NCURSES)
-  find_file(CURSES_HAVE_CURSES_H curses.h )
-  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()
-# we need to find ncurses
+if(CURSES_USE_NCURSES)
   get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
   get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
 
-  find_file(CURSES_HAVE_NCURSES_H         ncurses.h)
-  find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
-  find_file(CURSES_HAVE_NCURSES_CURSES_H  ncurses/curses.h)
-  find_file(CURSES_HAVE_CURSES_H          curses.h
-    HINTS "${_cursesParentDir}/include")
-
-  find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
-    ncurses/curses.h)
-  find_path(CURSES_NCURSES_INCLUDE_PATH curses.h
-    HINTS "${_cursesParentDir}/include")
-
-  # 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
-  # however if the value of the variable has NOTFOUND in it, then
-  # it is OK to force, and we need to force in order to have it work.
-  # a cache wqith these variables set
-  # only put ncurses include and library into
-  # variables if they are found
-  if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
-    get_filename_component(CURSES_NCURSES_INCLUDE_PATH
-      "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
+  # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility.
+  if(CURSES_NCURSES_INCLUDE_PATH)
+    find_path(CURSES_INCLUDE_PATH
+      NAMES ncurses.h curses.h
+      PATHS ${CURSES_NCURSES_INCLUDE_PATH}
+      NO_DEFAULT_PATH
+      )
   endif()
-  if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
-    set( FORCE_IT )
-    if(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
-      set(FORCE_IT FORCE)
-    endif()
-    set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
-      CACHE FILEPATH "The curses include path" ${FORCE_IT})
-    set( FORCE_IT)
-    if(CURSES_LIBRARY MATCHES NOTFOUND)
-      set(FORCE_IT FORCE)
-    endif()
-    set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
-      CACHE FILEPATH "The curses library" ${FORCE_IT})
+
+  find_path(CURSES_INCLUDE_PATH
+    NAMES ncurses.h curses.h
+    HINTS "${_cursesParentDir}/include"
+    PATH_SUFFIXES ncurses
+    )
+
+  # Previous versions of FindCurses provided these values.
+  if(NOT DEFINED CURSES_LIBRARY)
+    set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
   endif()
 
+  # Previous versions of FindCurses also looked for ncurses/ncurses.h
+  # and told projects to #include <ncurses/ncurses.h> instead of just
+  # #include <ncurses.h>.  Now we just report the include/ncurses
+  # directory instead, so just pretend that ncurses/ncurses.h is
+  # never available.
+  set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
+  set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
+
   CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
     cbreak "" CURSES_NCURSES_HAS_CBREAK)
   if(NOT CURSES_NCURSES_HAS_CBREAK)
@@ -147,6 +142,39 @@ else()
     CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}"
       cbreak "" CURSES_TINFO_HAS_CBREAK)
   endif()
+else()
+  get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
+  get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
+
+  find_path(CURSES_INCLUDE_PATH
+    NAMES curses.h
+    HINTS "${_cursesParentDir}/include"
+    )
+
+  # Previous versions of FindCurses provided these values.
+  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()
+
+# Previous versions of FindCurses did a separate find_file for
+# ncurses.h and curses.h.  Report the results as it would have.
+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()
 
 if (NOT CURSES_TINFO_HAS_CBREAK)
@@ -157,11 +185,10 @@ endif()
 find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
 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
-# qith these variables set
-set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
-  CACHE FILEPATH "The curses form library")
+# Previous versions of FindCurses provided these values.
+if(NOT DEFINED FORM_LIBRARY)
+  set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
+endif()
 
 # Need to provide the *_LIBRARIES
 set(CURSES_LIBRARIES ${CURSES_LIBRARY})
@@ -174,8 +201,9 @@ if(CURSES_FORM_LIBRARY)
   set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
 endif()
 
-# Proper name is *_INCLUDE_DIR
-set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+# Provide the *_INCLUDE_DIRS result.
+set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
+set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
 
 # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
 # all listed variables are TRUE
@@ -185,18 +213,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
 
 mark_as_advanced(
   CURSES_INCLUDE_PATH
-  CURSES_LIBRARY
-  CURSES_CURSES_INCLUDE_PATH
   CURSES_CURSES_LIBRARY
-  CURSES_NCURSES_INCLUDE_PATH
   CURSES_NCURSES_LIBRARY
   CURSES_EXTRA_LIBRARY
-  FORM_LIBRARY
-  CURSES_LIBRARIES
-  CURSES_INCLUDE_DIR
-  CURSES_CURSES_HAS_WSYNCUP
-  CURSES_NCURSES_HAS_WSYNCUP
-  CURSES_NCURSES_HAS_CBREAK
-  CURSES_TINFO_HAS_CBREAK
   )
-

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindCurses.cmake |  177 +++++++++++++++++++++++++---------------------
 1 file changed, 97 insertions(+), 80 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list