[Cmake-commits] CMake branch, master, updated. v3.15.0-rc2-143-g1009fd1

Kitware Robot kwrobot at kitware.com
Tue Jun 25 07:23:03 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  1009fd18604e7670838ed28798b83312eff1b0f0 (commit)
       via  dba8086f58484f545c053a3c5175ec75df8a817f (commit)
       via  56e89e50d3dc4a971ed9d7195834e1233658c08e (commit)
       via  51bcdeb17fc2bde72850507a2ee7b35493c2067b (commit)
       via  5e52de7d5708c5d2faf00837bf5f10ed024cced1 (commit)
      from  92351fe7cd73a756effd5a42ff7f04c2d9beaf88 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1009fd18604e7670838ed28798b83312eff1b0f0
commit 1009fd18604e7670838ed28798b83312eff1b0f0
Merge: dba8086 56e89e5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 25 11:15:25 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Jun 25 07:15:33 2019 -0400

    Merge topic 'matlab-if'
    
    56e89e50d3 FindMatlab: simplify several if()-constructs
    51bcdeb17f Tests: simplify checks for Matlab variables being set
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3472


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dba8086f58484f545c053a3c5175ec75df8a817f
commit dba8086f58484f545c053a3c5175ec75df8a817f
Merge: 92351fe 5e52de7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 25 11:13:29 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Jun 25 07:13:38 2019 -0400

    Merge topic 'refactor/use-unique_ptr'
    
    5e52de7d57 modermize: replace some raw pointers w/ `unique_ptr`
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3465


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56e89e50d3dc4a971ed9d7195834e1233658c08e
commit 56e89e50d3dc4a971ed9d7195834e1233658c08e
Author:     Rolf Eike Beer <eb at emlix.com>
AuthorDate: Mon Jun 24 16:24:47 2019 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Mon Jun 24 18:33:48 2019 +0200

    FindMatlab: simplify several if()-constructs

diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 3547642..c95a512 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -224,6 +224,9 @@ Reference
   this list.
 #]=======================================================================]
 
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
 set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}")
 
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
@@ -395,7 +398,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
       )
 
 
-    if(${resultMatlab} EQUAL 0)
+    if(resultMatlab EQUAL 0)
 
       string(
         REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)"
@@ -612,9 +615,10 @@ function(matlab_get_mex_suffix matlab_root mex_suffix)
     OUTPUT_VARIABLE _matlab_mex_extension
     #RESULT_VARIABLE _matlab_mex_extension_call
     ERROR_VARIABLE _matlab_mex_extension_error
+    OUTPUT_STRIP_TRAILING_WHITESPACE
     ${devnull})
 
-  if(NOT "${_matlab_mex_extension_error}" STREQUAL "")
+  if(_matlab_mex_extension_error)
     if(WIN32)
       # this is only for intel architecture
       if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -700,7 +704,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
     ${devnull}
     )
 
-  if("${_matlab_result_version_call}" MATCHES "timeout")
+  if(_matlab_result_version_call MATCHES "timeout")
     if(MATLAB_FIND_DEBUG)
       message(WARNING "[MATLAB] Unable to determine the version of Matlab."
         " Matlab call timed out after 120 seconds.")
@@ -955,14 +959,14 @@ function(matlab_add_mex)
     set(${prefix}_OUTPUT_NAME ${${prefix}_NAME})
   endif()
 
