Skip to content

Commit

Permalink
cmake: set _WIN32_WINNT when compiling with mingw
Browse files Browse the repository at this point in the history
This should fix #569

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Jul 23, 2020
1 parent 9b4b492 commit b80ae01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ elseif (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
endif()
endif()

# Per http://www.mingw.org/wiki/Use_more_recent_defined_functions
if (MINGW)
# Build for Vista and above
# check mingw-w64-headers/include/w32api.h
set(CMAKE_C_FLAGS "-D_WIN32_WINNT=0x600 ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-DWINVER=0x600 ${CMAKE_C_FLAGS}")
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter")
else()
Expand Down

0 comments on commit b80ae01

Please sign in to comment.