diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-10-23 21:54:03 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-23 21:54:03 +0000 |
commit | 340d0d30018dd3ed77fb17f33e785acd745bf97d (patch) | |
tree | 21702519af92c078bbb66ed24841fc234982f469 /CMakeLists.txt | |
parent | a7a38cb64e0781b8489332cedcfae9c8f95ba22e (diff) |
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
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f4fa1cb5d..53d4165cae 100644 --- a/CMakeLists.txt +++ b/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) |