-  if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, add version source file
+  if(NOT Matlab_VERSION_STRING VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, add version source file
     # TODO: check the file extensions in ${${prefix}_SRC} to see if they're C or C++ files
     # Currently, the C and C++ versions of the version files are identical, so this doesn't matter.
     set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/c_mexapi_version.c")
     #set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/cpp_mexapi_version.cpp")
   endif()
 
-  if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.4") # For 9.4 (R2018a) and newer, add API macro
+  if(NOT Matlab_VERSION_STRING VERSION_LESS "9.4") # For 9.4 (R2018a) and newer, add API macro
     if(${${prefix}_R2018a})
       set(MEX_API_MACRO "MATLAB_DEFAULT_RELEASE=R2018a")
     else()
@@ -1023,7 +1027,7 @@ function(matlab_add_mex)
     if (MSVC)
 
       set(_link_flags "${_link_flags} /EXPORT:mexFunction")
-      if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, export version
+      if(NOT Matlab_VERSION_STRING VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, export version
         set(_link_flags "${_link_flags} /EXPORT:mexfilerequiredapiversion")
       endif()
 
@@ -1042,13 +1046,13 @@ function(matlab_add_mex)
 
   else()
 
-    if(${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For versions prior to 9.1 (R2016b)
+    if(Matlab_VERSION_STRING VERSION_LESS "9.1") # For versions prior to 9.1 (R2016b)
       set(_ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/mexFunction.map)
     else()                                          # For 9.1 (R2016b) and newer
       set(_ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/c_exportsmexfileversion.map)
     endif()
 
-    if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.5") # For 9.5 (R2018b) (and newer?)
+    if(NOT Matlab_VERSION_STRING VERSION_LESS "9.5") # For 9.5 (R2018b) (and newer?)
       target_compile_options(${${prefix}_NAME} PRIVATE "-fvisibility=default")
       # This one is weird, it might be a bug in <mex.h> for R2018b. When compiling with
       # -fvisibility=hidden, the symbol `mexFunction` cannot be exported. Reading the
@@ -1112,14 +1116,14 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
   #  set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version")
   #endif()
 
-  if(NOT ${matlab_known_version} STREQUAL "NOTFOUND")
+  if(NOT matlab_known_version STREQUAL "NOTFOUND")
     # the version is known, we just return it
     set(${matlab_final_version} ${matlab_known_version} PARENT_SCOPE)
     set(Matlab_VERSION_STRING_INTERNAL ${matlab_known_version} CACHE INTERNAL "Matlab version (automatically determined)" FORCE)
     return()
   endif()
 
-  if("${matlab_or_mcr}" STREQUAL "UNKNOWN")
+  if(matlab_or_mcr STREQUAL "UNKNOWN")
     if(MATLAB_FIND_DEBUG)
       message(WARNING "[MATLAB] Determining Matlab or MCR")
     endif()
@@ -1134,10 +1138,10 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
 
       # default fallback to Matlab
       set(matlab_or_mcr "MATLAB")
-      if(NOT "${CMAKE_MATCH_1}" STREQUAL "")
+      if(NOT CMAKE_MATCH_1 STREQUAL "")
         string(TOLOWER "${CMAKE_MATCH_1}" product_reg_match)
 
-        if("${product_reg_match}" STREQUAL "matlab runtime")
+        if(product_reg_match STREQUAL "matlab runtime")
           set(matlab_or_mcr "MCR")
         endif()
       endif()
@@ -1151,7 +1155,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
   # UNKNOWN is the default behaviour in case we
   # - have an erroneous matlab_root
   # - have an initial 'UNKNOWN'
-  if("${matlab_or_mcr}" STREQUAL "MATLAB" OR "${matlab_or_mcr}" STREQUAL "UNKNOWN")
+  if(matlab_or_mcr STREQUAL "MATLAB" OR matlab_or_mcr STREQUAL "UNKNOWN")
     # MATLAB versions
     set(_matlab_current_program ${Matlab_MAIN_PROGRAM})
 
@@ -1203,7 +1207,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
     matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions)
 
     list(LENGTH matlab_list_of_all_versions list_of_all_versions_length)
-    if(${list_of_all_versions_length} GREATER 0)
+    if(list_of_all_versions_length GREATER 0)
       list(GET matlab_list_of_all_versions 0 _matlab_version_tmp)
     else()
       set(_matlab_version_tmp "unknown")
@@ -1213,7 +1217,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
     set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE)
 
     # warning, just in case several versions found (should not happen)
-    if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG)
+    if((list_of_all_versions_length GREATER 1) AND MATLAB_FIND_DEBUG)
       message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})")
     endif()
 
@@ -1233,10 +1237,8 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
              ${versioninfo_string}
             )
 
