[llvm] r322349 - [CMake] Add LLVM_ENABLE_IDE option to better process sources for IDE's

Eric Fiselier via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 20:01:41 PST 2018


Author: ericwf
Date: Thu Jan 11 20:01:41 2018
New Revision: 322349

URL: http://llvm.org/viewvc/llvm-project?rev=322349&view=rev
Log:
[CMake] Add LLVM_ENABLE_IDE option to better process sources for IDE's

Summary:
Currently LLVM has no way to support configuring for IDE's like CLion. Like XCode and MSVC's IDE, CLion needs to see all of the headers and tablegen files in order to properly parse the sources.

This patch adds an `LLVM_ENABLE_IDE` option which can be used to configure for IDE's in general. It is used by `LLVMProcessSources.cmake` to determine if the extra source files should be added to the target.

Unfortunately because of the low level of `LLVMProcessSources.cmake`, I'm not sure where the `LLVM_ENABLE_IDE` option should live. I choose `HandleLLVMOptions.cmake` so that out-of-tree Clang builds would correctly configure the option by default.



Reviewers: beanz, mgorny, lebedev.ri

Reviewed By: beanz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D40219

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

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=322349&r1=322348&r2=322349&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Jan 11 20:01:41 2018
@@ -849,6 +849,13 @@ else()
   set(LLVM_ENABLE_PLUGINS ON)
 endif()
 
+set(LLVM_ENABLE_IDE_default OFF)
+if (XCODE OR MSVC_IDE OR CMAKE_EXTRA_GENERATOR)
+  set(LLVM_ENABLE_IDE_default ON)
+endif()
+option(LLVM_ENABLE_IDE "Generate targets and process sources for use with an IDE"
+    ${LLVM_ENABLE_IDE_default})
+
 function(get_compile_definitions)
   get_directory_property(top_dir_definitions DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
   foreach(definition ${top_dir_definitions})

Modified: llvm/trunk/cmake/modules/LLVMProcessSources.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMProcessSources.cmake?rev=322349&r1=322348&r2=322349&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMProcessSources.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMProcessSources.cmake Thu Jan 11 20:01:41 2018
@@ -52,7 +52,7 @@ function(llvm_process_sources OUT_VAR)
   cmake_parse_arguments(ARG "" "" "ADDITIONAL_HEADERS;ADDITIONAL_HEADER_DIRS" ${ARGN})
   set(sources ${ARG_UNPARSED_ARGUMENTS})
   llvm_check_source_file_list( ${sources} )
-  if( MSVC_IDE OR XCODE )
+  if( LLVM_ENABLE_IDE )
     # This adds .td and .h files to the Visual Studio solution:
     add_td_sources(sources)
     find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")




More information about the llvm-commits mailing list