From 5fd5950165436fa80ded291a790f39426611f60f Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Tue, 3 Dec 2024 22:57:57 +0000 Subject: [PATCH] [cmake] Switch index store flag to opt-in Enabling by default for debug builds is problematic for those using sccache since it prevents caching. Switch to being opt-in for those that need it. --- llvm/cmake/modules/HandleLLVMOptions.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index efecad660f5ac..1eabe9678096b 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -910,9 +910,9 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT LLVM_ENABLE_WARNINGS) append("-w" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) endif() -# Enable '-index-store-path' on a Debug build, if the compiler supports it and for non-IDE generators. -option(LLVM_DISABLE_INDEX_STORE "Disable '-index-store-path' flag" Off) -if (NOT LLVM_DISABLE_INDEX_STORE AND NOT XCODE AND NOT MSVC_IDE AND uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") +# Allow enabling '-index-store-path' for non-IDE generators if the compiler supports it. +option(LLVM_ENABLE_INDEX_STORE "Enable '-index-store-path' flag" Off) +if (LLVM_ENABLE_INDEX_STORE AND NOT XCODE AND NOT MSVC_IDE) set(INDEX_DATA_STORE_PATH "${PROJECT_BINARY_DIR}/IndexStore" CACHE STRING "Index store path") check_c_compiler_flag("-Werror -index-store-path \"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/IndexStore\"" "C_SUPPORTS_INDEX_STORE")