-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFindJython.cmake
91 lines (81 loc) · 3.05 KB
/
FindJython.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#.rst
# FindJython
# ----------
#
# Find Jython components such as the interpreter.
#
# This module uses find_package to look for these components using the
# specialized Find modules named FindJythonInterp.cmake.
#=============================================================================
# Copyright 2016 Andreas Schuh <[email protected]>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# ------------------------------------------------------------------------------
# Components to look for
set (_Jython_FIND_Interp FALSE)
if (NOT Jython_FIND_COMPONENTS)
set (Jython_FIND_COMPONENTS Interp)
endif ()
foreach (_Jython_COMPONENT IN LISTS Jython_FIND_COMPONENTS)
if (NOT _Jython_COMPONENT MATCHES "^(Interp)$")
message (FATAL_ERROR "Invalid Jython COMPONENTS argument: ${_Jython_COMPONENT}")
endif ()
set (_Jython_FIND_${_Jython_COMPONENT} TRUE)
endforeach ()
# ------------------------------------------------------------------------------
# Verbose message
if (NOT Jython_FIND_QUIETLY)
set(_Jython_FIND_STATUS "Looking for Jython [${Jython_FIND_COMPONENTS}]")
if (NOT Jython_FIND_REQUIRED)
set(_Jython_FIND_STATUS "${_Jython_FIND_STATUS} (optional)")
endif ()
message(STATUS "${_Jython_FIND_STATUS}...")
endif ()
# ------------------------------------------------------------------------------
# Look for Jython components
set (_Jython_REQUIRED_VARS)
if (_Jython_FIND_Interp)
find_package (JythonInterp QUIET MODULE)
set (Jython_Interp_FOUND ${JythonInterp_FOUND})
list (APPEND _Jython_REQUIRED_VARS JYTHON_EXECUTABLE)
endif ()
# ------------------------------------------------------------------------------
# Handle QUIET, REQUIRED, and [EXACT] VERSION arguments and set Jython_FOUND
if (_Jython_REQUIRED_VARS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Jython
REQUIRED_VARS ${_Jython_REQUIRED_VARS}
VERSION_VAR JYTHON_VERSION_STRING
HANDLE_COMPONENTS
)
else ()
set (Jython_FOUND 1)
set (JYTHON_FOUND 1)
endif ()
# ------------------------------------------------------------------------------
# Verbose message
if (NOT Jython_FIND_QUIETLY)
if (Jython_FOUND)
if (JYTHON_VERSION_STRING)
message(STATUS "${_Jython_FIND_STATUS}... - found v${JYTHON_VERSION_STRING}")
else ()
message(STATUS "${_Jython_FIND_STATUS}... - found")
endif ()
else ()
message(STATUS "${_Jython_FIND_STATUS}... - not found")
endif ()
endif ()
# ------------------------------------------------------------------------------
# Unset local variables
unset (_Jython_FIND_Interp)
unset (_Jython_FIND_STATUS)
unset (_Jython_COMPONENT)
unset (_Jython_REQUIRED_VARS)