From 90f8d9646f276e5faa6d26295266fe8ff397f45a Mon Sep 17 00:00:00 2001 From: Martin Mitas Date: Fri, 26 Jan 2024 10:23:36 +0100 Subject: [PATCH] Put all compiler option to one place and unify them for all targets. (And fix a newly triggered warning in md2html/md2html.c.) --- CMakeLists.txt | 5 +++-- md2html/md2html.c | 2 ++ src/CMakeLists.txt | 3 --- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a4be6e3..82fdf688 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,10 +41,11 @@ endif() if(${CMAKE_C_COMPILER_ID} MATCHES GNU|Clang) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + add_compile_options(-Wall -Wextra) elseif(MSVC) # Disable warnings about the so-called unsecured functions: - add_definitions(/D_CRT_SECURE_NO_WARNINGS /W3) + add_definitions(/D_CRT_SECURE_NO_WARNINGS) + add_compile_options(/W3) # Specify proper C runtime library: string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") diff --git a/md2html/md2html.c b/md2html/md2html.c index 57baa82a..de4ab18e 100644 --- a/md2html/md2html.c +++ b/md2html/md2html.c @@ -344,6 +344,8 @@ static const char* output_path = NULL; static int cmdline_callback(int opt, char const* value, void* data) { + (void) data; /* unused parameter */ + switch(opt) { case 0: if(input_path) { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66f2f501..767c259e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,9 +7,6 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") configure_file(md4c.pc.in md4c.pc @ONLY) add_library(md4c md4c.c md4c.h) -if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") - target_compile_options(md4c PRIVATE -Wall -Wextra) -endif() set_target_properties(md4c PROPERTIES COMPILE_FLAGS "-DMD4C_USE_UTF8" VERSION ${MD_VERSION}