Commit 67ae45af authored by Tom Finegan's avatar Tom Finegan

cmake: Move compiler flag tests into aom_configure.cmake.

Make the flag tests more visible instead of hiding them in the cmake
include.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: I64cab909a08408d96b3c739e7dad3b231e2912fd
parent 03f6ca76
......@@ -21,6 +21,35 @@ include("${AOM_ROOT}/build/cmake/targets/${AOM_TARGET}.cmake")
include(FindGit)
include(FindPerl)
# Test compiler flags.
if (MSVC)
add_compiler_flag_if_supported("/W3")
# Disable MSVC warnings that suggest making code non-portable.
add_compiler_flag_if_supported("/wd4996")
if (ENABLE_WERROR)
add_compiler_flag_if_supported("/WX")
endif ()
else ()
add_compiler_flag_if_supported("-Wall")
add_compiler_flag_if_supported("-Wdeclaration-after-statement")
add_compiler_flag_if_supported("-Wdisabled-optimization")
add_compiler_flag_if_supported("-Wextra")
add_compiler_flag_if_supported("-Wfloat-conversion")
add_compiler_flag_if_supported("-Wimplicit-function-declaration")
add_compiler_flag_if_supported("-Wpointer-arith")
add_compiler_flag_if_supported("-Wshadow")
add_compiler_flag_if_supported("-Wsign-compare")
add_compiler_flag_if_supported("-Wtype-limits")
add_compiler_flag_if_supported("-Wuninitialized")
add_compiler_flag_if_supported("-Wunused")
add_compiler_flag_if_supported("-Wvla")
if (ENABLE_WERROR)
add_compiler_flag_if_supported("-Werror")
endif ()
# Flag(s) added here negate CMake defaults and produce build output similar
# to the existing configure/make build system.
add_compiler_flag_if_supported("-Wno-unused-function")
endif ()
# TODO(tomfinegan): consume trailing whitespace after configure_file() when
# target platform check produces empty INLINE and RESTRICT values (aka empty
......
......@@ -56,33 +56,3 @@ function (add_compiler_flag_if_supported flag)
add_c_flag_if_supported(${flag})
add_cxx_flag_if_supported(${flag})
endfunction ()
# Set warning levels.
if (MSVC)
add_compiler_flag_if_supported("/W3")
# Disable MSVC warnings that suggest making code non-portable.
add_compiler_flag_if_supported("/wd4996")
if (ENABLE_WERROR)
add_compiler_flag_if_supported("/WX")
endif ()
else ()
add_compiler_flag_if_supported("-Wall")
add_compiler_flag_if_supported("-Wdeclaration-after-statement")
add_compiler_flag_if_supported("-Wdisabled-optimization")
add_compiler_flag_if_supported("-Wextra")
add_compiler_flag_if_supported("-Wfloat-conversion")
add_compiler_flag_if_supported("-Wimplicit-function-declaration")
add_compiler_flag_if_supported("-Wpointer-arith")
add_compiler_flag_if_supported("-Wshadow")
add_compiler_flag_if_supported("-Wsign-compare")
add_compiler_flag_if_supported("-Wtype-limits")
add_compiler_flag_if_supported("-Wuninitialized")
add_compiler_flag_if_supported("-Wunused")
add_compiler_flag_if_supported("-Wvla")
if (ENABLE_WERROR)
add_compiler_flag_if_supported("-Werror")
endif ()
# Flag(s) added here negate CMake defaults and produce build output similar
# to the existing configure/make build system.
add_compiler_flag_if_supported("-Wno-unused-function")
endif ()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment