summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-packages.7.rst15
-rw-r--r--Modules/FindCurses.cmake177
-rw-r--r--Modules/FindImageMagick.cmake10
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmSystemTools.cxx42
6 files changed, 150 insertions, 98 deletions
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index 5badd48..c4cca6d 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -385,12 +385,9 @@ In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as:
.. code-block:: cmake
- if(NOT TARGET Upstream::ClimbingStats)
- include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
- endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
-This allows downstreams to use the ``IMPORTED`` targets, and guards
-against importing the targets more than once. If any macros
+As this allows downstreams to use the ``IMPORTED`` targets. If any macros
should be provided by the ``ClimbingStats`` package, they should
be in a separate file which is installed to the same location as the
``ClimbingStatsConfig.cmake`` file, and included from there.
@@ -457,9 +454,7 @@ dependencies of a package should be found in the ``Config.cmake`` file:
include(CMakeFindDependencyMacro)
find_dependency(Stats 2.6.4)
- if(NOT TARGET Upstream::ClimbingStats)
- include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
- endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake")
The ``find_dependency`` macro also sets ``ClimbingStats_FOUND`` to ``False`` if
@@ -476,9 +471,7 @@ be true. This can be tested with logic in the package configuration file:
include(CMakeFindDependencyMacro)
find_dependency(Stats 2.6.4)
- if(NOT TARGET Upstream::ClimbingStats)
- include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
- endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake")
set(_supported_components Plot Table)
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 6b8b196..0184c39 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -2,28 +2,43 @@
# 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_HAVE_NCURSES_NCURSES_H``
+# True if ``ncurses/ncurses.h`` is available.
+# ``CURSES_HAVE_NCURSES_CURSES_H``
+# True if ``ncurses/curses.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_INCLUDE_DIR``
+# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead.
+# ``CURSES_LIBRARY``
+# Path to Curses library. Use ``CURSES_LIBRARIES`` instead.
#=============================================================================
-# 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,59 +99,27 @@ 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/ncurses.h ncurses/curses.h 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/ncurses.h ncurses/curses.h ncurses.h curses.h
+ HINTS "${_cursesParentDir}/include"
+ )
+
+ # Previous versions of FindCurses provided these values.
+ if(NOT DEFINED CURSES_LIBRARY)
+ set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
endif()
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
@@ -147,6 +130,52 @@ 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()
+
+# Report whether each possible header name exists in the include directory.
+if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
+ endif()
+endif()
+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 +186,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 +202,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,17 +214,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
)
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 4f0e687..f6c8b3a 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -95,14 +95,21 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+find_package(PkgConfig QUIET)
+
#---------------------------------------------------------------------
# Helper functions
#---------------------------------------------------------------------
function(FIND_IMAGEMAGICK_API component header)
set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
+ pkg_check_modules(PC_${component} QUIET ${component})
+
find_path(ImageMagick_${component}_INCLUDE_DIR
NAMES ${header}
+ HINTS
+ ${PC_${component}_INCLUDEDIR}
+ ${PC_${component}_INCLUDE_DIRS}
PATHS
${ImageMagick_INCLUDE_DIRS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
@@ -112,6 +119,9 @@ function(FIND_IMAGEMAGICK_API component header)
)
find_library(ImageMagick_${component}_LIBRARY
NAMES ${ARGN}
+ HINTS
+ ${PC_${component}_LIBDIR}
+ ${PC_${component}_LIB_DIRS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
DOC "Path to the ImageMagick Magick++ library."
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0de45a0..9a1bcdd 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 20140714)
+set(CMake_VERSION_PATCH 20140715)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2218e2f..d3ca34a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1042,8 +1042,8 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
if (!file)
{
file = this->CreateSource(outName, true);
- file->SetProperty("__CMAKE_RULE", "1");
}
+ file->SetProperty("__CMAKE_RULE", "1");
}
// Always create the output sources and mark them generated.
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 12a63b0..444e143 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -384,14 +384,28 @@ bool cmSystemTools::IsOn(const char* val)
{
return false;
}
- std::basic_string<char> v = val;
+ size_t len = strlen(val);
+ if (len > 4)
+ {
+ return false;
+ }
+ std::basic_string<char> v(val, len);
+ static std::set<std::string> onValues;
+ if(onValues.empty())
+ {
+ onValues.insert("ON");
+ onValues.insert("1");
+ onValues.insert("YES");
+ onValues.insert("TRUE");
+ onValues.insert("Y");
+ }
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
- return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y");
+ return (onValues.count(v) > 0);
}
bool cmSystemTools::IsNOTFOUND(const char* val)
@@ -406,19 +420,35 @@ bool cmSystemTools::IsNOTFOUND(const char* val)
bool cmSystemTools::IsOff(const char* val)
{
- if (!val || strlen(val) == 0)
+ if (!val || !*val)
{
return true;
}
- std::basic_string<char> v = val;
+ size_t len = strlen(val);
+ // Try and avoid toupper() for large strings.
+ if (len > 6)
+ {
+ return cmSystemTools::IsNOTFOUND(val);
+ }
+ static std::set<std::string> offValues;
+ if(offValues.empty())
+ {
+ offValues.insert("OFF");
+ offValues.insert("0");
+ offValues.insert("NO");
+ offValues.insert("FALSE");
+ offValues.insert("N");
+ offValues.insert("IGNORE");
+ }
+ // Try and avoid toupper().
+ std::basic_string<char> v(val, len);
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
- return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
- v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE");
+ return (offValues.count(v) > 0);
}
//----------------------------------------------------------------------------