summaryrefslogtreecommitdiffstats
path: root/Modules/FindPython/Support.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-05-24 16:44:43 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-05-24 16:44:43 (GMT)
commit62d6ed79fb4cc4cdeb1a246f0f12db7e6031f4ba (patch)
tree109846dd8a4eb30116f236c0cd686cdbf34aa6fd /Modules/FindPython/Support.cmake
parent4ec2b999414495ae58871755307ea17f391f7910 (diff)
downloadCMake-62d6ed79fb4cc4cdeb1a246f0f12db7e6031f4ba.zip
CMake-62d6ed79fb4cc4cdeb1a246f0f12db7e6031f4ba.tar.gz
CMake-62d6ed79fb4cc4cdeb1a246f0f12db7e6031f4ba.tar.bz2
FindPython: Add variable 'Python_FIND_FRAMEWORK' to control frameworks lookup.
Diffstat (limited to 'Modules/FindPython/Support.cmake')
-rw-r--r--Modules/FindPython/Support.cmake29
1 files changed, 20 insertions, 9 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index bb2f60d..83fd1c5 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -361,6 +361,24 @@ set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40)
# Apple frameworks handling
_python_find_frameworks ()
+set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK "FIRST")
+
+if (DEFINED ${_PYTHON_PREFIX}_FIND_FRAMEWORK)
+ if (NOT ${_PYTHON_PREFIX}_FIND_FRAMEWORK MATCHES "^(FIRST|LAST|NEVER)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_FRAMEWORK}: invalid value for '${_PYTHON_PREFIX}_FIND_FRAMEWORK'. 'FIRST', 'LAST' or 'NEVER' expected. 'FIRST' will be used instead.")
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK ${${_PYTHON_PREFIX}_FIND_FRAMEWORK})
+ endif()
+elseif (DEFINED CMAKE_FIND_FRAMEWORK)
+ if (CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: CMAKE_FIND_FRAMEWORK: 'ONLY' value is not supported. 'FIRST' will be used instead.")
+ elseif (NOT CMAKE_FIND_FRAMEWORK MATCHES "^(FIRST|LAST|NEVER)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${CMAKE_FIND_FRAMEWORK}: invalid value for 'CMAKE_FIND_FRAMEWORK'. 'FIRST', 'LAST' or 'NEVER' expected. 'FIRST' will be used instead.")
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+ endif()
+endif()
+
# Save CMAKE_FIND_APPBUNDLE
if (DEFINED CMAKE_FIND_APPBUNDLE)
set (_${_PYTHON_PREFIX}_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
@@ -373,15 +391,8 @@ set (CMAKE_FIND_APPBUNDLE "NEVER")
# Save CMAKE_FIND_FRAMEWORK
if (DEFINED CMAKE_FIND_FRAMEWORK)
set (_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
- if (CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
- message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: CMAKE_FIND_FRAMEWORK: 'ONLY' value is not supported. 'FIRST' will be used instead.")
- set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK "FIRST")
- else()
- set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
- endif()
else()
unset (_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK)
- set (_${_PYTHON_PREFIX}_FIND_FRAMEWORK "FIRST")
endif()
# To avoid framework lookup
set (CMAKE_FIND_FRAMEWORK "NEVER")
@@ -389,7 +400,7 @@ set (CMAKE_FIND_FRAMEWORK "NEVER")
# Windows Registry handling
if (DEFINED ${_PYTHON_PREFIX}_FIND_REGISTRY)
if (NOT ${_PYTHON_PREFIX}_FIND_REGISTRY MATCHES "^(FIRST|LAST|NEVER)$")
- message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_REGISTRY}: invalid value for '${_PYTHON_PREFIX}_FIND_REGISTRY'. 'FIRST', 'LAST' or 'NEVER' expected.")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_REGISTRY}: invalid value for '${_PYTHON_PREFIX}_FIND_REGISTRY'. 'FIRST', 'LAST' or 'NEVER' expected. 'FIRST' will be used instead.")
set (_${_PYTHON_PREFIX}_FIND_REGISTRY "FIRST")
else()
set (_${_PYTHON_PREFIX}_FIND_REGISTRY ${${_PYTHON_PREFIX}_FIND_REGISTRY})
@@ -402,7 +413,7 @@ endif()
if (DEFINED ENV{VIRTUAL_ENV})
if (DEFINED ${_PYTHON_PREFIX}_FIND_VIRTUALENV)
if (NOT ${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY|STANDARD)$")
- message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_VIRTUALENV}: invalid value for '${_PYTHON_PREFIX}_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'IGNORE' expected.")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_VIRTUALENV}: invalid value for '${_PYTHON_PREFIX}_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'STANDARD' expected. 'FIRST' will be used instead.")
set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV "FIRST")
else()
set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV ${${_PYTHON_PREFIX}_FIND_VIRTUALENV})