cmake: build with -Wdocumentation

This commit is contained in:
Anonymous Maarten authored and Anonymous Maarten committed 2023-08-09 02:53:48 +02:00
1 parent e5f3b22d63
commit fcae9cd210
5 files changed
+91 -27

No files matched your search

+27 -1
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.0...3.5)
project(SDL2_test)
include(CheckCCompilerFlag)
@@ -20,6 +20,32 @@ macro(add_sdl_test_executable TARGET)
if(AST_NEEDS_RESOURCES)
list(APPEND SDL_TESTS_NEEDS_ESOURCES ${TARGET})
endif()
if(HAVE_GCC_WDOCUMENTATION)
target_compile_options(${TARGET} PRIVATE "-Wdocumentation")
if(HAVE_GCC_WERROR_DOCUMENTATION)
target_compile_options(${TARGET} PRIVATE "-Werror=documentation")
endif()
endif()
if(HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND)
if(SDL_WERROR)
if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND)
target_compile_options(${TARGET} PRIVATE "-Werror=documentation-unknown-command")
endif()
endif()
target_compile_options(${TARGET} PRIVATE "-Wdocumentation-unknown-command")
endif()
if(HAVE_GCC_COMMENT_BLOCK_COMMANDS)
target_compile_options(${TARGET} PRIVATE "-fcomment-block-commands=threadsafety")
target_compile_options(${TARGET} PRIVATE "-fcomment-block-commands=deprecated")
else()
if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS)
target_compile_options(${TARGET} PRIVATE "/clang:-fcomment-block-commands=threadsafety")
target_compile_options(${TARGET} PRIVATE "/clang:-fcomment-block-commands=deprecated")
endif()
endif()
endmacro()
if(NOT TARGET SDL2::SDL2-static)