aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules
diff options
context:
space:
mode:
authorJoerg Hofrichter <joerg.hofrichter@ni.com>2020-07-16 16:02:32 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2020-08-04 07:38:40 -0500
commit294e60eb60034fa24e1ca62e59cf032a1b7bd57a (patch)
tree4c65a9b65772ad73bcc255293256497f60665abd /host/cmake/Modules
parent233fc368a3d5ac2472d3b53918d4f0ed1d353f2c (diff)
downloaduhd-294e60eb60034fa24e1ca62e59cf032a1b7bd57a.tar.gz
uhd-294e60eb60034fa24e1ca62e59cf032a1b7bd57a.tar.bz2
uhd-294e60eb60034fa24e1ca62e59cf032a1b7bd57a.zip
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.
Diffstat (limited to 'host/cmake/Modules')
-rw-r--r--host/cmake/Modules/UHDPython.cmake8
1 files changed, 8 insertions, 0 deletions
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)