-      if(NOT "${version_reg_match}" STREQUAL "")
-        if("${CMAKE_MATCH_1}" MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*")
-          set(_matlab_version_tmp "${CMAKE_MATCH_1}")
-        endif()
+      if(CMAKE_MATCH_1 MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*")
+        set(_matlab_version_tmp "${CMAKE_MATCH_1}")
       endif()
     endif()
     set(${matlab_final_version} "${_matlab_version_tmp}" PARENT_SCOPE)
@@ -1615,8 +1617,7 @@ list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
 list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
 
 # component Mex Compiler
-list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler)
-if(_matlab_find_mex_compiler GREATER -1)
+if("MEX_COMPILER" IN_LIST Matlab_FIND_COMPONENTS)
   find_program(
     Matlab_MEX_COMPILER
     "mex"
@@ -1628,11 +1629,9 @@ if(_matlab_find_mex_compiler GREATER -1)
     set(Matlab_MEX_COMPILER_FOUND TRUE)
   endif()
 endif()
-unset(_matlab_find_mex_compiler)
 
 # component Matlab program
-list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
-if(_matlab_find_matlab_program GREATER -1)
+if("MAIN_PROGRAM" IN_LIST Matlab_FIND_COMPONENTS)
   find_program(
     Matlab_MAIN_PROGRAM
     matlab
@@ -1644,7 +1643,6 @@ if(_matlab_find_matlab_program GREATER -1)
     set(Matlab_MAIN_PROGRAM_FOUND TRUE)
   endif()
 endif()
-unset(_matlab_find_matlab_program)
 
 # The MX library is required
 _Matlab_find_library(
@@ -1792,3 +1790,5 @@ if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES)
     Matlab_MEX_EXTENSION
   )
 endif()
+
+cmake_policy(POP)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51bcdeb17fc2bde72850507a2ee7b35493c2067b
commit 51bcdeb17fc2bde72850507a2ee7b35493c2067b
Author:     Rolf Eike Beer <eb at emlix.com>
AuthorDate: Mon Jun 24 16:07:38 2019 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Mon Jun 24 18:33:43 2019 +0200

    Tests: simplify checks for Matlab variables being set

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 920af04..4fab127 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1591,16 +1591,16 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
   # CMake_TEST_FindMatlab_ROOT_DIR: indicates an optional root directory for Matlab, allows to select a version.
   # CMake_TEST_FindMatlab_MCR: indicates the MCR is installed
   # CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux
-  if(CMake_TEST_FindMatlab OR (NOT "${CMake_TEST_FindMatlab_ROOT_DIR}" STREQUAL "") OR
-     CMake_TEST_FindMatlab_MCR OR (NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL ""))
+  if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR
+     CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
     set(FindMatlab_additional_test_options )
-    if(CMake_TEST_FindMatlab_MCR OR NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "")
+    if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
       set(FindMatlab_additional_test_options -DIS_MCR=TRUE)
     endif()
-    if(NOT "${CMake_TEST_FindMatlab_ROOT_DIR}" STREQUAL "")
+    if(CMake_TEST_FindMatlab_ROOT_DIR)
       set(FindMatlab_additional_test_options ${FindMatlab_additional_test_options} "-DMatlab_ROOT_DIR=${CMake_TEST_FindMatlab_ROOT_DIR}")
     endif()
-    if(NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "")
+    if(CMake_TEST_FindMatlab_MCR_ROOT_DIR)
       set(FindMatlab_additional_test_options ${FindMatlab_additional_test_options} "-DMCR_ROOT:FILEPATH=${CMake_TEST_FindMatlab_MCR_ROOT_DIR}")
     endif()
     set(FindMatlab.basic_checks_BUILD_OPTIONS ${FindMatlab_additional_test_options})

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e52de7d5708c5d2faf00837bf5f10ed024cced1
commit 5e52de7d5708c5d2faf00837bf5f10ed024cced1
Author:     Alex Turbov <i.zaufi at gmail.com>
AuthorDate: Fri Jun 21 03:41:48 2019 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jun 24 09:36:09 2019 -0400

    modermize: replace some raw pointers w/ `unique_ptr`

diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 186deb6..a7618c7 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -202,7 +202,6 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
 cmComputeLinkDepends::~cmComputeLinkDepends()
 {
   cmDeleteAll(this->InferredDependSets);
-  delete this->CCG;
 }
 
 void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
@@ -632,7 +631,8 @@ void cmComputeLinkDepends::OrderLinkEntires()
   // the same order in which the items were originally discovered in
   // the BFS.  This should preserve the original order when no
   // constraints disallow it.
-  this->CCG = new cmComputeComponentGraph(this->EntryConstraintGraph);
+  this->CCG =
+    cm::make_unique<cmComputeComponentGraph>(this->EntryConstraintGraph);
 
   // The component graph is guaranteed to be acyclic.  Start a DFS
   // from every entry to compute a topological order for the
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index dfaaf8b..0b1f00c 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -137,7 +137,7 @@ private:
     std::set<int> Entries;
   };
   std::map<int, PendingComponent> PendingComponents;
-  cmComputeComponentGraph* CCG;
+  std::unique_ptr<cmComputeComponentGraph> CCG;
   std::vector<int> FinalLinkOrder;
   void DisplayComponents();
   void VisitComponent(unsigned int c);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index df0f33f..b250dd7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -92,7 +92,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
   // how long to let try compiles run
   this->TryCompileTimeout = cmDuration::zero();
 
-  this->ExtraGenerator = nullptr;
   this->CurrentConfigureMakefile = nullptr;
   this->TryCompileOuterMakefile = nullptr;
 
@@ -113,7 +112,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
 cmGlobalGenerator::~cmGlobalGenerator()
 {
   this->ClearGeneratorMembers();
-  delete this->ExtraGenerator;
 }
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1499,7 +1497,7 @@ void cmGlobalGenerator::Generate()
 
   this->WriteSummary();
 
-  if (this->ExtraGenerator != nullptr) {
+  if (this->ExtraGenerator) {
     this->ExtraGenerator->Generate();
   }
 
@@ -2720,8 +2718,8 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
 void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
   cmExternalMakefileProjectGenerator* extraGenerator)
 {
-  this->ExtraGenerator = extraGenerator;
-  if (this->ExtraGenerator != nullptr) {
+  this->ExtraGenerator.reset(extraGenerator);
+  if (this->ExtraGenerator) {
     this->ExtraGenerator->SetGlobalGenerator(this);
   }
 }
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index db96489..7fd5433 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -618,7 +618,7 @@ private:
 
   void ComputeBuildFileGenerators();
 
-  cmExternalMakefileProjectGenerator* ExtraGenerator;
+  std::unique_ptr<cmExternalMakefileProjectGenerator> ExtraGenerator;
 
   // track files replaced during a Generate
   std::vector<std::string> FilesReplacedDuringGenerate;
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index d4af1e0..ac6dce9 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -2,9 +2,9 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMachO.h"
 
+#include "cmAlgorithms.h"
 #include "cmsys/FStream.hxx"
-#include <algorithm>
-#include <stddef.h>
+#include <cstddef>
 #include <string>
 #include <vector>
 
@@ -120,7 +120,7 @@ protected:
 
 // Implementation for reading Mach-O header and load commands.
 // This is 32 or 64 bit arch specific.
-template <class T>
+template <typename T>
 class cmMachOHeaderAndLoadCommandsImpl : public cmMachOHeaderAndLoadCommands
 {
 public:
@@ -306,15 +306,11 @@ bool cmMachOInternal::read_mach_o(uint32_t file_offset)
 // External class implementation.
 
 cmMachO::cmMachO(const char* fname)
-  : Internal(nullptr)
+  : Internal(cm::make_unique<cmMachOInternal>(fname))
 {
-  this->Internal = new cmMachOInternal(fname);
 }
 
-cmMachO::~cmMachO()
-{
-  delete this->Internal;
-}
+cmMachO::~cmMachO() = default;
 
 std::string const& cmMachO::GetErrorMessage() const
 {
diff --git a/Source/cmMachO.h b/Source/cmMachO.h
index 5482465..0c44b55 100644
--- a/Source/cmMachO.h
+++ b/Source/cmMachO.h
@@ -41,7 +41,7 @@ public:
 private:
   friend class cmMachOInternal;
   bool Valid() const;
-  cmMachOInternal* Internal;
+  std::unique_ptr<cmMachOInternal> Internal;
 };
 
 #endif
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 091c2e0..587cda5 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -23,14 +23,12 @@
 
 cmState::cmState()
 {
-  this->CacheManager = new cmCacheManager;
-  this->GlobVerificationManager = new cmGlobVerificationManager;
+  this->CacheManager = cm::make_unique<cmCacheManager>();
+  this->GlobVerificationManager = cm::make_unique<cmGlobVerificationManager>();
 }
 
 cmState::~cmState()
 {
-  delete this->CacheManager;
-  delete this->GlobVerificationManager;
   cmDeleteAll(this->BuiltinCommands);
   cmDeleteAll(this->ScriptedCommands);
 }
diff --git a/Source/cmState.h b/Source/cmState.h
index 6abe71c..accd838 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -211,8 +211,8 @@ private:
   std::map<std::string, cmCommand*> BuiltinCommands;
   std::map<std::string, cmCommand*> ScriptedCommands;
   cmPropertyMap GlobalProperties;
-  cmCacheManager* CacheManager;
-  cmGlobVerificationManager* GlobVerificationManager;
+  std::unique_ptr<cmCacheManager> CacheManager;
+  std::unique_ptr<cmGlobVerificationManager> GlobVerificationManager;
 
   cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>
     BuildsystemDirectory;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3772f09..8f2f86d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -141,12 +141,12 @@ cmake::cmake(Role role, cmState::Mode mode)
   this->DebugOutput = false;
   this->DebugTryCompile = false;
   this->ClearBuildSystem = false;
-  this->FileTimeCache = new cmFileTimeCache;
+  this->FileTimeCache = cm::make_unique<cmFileTimeCache>();
 
-  this->State = new cmState;
+  this->State = cm::make_unique<cmState>();
   this->State->SetMode(mode);
   this->CurrentSnapshot = this->State->CreateBaseSnapshot();
-  this->Messenger = new cmMessenger;
+  this->Messenger = cm::make_unique<cmMessenger>();
 
 #ifdef __APPLE__
   struct rlimit rlp;
@@ -165,7 +165,7 @@ cmake::cmake(Role role, cmState::Mode mode)
   this->CurrentWorkingMode = NORMAL_MODE;
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
-  this->VariableWatch = new cmVariableWatch;
+  this->VariableWatch = cm::make_unique<cmVariableWatch>();
 #endif
 
   this->AddDefaultGenerators();
@@ -222,17 +222,11 @@ cmake::cmake(Role role, cmState::Mode mode)
 
 cmake::~cmake()
 {
-  delete this->State;
-  delete this->Messenger;
   if (this->GlobalGenerator) {
     delete this->GlobalGenerator;
     this->GlobalGenerator = nullptr;
   }
   cmDeleteAll(this->Generators);
-#ifdef CMAKE_BUILD_WITH_CMAKE
-  delete this->VariableWatch;
-#endif
-  delete this->FileTimeCache;
 }
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -460,7 +454,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         return false;
       }
       // Register fake project commands that hint misuse in script mode.
-      GetProjectCommandsInScriptMode(this->State);
+      GetProjectCommandsInScriptMode(this->GetState());
       this->ReadListFile(args, path);
     } else if (arg.find("--find-package", 0) == 0) {
       findPackageMode = true;
@@ -1898,12 +1892,12 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
 
 void cmake::AddScriptingCommands()
 {
-  GetScriptingCommands(this->State);
+  GetScriptingCommands(this->GetState());
 }
 
 void cmake::AddProjectCommands()
 {
-  GetProjectCommands(this->State);
+  GetProjectCommands(this->GetState());
 }
 
 void cmake::AddDefaultGenerators()
@@ -2607,11 +2601,6 @@ std::vector<std::string> cmake::GetDebugConfigs()
   return configs;
 }
 
-cmMessenger* cmake::GetMessenger() const
-{
-  return this->Messenger;
-}
-
 int cmake::Build(int jobs, const std::string& dir,
                  const std::vector<std::string>& targets,
                  const std::string& config,
diff --git a/Source/cmake.h b/Source/cmake.h
index fa4409a..e14a081 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -307,7 +307,7 @@ public:
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   //! Get the variable watch object
-  cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
+  cmVariableWatch* GetVariableWatch() { return this->VariableWatch.get(); }
 #endif
 
   std::vector<cmDocumentationEntry> GetGeneratorsDocumentation();
@@ -348,18 +348,18 @@ public:
   /**
    * Get the file comparison class
    */
-  cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache; }
+  cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache.get(); }
 
