Commit 96f4df61 authored by jcfr's avatar jcfr

ENH: Abort configuration early if patch executable is not found

This commit adds the FindPatch CMake module. Corresponding merge
request adding the functionality into upstream CMake is:
cmake/cmake!1184

See #4411

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26304 3bd1e089-480b-0410-8dfb-8563597acbee
parent fa4832ec
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindPatch
# ---------
#
# The module defines the following variables:
#
# ``PATCH_EXECUTABLE``
# Path to patch command-line executable.
# ````Patch_FOUND``, ``PATCH_FOUND``
# True if the patch command-line executable was found.
#
# Example usage:
#
# .. code-block:: cmake
#
# find_package(Patch)
# if(Patch_FOUND)
# message("Patch found: ${Patch_EXECUTABLE}")
# endif()
set(_x86 "(x86)") # Indirection required to avoid error related to CMP0053
find_program(PATCH_EXECUTABLE
NAME patch
PATHS "$ENV{ProgramFiles}/Git/usr/bin"
"$ENV{ProgramFiles${_x86}}/Git/usr/bin"
"$ENV{ProgramFiles}/GnuWin32/bin"
"$ENV{ProgramFiles${_x86}}/GnuWin32/bin"
"$ENV{ProgramFiles}/Git/bin"
"$ENV{ProgramFiles${_x86}}/Git/bin"
"$ENV{LOCALAPPDATA}/Programs/Git/bin"
"$ENV{LOCALAPPDATA}/Programs/Git/usr/bin"
"$ENV{APPDATA}/Programs/Git/bin"
"$ENV{APPDATA}/Programs/Git/usr/bin"
DOC "Patch command line executable"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Patch
REQUIRED_VARS PATCH_EXECUTABLE)
......@@ -164,6 +164,9 @@ if(NOT GIT_FOUND)
endif()
mark_as_superbuild(GIT_EXECUTABLE)
find_package(Patch REQUIRED)
mark_as_superbuild(PATCH_EXECUTABLE)
#-----------------------------------------------------------------------------
# Qt requirements
#-----------------------------------------------------------------------------
......
......@@ -156,6 +156,7 @@ if((NOT DEFINED PYTHON_INCLUDE_DIR
-DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARY}
-DENABLE_TKINTER:BOOL=${Slicer_USE_PYTHONQT_WITH_TCL}
-DENABLE_SSL:BOOL=${PYTHON_ENABLE_SSL}
-DPATCH_EXECUTABLE:FILEPATH=${PATCH_EXECUTABLE}
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment