[llvm] r344553 - [CMake] Change the default value of LLVM_ENABLE_IDE

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 15 14:14:19 PDT 2018


Author: cbieneman
Date: Mon Oct 15 14:14:19 2018
New Revision: 344553

URL: http://llvm.org/viewvc/llvm-project?rev=344553&view=rev
Log:
[CMake] Change the default value of LLVM_ENABLE_IDE

There really aren't any generator behaviors that we need to take `CMAKE_EXTRA_GENERATOR` into account for. Where we need to take different behaviors for IDEs is mostly in enabling or disabling certain build system features that are optional but trip up the IDE UIs. Like the generation of lots of utility targets.

By changing the LLVM_ENABLE_IDE default to only being on for multi-configuration generators, we allow gating where it will impact the UI presentation, while also supporting optionally disabling the generation if your tooling workflow encounters problems. Presently being able to manually disable extra target generation is useful for Visual Studio 2017's CMake integration where the IDE has trouble displaying and working with the large number of optional targets.

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

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=344553&r1=344552&r2=344553&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Mon Oct 15 14:14:19 2018
@@ -868,16 +868,19 @@ else()
   set(LLVM_ENABLE_PLUGINS ON)
 endif()
 
-# Remove LLVM_ENABLE_IDE from the CMake cache. This is a temporary change to
-# allow CMake caches to be cleaned up so that we can change the default for this
-# option and how it is used.
-unset(LLVM_ENABLE_IDE CACHE)
-#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})
+# By default we should enable LLVM_ENABLE_IDE only for multi-configuration
+# generators. This option disables optional build system features that make IDEs
+# less usable.
+set(LLVM_ENABLE_IDE_default OFF)
+if (CMAKE_CONFIGURATION_TYPES)
+  set(LLVM_ENABLE_IDE_default ON)
+endif()
+option(LLVM_ENABLE_IDE
+       "Disable optional build system features that cause problems for IDE generators"
+       ${LLVM_ENABLE_IDE_default})
+if (CMAKE_CONFIGURATION_TYPES AND NOT LLVM_ENABLE_IDE)
+  message(WARNING "Disabling LLVM_ENABLE_IDE on multi-configuration generators is not recommended.")
+endif()
 
 function(get_compile_definitions)
   get_directory_property(top_dir_definitions DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)




More information about the llvm-commits mailing list