-  // Get the selected log level for `message()` commands during the cmake run.
+  //! Get the selected log level for `message()` commands during the cmake run.
   LogLevel GetLogLevel() const { return this->MessageLogLevel; }
   void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
   static LogLevel StringToLogLevel(const std::string& levelStr);
 
-  // Do we want debug output during the cmake run.
+  //! Do we want debug output during the cmake run.
   bool GetDebugOutput() { return this->DebugOutput; }
   void SetDebugOutputOn(bool b) { this->DebugOutput = b; }
 
-  // Do we want trace output during the cmake run.
+  //! Do we want trace output during the cmake run.
   bool GetTrace() { return this->Trace; }
   void SetTrace(bool b) { this->Trace = b; }
   bool GetTraceExpand() { return this->TraceExpand; }
@@ -396,31 +396,31 @@ public:
     return this->CMakeEditCommand;
   }
 
-  cmMessenger* GetMessenger() const;
+  cmMessenger* GetMessenger() const { return this->Messenger.get(); }
 
-  /*
+  /**
    * Get the state of the suppression of developer (author) warnings.
    * Returns false, by default, if developer warnings should be shown, true
    * otherwise.
    */
   bool GetSuppressDevWarnings() const;
-  /*
+  /**
    * Set the state of the suppression of developer (author) warnings.
    */
   void SetSuppressDevWarnings(bool v);
 
