Imported Upstream version 3.12.2 upstream/3.12.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:13:27 +0000 (09:13 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:13:27 +0000 (09:13 +0900)
21 files changed:
Help/variable/CMAKE_ANDROID_STL_TYPE.rst
Help/variable/CMAKE_LANG_CLANG_TIDY.rst
Modules/CMakeCUDAInformation.cmake
Modules/CheckIPOSupported.cmake
Modules/FindBoost.cmake
Modules/FindCUDA.cmake
Modules/FindMatlab.cmake
Modules/Platform/Android-Common.cmake
Modules/Platform/Android/Determine-Compiler-NDK.cmake
Modules/Platform/Windows-NVIDIA-CUDA.cmake
Source/CMakeVersion.cmake
Source/cmExportFileGenerator.cxx
Source/cmGlobVerificationManager.cxx
Source/cmGlobVerificationManager.h
Source/cmState.cxx
Source/cmVisualStudio10TargetGenerator.cxx
Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
Tests/RunCMake/Android/RunCMakeTest.cmake
Tests/RunCMake/Android/common.cmake
Tests/RunCMake/export/ExportPropertiesUndefined.cmake [new file with mode: 0644]
Tests/RunCMake/export/RunCMakeTest.cmake

index cfb76aa..d174575 100644 (file)
@@ -30,7 +30,8 @@ set to specify the STL variant to be used.  The value may be one of:
 ``stlport_shared``
   STLport Shared
 
-The default value is ``gnustl_static``.  Note that this default differs from
+The default value is ``gnustl_static`` on NDK versions that provide it
+and otherwise ``c++_static``.  Note that this default differs from
 the native NDK build system because CMake may be used to build projects for
 Android that are not natively implemented for it and use the C++ standard
 library.
index d1fccbb..bd49de3 100644 (file)
@@ -9,5 +9,5 @@ created.  For example:
 
 .. code-block:: cmake
 
-  set(CMAKE_CXX_CLANG_TIDY clang-tidy checks=-*,readability-*)
+  set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=-*,readability-*)
   add_executable(foo foo.cxx)
index 8e62941..43ae989 100644 (file)
@@ -185,7 +185,7 @@ if(__IMPLICT_DLINK_DIRS)
 endif()
 set(__IMPLICT_DLINK_FLAGS )
 foreach(dir ${__IMPLICT_DLINK_DIRS})
-  if(EXISTS "${dir}/libcublas_device.a")
+  if(EXISTS "${dir}/libcurand_static.a")
     string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
   endif()
 endforeach()
index d8297d9..3344834 100644 (file)
@@ -56,13 +56,14 @@ include(CMakeParseArguments) # cmake_parse_arguments
 # X_RESULT - name of the final result variable
 # X_OUTPUT - name of the variable with information about error
 macro(_ipo_not_supported output)
-  string(COMPARE EQUAL "${X_RESULT}" "" is_empty)
-  if(is_empty)
+  if(NOT X_RESULT)
     message(FATAL_ERROR "IPO is not supported (${output}).")
   endif()
 
   set("${X_RESULT}" NO PARENT_SCOPE)
-  set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+  if(X_OUTPUT)
+    set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+  endif()
 endmacro()
 
 # Run IPO/LTO test
@@ -125,7 +126,13 @@ macro(_ipo_run_language_check language)
   )
 
   if(NOT result)
-    _ipo_not_supported("${output}")
+    file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+      "${language} compiler IPO check failed with the following output:\n"
+      "${output}\n")
+    _ipo_not_supported("check failed to compile")
+    if(X_OUTPUT)
+      set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+    endif()
     return()
   endif()
 endmacro()
index 4e5c45d..d5e7011 100644 (file)
@@ -881,7 +881,11 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
   set(_Boost_CHRONO_HEADERS              "boost/chrono.hpp")
   set(_Boost_CONTAINER_HEADERS           "boost/container/container_fwd.hpp")
   set(_Boost_CONTRACT_HEADERS            "boost/contract.hpp")
-  set(_Boost_CONTEXT_HEADERS             "boost/context/detail/fcontext.hpp")
+  if(Boost_VERSION VERSION_LESS 106100)
+    set(_Boost_CONTEXT_HEADERS           "boost/context/all.hpp")
+  else()
+    set(_Boost_CONTEXT_HEADERS           "boost/context/detail/fcontext.hpp")
+  endif()
   set(_Boost_COROUTINE_HEADERS           "boost/coroutine/all.hpp")
   set(_Boost_DATE_TIME_HEADERS           "boost/date_time/date.hpp")
   set(_Boost_EXCEPTION_HEADERS           "boost/exception/exception.hpp")
