Running unit tests with CMake/standalone build

Hi, everyone. A while ago I remember being told that the reason the Clang unit tests don’t run in a standalone CMake build is because it would require duplicating a whole bunch of LLVM’s CMake or gtest infrastructure. Or something like that.

However, do we even support building Clang without specifying a path to the LLVM source directory? I just tried it today (specifying only a path to the build directory), and got “include could not find load file” for “AddLLVM” and “TableGen”.

And building with the path to the LLVM source, the unit tests work fine, after being enabled in the top-level CMakeLists.txt and with a few tweaks to the CMakeLists.txt in test/.

If we do not support building Clang without LLVM sources available, we should go ahead and enable the unit tests. If we do support building Clang without LLVM sources available, we should fix this!

Jordan

output.diff (863 Bytes)