Skip to content

Commit

Permalink
Put all compiler option to one place and unify them for all targets.
Browse files Browse the repository at this point in the history
(And fix a newly triggered warning in md2html/md2html.c.)
  • Loading branch information
mity committed Jan 26, 2024
1 parent 5178c58 commit ccff554
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 2 additions & 0 deletions md2html/md2html.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ccff554

Please sign in to comment.