mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Allow building with cmake --compile-no-warning-as-error. (#2401)
In CMake 3.24+, there is built-in support for adding -Werror that does not require adding -Werror explicitly, and allows it to be downgraded to a warning if the user wants that. Use this, to account for warnings that have false positives.
This commit is contained in:
@@ -100,7 +100,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang"
|
||||
add_cxx_flag_if_supported(-Wmisleading-indentation)
|
||||
add_cxx_flag_if_supported(-Wunused-function)
|
||||
add_cxx_flag_if_supported(-Wunused-variable)
|
||||
add_cxx_flag_if_supported(-Werror)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
||||
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
||||
else()
|
||||
add_cxx_flag_if_supported(-Werror)
|
||||
endif()
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo|MinSizeRel")
|
||||
# Enable more warnings if not doing a release build.
|
||||
add_cxx_flag_if_supported(-Wall)
|
||||
|
||||
Reference in New Issue
Block a user