Merge branch 'upstream-KWSys' into update-kwsys

# By KWSys Upstream
* upstream-KWSys:
  KWSys 2025-03-01 (1d82baee)
This commit is contained in:
Brad King 2025-03-01 10:06:13 -05:00
commit 547c42b294
2 changed files with 9 additions and 4 deletions

View File

@ -173,6 +173,9 @@ if(KWSYS_USE_Process)
set(KWSYS_USE_System 1)
set(KWSYS_USE_Encoding 1)
endif()
if(KWSYS_USE_Status)
set(KWSYS_USE_Encoding 1)
endif()
if(KWSYS_USE_SystemInformation)
set(KWSYS_USE_Process 1)
endif()

View File

@ -2,10 +2,12 @@
file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Status.hxx)
#include KWSYS_HEADER(Encoding.hxx)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Encoding.hxx.in"
# include "Status.hxx.in"
#endif
@ -43,13 +45,13 @@ std::string Status::GetString() const
break;
#ifdef _WIN32
case Kind::Windows: {
LPSTR message = NULL;
DWORD size = FormatMessageA(
LPWSTR message = NULL;
DWORD size = FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, this->Windows_, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&message, 0, NULL);
err = std::string(message, size);
(LPWSTR)&message, 0, NULL);
err = kwsys::Encoding::ToNarrow(message);
LocalFree(message);
} break;
#endif