Put all compiler option to one place and unify them for all targets. (And fix a newly triggered warning in md2html/md2html.c.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a4be6e..82fdf68 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 57baa82..de4ab18 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 66f2f50..767c259 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}