diff --git a/CMakeLists.txt b/CMakeLists.txt index f84b551..c4c8d50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -98,4 +104,4 @@ if(IMNODES_EXAMPLES) else() target_link_libraries(hello X11 Xext GL) endif() -endif() \ No newline at end of file +endif()