Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
Replace /W compiler flag if it already exists to avoid compiler warning
  • Loading branch information
Auburn authored Mar 12, 2024
1 parent e9bb6ca commit 8563e16
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ endif()

if(MSVC)
add_compile_definitions(SDL_MAIN_HANDLED)
add_compile_options(/W4 /WX)
add_compile_options(/WX)
# replace existing /W to avoid warning
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
add_compile_options(/W4)
endif()
else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()
Expand Down Expand Up @@ -98,4 +104,4 @@ if(IMNODES_EXAMPLES)
else()
target_link_libraries(hello X11 Xext GL)
endif()
endif()
endif()

0 comments on commit 8563e16

Please sign in to comment.