From: Alexander Alekhin Date: Mon, 11 Nov 2019 20:19:40 +0000 (+0000) Subject: cmake: set _WIN32_WINNT for Windows 7 API X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~55^2~8^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af92a517a793726f9a810bf78b9ef19900a07e14;p=platform%2Fupstream%2Fopencv.git cmake: set _WIN32_WINNT for Windows 7 API --- diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index f7fd48b..e5bcaf7 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -383,6 +383,19 @@ if(MSVC) add_definitions(-D_VARIADIC_MAX=10) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_directory_property(__DIRECTORY_COMPILE_DEFINITIONS COMPILE_DEFINITIONS) + if((NOT " ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${OPENCV_EXTRA_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS_RELEASE} ${__DIRECTORY_COMPILE_DEFINITIONS}" MATCHES "_WIN32_WINNT" + AND NOT OPENCV_CMAKE_SKIP_MACRO_WIN32_WINNT) + OR OPENCV_CMAKE_FORCE_MACRO_WIN32_WINNT + ) + # https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt + # Target Windows 7 API + set(OPENCV_CMAKE_MACRO_WIN32_WINNT "0x0601" CACHE STRING "Value of _WIN32_WINNT macro") + add_definitions(-D_WIN32_WINNT=${OPENCV_CMAKE_MACRO_WIN32_WINNT}) + endif() +endif() + # Enable compiler options for OpenCV modules/apps/samples only (ignore 3rdparty) macro(ocv_add_modules_compiler_options) if(MSVC AND NOT OPENCV_SKIP_MSVC_W4_OPTION)