diff options
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Source/kwsys/ProcessUNIX.c | 6 | ||||
-rw-r--r-- | Source/kwsys/ProcessWin32.c | 2 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 27 | ||||
-rw-r--r-- | Source/kwsys/Terminal.c | 4 | ||||
-rw-r--r-- | Source/kwsys/testProcess.c | 4 | ||||
-rw-r--r-- | Source/kwsys/testSharedForward.c.in | 4 |
7 files changed, 47 insertions, 14 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 2253a83..af02f7f 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -88,17 +88,7 @@ # any outside mailing list and no documentation of the change will be # written. -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -foreach(p - CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature. - CMP0063 # CMake 3.3, Honor visibility properties for all target types. - CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature. - CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() +cmake_minimum_required(VERSION 3.9...3.22 FATAL_ERROR) # Some configure checks depend upon the deployment target. Clear checks when # the deployment target changes. @@ -1111,7 +1101,7 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") set(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0") - elseif(CMAKE_C_COMPILER_ID STREQUAL "XL") + elseif(CMAKE_C_COMPILER_ID MATCHES "^(XL|XLClang)$") # Tell IBM XL not to warn about our test infinite loop if(CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0" diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 19bf982..45a9e6f 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1,5 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ +#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__) +/* NOLINTNEXTLINE(bugprone-reserved-identifier) */ +# define _XOPEN_SOURCE 600 +#endif #include "kwsysPrivate.h" #include KWSYS_HEADER(Process.h) #include KWSYS_HEADER(System.h) @@ -1906,7 +1910,7 @@ static void kwsysProcessDestroy(kwsysProcess* cp) (errno == EINTR)) { } if (result > 0) { - /* This child has termianted. */ + /* This child has terminated. */ cp->ForkPIDs[i] = 0; if (--cp->CommandsLeft == 0) { /* All children have terminated. Close the signal pipe diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index e97973e..17e1507 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -2119,7 +2119,7 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int code, KWSYSPE_CASE(Fault, "In-page error"); break; case STATUS_INVALID_HANDLE: - KWSYSPE_CASE(Fault, "Invalid hanlde"); + KWSYSPE_CASE(Fault, "Invalid handle"); break; case STATUS_NONCONTINUABLE_EXCEPTION: KWSYSPE_CASE(Fault, "Noncontinuable exception"); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index c38b456..5889a4b 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -94,6 +94,13 @@ # include <linux/fs.h> #endif +#if defined(__APPLE__) && \ + (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0 >= 101200) +# define KWSYS_SYSTEMTOOLS_HAVE_MACOS_COPYFILE_CLONE +# include <copyfile.h> +# include <sys/stat.h> +#endif + // Windows API. #if defined(_WIN32) # include <windows.h> @@ -2474,6 +2481,26 @@ Status SystemTools::CloneFileContent(std::string const& source, close(out); return status; +#elif defined(__APPLE__) && \ + defined(KWSYS_SYSTEMTOOLS_HAVE_MACOS_COPYFILE_CLONE) + // NOTE: we cannot use `clonefile` as the {a,c,m}time for the file needs to + // be updated by `copy_file_if_different` and `copy_file`. + if (copyfile(source.c_str(), destination.c_str(), nullptr, + COPYFILE_METADATA | COPYFILE_CLONE) < 0) { + return Status::POSIX_errno(); + } +# if KWSYS_CXX_HAS_UTIMENSAT + // utimensat is only available on newer Unixes and macOS 10.13+ + if (utimensat(AT_FDCWD, destination.c_str(), nullptr, 0) < 0) { + return Status::POSIX_errno(); + } +# else + // fall back to utimes + if (utimes(destination.c_str(), nullptr) < 0) { + return Status::POSIX_errno(); + } +# endif + return Status::Success(); #else (void)source; (void)destination; diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index 20bb5fe..39081a7 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -1,5 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ +#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__) +/* NOLINTNEXTLINE(bugprone-reserved-identifier) */ +# define _XOPEN_SOURCE 600 +#endif #include "kwsysPrivate.h" #include KWSYS_HEADER(Terminal.h) diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index eed770c..fcc31da 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -1,5 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ +#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__) +/* NOLINTNEXTLINE(bugprone-reserved-identifier) */ +# define _XOPEN_SOURCE 600 +#endif #include "kwsysPrivate.h" #include KWSYS_HEADER(Process.h) #include KWSYS_HEADER(Encoding.h) diff --git a/Source/kwsys/testSharedForward.c.in b/Source/kwsys/testSharedForward.c.in index b3eb413..e909458 100644 --- a/Source/kwsys/testSharedForward.c.in +++ b/Source/kwsys/testSharedForward.c.in @@ -1,5 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ +#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__) +/* NOLINTNEXTLINE(bugprone-reserved-identifier) */ +# define _XOPEN_SOURCE 600 +#endif #if defined(CMAKE_INTDIR) # define CONFIG_DIR_PRE CMAKE_INTDIR "/" # define CONFIG_DIR_POST "/" CMAKE_INTDIR |