diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 68e122e7d9..af172293ff 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -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) diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index 07e19cdb2e..6e269638b5 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -30,6 +30,7 @@ a UNIX-style select system call. #endif #include /* _unlink */ #include /* snprintf */ +#include /* malloc */ #include /* strlen, strdup */ #ifndef _MAX_FNAME diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 743c224437..96dff616cc 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -65,6 +65,7 @@ using siginfo_t = int; # endif # include +# include // NTSTATUS #else # include diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 0e64be4aa3..b260e38701 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -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, diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 1ab746b7a1..4ce259f839 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -23,6 +23,8 @@ #if defined(_WIN32) # include + +# include #else # include # include