Imported Upstream version 3.23.4 upstream/3.23.4
authorJinWang An <jinwang.an@samsung.com>
Tue, 27 Dec 2022 08:20:17 +0000 (17:20 +0900)
committerJinWang An <jinwang.an@samsung.com>
Tue, 27 Dec 2022 08:20:17 +0000 (17:20 +0900)
Help/release/3.23.rst
Modules/FindCUDAToolkit.cmake
Modules/FindGTest.cmake
Source/CMakeVersion.cmake
Source/cmFileCommand.cxx
Source/cmStringAlgorithms.cxx
Source/cmStringAlgorithms.h
Tests/CMakeLib/testStringAlgorithms.cxx

index 18fd83b..594bb0b 100644 (file)
@@ -310,9 +310,9 @@ Changes made since CMake 3.23.0 include the following.
   The old ``CPACK_PACKAGEMAKER_CHOICES`` variable is now also set to the
   same content as it was before, but it is formally deprecated.
 
-3.23.3
-------
+3.23.3, 3.23.4
+--------------
 
-* This version made no changes to documented features or interfaces.
+* These versions made no changes to documented features or interfaces.
   Some implementation updates were made to support ecosystem changes
   and/or fix regressions.
index afdd4c4..f6dfc4f 100644 (file)
@@ -924,7 +924,7 @@ if(CUDAToolkit_FOUND)
   endif()
 
   _CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library
-  foreach (cuda_lib cublasLt cublas cufft curand cusparse nppc nvjpeg)
+  foreach (cuda_lib cublasLt cufft curand cusparse nppc nvjpeg)
     _CUDAToolkit_find_and_add_import_lib(${cuda_lib})
     _CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
   endforeach()
@@ -932,8 +932,11 @@ if(CUDAToolkit_FOUND)
   if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.0.0)
     # cublas depends on cublasLt
     # https://docs.nvidia.com/cuda/archive/11.0/cublas/index.html#static-library
-    _CUDAToolkit_find_and_add_import_lib(cublas DEPS cublasLt)
-    _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS cublasLt_static)
+    _CUDAToolkit_find_and_add_import_lib(cublas DEPS cublasLt culibos)
+    _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS cublasLt_static culibos)
+  else()
+    _CUDAToolkit_find_and_add_import_lib(cublas DEPS culibos)
+    _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS culibos)
   endif()
 
   # cuFFTW depends on cuFFT
@@ -944,25 +947,25 @@ if(CUDAToolkit_FOUND)
   endif()
 
   # cuSOLVER depends on cuBLAS, and cuSPARSE
-  _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse)
-  _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos)
-
-
-  if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
-    # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
-    # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
-    _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
-    _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_lapack_static)
-  endif()
-
+  set(cusolver_deps cublas cusparse)
+  set(cusolver_static_deps cublas_static cusparse_static culibos)
   if(CUDAToolkit_VERSION VERSION_GREATER 11.2.1)
     # cusolver depends on libcusolver_metis and cublasLt
     # https://docs.nvidia.com/cuda/archive/11.2.2/cusolver/index.html#link-dependency
-    _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublasLt)
-
+    list(APPEND cusolver_deps cublasLt)
     _CUDAToolkit_find_and_add_import_lib(cusolver_metis_static ALT metis_static) # implementation detail static lib
-    _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_metis_static cublasLt_static)
+    list(APPEND cusolver_static_deps cusolver_metis_static cublasLt_static)
+  endif()
+  if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
+    # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
+    # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
+    _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
+    list(APPEND cusolver_static_deps cusolver_lapack_static)
   endif()
+  _CUDAToolkit_find_and_add_import_lib(cusolver DEPS ${cusolver_deps})
+  _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS ${cusolver_static_deps})
+  unset(cusolver_deps)
+  unset(cusolver_static_deps)
 
   # nvGRAPH depends on cuRAND, and cuSOLVER.
   _CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver)
index 60bb401..92334e4 100644 (file)
@@ -314,7 +314,7 @@ if(GTest_FOUND)
     __gtest_define_backwards_compatible_library_targets()
 endif()
 
-if(GMock_FOUND)
+if(GMock_FOUND AND GTest_FOUND)
     if(NOT TARGET GTest::gmock)
         __gtest_determine_library_type(GMOCK_LIBRARY)
         add_library(GTest::gmock ${GMOCK_LIBRARY_TYPE} IMPORTED)
index f678659..bdc1b7d 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 23)
-set(CMake_VERSION_PATCH 3)
+set(CMake_VERSION_PATCH 4)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
@@ -21,7 +21,7 @@ endif()
 
 if(NOT CMake_VERSION_NO_GIT)
   # If this source was exported by 'git archive', use its commit info.
