azure-sdk-for-cpp/cmake-modules/global_compile_options.cmake
Victor Vazquez b8d9d42e5a
Update Notice and add cgmanifest.json (#839)
* Update Notice and add cgmanifest.json
2020-11-18 11:44:22 -08:00

25 lines
819 B
CMake

# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
if(MSVC)
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "/WX")
endif()
#https://stackoverflow.com/questions/37527946/warning-unreferenced-inline-function-has-been-removed
add_compile_options(/W4 ${WARNINGS_AS_ERRORS_FLAG} /wd5031 /wd4668 /wd4820 /wd4255 /wd4710 /analyze)
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
endif()
add_compile_options(-Xclang -Wall -Wextra -pedantic ${WARNINGS_AS_ERRORS_FLAG} -Wdocumentation -Wdocumentation-unknown-command -Wcast-qual)
else()
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
endif()
add_compile_options(-Wall -Wextra -pedantic ${WARNINGS_AS_ERRORS_FLAG})
endif()