Skip to content

Commit 30efed1

Browse files
committed
#2191 Check for minimum required Windows version
1 parent 0b3758e commit 30efed1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,16 @@ option(HTTPLIB_REQUIRE_ZSTD "Requires ZSTD to be found & linked, or fails build.
111111
option(HTTPLIB_USE_ZSTD_IF_AVAILABLE "Uses ZSTD (if available) to enable zstd support." ON)
112112
# Defaults to static library
113113
option(BUILD_SHARED_LIBS "Build the library as a shared library instead of static. Has no effect if using header-only." OFF)
114-
if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
114+
if(BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
115115
# Necessary for Windows if building shared libs
116116
# See https://stackoverflow.com/a/40743080
117117
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
118118
endif()
119119

120+
if( CMAKE_SYSTEM_NAME MATCHES "Windows" AND ${CMAKE_SYSTEM_VERSION} VERSION_LESS "10.0.0")
121+
message(SEND_ERROR "Windows ${CMAKE_SYSTEM_VERSION} or lower is not supported. Please use Windows 10 or later.")
122+
endif()
123+
120124
# Set some variables that are used in-tree and while building based on our options
121125
set(HTTPLIB_IS_COMPILED ${HTTPLIB_COMPILE})
122126
set(HTTPLIB_IS_USING_CERTS_FROM_MACOSX_KEYCHAIN ${HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN})
@@ -243,8 +247,8 @@ add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
243247
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} cxx_std_11)
244248

245249
target_include_directories(${PROJECT_NAME} SYSTEM ${_INTERFACE_OR_PUBLIC}
246-
$<BUILD_INTERFACE:${_httplib_build_includedir}>
247-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
250+
$<BUILD_INTERFACE:${_httplib_build_includedir}>
251+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
248252
)
249253

250254
# Always require threads
@@ -340,6 +344,6 @@ if(HTTPLIB_INSTALL)
340344
endif()
341345

342346
if(HTTPLIB_TEST)
343-
include(CTest)
344-
add_subdirectory(test)
347+
include(CTest)
348+
add_subdirectory(test)
345349
endif()

0 commit comments

Comments
 (0)