From 7ccf67e5edad983b00fe8344fac3f9cd21707654 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Fri, 10 Dec 2021 10:46:20 +0800 Subject: [PATCH] fix cmake bug when WITH_PYTHON=OFF (#38015) --- paddle/pten/api/lib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/pten/api/lib/CMakeLists.txt b/paddle/pten/api/lib/CMakeLists.txt index 96ad9ade8e3..d1e60c4505d 100644 --- a/paddle/pten/api/lib/CMakeLists.txt +++ b/paddle/pten/api/lib/CMakeLists.txt @@ -22,6 +22,10 @@ set(api_source_file ${CMAKE_SOURCE_DIR}/paddle/pten/api/lib/api.cc) set(api_header_file_tmp ${api_header_file}.tmp) set(api_source_file_tmp ${api_source_file}.tmp) +if (NOT PYTHON_EXECUTABLE) + find_package(PythonInterp REQUIRED) +endif() + add_custom_command( OUTPUT ${api_header_file} ${api_source_file} COMMAND ${PYTHON_EXECUTABLE} -m pip install pyyaml -- GitLab