Index: llvm/runtimes/CMakeLists.txt =================================================================== --- llvm/runtimes/CMakeLists.txt +++ llvm/runtimes/CMakeLists.txt @@ -61,6 +61,14 @@ find_package(LLVM PATHS "${LLVM_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + # find_package may have overridden some cache variables which ought not be + # overridden for a build using the just-built toolchain. Revert them. + get_cmake_property(_variableNames CACHE_VARIABLES) + foreach (_variableName ${_variableNames}) + get_property(original_value CACHE ${_variableName} PROPERTY VALUE) + set(${_variableName} ${original_value}) + endforeach() + # Add the root project's CMake modules, and the LLVM build's modules to the # CMake module path. list(INSERT CMAKE_MODULE_PATH 0