Skip to content

Commit

Permalink
Merge pull request #574 from analogdevicesinc/rgetz-fix-mingw-settings
Browse files Browse the repository at this point in the history
cmake: set _WIN32_WINNT when compiling with mingw
  • Loading branch information
dNechita authored Jul 24, 2020
2 parents 9b4b492 + d3be2ee commit ee40329
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ 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 or windows sdkddkver.h
# https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
# using a hex value is bad - but stops from loading the otherwise unnecessary headers
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 ee40329

Please sign in to comment.