-  /*
+  /**
    * Get the state of the suppression of deprecated warnings.
    * Returns false, by default, if deprecated warnings should be shown, true
    * otherwise.
    */
   bool GetSuppressDeprecatedWarnings() const;
-  /*
+  /**
    * Set the state of the suppression of deprecated warnings.
    */
   void SetSuppressDeprecatedWarnings(bool v);
 
-  /*
+  /**
    * Get the state of treating developer (author) warnings as errors.
    * Returns false, by default, if warnings should not be treated as errors,
    * true otherwise.
@@ -431,7 +431,7 @@ public:
    */
   void SetDevWarningsAsErrors(bool v);
 
-  /*
+  /**
    * Get the state of treating deprecated warnings as errors.
    * Returns false, by default, if warnings should not be treated as errors,
    * true otherwise.
@@ -459,7 +459,7 @@ public:
   void UnwatchUnusedCli(const std::string& var);
   void WatchUnusedCli(const std::string& var);
 
-  cmState* GetState() const { return this->State; }
+  cmState* GetState() const { return this->State.get(); }
   void SetCurrentSnapshot(cmStateSnapshot const& snapshot)
   {
     this->CurrentSnapshot = snapshot;
@@ -537,18 +537,18 @@ private:
   std::unordered_set<std::string> HeaderFileExtensionsSet;
   bool ClearBuildSystem;
   bool DebugTryCompile;
-  cmFileTimeCache* FileTimeCache;
+  std::unique_ptr<cmFileTimeCache> FileTimeCache;
   std::string GraphVizFile;
   InstalledFilesMap InstalledFiles;
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
-  cmVariableWatch* VariableWatch;
+  std::unique_ptr<cmVariableWatch> VariableWatch;
   std::unique_ptr<cmFileAPI> FileAPI;
 #endif
 
-  cmState* State;
+  std::unique_ptr<cmState> State;
   cmStateSnapshot CurrentSnapshot;
-  cmMessenger* Messenger;
+  std::unique_ptr<cmMessenger> Messenger;
 
   std::vector<std::string> TraceOnlyThisSources;
 
@@ -556,7 +556,7 @@ private:
 
   void UpdateConversionPathTable();
 
-  // Print a list of valid generators to stderr.
+  //! Print a list of valid generators to stderr.
   void PrintGeneratorList();
 
   std::unique_ptr<cmGlobalGenerator> EvaluateDefaultGlobalGenerator();

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindMatlab.cmake        | 50 ++++++++++++++++++++---------------------
 Source/cmComputeLinkDepends.cxx |  4 ++--
 Source/cmComputeLinkDepends.h   |  2 +-
 Source/cmGlobalGenerator.cxx    |  8 +++----
 Source/cmGlobalGenerator.h      |  2 +-
 Source/cmMachO.cxx              | 14 +++++-------
 Source/cmMachO.h                |  2 +-
 Source/cmState.cxx              |  6 ++---
 Source/cmState.h                |  4 ++--
 Source/cmake.cxx                | 25 ++++++---------------
 Source/cmake.h                  | 36 ++++++++++++++---------------
 Tests/CMakeLists.txt            | 10 ++++-----
 12 files changed, 72 insertions(+), 91 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list