summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/install.rst10
-rw-r--r--Help/command/target_precompile_headers.rst27
-rw-r--r--Help/envvar/CCMAKE_COLORS.rst34
-rw-r--r--Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx25
-rw-r--r--Help/manual/cmake-env-variables.7.rst8
-rw-r--r--Help/release/dev/FindBLAS-import-target.rst4
-rw-r--r--Help/release/dev/FindLAPACK-import-target.rst4
-rw-r--r--Help/release/dev/FindPython-find-implementations.rst5
-rw-r--r--Help/release/dev/ccmake-custom-colors.rst5
-rw-r--r--Modules/FindBLAS.cmake23
-rw-r--r--Modules/FindBoost.cmake2
-rw-r--r--Modules/FindLAPACK.cmake25
-rw-r--r--Modules/FindPython.cmake21
-rw-r--r--Modules/FindPython/Support.cmake1072
-rw-r--r--Modules/FindPython2.cmake21
-rw-r--r--Modules/FindPython3.cmake21
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CursesDialog/cmCursesColor.cxx59
-rw-r--r--Source/CursesDialog/cmCursesColor.h5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx4
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx12
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx7
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx5
-rw-r--r--Source/cmOutputConverter.cxx9
-rw-r--r--Source/cmOutputConverter.h1
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/FindBLAS/CMakeLists.txt10
-rw-r--r--Tests/FindBLAS/Test/CMakeLists.txt13
-rw-r--r--Tests/FindBLAS/Test/main.c14
-rw-r--r--Tests/FindLAPACK/CMakeLists.txt10
-rw-r--r--Tests/FindLAPACK/Test/CMakeLists.txt13
-rw-r--r--Tests/FindLAPACK/Test/main.c20
-rw-r--r--Tests/FindPython/CMakeLists.txt23
-rw-r--r--Tests/FindPython/Implementation/CMakeLists.txt37
-rw-r--r--Tests/FindPython/IronPython/CMakeLists.txt11
-rw-r--r--Tests/FindPython/IronPython2/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/include/foo_C.h1
-rw-r--r--Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h1
44 files changed, 1032 insertions, 564 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 3b72ea6..c8df7d9 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -18,10 +18,12 @@ Synopsis
Introduction
^^^^^^^^^^^^
-This command generates installation rules for a project. Rules
-specified by calls to this command within a source directory are
-executed in order during installation. The order across directories
-is not defined.
+This command generates installation rules for a project. Install rules
+specified by calls to the ``install()`` command within a source directory
+are executed in order during installation. Install rules in subdirectories
+added by calls to the :command:`add_subdirectory` command are interleaved
+with those in the parent directory to run in the order declared (see
+policy :policy:`CMP0082`).
There are multiple signatures for this command. Some of them define
installation options for files and targets. Options common to
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 569c7eb..0d4f45a 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -56,35 +56,34 @@ e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
must be available for the compiler to find them. Other header file names
(e.g. ``project_header.h``) are interpreted as being relative to the current
source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
-included by absolute path.
-
-Arguments to ``target_precompile_headers()`` may use "generator expressions"
-with the syntax ``$<...>``.
-See the :manual:`cmake-generator-expressions(7)` manual for available
-expressions. See the :manual:`cmake-compile-features(7)` manual for
-information on compile features and a list of supported compilers.
-The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
-useful for specifying a language-specific header to precompile for
-only one language (e.g. ``CXX`` and not ``C``). For example:
+included by absolute path. For example:
.. code-block:: cmake
target_precompile_headers(myTarget
PUBLIC
project_header.h
- "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
PRIVATE
[["other_header.h"]]
<unordered_map>
)
-When specifying angle brackets inside a :manual:`generator expression
-<cmake-generator-expressions(7)>`, be sure to encode the closing ``>``
-as ``$<ANGLE-R>``. For example:
+Arguments to ``target_precompile_headers()`` may use "generator expressions"
+with the syntax ``$<...>``.
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions.
+The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
+useful for specifying a language-specific header to precompile for
+only one language (e.g. ``CXX`` and not ``C``). In this case, header
+file names that are not explicitly in double quotes or angle brackets
+must be specified by absolute path. Also, when specifying angle brackets
+inside a generator expression, be sure to encode the closing ``>`` as
+``$<ANGLE-R>``. For example:
.. code-block:: cmake
target_precompile_headers(mylib PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only.h>"
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
)
diff --git a/Help/envvar/CCMAKE_COLORS.rst b/Help/envvar/CCMAKE_COLORS.rst
new file mode 100644
index 0000000..d4750c3
--- /dev/null
+++ b/Help/envvar/CCMAKE_COLORS.rst
@@ -0,0 +1,34 @@
+CCMAKE_COLORS
+-------------
+
+Determines what colors are used by the CMake curses interface,
+when run on a terminal that supports colors.
+The syntax follows the same conventions as ``LS_COLORS``;
+that is, a list of key/value pairs separated by ``:``.
+
+Keys are a single letter corresponding to a CMake cache variable type:
+
+- ``s``: A ``STRING``.
+- ``p``: A ``FILEPATH``.
+- ``c``: A value which has an associated list of choices.
+- ``y``: A ``BOOL`` which has a true-like value (e.g. ``ON``, ``YES``).
+- ``n``: A ``BOOL`` which has a false-like value (e.g. ``OFF``, ``NO``).
+
+Values are an integer number that specifies what color to use.
+``0`` is black (you probably don't want to use that).
+Others are determined by your terminal's color support.
+Most (color) terminals will support at least 8 or 16 colors.
+Some will support up to 256 colors. The colors will likely match
+`this chart <https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg>`_,
+although the first 16 colors may match the original
+`CGA color palette <https://en.wikipedia.org/wiki/Color_Graphics_Adapter#Color_palette>`_.
+(Many modern terminal emulators also allow their color palette,
+at least for the first 16 colors, to be configured by the user.)
+
+Note that fairly minimal checking is done for bad colors
+(although a value higher than what curses believes your terminal supports
+will be silently ignored) or bad syntax.
+
+For example::
+
+ CCMAKE_COLORS='s=39:p=220:c=207:n=196:y=46'
diff --git a/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx
new file mode 100644
index 0000000..ee58556
--- /dev/null
+++ b/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx
@@ -0,0 +1,25 @@
+// A simple program that builds a sqrt table
+#include <cmath>
+#include <fstream>
+#include <iostream>
+
+int main(int argc, char* argv[])
+{
+ // make sure we have enough arguments
+ if (argc < 2) {
+ return 1;
+ }
+
+ std::ofstream fout(argv[1], std::ios_base::out);
+ const bool fileOpen = fout.is_open();
+ if (fileOpen) {
+ fout << "double sqrtTable[] = {" << std::endl;
+ for (int i = 0; i < 10; ++i) {
+ fout << sqrt(static_cast<double>(i)) << "," << std::endl;
+ }
+ // close the table with a zero
+ fout << "0};" << std::endl;
+ fout.close();
+ }
+ return fileOpen ? 0 : 1; // return 0 if wrote the file
+}
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index dfdf415..ee83799 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -80,3 +80,11 @@ Environment Variables for CTest
/envvar/CTEST_PROGRESS_OUTPUT
/envvar/CTEST_USE_LAUNCHERS_DEFAULT
/envvar/DASHBOARD_TEST_FROM_CTEST
+
+Environment Variables for the CMake curses interface
+====================================================
+
+.. toctree::
+ :maxdepth: 1
+
+ /envvar/CCMAKE_COLORS
diff --git a/Help/release/dev/FindBLAS-import-target.rst b/Help/release/dev/FindBLAS-import-target.rst
new file mode 100644
index 0000000..29d6f0c
--- /dev/null
+++ b/Help/release/dev/FindBLAS-import-target.rst
@@ -0,0 +1,4 @@
+FindBLAS-import-target
+----------------------
+
+* The :module:`FindBLAS` module now provides an imported target.
diff --git a/Help/release/dev/FindLAPACK-import-target.rst b/Help/release/dev/FindLAPACK-import-target.rst
new file mode 100644
index 0000000..912d642
--- /dev/null
+++ b/Help/release/dev/FindLAPACK-import-target.rst
@@ -0,0 +1,4 @@
+FindLAPACK-import-target
+------------------------
+
+* The :module:`FindLAPACK` module now provides an imported target.
diff --git a/Help/release/dev/FindPython-find-implementations.rst b/Help/release/dev/FindPython-find-implementations.rst
new file mode 100644
index 0000000..d4f548b
--- /dev/null
+++ b/Help/release/dev/FindPython-find-implementations.rst
@@ -0,0 +1,5 @@
+FindPython-find-implementations
+-------------------------------
+
+* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
+ modules gained the capability to specify which implementations to search for.
diff --git a/Help/release/dev/ccmake-custom-colors.rst b/Help/release/dev/ccmake-custom-colors.rst
new file mode 100644
index 0000000..fcabe56
--- /dev/null
+++ b/Help/release/dev/ccmake-custom-colors.rst
@@ -0,0 +1,5 @@
+ccmake-custom-colors
+--------------------
+
+* :manual:`ccmake(1)` learned to read a :envvar:`CCMAKE_COLORS`
+ environment variable to customize colors.
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index caed7ef..4c569b3 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -61,6 +61,15 @@ The following variables may be set to influence this module's behavior:
if set ``pkg-config`` will be used to search for a BLAS library first
and if one is found that is preferred
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``BLAS::BLAS``
+ The libraries to use for BLAS, if found.
+
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -111,6 +120,17 @@ if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_CO
endif()
endif()
+function(_add_blas_target)
+ if(NOT TARGET BLAS::BLAS)
+ add_library(BLAS::BLAS INTERFACE IMPORTED)
+ if(BLAS_LIBRARIES)
+ set_target_properties(BLAS::BLAS PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}"
+ )
+ endif()
+ endif()
+endfunction()
+
if(CMAKE_Fortran_COMPILER_LOADED)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
else()
@@ -127,6 +147,7 @@ if(BLA_PREFER_PKGCONFIG)
if(PKGC_BLAS_FOUND)
set(BLAS_FOUND ${PKGC_BLAS_FOUND})
set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
+ _add_blas_target()
return()
endif()
endif()
@@ -926,11 +947,13 @@ if(NOT BLA_F95)
find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
endif()
+
# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines)
# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above.
if(BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
set(BLAS_LIBRARIES "")
endif()
+_add_blas_target()
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 1b27463..57e17b3 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1179,7 +1179,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(NOT Boost_VERSION_STRING VERSION_LESS 1.73.0)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.74.0)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index e5bd58d..e275946 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -47,6 +47,14 @@ The following variables may be set to influence this module's behavior:
``BLA_F95``
if ``ON`` tries to find the BLAS95/LAPACK95 interfaces
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``LAPACK::LAPACK``
+ The libraries to use for LAPACK, if found.
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -526,5 +534,22 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
set(LAPACK_LIBRARIES "")
endif()
+if(NOT TARGET LAPACK::LAPACK)
+ add_library(LAPACK::LAPACK INTERFACE IMPORTED)
+ set(_lapack_libs "${LAPACK_LIBRARIES}")
+ if(_lapack_libs AND TARGET BLAS::BLAS)
+ # remove the ${BLAS_LIBRARIES} from the interface and replace it
+ # with the BLAS::BLAS target
+ list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}")
+ endif()
+
+ if(_lapack_libs)
+ set_target_properties(LAPACK::LAPACK PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
+ )
+ endif()
+ unset(_lapack_libs)
+endif()
+
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 95c4a0f..93f77a8 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -271,6 +271,27 @@ Hints
recommended to also include the component ``Interpreter`` to get expected
result.
+``Python_FIND_IMPLEMENTATIONS``
+ This variable defines, in an ordered list, the different implementations
+ which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can
+ hold the following values:
+
+ * ``CPython``: this is the standard implementation. Various products, like
+ ``Anaconda`` or ``ActivePython``, rely on this implementation.
+ * ``IronPython``: This implementation use the ``CSharp`` language for
+ ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
+ See `IronPython <http://ironpython.net>`_.
+
+ The default value is the list: ``CPython``, ``IronPython``.
+
+ .. note::
+
+ This hint has the lowest priority of all hints, so even if, for example,
+ you specify ``IronPython`` first and ``CPython`` in second, a python
+ product based on ``CPython`` can be selected because, for example with
+ ``Python_FIND_STRATEGY=LOCATION``, each location will be search first for
+ ``IronPython`` and second for ``CPython``.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 670a550..ecbc53c 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -97,10 +97,10 @@ macro (_PYTHON_FIND_FRAMEWORKS)
if (CMAKE_HOST_APPLE OR APPLE)
file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _pff_CMAKE_FRAMEWORK_PATH)
set (_pff_frameworks ${CMAKE_FRAMEWORK_PATH}
- ${_pff_CMAKE_FRAMEWORK_PATH}
- ~/Library/Frameworks
- /usr/local/Frameworks
- ${CMAKE_SYSTEM_FRAMEWORK_PATH})
+ ${_pff_CMAKE_FRAMEWORK_PATH}
+ ~/Library/Frameworks
+ /usr/local/Frameworks
+ ${CMAKE_SYSTEM_FRAMEWORK_PATH})
list (REMOVE_DUPLICATES _pff_frameworks)
foreach (_pff_framework IN LISTS _pff_frameworks)
if (EXISTS ${_pff_framework}/Python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}.framework)
@@ -115,29 +115,53 @@ macro (_PYTHON_FIND_FRAMEWORKS)
endif()
endmacro()
-function (_PYTHON_GET_FRAMEWORKS _PYTHON_PGF_FRAMEWORK_PATHS _PYTHON_VERSION)
- set (_PYTHON_FRAMEWORK_PATHS)
- foreach (_PYTHON_FRAMEWORK IN LISTS ${_PYTHON_PREFIX}_FRAMEWORKS)
- list (APPEND _PYTHON_FRAMEWORK_PATHS
- "${_PYTHON_FRAMEWORK}/Versions/${_PYTHON_VERSION}")
+function (_PYTHON_GET_FRAMEWORKS _PYTHON_PGF_FRAMEWORK_PATHS)
+ cmake_parse_arguments (PARSE_ARGV 1 _PGF "" "" "VERSION")
+
+ set (framework_paths)
+
+ foreach (version IN LISTS _PGF_VERSION)
+ foreach (framework IN LISTS ${_PYTHON_PREFIX}_FRAMEWORKS)
+ list (APPEND framework_paths "${framework}/Versions/${version}")
+ endforeach()
endforeach()
- set (${_PYTHON_PGF_FRAMEWORK_PATHS} ${_PYTHON_FRAMEWORK_PATHS} PARENT_SCOPE)
+
+ set (${_PYTHON_PGF_FRAMEWORK_PATHS} ${framework_paths} PARENT_SCOPE)
endfunction()
-function (_PYTHON_GET_REGISTRIES _PYTHON_PGR_REGISTRY_PATHS _PYTHON_VERSION)
- string (REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${_PYTHON_VERSION})
- set (${_PYTHON_PGR_REGISTRY_PATHS}
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_PYTHON_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_PYTHON_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_PYTHON_VERSION}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_PYTHON_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_PYTHON_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- PARENT_SCOPE)
+function (_PYTHON_GET_REGISTRIES _PYTHON_PGR_REGISTRY_PATHS)
+ cmake_parse_arguments (PARSE_ARGV 1 _PGR "" "" "IMPLEMENTATIONS;VERSION")
+
+ if (NOT _PGR_IMPLEMENTATIONS)
+ set (_PGR_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS})
+ endif()
+
+ set (registries)
+
+ foreach (implementation IN LISTS _PGR_IMPLEMENTATIONS)
+ if (implementation STREQUAL "CPython")
+ foreach (version IN LISTS _PGR_VERSION)
+ string (REPLACE "." "" version_no_dots ${version})
+ list (APPEND registries
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath])
+ endforeach()
+ elseif (implementation STREQUAL "IronPython")
+ foreach (version IN LISTS _PGR_VERSION)
+ list (APPEND registries [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${version}\\InstallPath])
+ endforeach()
+ endif()
+ endforeach()
+
+ set (${_PYTHON_PGR_REGISTRY_PATHS} "${registries}" PARENT_SCOPE)
endfunction()
@@ -185,7 +209,7 @@ function (_PYTHON_GET_ABIFLAGS _PGABIFLAGS)
endfunction()
function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
- cmake_parse_arguments (PARSE_ARGV 1 _PGPS "LIBRARY;INCLUDE" "VERSION" "")
+ cmake_parse_arguments (PARSE_ARGV 1 _PGPS "EXECUTABLE;LIBRARY;INCLUDE" "" "VERSION")
if (DEFINED _${_PYTHON_PREFIX}_ABIFLAGS)
set (abi "${_${_PYTHON_PREFIX}_ABIFLAGS}")
@@ -194,93 +218,123 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
endif()
set (path_suffixes)
- if (_PGPS_LIBRARY)
- if (CMAKE_LIBRARY_ARCHITECTURE)
- list (APPEND path_suffixes lib/${CMAKE_LIBRARY_ARCHITECTURE})
- endif()
- list (APPEND path_suffixes lib libs)
- if (CMAKE_LIBRARY_ARCHITECTURE)
- set (suffixes "${abi}")
- if (suffixes)
- list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
- list (TRANSFORM suffixes APPEND "-${CMAKE_LIBRARY_ARCHITECTURE}")
+ foreach (implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ if (implementation STREQUAL "CPython")
+ if (_PGPS_EXECUTABLE)
+ list (APPEND path_suffixes bin Scripts)
else()
- set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}-${CMAKE_LIBRARY_ARCHITECTURE}")
+ foreach (version IN LISTS _PGPS_VERSION)
+ if (_PGPS_LIBRARY)
+ if (CMAKE_LIBRARY_ARCHITECTURE)
+ list (APPEND path_suffixes lib/${CMAKE_LIBRARY_ARCHITECTURE})
+ endif()
+ list (APPEND path_suffixes lib libs)
+
+ if (CMAKE_LIBRARY_ARCHITECTURE)
+ set (suffixes "${abi}")
+ if (suffixes)
+ list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
+ list (TRANSFORM suffixes APPEND "-${CMAKE_LIBRARY_ARCHITECTURE}")
+ else()
+ set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}-${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif()
+ list (APPEND path_suffixes ${suffixes})
+ endif()
+ set (suffixes "${abi}")
+ if (suffixes)
+ list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
+ else()
+ set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
+ endif()
+ list (APPEND path_suffixes ${suffixes})
+ elseif (_PGPS_INCLUDE)
+ set (suffixes "${abi}")
+ if (suffixes)
+ list (TRANSFORM suffixes PREPEND "include/python${_PGPS_VERSION}")
+ else()
+ set (suffixes "include/python${_PGPS_VERSION}")
+ endif()
+ list (APPEND path_suffixes ${suffixes} include)
+ endif()
+ endforeach()
+ endif()
+ elseif (implementation STREQUAL "IronPython")
+ if (_PGPS_EXECUTABLE)
+ list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES})
endif()
- list (APPEND path_suffixes ${suffixes})
- endif()
- set (suffixes "${abi}")
- if (suffixes)
- list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
- else()
- set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
- endif()
- list (APPEND path_suffixes ${suffixes})
- elseif (_PGPS_INCLUDE)
- set (suffixes "${abi}")
- if (suffixes)
- list (TRANSFORM suffixes PREPEND "include/python${_PGPS_VERSION}")
- else()
- set (suffixes "include/python${_PGPS_VERSION}")
endif()
- list (APPEND path_suffixes ${suffixes} include)
- endif()
+ endforeach()
+ list (REMOVE_DUPLICATES path_suffixes)
set (${_PYTHON_PGPS_PATH_SUFFIXES} ${path_suffixes} PARENT_SCOPE)
endfunction()
function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
- cmake_parse_arguments (PARSE_ARGV 1 _PGN "POSIX;EXECUTABLE;CONFIG;LIBRARY;WIN32;DEBUG" "VERSION" "")
+ cmake_parse_arguments (PARSE_ARGV 1 _PGN "POSIX;EXECUTABLE;CONFIG;LIBRARY;WIN32;DEBUG" "" "VERSION")
set (names)
- if (_PGN_WIN32)
- string (REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${_PGN_VERSION})
+ foreach (implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ if (implementation STREQUAL "CPython")
+ foreach (version IN LISTS _PGN_VERSION)
+ if (_PGN_WIN32)
+ string (REPLACE "." "" version_no_dots ${version})
- set (name python${_PYTHON_VERSION_NO_DOTS})
- if (_PGN_DEBUG)
- string (APPEND name "_d")
- endif()
+ set (name python${version_no_dots})
+ if (_PGN_DEBUG)
+ string (APPEND name "_d")
+ endif()
- list (APPEND names "${name}")
- endif()
+ list (APPEND names "${name}")
+ endif()
- if (_PGN_POSIX)
- if (DEFINED _${_PYTHON_PREFIX}_ABIFLAGS)
- set (abi "${_${_PYTHON_PREFIX}_ABIFLAGS}")
- else()
- if (_PGN_EXECUTABLE OR _PGN_CONFIG)
- set (abi "")
- else()
- set (abi "mu" "m" "u" "")
- endif()
- endif()
+ if (_PGN_POSIX)
+ if (DEFINED _${_PYTHON_PREFIX}_ABIFLAGS)
+ set (abi "${_${_PYTHON_PREFIX}_ABIFLAGS}")
+ else()
+ if (_PGN_EXECUTABLE OR _PGN_CONFIG)
+ set (abi "")
+ else()
+ set (abi "mu" "m" "u" "")
+ endif()
+ endif()
- if (abi)
- if (_PGN_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE)
- set (abinames "${abi}")
- list (TRANSFORM abinames PREPEND "${CMAKE_LIBRARY_ARCHITECTURE}-python${_PGN_VERSION}")
- list (TRANSFORM abinames APPEND "-config")
- list (APPEND names ${abinames})
- endif()
- set (abinames "${abi}")
- list (TRANSFORM abinames PREPEND "python${_PGN_VERSION}")
- if (_PGN_CONFIG)
- list (TRANSFORM abinames APPEND "-config")
- endif()
- list (APPEND names ${abinames})
- else()
- if (_PGN_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE)
- set (abinames "${CMAKE_LIBRARY_ARCHITECTURE}-python${_PGN_VERSION}")
+ if (abi)
+ if (_PGN_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE)
+ set (abinames "${abi}")
+ list (TRANSFORM abinames PREPEND "${CMAKE_LIBRARY_ARCHITECTURE}-python${version}")
+ list (TRANSFORM abinames APPEND "-config")
+ list (APPEND names ${abinames})
+ endif()
+ set (abinames "${abi}")
+ list (TRANSFORM abinames PREPEND "python${version}")
+ if (_PGN_CONFIG)
+ list (TRANSFORM abinames APPEND "-config")
+ endif()
+ list (APPEND names ${abinames})
+ else()
+ unset (abinames)
+ if (_PGN_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE)
+ set (abinames "${CMAKE_LIBRARY_ARCHITECTURE}-python${version}")
+ endif()
+ list (APPEND abinames "python${version}")
+ if (_PGN_CONFIG)
+ list (TRANSFORM abinames APPEND "-config")
+ endif()
+ list (APPEND names ${abinames})
+ endif()
+ endif()
+ endforeach()
+ if (_PGN_EXECUTABLE)
+ list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
endif()
- list (APPEND abinames "python${_PGN_VERSION}")
- if (_PGN_CONFIG)
- list (TRANSFORM abinames APPEND "-config")
+ elseif (implementation STREQUAL "IronPython")
+ if (_PGN_EXECUTABLE)
+ list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES})
endif()
- list (APPEND names ${abinames})
endif()
- endif()
+ endforeach()
set (${_PYTHON_PGN_NAMES} ${names} PARENT_SCOPE)
endfunction()
@@ -430,8 +484,8 @@ function (_PYTHON_GET_VERSION)
set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE)
+ endif()
endif()
- endif()
else()
if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
# retrieve version from header file
@@ -444,7 +498,7 @@ function (_PYTHON_GET_VERSION)
list (GET versions 1 version_minor)
list (GET versions 2 version_patch)
- set (${_PGV_PREFIX}VERSION "${version_major}.${version_minor}" PARENT_SCOPE)
+ set (${_PGV_PREFIX}VERSION "${version_major}.${version_minor}.${version_patch}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION_MAJOR ${version_major} PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION_MINOR ${version_minor} PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION_PATCH ${version_patch} PARENT_SCOPE)
@@ -491,7 +545,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
if (_PVI_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_EXECUTABLE}")
# interpreter does not exist anymore
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot find the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot find the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
return()
endif()
@@ -510,7 +564,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
endif()
if (NOT abi IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
# incompatible ABI
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong ABI for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong ABI for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
return()
endif()
@@ -528,12 +582,12 @@ function (_PYTHON_VALIDATE_INTERPRETER)
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (result)
# interpreter is not usable
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
else()
if (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version)
# interpreter has wrong version
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
else()
# check that version is OK
@@ -541,7 +595,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${expected_version}")
if (NOT major_version VERSION_EQUAL expected_major_version
OR NOT version VERSION_GREATER_EQUAL expected_version)
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
endif()
endif()
@@ -562,9 +616,9 @@ function (_PYTHON_VALIDATE_INTERPRETER)
if (result OR NOT version EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
# interpreter not usable or has wrong major version
if (result)
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
else()
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong major version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong major version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
endif()
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
return()
@@ -585,9 +639,9 @@ function (_PYTHON_VALIDATE_INTERPRETER)
if (result OR NOT size EQUAL CMAKE_SIZEOF_VOID_P)
# interpreter not usable or has wrong architecture
if (result)
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
else()
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong architecture for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong architecture for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
endif()
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
return()
@@ -613,7 +667,7 @@ function (_PYTHON_VALIDATE_COMPILER)
if (_PVC_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_COMPILER}")
# Compiler does not exist anymore
- set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot find the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"")
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot find the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
return()
endif()
@@ -639,12 +693,12 @@ function (_PYTHON_VALIDATE_COMPILER)
file (REMOVE_RECURSE "${working_dir}")
if (result)
# compiler is not usable
- set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot use the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"")
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot use the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
elseif ((_PVC_EXACT AND NOT version VERSION_EQUAL expected_version)
OR NOT version VERSION_GREATER_EQUAL expected_version)
# Compiler has wrong version
- set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"")
+ set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
endif()
endfunction()
@@ -665,7 +719,7 @@ function (_PYTHON_VALIDATE_LIBRARY)
if (_PVL_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
# library does not exist anymore
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
if (WIN32)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_DEBUG PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND")
@@ -679,19 +733,19 @@ function (_PYTHON_VALIDATE_LIBRARY)
if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT lib_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
# incompatible ABI
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
else()
if (expected_version)
if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL expected_version) OR (lib_VERSION VERSION_LESS expected_version))
# library has wrong version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
endif()
else()
if (NOT lib_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
# library has wrong major version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong major version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong major version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
endif()
endif()
@@ -722,7 +776,7 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
if (_PVID_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
# include file does not exist anymore
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
return()
endif()
@@ -732,19 +786,19 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT inc_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
# incompatible ABI
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong ABI for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
else()
if (expected_version)
if ((_PVID_EXACT AND NOT inc_VERSION VERSION_EQUAL expected_version) OR (inc_VERSION VERSION_LESS expected_version))
# include dir has wrong version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
endif()
else()
if (NOT inc_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
# include dir has wrong major version
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong major version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong major version for the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
endif()
endif()
@@ -923,6 +977,29 @@ else()
endif()
set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40)
+# Python Implementations handling
+unset (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+if (DEFINED ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython' or 'IronPython' expected. Value will be ignored.")
+ else()
+ list (APPEND _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_IMPLEMENTATION})
+ endif()
+ endforeach()
+else()
+ set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS CPython IronPython)
+endif()
+
+# compute list of names for header file
+unset (_${_PYTHON_PREFIX}_INCLUDE_NAMES)
+foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ if (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "CPython")
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "Python.h")
+ endif()
+endforeach()
+
+
# Apple frameworks handling
_python_find_frameworks ()
@@ -993,7 +1070,7 @@ endif()
# Compute search signature
# This signature will be used to check validity of cached variables on new search
-set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}")
+set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}")
if (NOT WIN32)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:")
endif()
@@ -1073,7 +1150,7 @@ unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE)
# first step, search for the interpreter
if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE
- _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
+ _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
endif()
@@ -1108,25 +1185,14 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
- unset (_${_PYTHON_PREFIX}_NAMES)
- unset (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
- unset (_${_PYTHON_PREFIX}_REGISTRY_PATHS)
+ # build all executable names
+ _python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} POSIX EXECUTABLE)
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} EXECUTABLE)
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- # build all executable names
- _python_get_names (_${_PYTHON_PREFIX}_VERSION_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX EXECUTABLE)
- list (APPEND _${_PYTHON_PREFIX}_NAMES ${_${_PYTHON_PREFIX}_VERSION_NAMES})
-
- # Framework Paths
- _python_get_frameworks (_${_PYTHON_PREFIX}_VERSION_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- list (APPEND _${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION_PATHS})
-
- # Registry Paths
- _python_get_registries (_${_PYTHON_PREFIX}_VERSION_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- list (APPEND _${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_VERSION_PATHS}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath])
- endforeach()
- list (APPEND _${_PYTHON_PREFIX}_NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+ # Framework Paths
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
+ # Registry Paths
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
while (TRUE)
# Virtual environments handling
@@ -1136,7 +1202,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX
- PATH_SUFFIXES bin Scripts
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
@@ -1158,7 +1224,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
@@ -1172,11 +1238,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
_python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
@@ -1188,10 +1253,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# try using HINTS
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
_python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
@@ -1201,9 +1265,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# try using standard paths
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES})
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
_python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
@@ -1215,7 +1278,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
_python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
@@ -1226,10 +1289,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
_python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
@@ -1243,11 +1305,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# look-up for various versions and locations
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
_python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX EXECUTABLE)
- list (APPEND _${_PYTHON_PREFIX}_NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
- python)
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} EXECUTABLE)
- _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_VERSION})
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
# Virtual environments handling
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
@@ -1256,7 +1317,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX
- PATH_SUFFIXES bin Scripts
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
@@ -1277,7 +1338,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
@@ -1288,12 +1349,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
endif()
@@ -1306,10 +1365,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# try using HINTS
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
_python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
@@ -1322,15 +1380,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# For example, typical systems have 'python' for version 2.* and 'python3'
# for version 3.*. So looking for names per dir will find, potentially,
# systematically 'python' (i.e. version 2) even if version 3 is searched.
- if (CMAKE_HOST_WIN32)
- find_program (_${_PYTHON_PREFIX}_EXECUTABLE
- NAMES ${_${_PYTHON_PREFIX}_NAMES}
- python
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES})
- else()
- find_program (_${_PYTHON_PREFIX}_EXECUTABLE
- NAMES ${_${_PYTHON_PREFIX}_NAMES})
- endif()
+ find_program (_${_PYTHON_PREFIX}_EXECUTABLE
+ NAMES ${_${_PYTHON_PREFIX}_NAMES})
_python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
@@ -1342,7 +1393,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES bin
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
endif()
@@ -1350,11 +1401,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
- PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
endif()
@@ -1372,10 +1421,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# For example, typical systems have 'python' for version 2.* and 'python3'
# for version 3.*. So looking for names per dir will find, potentially,
# systematically 'python' (i.e. version 2) even if version 3 is searched.
+ _python_get_names (_${_PYTHON_PREFIX}_NAMES POSIX EXECUTABLE)
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
- NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
- python
- ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES})
+ NAMES ${_${_PYTHON_PREFIX}_NAMES})
_python_validate_interpreter ()
endif()
endif()
@@ -1444,13 +1492,16 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
if (${_PYTHON_PREFIX}_Interpreter_FOUND)
+ unset (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE)
+
# compute and save interpreter signature
string (MD5 __${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_EXECUTABLE}")
set (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${__${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}" CACHE INTERNAL "")
if (NOT CMAKE_SIZEOF_VOID_P)
# determine interpreter architecture
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.maxsize > 2**32)"
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; print(sys.maxsize > 2**32)"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE ${_PYTHON_PREFIX}_IS64BIT
ERROR_VARIABLE ${_PYTHON_PREFIX}_IS64BIT)
@@ -1494,9 +1545,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# retrieve various package installation directories
execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
- ERROR_QUIET)
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
+ ERROR_QUIET)
if (NOT _${_PYTHON_PREFIX}_RESULT)
list (GET _${_PYTHON_PREFIX}_LIBPATHS 0 ${_PYTHON_PREFIX}_STDLIB)
list (GET _${_PYTHON_PREFIX}_LIBPATHS 1 ${_PYTHON_PREFIX}_STDARCH)
@@ -1540,7 +1591,10 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER)
endif()
- if (DEFINED ${_PYTHON_PREFIX}_COMPILER
+ if (NOT "IronPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ unset (_${_PYTHON_PREFIX}_COMPILER CACHE)
+ unset (_${_PYTHON_PREFIX}_COMPILER_SIGNATURE CACHE)
+ elseif (DEFINED ${_PYTHON_PREFIX}_COMPILER
AND IS_ABSOLUTE "${${_PYTHON_PREFIX}_COMPILER}")
set (_${_PYTHON_PREFIX}_COMPILER "${${_PYTHON_PREFIX}_COMPILER}" CACHE INTERNAL "")
elseif (DEFINED _${_PYTHON_PREFIX}_COMPILER)
@@ -1559,7 +1613,8 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
endif()
- if (NOT _${_PYTHON_PREFIX}_COMPILER)
+ if ("IronPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS
+ AND NOT _${_PYTHON_PREFIX}_COMPILER)
# IronPython specific artifacts
# If IronPython interpreter is found, use its path
unset (_${_PYTHON_PREFIX}_IRON_ROOT)
@@ -1568,13 +1623,9 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
- set (_${_PYTHON_PREFIX}_REGISTRY_PATHS)
-
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- # Registry Paths
- list (APPEND _${_PYTHON_PREFIX}_REGISTRY_PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath])
- endforeach()
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
while (TRUE)
if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
@@ -1615,11 +1666,15 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
else()
# try using root dir and registry
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_VERSIO})
+
if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_program (_${_PYTHON_PREFIX}_COMPILER
NAMES ipyc
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
+ PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
@@ -1643,7 +1698,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
find_program (_${_PYTHON_PREFIX}_COMPILER
NAMES ipyc
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
+ PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
NO_DEFAULT_PATH)
_python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
@@ -1706,12 +1761,14 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
elseif (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
set (${_PYTHON_PREFIX}_Compiler_FOUND TRUE)
- # Use compiler version for future searches to ensure consistency
- set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR})
+ # Use compiler version for future searches to ensure consistency
+ set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR})
endif()
endif()
if (${_PYTHON_PREFIX}_Compiler_FOUND)
+ unset (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE)
+
# compute and save compiler signature
string (MD5 __${_PYTHON_PREFIX}_COMPILER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_COMPILER}")
set (_${_PYTHON_PREFIX}_COMPILER_SIGNATURE "${__${_PYTHON_PREFIX}_COMPILER_SIGNATURE}" CACHE INTERNAL "")
@@ -1730,17 +1787,18 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
_${_PYTHON_PREFIX}_COMPILER_SIGNATURE)
endif()
-
# third step, search for the development artifacts
## Development environment is not compatible with IronPython interpreter
if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
- AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
+ AND ((${_PYTHON_PREFIX}_Interpreter_FOUND
+ AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
+ OR NOT ${_PYTHON_PREFIX}_Interpreter_FOUND))
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE
- _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
- _${_PYTHON_PREFIX}_LIBRARY_DEBUG
- _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_LIBRARY_DEBUG
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_INCLUDE_DIR)
@@ -1792,25 +1850,18 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# if python interpreter is found, use it to look-up for artifacts
# to ensure consistency between interpreter and development environments.
# If not, try to locate a compatible config tool
- if (NOT ${_PYTHON_PREFIX}_Interpreter_FOUND OR CMAKE_CROSSCOMPILING)
+ if ((NOT ${_PYTHON_PREFIX}_Interpreter_FOUND OR CMAKE_CROSSCOMPILING)
+ AND "CPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
- unset (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
- set (_${_PYTHON_PREFIX}_CONFIG_NAMES)
-
- foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- _python_get_names (_${_PYTHON_PREFIX}_VERSION_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX CONFIG)
- list (APPEND _${_PYTHON_PREFIX}_CONFIG_NAMES ${_${_PYTHON_PREFIX}_VERSION_NAMES})
-
+ _python_get_names (_${_PYTHON_PREFIX}_CONFIG_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} POSIX CONFIG)
# Framework Paths
- _python_get_frameworks (_${_PYTHON_PREFIX}_VERSION_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- list (APPEND _${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION_PATHS})
- endforeach()
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
# Apple frameworks handling
if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
@@ -1894,7 +1945,7 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_python_get_names (_${_PYTHON_PREFIX}_CONFIG_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX CONFIG)
# Framework Paths
- _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION})
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
# Apple frameworks handling
if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
@@ -1988,140 +2039,60 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG)
- # retrieve root install directory
- _python_get_config_var (_${_PYTHON_PREFIX}_PREFIX PREFIX)
-
- # enforce current ABI
- _python_get_config_var (_${_PYTHON_PREFIX}_ABIFLAGS ABIFLAGS)
-
- set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_PREFIX}")
-
- # retrieve library
- ## compute some paths and artifact names
- if (_${_PYTHON_PREFIX}_CONFIG)
- string (REGEX REPLACE "^.+python([0-9.]+)[a-z]*-config" "\\1" _${_PYTHON_PREFIX}_VERSION "${_${_PYTHON_PREFIX}_CONFIG}")
- else()
- set (_${_PYTHON_PREFIX}_VERSION "${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}")
- endif()
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} LIBRARY)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 POSIX LIBRARY)
-
- _python_get_config_var (_${_PYTHON_PREFIX}_CONFIGDIR CONFIGDIR)
- list (APPEND _${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_CONFIGDIR}")
-
- list (APPEND _${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
-
- find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
- NAMES_PER_DIR
- HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
-
- # Rely on HINTS and standard paths if interpreter or config tool failed to locate artifacts
if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
+ if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG)
+ # retrieve root install directory
+ _python_get_config_var (_${_PYTHON_PREFIX}_PREFIX PREFIX)
- unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
- if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
- endif()
+ # enforce current ABI
+ _python_get_config_var (_${_PYTHON_PREFIX}_ABIFLAGS ABIFLAGS)
- if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
- unset (_${_PYTHON_PREFIX}_LIB_NAMES)
- unset (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG)
- unset (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
- unset (_${_PYTHON_PREFIX}_REGISTRY_PATHS)
- unset (_${_PYTHON_PREFIX}_PATH_SUFFIXES)
+ set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_PREFIX}")
- foreach (_${_PYTHON_PREFIX}_LIB_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- # library names
- _python_get_names (_${_PYTHON_PREFIX}_VERSION_NAMES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 POSIX LIBRARY)
- list (APPEND _${_PYTHON_PREFIX}_LIB_NAMES ${_${_PYTHON_PREFIX}_VERSION_NAMES})
- _python_get_names (_${_PYTHON_PREFIX}_VERSION_NAMES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 DEBUG)
- list (APPEND _${_PYTHON_PREFIX}_LIB_NAMES_DEBUG ${_${_PYTHON_PREFIX}_VERSION_NAMES})
-
- # Framework Paths
- _python_get_frameworks (_${_PYTHON_PREFIX}_VERSION_PATHS ${_${_PYTHON_PREFIX}_LIB_VERSION})
- list (APPEND _${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION_PATHS})
-
- # Registry Paths
- _python_get_registries (_${_PYTHON_PREFIX}_VERSION_PATHS ${_${_PYTHON_PREFIX}_LIB_VERSION})
- list (APPEND _${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_VERSION_PATHS})
-
- # Paths suffixes
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_VERSION_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} LIBRARY)
- list (APPEND _${_PYTHON_PREFIX}_PATH_SUFFIXES ${_${_PYTHON_PREFIX}_VERSION_PATHS})
- endforeach()
-
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
- find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
- NAMES_PER_DIR
- HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
+ # retrieve library
+ ## compute some paths and artifact names
+ if (_${_PYTHON_PREFIX}_CONFIG)
+ string (REGEX REPLACE "^.+python([0-9.]+)[a-z]*-config" "\\1" _${_PYTHON_PREFIX}_VERSION "${_${_PYTHON_PREFIX}_CONFIG}")
+ else()
+ set (_${_PYTHON_PREFIX}_VERSION "${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}")
endif()
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} LIBRARY)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 POSIX LIBRARY)
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
- find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
- NAMES_PER_DIR
- HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
+ _python_get_config_var (_${_PYTHON_PREFIX}_CONFIGDIR CONFIGDIR)
+ list (APPEND _${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_CONFIGDIR}")
+
+ list (APPEND _${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
- # search in HINTS locations
find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
+ endif()
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
- endif()
+ # Rely on HINTS and standard paths if interpreter or config tool failed to locate artifacts
+ if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
+ unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
- # search in all default paths
- find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
- NAMES_PER_DIR
- PATHS ${__${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- ${__${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
- else()
- foreach (_${_PYTHON_PREFIX}_LIB_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 POSIX LIBRARY)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 DEBUG)
-
- _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_LIB_VERSION})
- _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_LIB_VERSION})
+ if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
+ # library names
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} WIN32 POSIX LIBRARY)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} WIN32 DEBUG)
+ # Paths suffixes
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} LIBRARY)
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} LIBRARY)
+ # Framework Paths
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_FIND_VERSIONS})
+ # Registry Paths
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} )
if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
@@ -2159,204 +2130,282 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
- endif()
+ if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
+ endif()
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
- endif()
+ if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
+ endif()
- # search in all default paths
- find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ # search in all default paths
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
NAMES_PER_DIR
PATHS ${__${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
${__${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
+ else()
+ foreach (_${_PYTHON_PREFIX}_LIB_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 POSIX LIBRARY)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} WIN32 DEBUG)
+
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION})
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION})
+
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_LIB_VERSION} LIBRARY)
+
+ if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ endif()
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- break()
- endif()
- endforeach()
+ if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ endif()
+
+ # search in HINTS locations
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+
+ if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
+ endif()
+
+ if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
+ endif()
+
+ # search in all default paths
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
+ NAMES_PER_DIR
+ PATHS ${__${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ ${__${_PYTHON_PREFIX}_REGISTRY_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
+
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ break()
+ endif()
+ endforeach()
+ endif()
endif()
endif()
- endif()
- # finalize library version information
- _python_get_version (LIBRARY PREFIX _${_PYTHON_PREFIX}_)
+ # finalize library version information
+ _python_get_version (LIBRARY PREFIX _${_PYTHON_PREFIX}_)
+ if (_${_PYTHON_PREFIX}_VERSION EQUAL "${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}")
+ # not able to extract full version from library name
+ if (${_PYTHON_PREFIX}_Interpreter_FOUND)
+ # update from interpreter
+ set (_${_PYTHON_PREFIX}_VERSION ${${_PYTHON_PREFIX}_VERSION})
+ set (_${_PYTHON_PREFIX}_VERSION_MAJOR ${${_PYTHON_PREFIX}_VERSION_MAJOR})
+ set (_${_PYTHON_PREFIX}_VERSION_MINOR ${${_PYTHON_PREFIX}_VERSION_MINOR})
+ set (_${_PYTHON_PREFIX}_VERSION_PATCH ${${_PYTHON_PREFIX}_VERSION_PATCH})
+ endif()
+ endif()
- set (${_PYTHON_PREFIX}_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
+ set (${_PYTHON_PREFIX}_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
- set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
- endif()
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"")
+ set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+ endif()
- set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
+ set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
- if (WIN32 AND _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- # search for debug library
- # use release library location as a hint
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
- get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
- find_library (_${_PYTHON_PREFIX}_LIBRARY_DEBUG
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
- NAMES_PER_DIR
- HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS}
- NO_DEFAULT_PATH)
- endif()
+ if (WIN32 AND _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ # search for debug library
+ # use release library location as a hint
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
+ get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_DEBUG
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
+ NAMES_PER_DIR
+ HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS}
+ NO_DEFAULT_PATH)
+ endif()
- # retrieve runtime libraries
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 POSIX LIBRARY)
- get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
- get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
- _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
- NAMES_PER_DIR
- HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES bin)
- endif()
- if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
- get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}" DIRECTORY)
- get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
- _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
- NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
- NAMES_PER_DIR
- HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES bin)
- endif()
+ # retrieve runtime libraries
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 POSIX LIBRARY)
+ get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
+ get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
+ _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
+ NAMES_PER_DIR
+ HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
+ PATH_SUFFIXES bin)
+ endif()
+ if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
+ get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}" DIRECTORY)
+ get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
+ _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
+ NAMES_PER_DIR
+ HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
+ PATH_SUFFIXES bin)
+ endif()
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
while (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS
AND NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- # Don't search for include dir if no library was founded
+ # Don't search for include dir if no library was founded
break()
endif()
- if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG)
- _python_get_config_var (_${_PYTHON_PREFIX}_INCLUDE_DIRS INCLUDES)
+ if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG)
+ _python_get_config_var (_${_PYTHON_PREFIX}_INCLUDE_DIRS INCLUDES)
- find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
- NAMES Python.h
- HINTS ${_${_PYTHON_PREFIX}_INCLUDE_DIRS}
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
-
- # Rely on HINTS and standard paths if interpreter or config tool failed to locate artifacts
- if (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
- unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
- if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
+ NAMES ${_${_PYTHON_PREFIX}_INCLUDE_NAMES}
+ HINTS ${_${_PYTHON_PREFIX}_INCLUDE_DIRS}
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
endif()
- unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS)
+
+ # Rely on HINTS and standard paths if interpreter or config tool failed to locate artifacts
+ if (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
+ unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
+ endif()
+ unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS)
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- # Use the library's install prefix as a hint
+ # Use the library's install prefix as a hint
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^(.+/Frameworks/Python.framework/Versions/[0-9.]+)")
- list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^(.+)/lib(64|32)?/python[0-9.]+/config")
- list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
- elseif (DEFINED CMAKE_LIBRARY_ARCHITECTURE AND ${_${_PYTHON_PREFIX}_LIBRARY_RELEASE} MATCHES "^(.+)/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
- list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
- else()
- # assume library is in a directory under root
- get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
- get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_PREFIX}" DIRECTORY)
- list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${_${_PYTHON_PREFIX}_PREFIX}")
- endif()
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
+ elseif (DEFINED CMAKE_LIBRARY_ARCHITECTURE AND ${_${_PYTHON_PREFIX}_LIBRARY_RELEASE} MATCHES "^(.+)/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}")
+ else()
+ # assume library is in a directory under root
+ get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
+ get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_PREFIX}" DIRECTORY)
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${_${_PYTHON_PREFIX}_PREFIX}")
+ endif()
endif()
- _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_VERSION})
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} INCLUDE)
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
+ _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} INCLUDE)
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
- find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
- NAMES Python.h
- HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
+ if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
+ NAMES ${_${_PYTHON_PREFIX}_INCLUDE_NAMES}
+ HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ endif()
+
+ if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
+ NAMES ${_${_PYTHON_PREFIX}_INCLUDE_NAMES}
+ HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
+ ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ endif()
+
+ if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
+ endif()
+
+ if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
+ else()
+ unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
+ endif()
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
- NAMES Python.h
+ NAMES ${_${_PYTHON_PREFIX}_INCLUDE_NAMES}
HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
+ ${__${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ ${__${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
endif()
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
- endif()
-
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
- set (__${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS})
- else()
- unset (__${_PYTHON_PREFIX}_REGISTRY_PATHS)
- endif()
-
+ # search header file in standard locations
find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
- NAMES Python.h
- HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ${_${_PYTHON_PREFIX}_VIRTUALENV_PATHS}
- ${__${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
- ${__${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
- endif()
-
- # search header file in standard locations
- find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR
- NAMES Python.h)
+ NAMES ${_${_PYTHON_PREFIX}_INCLUDE_NAMES})
break()
endwhile()
- set (${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
+ set (${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
- if (_${_PYTHON_PREFIX}_INCLUDE_DIR AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
- set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
- set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
- endif()
-
- if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
- # retrieve version from header file
- _python_get_version (INCLUDE PREFIX _${_PYTHON_PREFIX}_INC_)
-
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
- # update versioning
- if (_${_PYTHON_PREFIX}_INC_VERSION VERSION_EQUAL _${_PYTHON_PREFIX}_VERSION)
- set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH})
+ if (_${_PYTHON_PREFIX}_INCLUDE_DIR AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
+ set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Cannot find the directory \"${_${_PYTHON_PREFIX}_INCLUDE_DIR}\"")
+ set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
endif()
+
+ if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
+ # retrieve version from header file
+ _python_get_version (INCLUDE PREFIX _${_PYTHON_PREFIX}_INC_)
+
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND
+ NOT _${_PYTHON_PREFIX}_VERSION EQUAL "${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}")
+ # update versioning
+ if ("${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}"
+ VERSION_EQUAL _${_PYTHON_PREFIX}_VERSION)
+ set (_${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_INC_VERSION})
+ set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH})
+ endif()
else()
set (_${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_INC_VERSION})
set (_${_PYTHON_PREFIX}_VERSION_MAJOR ${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR})
set (_${_PYTHON_PREFIX}_VERSION_MINOR ${_${_PYTHON_PREFIX}_INC_VERSION_MINOR})
set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH})
endif()
- endif()
+ endif()
endif()
if (NOT ${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT ${_PYTHON_PREFIX}_Compiler_FOUND)
@@ -2369,30 +2418,32 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# define public variables
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- set (${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
- _python_select_library_configurations (${_PYTHON_PREFIX})
+ set (${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+ _python_select_library_configurations (${_PYTHON_PREFIX})
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
- if (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
- elseif (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
- else()
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_PYTHON_PREFIX}_RUNTIME_LIBRARY-NOTFOUND")
- endif()
-
- _python_set_library_dirs (${_PYTHON_PREFIX}_LIBRARY_DIRS
- _${_PYTHON_PREFIX}_LIBRARY_RELEASE _${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- if (UNIX)
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
- set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS ${${_PYTHON_PREFIX}_LIBRARY_DIRS})
+ if (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+ elseif (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ else()
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_PYTHON_PREFIX}_RUNTIME_LIBRARY-NOTFOUND")
endif()
- else()
+
+ _python_set_library_dirs (${_PYTHON_PREFIX}_LIBRARY_DIRS
+ _${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ if (UNIX)
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
+ set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS ${${_PYTHON_PREFIX}_LIBRARY_DIRS})
+ endif()
+ else()
_python_set_library_dirs (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS
- _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
- endif()
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ endif()
endif()
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE OR _${_PYTHON_PREFIX}_INCLUDE_DIR)
@@ -2404,9 +2455,9 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_python_set_development_module_found (Embed)
endif()
elseif (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR
- AND "${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}" VERSION_EQUAL "${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}")
- _python_set_development_module_found (Module)
- _python_set_development_module_found (Embed)
+ AND "${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}" VERSION_EQUAL "${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}")
+ _python_set_development_module_found (Module)
+ _python_set_development_module_found (Embed)
endif()
if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND
(NOT _${_PYTHON_PREFIX}_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS
@@ -2416,6 +2467,15 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
+ if (( ${_PYTHON_PREFIX}_Development.Module_FOUND
+ AND ${_PYTHON_PREFIX}_Development.Embed_FOUND)
+ OR (NOT "Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Development.Embed_FOUND)
+ OR (NOT "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Development.Module_FOUND))
+ unset (_${_PYTHON_PREFIX}_Development_REASON_FAILURE)
+ endif()
+
if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
AND ${_PYTHON_PREFIX}_Development.Module_FOUND
AND ${_PYTHON_PREFIX}_Development.Embed_FOUND)
@@ -2437,11 +2497,11 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (${_PYTHON_PREFIX}_ARTIFACTS_INTERACTIVE)
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- set (${_PYTHON_PREFIX}_LIBRARY "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" CACHE FILEPATH "${_PYTHON_PREFIX} Library")
+ set (${_PYTHON_PREFIX}_LIBRARY "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" CACHE FILEPATH "${_PYTHON_PREFIX} Library")
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- set (${_PYTHON_PREFIX}_INCLUDE_DIR "${_${_PYTHON_PREFIX}_INCLUDE_DIR}" CACHE FILEPATH "${_PYTHON_PREFIX} Include Directory")
- endif()
+ set (${_PYTHON_PREFIX}_INCLUDE_DIR "${_${_PYTHON_PREFIX}_INCLUDE_DIR}" CACHE FILEPATH "${_PYTHON_PREFIX} Include Directory")
+ endif()
endif()
_python_mark_as_internal (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
@@ -2474,13 +2534,12 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
if (NOT _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
- execute_process(
- COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT _${_PYTHON_PREFIX}_RESULT)
find_path (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR
@@ -2498,11 +2557,10 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
if (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
- execute_process (
- COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION)
+ execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION)
if (NOT _${_PYTHON_PREFIX}_RESULT)
set (${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}")
else()
@@ -2516,6 +2574,8 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
if (${_PYTHON_PREFIX}_NumPy_FOUND)
+ unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE)
+
# compute and save numpy signature
string (MD5 __${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}:${_${_PYTHON_PREFIX}_DEVELOPMENT_MODULE_SIGNATURE}:${${_PYTHON_PREFIX}_NumPyINCLUDE_DIR}")
set (_${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${__${_PYTHON_PREFIX}_NUMPY_SIGNATURE}" CACHE INTERNAL "")
@@ -2541,6 +2601,7 @@ unset (_${_PYTHON_PREFIX}_REASON_FAILURE)
foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development NumPy)
if (_${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_REASON_FAILURE)
string (APPEND _${_PYTHON_PREFIX}_REASON_FAILURE "\n ${_${_PYTHON_PREFIX}_COMPONENT}: ${_${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_REASON_FAILURE}")
+ unset (_${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_REASON_FAILURE)
endif()
endforeach()
@@ -2634,7 +2695,7 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
endmacro()
if (${_PYTHON_PREFIX}_Development.Embed_FOUND)
- __python_import_library (${_PYTHON_PREFIX}::Python)
+ __python_import_library (${_PYTHON_PREFIX}::Python)
endif()
if (${_PYTHON_PREFIX}_Development.Module_FOUND)
@@ -2670,8 +2731,7 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
# It is used to build modules for python.
#
function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
- cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY
- "STATIC;SHARED;MODULE;WITH_SOABI" "" "")
+ cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY "STATIC;SHARED;MODULE;WITH_SOABI" "" "")
if (prefix STREQUAL "Python2" AND PYTHON_ADD_LIBRARY_WITH_SOABI)
message (AUTHOR_WARNING "FindPython2: Option `WITH_SOABI` is not supported for Python2 and will be ignored.")
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index ef3280f..def6f3c 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -218,6 +218,27 @@ Hints
recommended to also include the component ``Interpreter`` to get expected
result.
+``Python2_FIND_IMPLEMENTATIONS``
+ This variable defines, in an ordered list, the different implementations
+ which will be searched. The ``Python2_FIND_IMPLEMENTATIONS`` variable can
+ hold the following values:
+
+ * ``CPython``: this is the standard implementation. Various products, like
+ ``Anaconda`` or ``ActivePython``, rely on this implementation.
+ * ``IronPython``: This implementation use the ``CSharp`` language for
+ ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
+ See `IronPython <http://ironpython.net>`_.
+
+ The default value is the list: ``CPython``, ``IronPython``.
+
+ .. note::
+
+ This hint has the lowest priority of all hints, so even if, for example,
+ you specify ``IronPython`` first and ``CPython`` in second, a python
+ product based on ``CPython`` can be selected because, for example with
+ ``Python2_FIND_STRATEGY=LOCATION``, each location will be search first for
+ ``IronPython`` and second for ``CPython``.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 1373407..3660ee8 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -268,6 +268,27 @@ Hints
recommended to also include the component ``Interpreter`` to get expected
result.
+``Python3_FIND_IMPLEMENTATIONS``
+ This variable defines, in an ordered list, the different implementations
+ which will be searched. The ``Python3_FIND_IMPLEMENTATIONS`` variable can
+ hold the following values:
+
+ * ``CPython``: this is the standard implementation. Various products, like
+ ``Anaconda`` or ``ActivePython``, rely on this implementation.
+ * ``IronPython``: This implementation use the ``CSharp`` language for
+ ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
+ See `IronPython <http://ironpython.net>`_.
+
+ The default value is the list: ``CPython``, ``IronPython``.
+
+ .. note::
+
+ This hint has the lowest priority of all hints, so even if, for example,
+ you specify ``IronPython`` first and ``CPython`` in second, a python
+ product based on ``CPython`` can be selected because, for example with
+ ``Python3_FIND_STRATEGY=LOCATION``, each location will be search first for
+ ``IronPython`` and second for ``CPython``.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8d3735a..7384c59 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 17)
-set(CMake_VERSION_PATCH 20200426)
+set(CMake_VERSION_PATCH 20200429)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CursesDialog/cmCursesColor.cxx b/Source/CursesDialog/cmCursesColor.cxx
index 641d48c..c0b468b 100644
--- a/Source/CursesDialog/cmCursesColor.cxx
+++ b/Source/CursesDialog/cmCursesColor.cxx
@@ -2,6 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesColor.h"
+#include <cctype>
+#include <cstdlib>
+#include <cstring>
+#include <unordered_map>
+#include <utility>
+
#include "cmCursesStandardIncludes.h"
bool cmCursesColor::HasColors()
@@ -19,11 +25,54 @@ void cmCursesColor::InitColors()
if (HasColors()) {
start_color();
use_default_colors();
- init_pair(cmCursesColor::BoolOff, COLOR_RED, -1);
- init_pair(cmCursesColor::BoolOn, COLOR_GREEN, -1);
- init_pair(cmCursesColor::String, COLOR_BLUE, -1);
- init_pair(cmCursesColor::Path, COLOR_YELLOW, -1);
- init_pair(cmCursesColor::Options, COLOR_MAGENTA, -1);
+ init_pair(BoolOff, GetColor('N', COLOR_RED), -1);
+ init_pair(BoolOn, GetColor('Y', COLOR_GREEN), -1);
+ init_pair(String, GetColor('S', COLOR_CYAN), -1);
+ init_pair(Path, GetColor('P', COLOR_YELLOW), -1);
+ init_pair(Choice, GetColor('C', COLOR_MAGENTA), -1);
}
#endif
}
+
+short cmCursesColor::GetColor(char id, short fallback)
+{
+ static bool initialized = false;
+ static std::unordered_map<char, short> env;
+
+ if (!initialized) {
+ if (auto* v = getenv("CCMAKE_COLORS")) {
+ while (v[0] && v[1] && v[1] == '=') {
+ auto const n = std::toupper(*v);
+
+ char buffer[12];
+ memset(buffer, 0, sizeof(buffer));
+
+ if (auto* const e = strchr(v, ':')) {
+ if (static_cast<size_t>(e - v) > sizeof(buffer)) {
+ break;
+ }
+
+ strncpy(buffer, v + 2, static_cast<size_t>(e - v - 2));
+ v = e + 1;
+ } else {
+ auto const l = strlen(v);
+ if (l > sizeof(buffer)) {
+ break;
+ }
+
+ strncpy(buffer, v + 2, l - 2);
+ v += l;
+ }
+
+ auto const c = atoi(buffer);
+ if (c && c < COLORS) {
+ env.emplace(n, static_cast<short>(c));
+ }
+ }
+ }
+ initialized = true;
+ }
+
+ auto const iter = env.find(id);
+ return (iter == env.end() ? fallback : iter->second);
+}
diff --git a/Source/CursesDialog/cmCursesColor.h b/Source/CursesDialog/cmCursesColor.h
index 78ca52c..f83265f 100644
--- a/Source/CursesDialog/cmCursesColor.h
+++ b/Source/CursesDialog/cmCursesColor.h
@@ -13,12 +13,15 @@ public:
BoolOn,
String,
Path,
- Options
+ Choice
};
static bool HasColors();
static void InitColors();
+
+protected:
+ static short GetColor(char id, short fallback);
};
#endif // cmCursesColor_h
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index a15241f..8df32e2 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -17,8 +17,8 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
// the widget into a string widget at some point. BOOL is safe for
// now.
if (cmCursesColor::HasColors()) {
- set_field_fore(this->Field, COLOR_PAIR(cmCursesColor::Options));
- set_field_back(this->Field, COLOR_PAIR(cmCursesColor::Options));
+ set_field_fore(this->Field, COLOR_PAIR(cmCursesColor::Choice));
+ set_field_back(this->Field, COLOR_PAIR(cmCursesColor::Choice));
} else {
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 4daf726..930f300 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -808,11 +808,15 @@ bool CMakeSetupDialog::setupFirstConfigure()
m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_PROCESSOR",
tr("CMake System Processor"), systemProcessor, false);
QString cxxCompiler = dialog.getCXXCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
- tr("CXX compiler."), cxxCompiler, false);
+ if (!cxxCompiler.isEmpty()) {
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
+ tr("CXX compiler."), cxxCompiler, false);
+ }
QString cCompiler = dialog.getCCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
- tr("C compiler."), cCompiler, false);
+ if (!cCompiler.isEmpty()) {
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
+ tr("C compiler."), cCompiler, false);
+ }
} else if (dialog.crossCompilerToolChainFile()) {
QString toolchainFile = dialog.getCrossCompilerToolChainFile();
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE",
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 673936c..fbb9429 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -73,11 +73,12 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string& flags, cmSourceFile const& source)
{
- cmProp srcfmt = source.GetProperty("Fortran_FORMAT");
+ const std::string srcfmt = source.GetSafeProperty("Fortran_FORMAT");
cmOutputConverter::FortranFormat format =
- cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr);
+ cmOutputConverter::GetFortranFormat(srcfmt);
if (format == cmOutputConverter::FortranFormatNone) {
- const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
+ const std::string tgtfmt =
+ this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT");
format = cmOutputConverter::GetFortranFormat(tgtfmt);
}
const char* var = nullptr;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 308ddda..07e0793 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -19,7 +19,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
#endif
this->ToolSupportsColor = true;
this->NeedSymbolicMark = true;
- this->EmptyRuleHackCommand = "@cd .";
+ this->EmptyRuleHackCommand = "@%null";
#ifdef _WIN32
cm->GetState()->SetWindowsShell(true);
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 1a753e2..f305246 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -808,9 +808,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add flags from target and source file properties.
std::string flags;
- cmProp srcfmt = sf->GetProperty("Fortran_FORMAT");
- switch (
- cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr)) {
+ const std::string srcfmt = sf->GetSafeProperty("Fortran_FORMAT");
+ switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
break;
@@ -2290,7 +2289,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add Fortran source format attribute if property is set.
const char* format = nullptr;
- const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
+ const std::string tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
format = "fixed";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index aa8912e..1401e29 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1442,7 +1442,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// Create the scanner for this language
std::unique_ptr<cmDepends> scanner;
if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" ||
- lang == "CUDA") {
+ lang == "OBJC" || lang == "OBJCXX" || lang == "CUDA") {
// TODO: Handle RC (resource files) dependencies correctly.
scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps);
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 95c798b..8daffa0 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -672,7 +672,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
if (this->FortranProject) {
switch (cmOutputConverter::GetFortranFormat(
- target->GetProperty("Fortran_FORMAT"))) {
+ target->GetSafeProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
flags += " -fixed";
break;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b21946c..267d5e1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -724,8 +724,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// At the moment, it is assumed that C, C++, Fortran, and CUDA have both
// assembly and preprocessor capabilities. The same is true for the
// ability to export compile commands
- bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") ||
- (lang == "Fortran") || (lang == "CUDA"));
+ bool lang_has_preprocessor =
+ ((lang == "C") || (lang == "CXX") || (lang == "OBJC") ||
+ (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA"));
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 68bf3af..dc324cc 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -170,15 +170,6 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
return format;
}
-cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
- const char* value)
-{
- if (!value) {
- return FortranFormatNone;
- }
- return GetFortranFormat(cm::string_view(value));
-}
-
void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell)
{
this->LinkScriptShell = linkScriptShell;
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 6583ab5..28582df 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -94,7 +94,6 @@ public:
FortranFormatFree
};
static FortranFormat GetFortranFormat(cm::string_view value);
- static FortranFormat GetFortranFormat(const char* value);
private:
cmState* GetState() const;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5b3d2b4..5011863 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1414,6 +1414,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
foreach(_mod IN ITEMS
ALSA
Boost
+ BLAS
BZip2
CURL
Cups
@@ -1433,6 +1434,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
ICU
JPEG
JsonCpp
+ LAPACK
LibArchive
LibLZMA
LibRHash
diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt
new file mode 100644
index 0000000..667195d
--- /dev/null
+++ b/Tests/FindBLAS/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindBLAS.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test"
+ "${CMake_BINARY_DIR}/Tests/FindBLAS/Test"
+ ${build_generator_args}
+ --build-project TestFindBLAS
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt
new file mode 100644
index 0000000..59418f3
--- /dev/null
+++ b/Tests/FindBLAS/Test/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindBLAS C)
+include(CTest)
+
+find_package(BLAS REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt BLAS::BLAS)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c
new file mode 100644
index 0000000..7360dee
--- /dev/null
+++ b/Tests/FindBLAS/Test/main.c
@@ -0,0 +1,14 @@
+#include <assert.h>
+#include <string.h>
+
+// declare what parts of the blas C-API we need
+void cblas_dswap(const int N, double* X, const int incX, double* Y,
+ const int incY);
+
+int main()
+{
+ double x[4] = { 1, 2, 3, 4 };
+ double y[4] = { 8, 7, 7, 6 };
+ cblas_dswap(4, x, 1, y, 1);
+ return 0;
+}
diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt
new file mode 100644
index 0000000..2081d59
--- /dev/null
+++ b/Tests/FindLAPACK/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindLAPACK.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test"
+ "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test"
+ ${build_generator_args}
+ --build-project TestFindLAPACK
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt
new file mode 100644
index 0000000..8afa36a
--- /dev/null
+++ b/Tests/FindLAPACK/Test/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindLAPACK C)
+include(CTest)
+
+find_package(LAPACK REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt LAPACK::LAPACK)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c
new file mode 100644
index 0000000..5873e7b
--- /dev/null
+++ b/Tests/FindLAPACK/Test/main.c
@@ -0,0 +1,20 @@
+#include <assert.h>
+#include <string.h>
+
+// declare what parts of the lapack C-API we need
+void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*);
+
+int main()
+{
+ double A[8] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ };
+ double B[2] = { 0, 5 };
+ int ipiv[2] = { 0, 0 };
+ int info = 0;
+
+ int dim = 2;
+ int numCols = 1;
+ dgesv_(&dim, &numCols, A, &dim, ipiv, B, &dim, &info);
+ return 0;
+}
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index c72b5e2..072a993 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -314,6 +314,29 @@ if(CMake_TEST_FindPython_Conda)
)
endif()
+if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython)
+ add_test(NAME FindPython.Implementation.CPython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython"
+ ${build_generator_args}
+ --build-project TestImplementationCPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATIONS=CPython
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Implementation.IronPython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython"
+ ${build_generator_args}
+ --build-project TestImplementationIronPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATION=IronPython
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
+
if(CMake_TEST_FindPython_IronPython)
add_test(NAME FindPython.IronPython2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt
new file mode 100644
index 0000000..d64fa1e
--- /dev/null
+++ b/Tests/FindPython/Implementation/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C)
+
+
+set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
+
+find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter)
+if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python${Python_REQUESTED_VERSION}")
+endif()
+
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
+ AND NOT Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
+endif()
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
+ AND Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
+endif()
+
+
+set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
+
+find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter)
+if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+endif()
+
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
+ AND NOT Python_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
+ AND Python_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt
index c96a3e0..3493c29 100644
--- a/Tests/FindPython/IronPython/CMakeLists.txt
+++ b/Tests/FindPython/IronPython/CMakeLists.txt
@@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1)
project(TestIronPython C)
-find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Compiler)
+set (Python_FIND_IMPLEMENTATIONS IronPython)
+
+find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Compiler)
if (NOT Python_FOUND)
message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
endif()
+if (NOT Python_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python Interpreter")
+endif()
+if (NOT Python_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
+
if (NOT Python_Compiler_FOUND)
message (FATAL_ERROR "Fail to found Python Compiler")
endif()
diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt
index 43ec309..1db798c 100644
--- a/Tests/FindPython/IronPython2/CMakeLists.txt
+++ b/Tests/FindPython/IronPython2/CMakeLists.txt
@@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1)
project(TestIronPython2 C)
-find_package(Python2 REQUIRED COMPONENTS Interpreter Compiler)
+set (Python2_FIND_IMPLEMENTATIONS "IronPython")
+
+find_package(Python2 COMPONENTS Interpreter Compiler)
if (NOT Python2_FOUND)
message (FATAL_ERROR "Fail to found Python 2")
endif()
+if (NOT Python2_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python 2 Interpreter")
+endif()
+if (NOT Python2_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
+endif()
+
if (NOT Python2_Compiler_FOUND)
message (FATAL_ERROR "Fail to found Python 2 Compiler")
endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
index 1696037..3119341 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
@@ -17,14 +17,14 @@ endif()
file(STRINGS ${foobar_pch_h_header} foobar_pch_h_header_strings)
-if (NOT foobar_pch_h_header_strings MATCHES ";#include <stddef.h>(;|$)")
+if (NOT foobar_pch_h_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_C.h\";#include <stddef.h>(;|$)")
set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_h_header}\nhas bad content:\n ${foobar_pch_h_header_strings}")
return()
endif()
file(STRINGS ${foobar_pch_hxx_header} foobar_pch_hxx_header_strings)
-if (NOT foobar_pch_hxx_header_strings MATCHES ";#include <cstddef>(;|$)")
+if (NOT foobar_pch_hxx_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_CXX.h\";#include <cstddef>(;|$)")
set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_hxx_header}\nhas bad content:\n ${foobar_pch_hxx_header_strings}")
return()
endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
index cdc42b2..bb18a64 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -7,6 +7,8 @@ add_executable(foobar
)
target_include_directories(foobar PUBLIC include)
target_precompile_headers(foobar PRIVATE
+ "$<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_C.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_CXX.h>"
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
)
diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_C.h b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h
new file mode 100644
index 0000000..f4de601
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h
@@ -0,0 +1 @@
+#include "foo.h"
diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h
new file mode 100644
index 0000000..f4de601
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h
@@ -0,0 +1 @@
+#include "foo.h"