Significantly change the way we build ASan unittests in CMake
build tree. Now just-built Clang is used to:
  1) compile instrumented sources (as before);
  2) compile non-instrumented sources;
  3) compile our own instrumented version of googletest;
  4) link it all together using -fsanitize=address flag
     (instead of trying to copy linker behavior in
      CMake build rules).

This makes ASan unittests pretty much self-consistent
and independent of other LLVM libraries.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@170541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4544f15..bbf41f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,14 @@
 # runtime libraries.
 cmake_minimum_required(VERSION 2.8.8)
 
+# Add path for custom modules
+set(CMAKE_MODULE_PATH
+  ${CMAKE_MODULE_PATH}
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
+  )
+
+set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
 # FIXME: Below we assume that the target build of LLVM/Clang is x86, which is
 # not at all valid. Much of this can be fixed just by switching to use
 # a just-built-clang binary for the compiles.