Skip to content

Commit 42450ce

Browse files
authored
CMake: Fix wrong MSVC related conditions (#981)
Fix #980 MSVC and GCC/Clang use different style for command line options. We should use "MSVC" not "WIN32" for detecting MSVC. If we use "WIN32", mingw-w64 also uses MSVC style command line options because "WIN32" is true for both of MSVC and mingw-w64.
1 parent f530729 commit 42450ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ set(H3_COMPILE_FLAGS "")
101101
set(H3_LINK_FLAGS "")
102102
option(ENABLE_WARNINGS "Enables compiler warnings" ON)
103103
if(ENABLE_WARNINGS)
104-
if(WIN32)
104+
if(MSVC)
105105
list(APPEND H3_COMPILE_FLAGS /W2)
106106
else()
107107
list(APPEND H3_COMPILE_FLAGS -Wall)
108108
endif()
109109
endif()
110110

111-
if(NOT WIN32)
111+
if(NOT MSVC)
112112
# Compiler options are set only on non-Windows, since these options are not
113113
# correct for MSVC.
114114
list(
@@ -134,7 +134,7 @@ endif()
134134

135135
option(WARNINGS_AS_ERRORS "Warnings are treated as errors" OFF)
136136
if(WARNINGS_AS_ERRORS)
137-
if(WIN32)
137+
if(MSVC)
138138
list(APPEND H3_COMPILE_FLAGS /WX)
139139
else()
140140
list(APPEND H3_COMPILE_FLAGS -Werror)

0 commit comments

Comments
 (0)