index 21cace3..1650e55 100644 (file)
@@ -971,7 +971,8 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2")
     find_cuda_helper_libs(nvcuvid)
   endif()
 endif()
-if(CUDA_VERSION VERSION_GREATER "5.0")
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CUDA_VERSION VERSION_LESS "9.2")
+  # In CUDA 9.2 cublas_device was deprecated
   find_cuda_helper_libs(cublas_device)
 endif()
 
index 54e62db..2d04b84 100644 (file)
@@ -1218,21 +1218,6 @@ function(_Matlab_find_instances_win32 matlab_roots)
 
   # filtering the results with the registry keys
   matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
-  unset(_matlab_versions_from_registry)
-
-  set(_matlab_versions_from_registry)
-  matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry)
-
-  # the returned list is empty, doing the search on all known versions
-  if(NOT _matlab_versions_from_registry)
-    if(MATLAB_FIND_DEBUG)
-      message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions")
-    endif()
-    extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry)
-  endif()
-
-  # filtering the results with the registry keys
-  matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
   set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE)
 
 endfunction()
index 80a8f41..f8b9346 100644 (file)
@@ -32,8 +32,10 @@ if(CMAKE_ANDROID_NDK)
         )
     endif()
     unset(_ANDROID_STL_TYPE_FOUND)
-  else()
+  elseif(IS_DIRECTORY ${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++)
     set(CMAKE_ANDROID_STL_TYPE "gnustl_static")
+  else()
+    set(CMAKE_ANDROID_STL_TYPE "c++_static")
   endif()
 
   unset(_ANDROID_STL_TYPES)
index 0649925..5f2cc52 100644 (file)
@@ -35,7 +35,18 @@ elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
   endif()
   set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}")
 else()
-  set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+  # If we can find any gcc toolchains then use one by default.
+  # Otherwise we look for clang toolchains (e.g. NDK r18+).
+  file(GLOB _ANDROID_CONFIG_MKS_FOR_GCC
+    "${CMAKE_ANDROID_NDK}/build/core/toolchains/*-[0-9].[0-9]/config.mk"
+    "${CMAKE_ANDROID_NDK}/toolchains/*-[0-9].[0-9]/config.mk"
+    )
+  if(_ANDROID_CONFIG_MKS_FOR_GCC)
+    set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+  else()
+    set(_ANDROID_TOOL_PATTERNS "*-clang")
+  endif()
+  unset(_ANDROID_CONFIG_MKS_FOR_GCC)
 endif()
 set(_ANDROID_CONFIG_MK_PATTERNS)
 foreach(base "build/core/toolchains" "toolchains")
index f1c1f2d..ba1638f 100644 (file)
@@ -44,7 +44,7 @@ if(__IMPLICT_DLINK_DIRS)
 endif()
 set(__IMPLICT_DLINK_FLAGS )
 foreach(dir ${__IMPLICT_DLINK_DIRS})
-  if(EXISTS "${dir}/cublas_device.lib")
+  if(EXISTS "${dir}/curand_static.lib")
     string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
   endif()
 endforeach()
index a1343ae..e236d31 100644 (file)
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 12)
-set(CMake_VERSION_PATCH 1)
+set(CMake_VERSION_PATCH 2)
 #set(CMake_VERSION_RC 0)
index 5f61571..9e6560f 100644 (file)
@@ -1143,6 +1143,11 @@ bool cmExportFileGenerator::PopulateExportProperties(
         return false;
       }
       auto propertyValue = targetProperties.GetPropertyValue(prop);
+      if (propertyValue == nullptr) {
+        // Asked to export a property that isn't defined on the target. Do not
+        // consider this an error, there's just nothing to export.
+        continue;
+      }
       std::string evaluatedValue = cmGeneratorExpression::Preprocess(
         propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
       if (evaluatedValue != propertyValue) {
index e23b6ea..189b517 100644 (file)
@@ -170,3 +170,10 @@ void cmGlobVerificationManager::AddCacheEntry(
     value.Backtraces.emplace_back(variable, backtrace);
   }
 }
+
+void cmGlobVerificationManager::Reset()
+{
+  this->Cache.clear();
+  this->VerifyScript.clear();
+  this->VerifyStamp.clear();
+}
index 4508602..cf04c97 100644 (file)
@@ -37,6 +37,9 @@ protected:
                      const std::string& variable,
                      const cmListFileBacktrace& bt);
 
