----
-=== src/third_party/win32/getopt.*
+=== src/third_party/win32-compat/win32/getopt.*
This implementation of `getopt_long()` for Win32 was taken from
https://www.codeproject.com/Articles/157001/Full-getopt-Port-for-Unicode-and-Multibyte-Microso
https://www.gnu.org/licenses/lgpl-3.0.html.
-=== src/third_party/win32/mktemp.*
+=== src/third_party/win32-compat/win32/mktemp.*
This implementation of `mkstemp()` for Win32 was adapted from
<https://github.com/openbsd/src/blob/99b791d14c0f1858d87a0c33b55880fb9b00be66/lib/libc/stdio/mktemp.c>
----
-=== src/third_party/win32/winerror_to_errno.h
+=== src/third_party/win32-compat/win32/winerror_to_errno.h
The implementation of `winerror_to_errno()` was adapted from
<https://github.com/python/cpython/blob/1a79785e3e8fea80bcf6a800b45a04e06c787480/PC/errmap.h>
Threads::Threads
)
+if(WIN32)
+ target_link_libraries(ccache_framework PUBLIC win32_compat)
+endif()
+
get_filename_component(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
target_include_directories(ccache_framework PUBLIC ${CMAKE_BINARY_DIR} ${SRC_DIR})
add_library(third_party STATIC xxhash.c)
target_include_directories(third_party INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
-if(MSVC)
- target_sources(third_party PRIVATE win32/getopt.c)
- target_compile_definitions(third_party PUBLIC -DSTATIC_GETOPT)
-endif()
-
-if(WIN32)
- target_sources(third_party PRIVATE win32/mktemp.c)
-endif ()
-
-file(GLOB headers *.h nonstd/*.hpp win32/*.h)
-target_sources(third_party PRIVATE ${headers})
-
set(xxhdispatchtest [=[
#include "xxh_x86dispatch.c"
target_link_libraries(third_party PRIVATE standard_settings)
-if(WIN32)
- target_link_libraries(third_party PRIVATE ws2_32)
-endif()
-
# Silence warning from winbase.h due to /Zc:preprocessor.
if(MSVC)
target_compile_options(third_party PRIVATE /wd5105)
add_subdirectory(blake3)
add_subdirectory(cxxurl)
+add_subdirectory(win32-compat)
if(NOT TARGET dep_cpphttplib)
add_subdirectory(cpp-httplib)
--- /dev/null
+add_library(win32_compat STATIC EXCLUDE_FROM_ALL win32/mktemp.c)
+
+if(MSVC)
+ target_sources(win32_compat PRIVATE win32/getopt.c)
+ target_compile_definitions(win32_compat PUBLIC STATIC_GETOPT)
+endif()
+
+# Silence warning from winbase.h due to /Zc:preprocessor.
+if(MSVC)
+ target_compile_options(win32_compat PRIVATE /wd5105)
+endif()
+
+target_include_directories(win32_compat INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")