mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00

__attribute__((unused)) does emit that warning if a variable is used. The C23/C++17 version [[maybe_unused]] does not, so drop the warning to have consistency
48 lines
1.6 KiB
CMake
48 lines
1.6 KiB
CMake
include(CheckAndSetFlag)
|
|
|
|
option(ENABLE_WARNING_VERBOSE "enable -Weveryting (and some exceptions) for compile" OFF)
|
|
option(ENABLE_WARNING_ERROR "enable -Werror for compile" OFF)
|
|
|
|
set(COMMON_COMPILER_FLAGS "")
|
|
if(ENABLE_WARNING_VERBOSE)
|
|
if(MSVC)
|
|
list(APPEND COMMON_COMPILER_FLAGS /W4 /wo4324)
|
|
else()
|
|
list(
|
|
APPEND
|
|
COMMON_COMPILER_FLAGS
|
|
-Weverything
|
|
-Wall
|
|
-Wpedantic
|
|
-Wno-padded
|
|
-Wno-switch-enum
|
|
-Wno-cast-align
|
|
-Wno-unsafe-buffer-usage
|
|
-Wno-reserved-identifier
|
|
-Wno-covered-switch-default
|
|
-Wno-disabled-macro-expansion
|
|
-Wno-used-but-marked-unused
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
if(ENABLE_WARNING_ERROR)
|
|
list(APPEND COMMON_COMPILER_FLAGS -Werror)
|
|
endif()
|
|
|
|
list(APPEND COMMON_COMPILER_FLAGS -fno-omit-frame-pointer -Wredundant-decls)
|
|
|
|
include(ExportAllSymbols)
|
|
include(CompilerSanitizerOptions)
|
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang.*" OR (CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION
|
|
VERSION_GREATER_EQUAL 10)
|
|
)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>)
|
|
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>)
|
|
endif()
|