KWSys 2026-08-08 (ea3b2a5a)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit ea3b2a5a965edbc762ff8c3331742603d054bc37 (master).

Upstream Shortlog
-----------------

Brad King (3):
      badc3d09 Process: Fix compilation on Windows with WIN32_LEAN_AND_MEAN
      c54df4be cmake: Modernize add_definitions calls to add_compile_definitions
      1cda2290 cmake: Compile with WIN32_LEAN_AND_MEAN on Windows

Matthew Woehlke (2):
      d5b086a9 SystemTools: Fix compilation on Windows with WIN32_LEAN_AND_MEAN
      bd32c8f4 SystemInformation: Fix compilation on Windows with WIN32_LEAN_AND_MEAN
This commit is contained in:
KWSys Upstream
2026-08-08 10:31:38 -04:00
committed by Brad King
parent 0add8c6329
commit 40ee224f0a
5 changed files with 17 additions and 10 deletions

View File

@@ -879,22 +879,25 @@ endif()
# For building kwsys itself, we use a macro defined on the command
# line to configure the namespace in the C and C++ source files.
add_definitions("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
add_compile_definitions(KWSYS_NAMESPACE=${KWSYS_NAMESPACE})
# Disable deprecation warnings for standard C functions.
if(MSVC OR (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))))
add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_DEPRECATE
add_compile_definitions(
_CRT_NONSTDC_NO_DEPRECATE
_CRT_SECURE_NO_DEPRECATE
_CRT_SECURE_NO_WARNINGS
_SCL_SECURE_NO_DEPRECATE
)
endif()
if(WIN32)
# Help enforce the use of wide Windows apis.
add_definitions(-DUNICODE -D_UNICODE)
add_compile_definitions(UNICODE _UNICODE)
# Minimize "windows.h". We include granular Windows SDK headers as needed.
add_compile_definitions(WIN32_LEAN_AND_MEAN)
endif()
if(KWSYS_USE_String)

View File

@@ -30,6 +30,7 @@ a UNIX-style select system call.
#endif
#include <io.h> /* _unlink */
#include <stdio.h> /* snprintf */
#include <stdlib.h> /* malloc */
#include <string.h> /* strlen, strdup */
#ifndef _MAX_FNAME

View File

@@ -65,6 +65,7 @@
using siginfo_t = int;
# endif
# include <powerbase.h>
# include <winternl.h> // NTSTATUS
#else
# include <sys/types.h>

View File

@@ -1345,7 +1345,7 @@ bool SystemTools::FileExists(std::string const& filename)
return false;
}
byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
BYTE buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
DWORD bytesReturned = 0;
if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, nullptr, 0, buffer,
@@ -3091,7 +3091,7 @@ bool SystemTools::FileIsSymlinkWithAttr(std::wstring const& path,
if (hFile == INVALID_HANDLE_VALUE) {
return false;
}
byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
BYTE buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
DWORD bytesReturned = 0;
if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, nullptr, 0, buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned,
@@ -3157,7 +3157,7 @@ Status SystemTools::ReadSymlink(std::string const& newName,
if (hFile == INVALID_HANDLE_VALUE) {
return Status::Windows_GetLastError();
}
byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
BYTE buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
DWORD bytesReturned = 0;
Status status;
if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, nullptr, 0, buffer,

View File

@@ -23,6 +23,8 @@
#if defined(_WIN32)
# include <windows.h>
# include <shellapi.h>
#else
# include <signal.h>
# include <unistd.h>