[llvm-commits] [llvm] r85817 - /llvm/trunk/cmake/modules/LLVMProcessSources.cmake

Oscar Fuentes ofv at wanadoo.es
Mon Nov 2 11:11:03 PST 2009


Author: ofv
Date: Mon Nov  2 13:11:03 2009
New Revision: 85817

URL: http://llvm.org/viewvc/llvm-project?rev=85817&view=rev
Log:
CMake: Report an error if there is an unknown .cpp file in a source
directory.

This is useful in case someone who works with the config&make build
system forgot to add a file to its CMakeLists.txt. Instead of
obtaining undefined references at link time, cmake will complain at
configure time on the first build after a svn update.

Modified:
    llvm/trunk/cmake/modules/LLVMProcessSources.cmake

Modified: llvm/trunk/cmake/modules/LLVMProcessSources.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMProcessSources.cmake?rev=85817&r1=85816&r2=85817&view=diff

==============================================================================
--- llvm/trunk/cmake/modules/LLVMProcessSources.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMProcessSources.cmake Mon Nov  2 13:11:03 2009
@@ -22,6 +22,7 @@
 
 function(llvm_process_sources OUT_VAR)
   set( sources ${ARGN} )
+  llvm_check_source_file_list( ${sources} )
   # Create file dependencies on the tablegenned files, if any.  Seems
   # that this is not strictly needed, as dependencies of the .cpp
   # sources on the tablegenned .inc files are detected and handled,
@@ -37,3 +38,17 @@
   endif()
   set( ${OUT_VAR} ${sources} PARENT_SCOPE )
 endfunction(llvm_process_sources)
+
+
+function(llvm_check_source_file_list)
+  set(listed ${ARGN})
+  file(GLOB globbed *.cpp)
+  foreach(g ${globbed})
+    get_filename_component(fn ${g} NAME)
+    list(FIND listed ${fn} idx)
+    if( idx LESS 0 )
+      message(SEND_ERROR "Found unknown source file ${g}
+Please update ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt\n")
+    endif()
+  endforeach()
+endfunction(llvm_check_source_file_list)





More information about the llvm-commits mailing list