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.

llvm-svn: 58566
This commit is contained in:
Cedric Venet 2008-11-02 16:28:53 +00:00
parent de297f8198
commit 1bb549685b
1 changed files with 16 additions and 2 deletions

View File

@ -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 @@ macro(add_clang_library name)
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)