mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2023-11-19 (8ce4c90d)
This commit is contained in:
@@ -298,14 +298,6 @@ endif()
|
|||||||
set(KWSYS_HEADER_INSTALL_DIR)
|
set(KWSYS_HEADER_INSTALL_DIR)
|
||||||
set(KWSYS_LIBRARY_INSTALL_DIR)
|
set(KWSYS_LIBRARY_INSTALL_DIR)
|
||||||
|
|
||||||
# Generated source files will need this header.
|
|
||||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
|
|
||||||
KWSYS_IN_SOURCE_BUILD)
|
|
||||||
if(NOT KWSYS_IN_SOURCE_BUILD)
|
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
|
|
||||||
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Select plugin module file name convention.
|
# Select plugin module file name convention.
|
||||||
if(NOT KWSYS_DynamicLoader_PREFIX)
|
if(NOT KWSYS_DynamicLoader_PREFIX)
|
||||||
set(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX})
|
set(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX})
|
||||||
|
|||||||
@@ -412,18 +412,6 @@ inline void Realpath(const std::string& path, std::string& resolved_path,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32) && defined(__COMO__)
|
|
||||||
// Hack for como strict mode to avoid defining _SVID_SOURCE or _BSD_SOURCE.
|
|
||||||
extern "C" {
|
|
||||||
extern FILE* popen(__const char* __command, __const char* __modes) __THROW;
|
|
||||||
extern int pclose(FILE* __stream) __THROW;
|
|
||||||
extern char* realpath(__const char* __restrict __name,
|
|
||||||
char* __restrict __resolved) __THROW;
|
|
||||||
extern char* strdup(__const char* __s) __THROW;
|
|
||||||
extern int putenv(char* __string) __THROW;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace KWSYS_NAMESPACE {
|
namespace KWSYS_NAMESPACE {
|
||||||
|
|
||||||
double SystemTools::GetTime()
|
double SystemTools::GetTime()
|
||||||
@@ -777,12 +765,16 @@ const char* SystemTools::GetEnv(const std::string& key)
|
|||||||
bool SystemTools::GetEnv(const char* key, std::string& result)
|
bool SystemTools::GetEnv(const char* key, std::string& result)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
const std::wstring wkey = Encoding::ToWide(key);
|
auto wide_key = Encoding::ToWide(key);
|
||||||
const wchar_t* wv = _wgetenv(wkey.c_str());
|
auto result_size = GetEnvironmentVariableW(wide_key.data(), nullptr, 0);
|
||||||
if (wv) {
|
if (result_size <= 0) {
|
||||||
result = Encoding::ToNarrow(wv);
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
std::wstring wide_result;
|
||||||
|
wide_result.resize(result_size - 1);
|
||||||
|
GetEnvironmentVariableW(wide_key.data(), &wide_result[0], result_size);
|
||||||
|
result = Encoding::ToNarrow(wide_result);
|
||||||
|
return true;
|
||||||
#else
|
#else
|
||||||
const char* v = getenv(key);
|
const char* v = getenv(key);
|
||||||
if (v) {
|
if (v) {
|
||||||
|
|||||||
Reference in New Issue
Block a user