diff options
author | Martin Kelly <mkelly@xevo.com> | 2020-04-02 13:56:32 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-05 11:46:38 +0100 |
commit | 1b15cc6e65c18cda7888a2eef1f55bf0a660ae7e (patch) | |
tree | 71dd774eca8f83bc68321cc24f349cf5f33b9893 /meta/classes/cmake.bbclass | |
parent | c23d6f77994698e71d9a011cddec1237158b15ca (diff) | |
download | poky-1b15cc6e65c18cda7888a2eef1f55bf0a660ae7e.tar.gz |
cmake: fix Python executable with cmake
Currently, CMake has two ways of finding Python executables:
FindPythonInterp and FindPython/FindPython3. FindPythonInterp is
deprecated and may be removed at some point. Currently, python3native
sets PYTHON_EXECUTABLE, which FindPythonInterp uses. This is a problem
for a few reasons:
- Setting PYTHON_EXECUTABLE as an environment variable doesn't work, as
CMake needs it to be set as an explicit CMake option via -D.
- Projects using the newer FindPython/FindPython3 don't pickup the right
Python, as the newer routines use Python_EXECUTABLE and
Python3_EXECUTABLE.
Fix this by setting PYTHON_EXECUTABLE, Python_EXECUTABLE, and
Python3_EXECUTABLE using -D options to EXTRA_OECMAKE.
The CMake routines are documented below:
https://cmake.org/cmake/help/latest/module/FindPythonInterp.html
https://cmake.org/cmake/help/latest/module/FindPython.html
https://cmake.org/cmake/help/latest/module/FindPython3.html
(From OE-Core rev: a22200a646eaf42cd4902a2fe3358d29717ac129)
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/cmake.bbclass')
-rw-r--r-- | meta/classes/cmake.bbclass | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index d91cf20130..94ed8061bb 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass | |||
@@ -175,6 +175,9 @@ cmake_do_configure() { | |||
175 | -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \ | 175 | -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \ |
176 | -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \ | 176 | -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \ |
177 | -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \ | 177 | -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \ |
178 | -DPYTHON_EXECUTABLE:PATH=${PYTHON} \ | ||
179 | -DPython_EXECUTABLE:PATH=${PYTHON} \ | ||
180 | -DPython3_EXECUTABLE:PATH=${PYTHON} \ | ||
178 | -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \ | 181 | -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \ |
179 | -DCMAKE_INSTALL_SO_NO_EXE=0 \ | 182 | -DCMAKE_INSTALL_SO_NO_EXE=0 \ |
180 | -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ | 183 | -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ |