Skip to content

[cmake] Centralize LLVM_ENABLE_WARNINGS option #1991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
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)

Expand Down
1 change: 0 additions & 1 deletion flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
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)

include(CMakeParseArguments)
Expand Down
2 changes: 0 additions & 2 deletions libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_B
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")
Expand Down
1 change: 0 additions & 1 deletion llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ set(LLVM_TARGETS_TO_BUILD
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)
Expand Down
2 changes: 2 additions & 0 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ elseif(MINGW) # FIXME: Also cygwin?
endif()
endif()

option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)

if( MSVC )
include(ChooseMSVCCRT)

Expand Down
2 changes: 2 additions & 0 deletions llvm/cmake/modules/LLVMConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ set(TARGET_TRIPLE "@TARGET_TRIPLE@")

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@)
Expand Down
4 changes: 0 additions & 4 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# 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)
Expand Down