Adjust CLANG_BUILD_EXAMPLES to mean whether the examples are built
by default, rather than whether they may be built at all.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149037 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 019168f..25be7e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -246,10 +246,8 @@
 
 add_subdirectory(utils/TableGen)
 
-option(CLANG_BUILD_EXAMPLES "Build CLANG example programs." OFF)
-if(CLANG_BUILD_EXAMPLES)
-  add_subdirectory(examples)
-endif ()
+option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
+add_subdirectory(examples)
 
 add_subdirectory(include)
 add_subdirectory(lib)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 317bc81..7f4253a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,2 +1,6 @@
+if(NOT CLANG_BUILD_EXAMPLES)
+  set(EXCLUDE_FROM_ALL ON)
+endif()
+
 add_subdirectory(clang-interpreter)
 add_subdirectory(PrintFunctionNames)