Skip to content

Commit c245df9

Browse files
authored
CMake corrections for building on Windows (#1122)
* Replace use of newer CMake builtins than in v3.0.0 Visual Studio generator will replace -D with /D. * Only use /Z7 flag on a Visual Studio compilator Flag is not available on a GNU compilator running on windows, like in a mingw64 setup.
1 parent 9c338a5 commit c245df9

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
@@ -41,7 +41,7 @@ SET(hiredis_sources
4141
SET(hiredis_sources ${hiredis_sources})
4242

4343
IF(WIN32)
44-
ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN)
44+
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN)
4545
ENDIF()
4646

4747
ADD_LIBRARY(hiredis SHARED ${hiredis_sources})
@@ -57,7 +57,7 @@ ENDIF()
5757
SET_TARGET_PROPERTIES(hiredis
5858
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE
5959
VERSION "${HIREDIS_SONAME}")
60-
IF(WIN32)
60+
IF(MSVC)
6161
SET_TARGET_PROPERTIES(hiredis_static
6262
PROPERTIES COMPILE_FLAGS /Z7)
6363
ENDIF()
@@ -178,7 +178,7 @@ IF(ENABLE_SSL)
178178
PROPERTIES
179179
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
180180
VERSION "${HIREDIS_SONAME}")
181-
IF(WIN32)
181+
IF(MSVC)
182182
SET_TARGET_PROPERTIES(hiredis_ssl_static
183183
PROPERTIES COMPILE_FLAGS /Z7)
184184
ENDIF()

0 commit comments

Comments
 (0)