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

Cedric Venet cedric.venet at laposte.net
Sun Nov 2 08:28:54 PST 2008


Author: venet
Date: Sun Nov  2 10:28:53 2008
New Revision: 58566

URL: http://llvm.org/viewvc/llvm-project?rev=58566&view=rev
Log:
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.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=58566&r1=58565&r2=58566&view=diff

==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Sun Nov  2 10:28:53 2008
@@ -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)





More information about the cfe-commits mailing list