diff options
author | Reid Kleckner <rnk@google.com> | 2019-10-31 14:00:22 -0700 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-11-01 11:24:39 -0700 |
commit | 309f9a1c52977cbd011b29909f7aa45c124b005f (patch) | |
tree | 64113b1b6db96c100780e6a691bcb64c89fbaffa /debuginfo-tests | |
parent | cb2c4bb0e0da675bb0ab3a3fce4cbb014d83f675 (diff) | |
download | bcm5719-llvm-309f9a1c52977cbd011b29909f7aa45c124b005f.tar.gz bcm5719-llvm-309f9a1c52977cbd011b29909f7aa45c124b005f.zip |
[debuginfo-tests] Don't look for Python 3 if we already have it
LLDB already requires Python 3 on Windows, so I already configure it
that way. For some reason CMake fails to find the one that Visual Studio
automatically installs at this standard location:
C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python.exe
CMake prefers the python on path, which happens to be python 2.7.
Reviewers: aprantl, jmorse
Differential Revision: https://reviews.llvm.org/D69684
Diffstat (limited to 'debuginfo-tests')
-rw-r--r-- | debuginfo-tests/CMakeLists.txt | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/debuginfo-tests/CMakeLists.txt b/debuginfo-tests/CMakeLists.txt index 0ac48da5fbc..68ce6398445 100644 --- a/debuginfo-tests/CMakeLists.txt +++ b/debuginfo-tests/CMakeLists.txt @@ -13,20 +13,26 @@ set(DEBUGINFO_TEST_DEPS not ) -# Wipe, uh, previous results -unset(PYTHONINTERP_FOUND CACHE) -unset(PYTHON_EXECUTABLE CACHE) -unset(PYTHON_LIBRARY CACHE) -unset(PYTHON_DLL CACHE) -unset(PYTHON_INCLUDE_DIR CACHE) -unset(PYTHON_VERSION_STRING CACHE) -unset(PYTHON_VERSION_MAJOR CACHE) -unset(PYTHON_VERSION_MINOR CACHE) -unset(PYTHON_VERSION_PATCH CACHE) -unset(PYTHONLIBS_VERSION_STRING CACHE) +# If we don't already have Python 3, throw away any previous results and try to +# find it again. +set(DEBUGINFO_UNSET_PYTHON3 OFF) +if (PYTHON_VERSION_MAJOR LESS 3) + unset(PYTHONINTERP_FOUND CACHE) + unset(PYTHON_EXECUTABLE CACHE) + unset(PYTHON_LIBRARY CACHE) + unset(PYTHON_DLL CACHE) + unset(PYTHON_INCLUDE_DIR CACHE) + unset(PYTHON_VERSION_STRING CACHE) + unset(PYTHON_VERSION_MAJOR CACHE) + unset(PYTHON_VERSION_MINOR CACHE) + unset(PYTHON_VERSION_PATCH CACHE) + unset(PYTHONLIBS_VERSION_STRING CACHE) + + # Try to find python3. If it doesn't exist, dexter tests can't run. + find_package(PythonInterp "3") + set(DEBUGINFO_UNSET_PYTHON3 ON) +endif() -# Try to find python3. If it doesn't exist, dexter tests can't run. -find_package(PythonInterp "3") if (NOT DEFINED PYTHON_EXECUTABLE) message(FATAL_ERROR "Cannot run debuginfo-tests without python") elseif(PYTHON_VERSION_MAJOR LESS 3) @@ -43,17 +49,20 @@ else() ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${DEBUGINFO_TEST_DEPS} ) - set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests") + set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests") endif() -# Prevent the rest of llvm observing our secret python3-ness -unset(PYTHONINTERP_FOUND CACHE) -unset(PYTHON_EXECUTABLE CACHE) -unset(PYTHON_LIBRARY CACHE) -unset(PYTHON_DLL CACHE) -unset(PYTHON_INCLUDE_DIR CACHE) -unset(PYTHON_VERSION_STRING CACHE) -unset(PYTHON_VERSION_MAJOR CACHE) -unset(PYTHON_VERSION_MINOR CACHE) -unset(PYTHON_VERSION_PATCH CACHE) -unset(PYTHONLIBS_VERSION_STRING CACHE) +# Prevent the rest of llvm observing our secret python3-ness, if that wasn't +# what was originally found. +if (DEBUGINFO_UNSET_PYTHON3) + unset(PYTHONINTERP_FOUND CACHE) + unset(PYTHON_EXECUTABLE CACHE) + unset(PYTHON_LIBRARY CACHE) + unset(PYTHON_DLL CACHE) + unset(PYTHON_INCLUDE_DIR CACHE) + unset(PYTHON_VERSION_STRING CACHE) + unset(PYTHON_VERSION_MAJOR CACHE) + unset(PYTHON_VERSION_MINOR CACHE) + unset(PYTHON_VERSION_PATCH CACHE) + unset(PYTHONLIBS_VERSION_STRING CACHE) +endif() |