[cfe-commits] r166505 - /cfe/trunk/CMakeLists.txt

Jordan Rose jordan_rose at apple.com
Tue Oct 23 14:54:03 PDT 2012


Author: jrose
Date: Tue Oct 23 16:54:03 2012
New Revision: 166505

URL: http://llvm.org/viewvc/llvm-project?rev=166505&view=rev
Log:
CMake: Fix public header search for generating Xcode/MSVC projects.

Previously, we only had support for one level of library under lib/,
with the existence of the two-level lib/StaticAnalyzer/* hardcoded in
the top-level CMakeLists.txt. This became a problem with split of
libRewrite into several libraries -- with the same sub-names as the
libraries in lib/StaticAnalyzer/.

Now, we match up anything under lib/ to the corresponding directory
in include/clang/.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=166505&r1=166504&r2=166505&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue Oct 23 16:54:03 2012
@@ -181,16 +181,26 @@
 macro(add_clang_library name)
   llvm_process_sources(srcs ${ARGN})
   if(MSVC_IDE OR XCODE)
-    string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
-    list( GET split_path -1 dir)
-    file( GLOB_RECURSE headers
-      ../../../include/clang/StaticAnalyzer${dir}/*.h
-      ../../../include/clang/StaticAnalyzer${dir}/*.td
-      ../../../include/clang/StaticAnalyzer${dir}/*.def
-      ../../include/clang${dir}/*.h
-      ../../include/clang${dir}/*.td
-      ../../include/clang${dir}/*.def)
-    set(srcs ${srcs} ${headers})
+    # Add public headers
+    file(RELATIVE_PATH lib_path
+      ${CLANG_SOURCE_DIR}/lib/
+      ${CMAKE_CURRENT_SOURCE_DIR}
+    )
+    if(NOT lib_path MATCHES "^[.][.]")
+      file( GLOB_RECURSE headers
+        ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.h
+        ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.def
+      )
+      set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
+
+      file( GLOB_RECURSE tds
+        ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.td
+      )
+      source_group("TableGen descriptions" FILES ${tds})
+      set_source_files_properties(${tds}} PROPERTIES HEADER_FILE_ONLY ON)
+
+      set(srcs ${srcs} ${headers} ${tds})
+    endif()
   endif(MSVC_IDE OR XCODE)
   if (MODULE)
     set(libkind MODULE)





More information about the cfe-commits mailing list