From b8adf90aa3aa03e9a32b281767746e9b8503dcea Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 26 Jan 2023 00:43:39 +0100 Subject: [PATCH] cmake: check again for unknown documentation commands --- CMakeLists.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b6460bac..afc700330 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -578,10 +578,26 @@ if(USE_GCC OR USE_CLANG) endif() endif() target_compile_options(sdl-global-options INTERFACE "-Wdocumentation") + endif() - check_c_compiler_flag(-fcomment-block-commands=threadsafety HAVE_GCC_COMMENT_BLOCK_COMMANDS) - if(HAVE_GCC_COMMENT_BLOCK_COMMANDS) - target_compile_options(sdl-global-options INTERFACE "-fcomment-block-commands=threadsafety") + check_c_compiler_flag(-Wdocumentation-unknown-command HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND) + if(HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND) + if(SDL_WERROR) + check_c_compiler_flag(-Werror=documentation-unknown-command HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND) + if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND) + target_compile_options(sdl-global-options INTERFACE "-Werror=documentation-unknown-command") + endif() + endif() + target_compile_options(sdl-global-options INTERFACE "-Wdocumentation-unknown-command") + endif() + + check_c_compiler_flag(-fcomment-block-commands=threadsafety HAVE_GCC_COMMENT_BLOCK_COMMANDS) + if(HAVE_GCC_COMMENT_BLOCK_COMMANDS) + target_compile_options(sdl-global-options INTERFACE "-fcomment-block-commands=threadsafety") + else() + check_c_compiler_flag(/clang:-fcomment-block-commands=threadsafety HAVE_CLANG_COMMENT_BLOCK_COMMANDS) + if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS) + target_compile_options(sdl-global-options INTERFACE "/clang:-fcomment-block-commands=threadsafety") endif() endif()