[Openmp-commits] [openmp] [OpenMP] [cmake] In standalone mode, make Python3_EXECUTABLE available (PR #80828)

Martin Storsjö via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 6 04:46:42 PST 2024


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/80828

When running the tests, we try to invoke them as
"${Python3_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE}", but when running "find_package(Python3)" within the function "find_standalone_test_dependencies", the variable "Python3_EXECUTABLE" only gets set within the function scope.

Tests have worked regardless of this in many cases, where executing the python script directly succeeds. But for consistency, and for working in cases when the python script can't be executed as such, make the Python3_EXECUTABLE variable available as intended.

>From 175743011fa9f409628b0bf00d8f54af01eaed2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Fri, 2 Feb 2024 17:47:15 +0200
Subject: [PATCH] [OpenMP] [cmake] In standalone mode, make Python3_EXECUTABLE
 available

When running the tests, we try to invoke them as
"${Python3_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE}", but when
running "find_package(Python3)" within the function
"find_standalone_test_dependencies", the variable "Python3_EXECUTABLE"
only gets set within the function scope.

Tests have worked regardless of this in many cases, where executing
the python script directly succeeds. But for consistency, and for
working in cases when the python script can't be executed as such,
make the Python3_EXECUTABLE variable available as intended.
---
 openmp/cmake/OpenMPTesting.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index df41956dadd4f..ab2348ae59b5f 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -10,6 +10,8 @@ function(find_standalone_test_dependencies)
     message(WARNING "The check targets will not be available!")
     set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE)
     return()
+  else()
+    set(Python3_EXECUTABLE ${Python3_EXECUTABLE} PARENT_SCOPE)
   endif()
 
   # Find executables.



More information about the Openmp-commits mailing list