-  set(git_info [==[d566bd962d CMake 3.23.3]==])
+  set(git_info [==[34a6da34b8 CMake 3.23.4]==])
 
   # Otherwise, try to identify the current development source version.
   if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
index da2f15f..fb15a1b 100644 (file)
@@ -199,13 +199,19 @@ bool HandleReadCommand(std::vector<std::string> const& args,
   // is there a limit?
   std::string::size_type sizeLimit = std::string::npos;
   if (!arguments.Limit.empty()) {
-    std::istringstream(arguments.Limit) >> sizeLimit;
+    unsigned long long limit;
+    if (cmStrToULongLong(arguments.Limit, &limit)) {
+      sizeLimit = static_cast<std::string::size_type>(limit);
+    }
   }
 
   // is there an offset?
   cmsys::ifstream::off_type offset = 0;
   if (!arguments.Offset.empty()) {
-    std::istringstream(arguments.Offset) >> offset;
+    long long off;
+    if (cmStrToLongLong(arguments.Offset, &off)) {
+      offset = static_cast<cmsys::ifstream::off_type>(off);
+    }
   }
 
   file.seekg(offset, std::ios::beg); // explicit ios::beg for IBM VisualAge 6
index 1bb6808..f73c854 100644 (file)
@@ -250,6 +250,38 @@ bool cmStrToULong(std::string const& str, unsigned long* value)
   return cmStrToULong(str.c_str(), value);
 }
 
+bool cmStrToLongLong(const char* str, long long* value)
+{
+  errno = 0;
+  char* endp;
+  *value = strtoll(str, &endp, 10);
+  return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToLongLong(std::string const& str, long long* value)
+{
+  return cmStrToLongLong(str.c_str(), value);
+}
+
+bool cmStrToULongLong(const char* str, unsigned long long* value)
+{
+  errno = 0;
+  char* endp;
+  while (cmIsSpace(*str)) {
+    ++str;
+  }
+  if (*str == '-') {
+    return false;
+  }
+  *value = strtoull(str, &endp, 10);
+  return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToULongLong(std::string const& str, unsigned long long* value)
+{
+  return cmStrToULongLong(str.c_str(), value);
+}
+
 template <typename Range>
 std::size_t getJoinedLength(Range const& rng, cm::string_view separator)
 {
index 492e588..83938bc 100644 (file)
@@ -303,3 +303,13 @@ bool cmStrToLong(std::string const& str, long* value);
  * integer */
 bool cmStrToULong(const char* str, unsigned long* value);
 bool cmStrToULong(std::string const& str, unsigned long* value);
+
+/** Converts a string to long long. Expects that the whole string
+ * is an integer */
+bool cmStrToLongLong(const char* str, long long* value);
+bool cmStrToLongLong(std::string const& str, long long* value);
+
+/** Converts a string to unsigned long long. Expects that the whole string
+ * is an integer */
+bool cmStrToULongLong(const char* str, unsigned long long* value);
+bool cmStrToULongLong(std::string const& str, unsigned long long* value);
index c2706c1..1e6b611 100644 (file)
@@ -227,6 +227,41 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
   }
 
   // ----------------------------------------------------------------------
+  // Test cmStrToLongLong
+  {
+    long long value;
+    assert_ok(cmStrToLongLong("1", &value) && value == 1,
+              "cmStrToLongLong parses a positive decimal integer.");
+    assert_ok(cmStrToLongLong(" 1", &value) && value == 1,
+              "cmStrToLongLong parses a decimal integer after whitespace.");
+
+    assert_ok(cmStrToLongLong("-1", &value) && value == -1,
+              "cmStrToLongLong parses a negative decimal integer.");
+    assert_ok(
+      cmStrToLongLong(" -1", &value) && value == -1,
+      "cmStrToLongLong parses a negative decimal integer after whitespace.");
+
+    assert_ok(!cmStrToLongLong("1x", &value),
+              "cmStrToLongLong rejects trailing content.");
+  }
+
+  // ----------------------------------------------------------------------
+  // Test cmStrToULongLong
+  {
+    unsigned long long value;
+    assert_ok(cmStrToULongLong("1", &value) && value == 1,
+              "cmStrToULongLong parses a decimal integer.");
+    assert_ok(cmStrToULongLong(" 1", &value) && value == 1,
+              "cmStrToULongLong parses a decimal integer after whitespace.");
+    assert_ok(!cmStrToULongLong("-1", &value),
+              "cmStrToULongLong rejects a negative number.");
+    assert_ok(!cmStrToULongLong(" -1", &value),
+              "cmStrToULongLong rejects a negative number after whitespace.");
+    assert_ok(!cmStrToULongLong("1x", &value),
+              "cmStrToULongLong rejects trailing content.");
+  }
+
+  // ----------------------------------------------------------------------
   // Test cmStrLen
   {
     constexpr auto len = cmStrLen("Hello world!");