CMake: Include private headers / tablegen files in generated Xcode projects.
[oota-llvm.git] / cmake / modules / LLVMProcessSources.cmake
index 270292ad3b863673ad7b1eba1d2c7bcba572f40e..2cef6cfc3a30ec8e1f5aa265021c65e84fbe493a 100644 (file)
@@ -29,7 +29,7 @@ endmacro(add_td_sources)
 
 
 macro(add_header_files srcs)
-  file(GLOB hds *.h *.def)
+  file(GLOB hds *.h)
   if( hds )
     set_source_files_properties(${hds} PROPERTIES HEADER_FILE_ONLY ON)
     list(APPEND ${srcs} ${hds})
@@ -48,15 +48,16 @@ function(llvm_process_sources OUT_VAR)
     set( f ${CMAKE_CURRENT_SOURCE_DIR}/${s} )
     add_file_dependencies( ${f} ${TABLEGEN_OUTPUT} )
   endforeach(s)
-  if( MSVC_IDE )
+  if( MSVC_IDE OR XCODE )
     # This adds .td and .h files to the Visual Studio solution:
+    # FIXME: Shall we handle *.def here?
     add_td_sources(sources)
     add_header_files(sources)
   endif()
 
   # Set common compiler options:
   if( NOT LLVM_REQUIRES_EH )
-    if( CMAKE_COMPILER_IS_GNUCXX )
+    if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
       add_definitions( -fno-exceptions )
     elseif( MSVC )
       llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/EHsc" "/EHs-c-")
@@ -64,7 +65,7 @@ function(llvm_process_sources OUT_VAR)
     endif()
   endif()
   if( NOT LLVM_REQUIRES_RTTI )
-    if( CMAKE_COMPILER_IS_GNUCXX )
+    if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
       llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
     elseif( MSVC )
       llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
@@ -81,10 +82,13 @@ function(llvm_check_source_file_list)
   file(GLOB globbed *.cpp)
   foreach(g ${globbed})
     get_filename_component(fn ${g} NAME)
-    list(FIND listed ${fn} idx)
+    list(FIND LLVM_OPTIONAL_SOURCES ${fn} idx)
     if( idx LESS 0 )
-      message(SEND_ERROR "Found unknown source file ${g}
+      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()
     endif()
   endforeach()
 endfunction(llvm_check_source_file_list)