Skip to content

Commit

Permalink
cmake: enable /MP and /Wall on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Jun 25, 2024
1 parent 9f8795e commit 84e7255
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@ endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

if (NOT MSVC)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall")

# At least Ninja doesn't remove the /W3 flag when we add /W4|/Wall one, which
# leads to compilation warnings. Remove /W3 entirely, as /W4|/Wall be used.
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if (${flag_var} MATCHES "/W3")
string(REGEX REPLACE "/W3" "" ${flag_var} "${${flag_var}}")
endif()
endforeach()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-value -Wno-unused")
endif()

Expand Down

0 comments on commit 84e7255

Please sign in to comment.