OSDN Git Service

[CMake] Allow parent projects to use in-source builds
authorChris Bieneman <beanz@apple.com>
Thu, 19 Oct 2017 00:43:48 +0000 (00:43 +0000)
committerChris Bieneman <beanz@apple.com>
Thu, 19 Oct 2017 00:43:48 +0000 (00:43 +0000)
commitf3ed5282d73a489c737802eae61c07916151a5e6
treeff5fff3c3b962fe24394a51c94b6ee699f7e4a3c
parent2ce33a5dffc95368fb7d6faa5e6f4b9b5471c3b9
[CMake] Allow parent projects to use in-source builds

LLVM checks if it is performing an in-source build and then stop the
build. However, this check is also triggered if LLVM is being build as
part of a parent project, which prevents the parent project itself from
using in-source builds. For example, CMake allows a parent project to
specify the output of its subproject:

add_subdirectory(llvm llvm_build)

This tells CMake to conduct an out-tree build of LLVM, which without
this patch will still fails because what is being tested is the parent
project, not LLVM. This is fixed by using the "CURRENT" variable, which
is only concerned by the CMakeLists that is actually bein processed at
the moment.

Tests:
Ran `make check-llvm`.

Patch by Henrique Jung <henriquenj_AT_gmail_DOT_com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316142 91177308-0d34-0410-b5e6-96231b3b80d8
CMakeLists.txt