diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -105,7 +105,6 @@ set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) endif() - option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -72,7 +72,6 @@ if(LLVM_ENABLE_ZLIB) find_package(ZLIB REQUIRED) endif() - option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) if(CMAKE_COMPILER_IS_GNUCXX) set(USE_NO_MAYBE_UNINITIALIZED 1) diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -73,8 +73,6 @@ endif() if (EXISTS ${LLVM_CMAKE_PATH}) - # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions. - set(LLVM_ENABLE_WARNINGS ON) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") include("${LLVM_CMAKE_PATH}/AddLLVM.cmake") include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake") diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -399,7 +399,6 @@ list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) -option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -409,6 +409,8 @@ endif() endif() +option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) + if( MSVC ) include(ChooseMSVCCRT) diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in --- a/llvm/cmake/modules/LLVMConfig.cmake.in +++ b/llvm/cmake/modules/LLVMConfig.cmake.in @@ -36,6 +36,8 @@ set(LLVM_ABI_BREAKING_CHECKS @LLVM_ABI_BREAKING_CHECKS@) +set(LLVM_ENABLE_WARNINGS @LLVM_ENABLE_WARNINGS@) + set(LLVM_ENABLE_EXPENSIVE_CHECKS @LLVM_ENABLE_EXPENSIVE_CHECKS@) set(LLVM_ENABLE_ASSERTIONS @LLVM_ENABLE_ASSERTIONS@) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -105,10 +105,6 @@ # Avoid checking whether the compiler is working. set(LLVM_COMPILER_CHECKED ON) - # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions - # resulting in unjustified successes by check_cxx_compiler_flag. - set(LLVM_ENABLE_WARNINGS ON) - # Handle common options used by all runtimes. include(AddLLVM) include(HandleLLVMOptions)