Skip to content
Browse files

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/.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166505 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
1 parent a7a38cb commit 340d0d30018dd3ed77fb17f33e785acd745bf97d @jrose-apple jrose-apple committed Oct 23, 2012
Showing with 20 additions and 10 deletions.
  1. +20 −10 CMakeLists.txt
View
30 CMakeLists.txt
@@ -181,16 +181,26 @@ endfunction(clang_tablegen)
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)

0 comments on commit 340d0d3

Please sign in to comment.
Something went wrong with that request. Please try again.