+  ///! Clear the glob cache for state reset.
+  void Reset();
+
   ///! Check targets should be written in generated build system.
   bool DoWriteVerifyTarget() const;
 
index a57be4d..b2f6091 100644 (file)
@@ -267,6 +267,7 @@ cmStateSnapshot cmState::Reset()
 {
   this->GlobalProperties.clear();
   this->PropertyDefinitions.clear();
+  this->GlobVerificationManager->Reset();
 
   cmStateDetail::PositionType pos = this->SnapshotData.Truncate();
   this->ExecutionListFiles.Truncate();
index eff915b..f472d8a 100644 (file)
@@ -1207,7 +1207,11 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands(Elem& e0)
       this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
     if (cmSourceFile const* sf =
           this->LocalGenerator->CreateVCProjBuildRule()) {
-      this->WriteCustomCommand(e0, sf);
+      // Write directly rather than through WriteCustomCommand because
+      // we do not want the de-duplication and it has no dependencies.
+      if (cmCustomCommand const* command = sf->GetCustomCommand()) {
+        this->WriteCustomRule(e0, sf, *command);
+      }
     }
   }
 }
index 7eecec1..2c7c388 100644 (file)
@@ -3,6 +3,9 @@
 #include <cuda_runtime.h>
 #include <iostream>
 
+// this test only makes sense for versions of CUDA that ships
+// static libraries that have separable compilation device symbols
+#if __CUDACC_VER_MAJOR__ <= 9
 __global__ void deviceCublasSgemm(int n, float alpha, float beta,
                                   const float* d_A, const float* d_B,
                                   float* d_C)
@@ -22,6 +25,7 @@ __global__ void deviceCublasSgemm(int n, float alpha, float beta,
 
   cublasDestroy(cnpHandle);
 }
+#endif
 
 int choose_cuda_device()
 {
@@ -63,6 +67,7 @@ int main(int argc, char** argv)
     return 0;
   }
 
+#if __CUDACC_VER_MAJOR__ <= 9
   // initial values that will make sure that the cublasSgemm won't actually
   // do any work
   int n = 0;
@@ -72,6 +77,7 @@ int main(int argc, char** argv)
   float* d_B = nullptr;
   float* d_C = nullptr;
   deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C);
+#endif
 
   return 0;
 }
index 2027c4f..45798ce 100644 (file)
@@ -61,8 +61,12 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK)
       list(APPEND _abis_${_version} ${_abis})
     endif()
   endforeach()
-  set(_abis_ ${_abis_${_latest_gcc}})
   set(_abis_clang ${_abis_${_latest_clang}})
+  if(_latest_gcc)
+    set(_abis_ ${_abis_${_latest_gcc}})
+  else()
+    set(_abis_ ${_abis_clang})
+  endif()
   if(_versions MATCHES "clang")
     set(_versions "clang" ${_versions})
   endif()
@@ -132,10 +136,11 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK)
   set(stl_types
     none
     system
-    gnustl_static
-    gnustl_shared
     )
 
+  if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gnu-libstdc++")
+    list(APPEND stl_types gnustl_static gnustl_shared)
+  endif()
   if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs")
     list(APPEND stl_types gabi++_static gabi++_shared)
   endif()
index f931be1..aaa7c89 100644 (file)
@@ -8,7 +8,6 @@ endif()
 foreach(f
     "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}"
     "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
-    "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
     "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
     "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
     )
@@ -61,10 +60,12 @@ execute_process(
 if(NOT _res EQUAL 0)
   message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}")
 endif()
-if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}")
+string(REPLACE "--" "-" _out_check "${_out}")
+if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
+    AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi"))
   message(SEND_ERROR "'gcc -dumpmachine' produced:\n"
     " ${_out}\n"
-    "which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
+    "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
     " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
     )
 endif()
diff --git a/Tests/RunCMake/export/ExportPropertiesUndefined.cmake b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake
new file mode 100644 (file)
index 0000000..aa529f2
--- /dev/null
@@ -0,0 +1,11 @@
+enable_language(CXX)
+add_library(foo empty.cpp)
+set_target_properties(foo PROPERTIES
+  EXPORT_PROPERTIES "NotDefinedProp"
+)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+)
index 10ced90..46bb1fc 100644 (file)
@@ -8,3 +8,4 @@ run_cmake(NoExportSet)
 run_cmake(ForbiddenToExportInterfaceProperties)
 run_cmake(ForbiddenToExportImportedProperties)
 run_cmake(ForbiddenToExportPropertyWithGenExp)
+run_cmake(ExportPropertiesUndefined)