Add header files to CMake build solution. It use globing so it doesn't need to be manually maintained, but it won't automatically detect a new header. I think this is a good compromise for the header files, since there presence in the solution is just an help for the user. Moreover, a new header is often introduced with a new cpp source file which need a makefile change, which will regenerate the solution and detect the new header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58566 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ccc1158..a033a9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,14 @@
macro(add_clang_library name)
- add_library( ${name} ${ARGN} )
+ set(srcs ${ARGN})
+ if(MSVC_IDE)
+ file( GLOB_RECURSE headers *.h)
+ set(srcs ${srcs} ${headers})
+ string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
+ list( GET split_path -1 dir)
+ file( GLOB_RECURSE headers ../../include/clang${dir}/*.h)
+ set(srcs ${srcs} ${headers})
+ endif(MSVC_IDE)
+ add_library( ${name} ${srcs} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
@@ -9,7 +18,12 @@
endmacro(add_clang_library)
macro(add_clang_executable name)
- add_llvm_executable( ${name} ${ARGN} )
+ set(srcs ${ARGN})
+ if(MSVC_IDE)
+ file( GLOB_RECURSE headers *.h)
+ set(srcs ${srcs} ${headers})
+ endif(MSVC_IDE)
+ add_llvm_executable( ${name} ${srcs} )
install(TARGETS ${name}
RUNTIME DESTINATION bin)
endmacro(add_clang_executable)