From 294e60eb60034fa24e1ca62e59cf032a1b7bd57a Mon Sep 17 00:00:00 2001 From: Joerg Hofrichter Date: Thu, 16 Jul 2020 16:02:32 +0200 Subject: cmake: find python in sysroot path first Set CMP0094 policy to NEW to make sure Python3 is first found in the SDK's sysroot if both the sysroot and the native paths are included in the PATH variable. --- host/cmake/Modules/UHDPython.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'host/cmake/Modules') diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake index f5e67fc2d..87b974083 100644 --- a/host/cmake/Modules/UHDPython.cmake +++ b/host/cmake/Modules/UHDPython.cmake @@ -6,6 +6,14 @@ # SPDX-License-Identifier: GPL-3.0-or-later # +if (POLICY CMP0094) + # See https://cmake.org/cmake/help/v3.15/policy/CMP0094.html + # set Python3_FIND_STRATEGY to LOCATION - this ensures that Python from + # sysroot is used first when cross-compiling + # note: policy CMP0094 is available starting with CMake 3.15 + cmake_policy(SET CMP0094 NEW) +endif() + if(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) set(INCLUDED_UHD_PYTHON_CMAKE TRUE) -- cgit v1.2.3