libclang, examples: [CMake] Add dependencies to tblgen'd headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160849 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
index a31a8f6..ba6a350 100644
--- a/examples/PrintFunctionNames/CMakeLists.txt
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -4,6 +4,15 @@
 
 add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
 
+add_dependencies(PrintFunctionNames
+  ClangAttrClasses
+  ClangAttrList
+  ClangCommentNodes
+  ClangDeclNodes
+  ClangDiagnosticCommon
+  ClangStmtNodes
+  )
+
 target_link_libraries(PrintFunctionNames
   clangFrontend
   clangAST
diff --git a/examples/analyzer-plugin/CMakeLists.txt b/examples/analyzer-plugin/CMakeLists.txt
index 9ad5cac..ba73030 100644
--- a/examples/analyzer-plugin/CMakeLists.txt
+++ b/examples/analyzer-plugin/CMakeLists.txt
@@ -4,6 +4,15 @@
 
 add_clang_library(SampleAnalyzerPlugin MainCallChecker.cpp)
 
+add_dependencies(SampleAnalyzerPlugin
+  ClangAttrClasses
+  ClangAttrList
+  ClangCommentNodes
+  ClangDeclNodes
+  ClangDiagnosticCommon
+  ClangStmtNodes
+  )
+
 target_link_libraries(SampleAnalyzerPlugin
   clangStaticAnalyzerCore
   )
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 6270038..45f5e13 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -53,10 +53,22 @@
   clangBasic
   )
 
+set(GENERATED_HEADERS
+  ClangAttrClasses
+  ClangAttrList
+  ClangAttrParsedAttrList
+  ClangCommentNodes
+  ClangDiagnosticCommon
+  ClangDiagnosticFrontend
+  ClangDeclNodes
+  ClangStmtNodes
+  )
+
 if( LLVM_ENABLE_PIC )
   set(SHARED_LIBRARY TRUE)
   add_clang_library(libclang ${SOURCES})
   target_link_libraries(libclang ${LIBRARIES})
+  add_dependencies(libclang ${GENERATED_HEADERS})
 
   if(WIN32)
     set_target_properties(libclang
@@ -90,6 +102,7 @@
 if( NOT BUILD_SHARED_LIBS AND NOT WIN32 )
   add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})
   target_link_libraries(${LIBCLANG_STATIC_TARGET_NAME} ${LIBRARIES})
+  add_dependencies(${LIBCLANG_STATIC_TARGET_NAME} ${GENERATED_HEADERS})
 
   set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
     PROPERTIES