diff options
author | Chris Bieneman <chris.bieneman@me.com> | 2019-05-07 21:46:55 +0000 |
---|---|---|
committer | Chris Bieneman <chris.bieneman@me.com> | 2019-05-07 21:46:55 +0000 |
commit | bec30c4af1e39842077b74e349c15acd8c608560 (patch) | |
tree | 691805b47c599ff5fe05e66979b69fdf6aebf825 /llvm/cmake/config-ix.cmake | |
parent | 89e58ddb2868bfb84c082b1a7ac07faf8c3bbca7 (diff) | |
download | bcm5719-llvm-bec30c4af1e39842077b74e349c15acd8c608560.tar.gz bcm5719-llvm-bec30c4af1e39842077b74e349c15acd8c608560.zip |
[CMake] Detecting python modules should be cached
Summary: This requres exec-ing python, which in a trace I ran of the CMake re-configure time took ~2% of the reconfigure time.
Reviewers: phosek, smeenai, compnerd
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61402
llvm-svn: 360196
Diffstat (limited to 'llvm/cmake/config-ix.cmake')
-rw-r--r-- | llvm/cmake/config-ix.cmake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 5bf301f3cfd..66c7382fafc 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -606,16 +606,19 @@ function(find_python_module module) string(REPLACE "." "_" module_name ${module}) string(TOUPPER ${module_name} module_upper) set(FOUND_VAR PY_${module_upper}_FOUND) + if (DEFINED ${FOUND_VAR}) + return() + endif() execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}" RESULT_VARIABLE status ERROR_QUIET) if(status) - set(${FOUND_VAR} 0 PARENT_SCOPE) + set(${FOUND_VAR} OFF CACHE BOOL "Failed to find python module '${module}'") message(STATUS "Could NOT find Python module ${module}") else() - set(${FOUND_VAR} 1 PARENT_SCOPE) + set(${FOUND_VAR} ON CACHE BOOL "Found python module '${module}'") message(STATUS "Found Python module ${module}") endif() endfunction() |