FreeRDP/cmake/DisableCompilerWarnings.cmake
Armin Novak d71af44bb1
[warnings] disable warnings for generated code
* Disable clang-tidy in test build directories
* Disable compiler warnings for test binary directories.

These contain generated code we can not change, so the warnings are just noise
2024-08-28 09:18:30 +02:00

22 lines
627 B
CMake

if (MSVC)
set(COMPILE_WARN_OPTS "/W0")
else()
set(COMPILE_WARN_OPTS "-w")
endif()
set(COMPILE_WARN_OPTS "${COMPILE_WARN_OPTS}" CACHE STRING "cached value")
function (disable_warnings_for_directory dir)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
set_property(
DIRECTORY "${dir}"
PROPERTY COMPILE_OPTIONS ${COMPILE_WARN_OPTS}
)
endif()
file(MAKE_DIRECTORY "${dir}")
set(ctidy "${dir}/.clang-tidy")
file(WRITE ${ctidy} "Checks: '-*,misc-definitions-in-headers'\n")
file(APPEND ${ctidy} "CheckOptions:\n")
file(APPEND ${ctidy} "\t- { key: HeaderFileExtensions, value: \"x\" }\n")
endfunction()