diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index accba083da178ff3ac9c0546cdd30df6ecefe974..4a5eb90381744c2bbe220aa4a7025a5679095ccf 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -101,8 +101,9 @@ int cmCPackIFWGenerator::PackageFiles()
     int retVal = 1;
     cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository"
                     << std::endl);
-    bool res = cmSystemTools::RunSingleCommand(
-      ifwCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+    bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
+                                               &output, &retVal, CM_NULLPTR,
+                                               this->GeneratorVerbose, 0);
     if (!res || retVal) {
       cmGeneratedFileStream ofs(ifwTmpFile.c_str());
       ofs << "# Run command: " << ifwCmd << std::endl
@@ -178,8 +179,9 @@ int cmCPackIFWGenerator::PackageFiles()
     std::string output;
     int retVal = 1;
     cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
-    bool res = cmSystemTools::RunSingleCommand(
-      ifwCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+    bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
+                                               &output, &retVal, CM_NULLPTR,
+                                               this->GeneratorVerbose, 0);
     if (!res || retVal) {
       cmGeneratedFileStream ofs(ifwTmpFile.c_str());
       ofs << "# Run command: " << ifwCmd << std::endl
@@ -526,7 +528,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
 {
   std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
     GroupPackages.find(group);
-  return pit != GroupPackages.end() ? pit->second : 0;
+  return pit != GroupPackages.end() ? pit->second : CM_NULLPTR;
 }
 
 cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
@@ -534,7 +536,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
 {
   std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
     ComponentPackages.find(component);
-  return pit != ComponentPackages.end() ? pit->second : 0;
+  return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR;
 }
 
 cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
@@ -556,7 +558,7 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
     }
   } else {
     Repositories.erase(repositoryName);
-    repository = 0;
+    repository = CM_NULLPTR;
     cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
                     << repositoryName << "\""
                     << " configuration. Repository will be skipped."
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 74f6da671252924efec60687d92ae1b639753df4..13a361309b09d909e554bd5d517198d3e367be23 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -33,13 +33,13 @@
   } while (0)
 
 cmCPackIFWInstaller::cmCPackIFWInstaller()
-  : Generator(0)
+  : Generator(CM_NULLPTR)
 {
 }
 
 const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
 {
-  return Generator ? Generator->GetOption(op) : 0;
+  return Generator ? Generator->GetOption(op) : CM_NULLPTR;
 }
 
 bool cmCPackIFWInstaller::IsOn(const std::string& op) const
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 405d6684402d2304f9c202d2bed431ec2088c2b0..5db06e61f5e0f7c5692c0b03cb961a234feb9e2f 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -96,15 +96,15 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
 
 //------------------------------------------------------ cmCPackIFWPackage ---
 cmCPackIFWPackage::cmCPackIFWPackage()
-  : Generator(0)
-  , Installer(0)
+  : Generator(CM_NULLPTR)
+  , Installer(CM_NULLPTR)
 {
 }
 
 const char* cmCPackIFWPackage::GetOption(const std::string& op) const
 {
-  const char* option = Generator ? Generator->GetOption(op) : 0;
-  return option && *option ? option : 0;
+  const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR;
+  return option && *option ? option : CM_NULLPTR;
 }
 
 bool cmCPackIFWPackage::IsOn(const std::string& op) const
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index e4fa569b1217e13c70a65fd6623ea51f0001b3be..ee6d5e5ece778ed2d162fd457dc70f3cb8a19682 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -35,7 +35,7 @@
 
 cmCPackIFWRepository::cmCPackIFWRepository()
   : Update(None)
-  , Generator(0)
+  , Generator(CM_NULLPTR)
 {
 }
 
@@ -63,7 +63,7 @@ bool cmCPackIFWRepository::IsValid() const
 
 const char* cmCPackIFWRepository::GetOption(const std::string& op) const
 {
-  return Generator ? Generator->GetOption(op) : 0;
+  return Generator ? Generator->GetOption(op) : CM_NULLPTR;
 }
 
 bool cmCPackIFWRepository::IsOn(const std::string& op) const
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index baf6719ca049c8d93331a57acbebf00cdac0702b..b1f686468f49301d9b29e5c156adf93fa42ed8f6 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -68,7 +68,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
        ++fileIt) {
     std::string rp = filePrefix + *fileIt;
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl);
-    archive.Add(rp, 0, 0, false);
+    archive.Add(rp, 0, CM_NULLPTR, false);
     if (!archive) {
       cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
                       << archive.GetError() << std::endl);
@@ -139,7 +139,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
     for (compIt = this->Components.begin(); compIt != this->Components.end();
          ++compIt) {
       // Does the component belong to a group?
-      if (compIt->second.Group == NULL) {
+      if (compIt->second.Group == CM_NULLPTR) {
         cmCPackLogger(
           cmCPackLog::LOG_VERBOSE, "Component <"
             << compIt->second.Name
@@ -246,7 +246,7 @@ int cmCPackArchiveGenerator::PackageFiles()
     // Get the relative path to the file
     std::string rp =
       cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str());
-    archive.Add(rp, 0, 0, false);
+    archive.Add(rp, 0, CM_NULLPTR, false);
     if (!archive) {
       cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
                       << *fileIt << "> to archive <" << packageFileNames[0]
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 5361d955f108866584b73666ab09a19c0eb6cdf3..01a9e76f582d461d27537df6d4b6ce37c7be5593 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -43,7 +43,7 @@ class cmCPackComponent
 {
 public:
   cmCPackComponent()
-    : Group(0)
+    : Group(CM_NULLPTR)
     , IsRequired(true)
     , IsHidden(false)
     , IsDisabledByDefault(false)
@@ -117,7 +117,7 @@ class cmCPackComponentGroup
 {
 public:
   cmCPackComponentGroup()
-    : ParentGroup(0)
+    : ParentGroup(CM_NULLPTR)
   {
   }
 
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index b659359c0845f7f643b65cd954d6636541349b65..3edc430b02a00041934544989b22394636c29cd3 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -133,7 +133,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
     for (compIt = this->Components.begin(); compIt != this->Components.end();
          ++compIt) {
       // Does the component belong to a group?
-      if (compIt->second.Group == NULL) {
+      if (compIt->second.Group == CM_NULLPTR) {
         cmCPackLogger(
           cmCPackLog::LOG_VERBOSE, "Component <"
             << compIt->second.Name
@@ -692,7 +692,7 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
   // the current COMPONENT belongs to.
   std::string groupVar =
     "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
-  if (NULL != GetOption(groupVar)) {
+  if (CM_NULLPTR != GetOption(groupVar)) {
     return std::string(GetOption(groupVar));
   } else {
     return componentName;
@@ -917,18 +917,18 @@ static int ar_append(const char* archive,
 {
   int eval = 0;
   FILE* aFile = cmSystemTools::Fopen(archive, "wb+");
-  if (aFile != NULL) {
+  if (aFile != CM_NULLPTR) {
     fwrite(ARMAG, SARMAG, 1, aFile);
     if (fseek(aFile, 0, SEEK_END) != -1) {
       CF cf;
       struct stat sb;
       /* Read from disk, write to an archive; pad on write. */
-      SETCF(NULL, 0, aFile, archive, WPAD);
+      SETCF(CM_NULLPTR, CM_NULLPTR, aFile, archive, WPAD);
       for (std::vector<std::string>::const_iterator fileIt = files.begin();
            fileIt != files.end(); ++fileIt) {
         const char* filename = fileIt->c_str();
         FILE* file = cmSystemTools::Fopen(filename, "rb");
-        if (file == NULL) {
+        if (file == CM_NULLPTR) {
           eval = -1;
           continue;
         }
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c8b075d799465a1f43db9bb28679a6fa78fac55e..914d0dc20f7be7027de232732ad1dada519a027f 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -34,14 +34,14 @@
 cmCPackGenerator::cmCPackGenerator()
 {
   this->GeneratorVerbose = cmSystemTools::OUTPUT_NONE;
-  this->MakefileMap = 0;
-  this->Logger = 0;
+  this->MakefileMap = CM_NULLPTR;
+  this->Logger = CM_NULLPTR;
   this->componentPackageMethod = ONE_PACKAGE_PER_GROUP;
 }
 
 cmCPackGenerator::~cmCPackGenerator()
 {
-  this->MakefileMap = 0;
+  this->MakefileMap = CM_NULLPTR;
 }
 
 void cmCPackGeneratorProgress(const char* msg, float prog, void* ptr)
@@ -251,8 +251,9 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
       cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << *it << std::endl);
       std::string output;
       int retVal = 1;
-      bool resB = cmSystemTools::RunSingleCommand(
-        it->c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+      bool resB =
+        cmSystemTools::RunSingleCommand(it->c_str(), &output, &output, &retVal,
+                                        CM_NULLPTR, this->GeneratorVerbose, 0);
       if (!resB || retVal) {
         std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
         tmpFile += "/InstallOutput.log";
@@ -814,7 +815,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           }
         }
 
-        if (NULL != mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+        if (CM_NULLPTR !=
+            mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
           if (!absoluteDestFiles.empty()) {
             absoluteDestFiles += ";";
           }
@@ -828,7 +830,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
             std::string absoluteDestFileComponent =
               std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
               GetComponentInstallDirNameSuffix(installComponent);
-            if (NULL != this->GetOption(absoluteDestFileComponent)) {
+            if (CM_NULLPTR != this->GetOption(absoluteDestFileComponent)) {
               std::string absoluteDestFilesListComponent =
                 this->GetOption(absoluteDestFileComponent);
               absoluteDestFilesListComponent += ";";
@@ -1178,7 +1180,7 @@ int cmCPackGenerator::PrepareGroupingKind()
   std::string groupingType;
 
   // Second way to specify grouping
-  if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
+  if (CM_NULLPTR != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
     groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
   }
 
@@ -1355,7 +1357,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
       component->Group = GetComponentGroup(projectName, groupName);
       component->Group->Components.push_back(component);
     } else {
-      component->Group = 0;
+      component->Group = CM_NULLPTR;
     }
 
     const char* description = this->GetOption(macroPrefix + "_DESCRIPTION");
@@ -1423,7 +1425,7 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(
       group->ParentGroup = GetComponentGroup(projectName, parentGroupName);
       group->ParentGroup->Subgroups.push_back(group);
     } else {
-      group->ParentGroup = 0;
+      group->ParentGroup = CM_NULLPTR;
     }
   }
   return group;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 6313a0e2834cbe1acbcdf5a54aa66e3d1c9b2284..23e4bb7f98be078afd27c6fa14874b073ae4c203 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -136,7 +136,7 @@ protected:
   cmInstalledFile const* GetInstalledFile(std::string const& name) const;
 
   virtual const char* GetOutputExtension() { return ".cpack"; }
-  virtual const char* GetOutputPostfix() { return 0; }
+  virtual const char* GetOutputPostfix() { return CM_NULLPTR; }
 
   /**
    * Prepare requested grouping kind from CPACK_xxx vars
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 22108351ba97b42607d4f979ab10b79e13fc3e3a..0f0268fa29332750a72823ef14d771a2a635c5ae 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -151,7 +151,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
 {
   cmCPackGenerator* gen = this->NewGeneratorInternal(name);
   if (!gen) {
-    return 0;
+    return CM_NULLPTR;
   }
   this->Generators.push_back(gen);
   gen->SetLogger(this->Logger);
@@ -164,7 +164,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
   cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it =
     this->GeneratorCreators.find(name);
   if (it == this->GeneratorCreators.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return (it->second)();
 }
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index ff06eb8b98b7957d6693e1ad99e156859cdfc396..339323ed2729852ca8f3fe42da131495aeb23e05 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -28,13 +28,13 @@ cmCPackLog::cmCPackLog()
   this->DefaultOutput = &std::cout;
   this->DefaultError = &std::cerr;
 
-  this->LogOutput = 0;
+  this->LogOutput = CM_NULLPTR;
   this->LogOutputCleanup = false;
 }
 
 cmCPackLog::~cmCPackLog()
 {
-  this->SetLogOutputStream(0);
+  this->SetLogOutputStream(CM_NULLPTR);
 }
 
 void cmCPackLog::SetLogOutputStream(std::ostream* os)
@@ -48,13 +48,13 @@ void cmCPackLog::SetLogOutputStream(std::ostream* os)
 
 bool cmCPackLog::SetLogOutputFile(const char* fname)
 {
-  cmGeneratedFileStream* cg = 0;
+  cmGeneratedFileStream* cg = CM_NULLPTR;
   if (fname) {
     cg = new cmGeneratedFileStream(fname);
   }
   if (cg && !*cg) {
     delete cg;
-    cg = 0;
+    cg = CM_NULLPTR;
   }
   this->SetLogOutputStream(cg);
   if (!cg) {
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 5123edda2452eb0782fcb29c70753df3401d9db9..d8ff9071283aa6a2b6996956b20dbff988775364 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -212,7 +212,7 @@ int cmCPackNSISGenerator::PackageFiles()
     std::map<std::string, cmCPackComponentGroup>::iterator groupIt;
     for (groupIt = this->ComponentGroups.begin();
          groupIt != this->ComponentGroups.end(); ++groupIt) {
-      if (groupIt->second.ParentGroup == 0) {
+      if (groupIt->second.ParentGroup == CM_NULLPTR) {
         componentCode +=
           this->CreateComponentGroupDescription(&groupIt->second, macrosOut);
       }
@@ -301,8 +301,9 @@ int cmCPackNSISGenerator::PackageFiles()
   cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
   std::string output;
   int retVal = 1;
-  bool res = cmSystemTools::RunSingleCommand(
-    nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+  bool res =
+    cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
+                                    CM_NULLPTR, this->GeneratorVerbose, 0);
   if (!res || retVal) {
     cmGeneratedFileStream ofs(tmpFile.c_str());
     ofs << "# Run command: " << nsisCmd << std::endl
@@ -326,7 +327,7 @@ int cmCPackNSISGenerator::InitializeInternal()
       "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
       "This option will be reset to 0 (for this generator only)."
         << std::endl);
-    this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
+    this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", CM_NULLPTR);
   }
 
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackNSISGenerator::Initialize()"
@@ -399,8 +400,9 @@ int cmCPackNSISGenerator::InitializeInternal()
                                                                << std::endl);
   std::string output;
   int retVal = 1;
-  bool resS = cmSystemTools::RunSingleCommand(
-    nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0);
+  bool resS =
+    cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
+                                    CM_NULLPTR, this->GeneratorVerbose, 0);
   cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
   cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
   if (!resS || retVal ||
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index bc101118f47c625f9b9552fbf6744b27b3a75885..2568d17d94a82d94157661714f4729ae17ed83a0 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -121,7 +121,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
     for (compIt = this->Components.begin(); compIt != this->Components.end();
          ++compIt) {
       // Does the component belong to a group?
-      if (compIt->second.Group == NULL) {
+      if (compIt->second.Group == CM_NULLPTR) {
         cmCPackLogger(
           cmCPackLog::LOG_VERBOSE, "Component <"
             << compIt->second.Name
@@ -245,7 +245,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
   // the current COMPONENT belongs to.
   std::string groupVar =
     "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
-  if (NULL != GetOption(groupVar)) {
+  if (CM_NULLPTR != GetOption(groupVar)) {
     return std::string(GetOption(groupVar));
   } else {
     return componentName;
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 425afd9e8942a15cdb0b9515d69e601c0b601bb0..b4a2c6fe2179939c48c4f4c3e7e40c9fe1287e48 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -27,13 +27,13 @@
 #include <cmsys/SystemTools.hxx>
 
 static const char* cmDocumentationName[][2] = {
-  { 0, "  cpack - Packaging driver provided by CMake." },
-  { 0, 0 }
+  { CM_NULLPTR, "  cpack - Packaging driver provided by CMake." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationUsage[][2] = {
-  { 0, "  cpack -G <generator> [options]" },
-  { 0, 0 }
+  { CM_NULLPTR, "  cpack -G <generator> [options]" },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationOptions[][2] = {
@@ -47,7 +47,7 @@ static const char* cmDocumentationOptions[][2] = {
   { "-R <package version>", "override/define CPACK_PACKAGE_VERSION" },
   { "-B <package directory>", "override/define CPACK_PACKAGE_DIRECTORY" },
   { "--vendor <vendor name>", "override/define CPACK_PACKAGE_VENDOR" },
-  { 0, 0 }
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 int cpackUnknownArgument(const char*, void*)
@@ -200,7 +200,7 @@ int main(int argc, char const* const* argv)
 
   cmCPackGeneratorFactory generators;
   generators.SetLogger(&log);
-  cmCPackGenerator* cpackGenerator = 0;
+  cmCPackGenerator* cpackGenerator = CM_NULLPTR;
 
   cmDocumentation doc;
   doc.addCPackStandardDocSections();
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 17d4eefa3f8e6c006025522d2d424d6c079396ca..0e08e1c0f034db611f5681fcd495e50088599a69 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -139,13 +139,13 @@ std::string cmCTestBZR::LoadInfo()
 {
   // Run "bzr info" to get the repository info from the work tree.
   const char* bzr = this->CommandLineTool.c_str();
-  const char* bzr_info[] = { bzr, "info", 0 };
+  const char* bzr_info[] = { bzr, "info", CM_NULLPTR };
   InfoParser iout(this, "info-out> ");
   OutputLogger ierr(this->Log, "info-err> ");
   this->RunChild(bzr_info, &iout, &ierr);
 
   // Run "bzr revno" to get the repository revision number from the work tree.
-  const char* bzr_revno[] = { bzr, "revno", 0 };
+  const char* bzr_revno[] = { bzr, "revno", CM_NULLPTR };
   std::string rev;
   RevnoParser rout(this, "revno-out> ", rev);
   OutputLogger rerr(this->Log, "revno-err> ");
@@ -190,7 +190,8 @@ public:
     int res = cmXMLParser::InitializeParser();
     if (res) {
       XML_SetUnknownEncodingHandler(static_cast<XML_Parser>(this->Parser),
-                                    cmBZRXMLParserUnknownEncodingHandler, 0);
+                                    cmBZRXMLParserUnknownEncodingHandler,
+                                    CM_NULLPTR);
     }
     return res;
   }
@@ -380,7 +381,7 @@ bool cmCTestBZR::UpdateImpl()
 
   bzr_update.push_back(this->URL.c_str());
 
-  bzr_update.push_back(0);
+  bzr_update.push_back(CM_NULLPTR);
 
   // For some reason bzr uses stderr to display the update status.
   OutputLogger out(this->Log, "pull-out> ");
@@ -408,7 +409,8 @@ void cmCTestBZR::LoadRevisions()
   // Run "bzr log" to get all global revisions of interest.
   const char* bzr = this->CommandLineTool.c_str();
   const char* bzr_log[] = {
-    bzr, "log", "-v", "-r", revs.c_str(), "--xml", this->URL.c_str(), 0
+    bzr,       "log", "-v", "-r", revs.c_str(), "--xml", this->URL.c_str(),
+    CM_NULLPTR
   };
   {
     LogParser out(this, "log-out> ");
@@ -465,7 +467,7 @@ void cmCTestBZR::LoadModifications()
 {
   // Run "bzr status" which reports local modifications.
   const char* bzr = this->CommandLineTool.c_str();
-  const char* bzr_status[] = { bzr, "status", "-SV", 0 };
+  const char* bzr_status[] = { bzr, "status", "-SV", CM_NULLPTR };
   StatusParser out(this, "status-out> ");
   OutputLogger err(this->Log, "status-err> ");
   this->RunChild(bzr_status, &out, &err);
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 632f4521156f8b96c7640902235901f4e43e3bdd..eddbddc5233525af1c232e63c5cf0d8474afccc8 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -72,7 +72,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
     args.push_back(toolset);
   }
 
-  const char* config = 0;
+  const char* config = CM_NULLPTR;
   if (!this->CTest->GetConfigType().empty()) {
     config = this->CTest->GetConfigType().c_str();
   }
@@ -158,10 +158,10 @@ public:
   }
   ~cmCTestBuildAndTestCaptureRAII()
   {
-    this->CM.SetProgressCallback(0, 0);
-    cmSystemTools::SetStderrCallback(0, 0);
-    cmSystemTools::SetStdoutCallback(0, 0);
-    cmSystemTools::SetMessageCallback(0, 0);
+    this->CM.SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
+    cmSystemTools::SetStderrCallback(CM_NULLPTR, CM_NULLPTR);
+    cmSystemTools::SetStdoutCallback(CM_NULLPTR, CM_NULLPTR);
+    cmSystemTools::SetMessageCallback(CM_NULLPTR, CM_NULLPTR);
   }
 };
 
@@ -247,7 +247,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
       }
     }
     std::string output;
-    const char* config = 0;
+    const char* config = CM_NULLPTR;
     if (!this->CTest->GetConfigType().empty()) {
       config = this->CTest->GetConfigType().c_str();
     }
@@ -321,7 +321,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
   for (size_t k = 0; k < this->TestCommandArgs.size(); ++k) {
     testCommand.push_back(this->TestCommandArgs[k].c_str());
   }
-  testCommand.push_back(0);
+  testCommand.push_back(CM_NULLPTR);
   std::string outs;
   int retval = 0;
   // run the test from the this->BuildRunDir if set
@@ -347,8 +347,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
     }
   }
 
-  int runTestRes =
-    this->CTest->RunTest(testCommand, &outs, &retval, 0, remainingTime, 0);
+  int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval,
+                                        CM_NULLPTR, remainingTime, CM_NULLPTR);
 
   if (runTestRes != cmsysProcess_State_Exited || retval != 0) {
     out << "Test command failed: " << testCommand[0] << "\n";
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 05cccbfe20aa089b0281844f969c6db55a0de5d1..408a1a898c7258bd63fd9d5f3114241cd0e1d0af 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -19,14 +19,14 @@
 
 cmCTestBuildCommand::cmCTestBuildCommand()
 {
-  this->GlobalGenerator = 0;
+  this->GlobalGenerator = CM_NULLPTR;
   this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS";
   this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS";
   this->Arguments[ctb_TARGET] = "TARGET";
   this->Arguments[ctb_CONFIGURATION] = "CONFIGURATION";
   this->Arguments[ctb_FLAGS] = "FLAGS";
   this->Arguments[ctb_PROJECT_NAME] = "PROJECT_NAME";
-  this->Arguments[ctb_LAST] = 0;
+  this->Arguments[ctb_LAST] = CM_NULLPTR;
   this->Last = ctb_LAST;
 }
 
@@ -34,7 +34,7 @@ cmCTestBuildCommand::~cmCTestBuildCommand()
 {
   if (this->GlobalGenerator) {
     delete this->GlobalGenerator;
-    this->GlobalGenerator = 0;
+    this->GlobalGenerator = CM_NULLPTR;
   }
 }
 
@@ -43,7 +43,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
   cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("build");
   if (!handler) {
     this->SetError("internal CTest error. Cannot instantiate build handler");
-    return 0;
+    return CM_NULLPTR;
   }
   this->Handler = (cmCTestBuildHandler*)handler;
 
@@ -91,7 +91,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
       if (this->GlobalGenerator) {
         if (this->GlobalGenerator->GetName() != cmakeGeneratorName) {
           delete this->GlobalGenerator;
-          this->GlobalGenerator = 0;
+          this->GlobalGenerator = CM_NULLPTR;
         }
       }
       if (!this->GlobalGenerator) {
@@ -104,11 +104,11 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
           e += "\"";
           this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
           cmSystemTools::SetFatalErrorOccured();
-          return 0;
+          return CM_NULLPTR;
         }
       }
       if (strlen(cmakeBuildConfiguration) == 0) {
-        const char* config = 0;
+        const char* config = CM_NULLPTR;
 #ifdef CMAKE_INTDIR
         config = CMAKE_INTDIR;
 #endif
@@ -145,7 +145,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
         "with a custom command line.";
       /* clang-format on */
       this->SetError(ostr.str());
-      return 0;
+      return CM_NULLPTR;
     }
   }
 
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index a4d9deeaa1488e9a86922a70f56283cf32781827..f96ef6d66599a72e975e6059ed9d5f6de2fc72dd 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -92,7 +92,7 @@ static const char* cmCTestErrorMatches[] = {
   "^The project cannot be built\\.",
   "^\\[ERROR\\]",
   "^Command .* failed with exit code",
-  0
+  CM_NULLPTR
 };
 
 static const char* cmCTestErrorExceptions[] = {
@@ -107,7 +107,7 @@ static const char* cmCTestErrorExceptions[] = {
   ":[ \\t]+Where:",
   "([^ :]+):([0-9]+): Warning",
   "------ Build started: .* ------",
-  0
+  CM_NULLPTR
 };
 
 static const char* cmCTestWarningMatches[] = {
@@ -132,7 +132,7 @@ static const char* cmCTestWarningMatches[] = {
   "cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*",
   "^CMake Warning.*:",
   "^\\[WARNING\\]",
-  0
+  CM_NULLPTR
 };
 
 static const char* cmCTestWarningExceptions[] = {
@@ -152,7 +152,7 @@ static const char* cmCTestWarningExceptions[] = {
   "ld32: WARNING 85: definition of dataKey in",
   "cc: warning 422: Unknown option \"\\+b",
   "_with_warning_C",
-  0
+  CM_NULLPTR
 };
 
 struct cmCTestBuildCompileErrorWarningRex
@@ -170,7 +170,7 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = {
   { "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 },
   { "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 },
   { "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 },
-  { 0, 0, 0 }
+  { CM_NULLPTR, 0, 0 }
 };
 
 cmCTestBuildHandler::cmCTestBuildHandler()
@@ -521,7 +521,7 @@ public:
   {
   }
   FragmentCompare()
-    : FTC(0)
+    : FTC(CM_NULLPTR)
   {
   }
   bool operator()(std::string const& l, std::string const& r)
@@ -799,7 +799,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
        a != args.end(); ++a) {
     argv.push_back(a->c_str());
   }
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:",
                      this->Quiet);
@@ -851,7 +851,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
 
   // For every chunk of data
   int res;
-  while ((res = cmsysProcess_WaitForData(cp, &data, &length, 0))) {
+  while ((res = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR))) {
     // Replace '\0' with '\n', since '\0' does not really make sense. This is
     // for Visual Studio output
     for (int cc = 0; cc < length; ++cc) {
@@ -870,8 +870,9 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
     }
   }
 
-  this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue);
-  this->ProcessBuffer(0, 0, tick, tick_len, ofs,
+  this->ProcessBuffer(CM_NULLPTR, 0, tick, tick_len, ofs,
+                      &this->BuildProcessingQueue);
+  this->ProcessBuffer(CM_NULLPTR, 0, tick, tick_len, ofs,
                       &this->BuildProcessingErrorQueue);
   cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size of output: "
                        << ((this->BuildOutputLogSize + 512) / 1024) << "K"
@@ -879,7 +880,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
                      this->Quiet);
 
   // Properly handle output of the build command
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   int result = cmsysProcess_GetState(cp);
 
   if (result == cmsysProcess_State_Exited) {
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index df19685041dba666b21bf371b443c252c3206d65..37bdf9a3ff3d36f5d3dc66bb7e1a1a937424608e 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -103,7 +103,7 @@ bool cmCTestCVS::UpdateImpl()
        ai != args.end(); ++ai) {
     cvs_update.push_back(ai->c_str());
   }
-  cvs_update.push_back(0);
+  cvs_update.push_back(CM_NULLPTR);
 
   UpdateParser out(this, "up-out> ");
   UpdateParser err(this, "up-err> ");
@@ -229,7 +229,8 @@ void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
 
   // Run "cvs log" to get revisions of this file on this branch.
   const char* cvs = this->CommandLineTool.c_str();
-  const char* cvs_log[] = { cvs, "log", "-N", branchFlag, file.c_str(), 0 };
+  const char* cvs_log[] = { cvs,        "log",        "-N",
+                            branchFlag, file.c_str(), CM_NULLPTR };
 
   LogParser out(this, "log-out> ", revisions);
   OutputLogger err(this->Log, "log-err> ");
diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h
index 22a2c8ed8f8df05101b6c7ad5f2f54532a242374..b0c92066ff9b1535d22339cb99be5c709bd9bbe2 100644
--- a/Source/CTest/cmCTestCommand.h
+++ b/Source/CTest/cmCTestCommand.h
@@ -29,8 +29,8 @@ class cmCTestCommand : public cmCommand
 public:
   cmCTestCommand()
   {
-    this->CTest = 0;
-    this->CTestScriptHandler = 0;
+    this->CTest = CM_NULLPTR;
+    this->CTestScriptHandler = CM_NULLPTR;
   }
 
   cmCTest* CTest;
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index a90f27ad2f9b9ab39b5949be8f20c29e08779b2c..a8237048ac121722c520046f2fb11a785d4afc05 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -18,7 +18,7 @@
 cmCTestConfigureCommand::cmCTestConfigureCommand()
 {
   this->Arguments[ctc_OPTIONS] = "OPTIONS";
-  this->Arguments[ctc_LAST] = 0;
+  this->Arguments[ctc_LAST] = CM_NULLPTR;
   this->Last = ctc_LAST;
 }
 
@@ -35,7 +35,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
       "Build directory not specified. Either use BUILD "
       "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
       "variable");
-    return 0;
+    return CM_NULLPTR;
   }
 
   const char* ctestConfigureCommand =
@@ -55,7 +55,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
           "Source directory not specified. Either use SOURCE "
           "argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY "
           "variable");
-        return 0;
+        return CM_NULLPTR;
       }
 
       const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
@@ -63,7 +63,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
         std::ostringstream e;
         e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]";
         this->SetError(e.str());
-        return 0;
+        return CM_NULLPTR;
       }
 
       bool multiConfig = false;
@@ -90,8 +90,9 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
         cmakeConfigureCommand += option;
         cmakeConfigureCommand += "\"";
 
-        if ((0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
-            (0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) {
+        if ((CM_NULLPTR != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
+            (CM_NULLPTR !=
+             strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) {
           cmakeBuildTypeInOptions = true;
         }
       }
@@ -134,7 +135,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
         "Configure command is not specified. If this is a "
         "\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, "
         "set CTEST_CONFIGURE_COMMAND.");
-      return 0;
+      return CM_NULLPTR;
     }
   }
 
@@ -143,7 +144,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
   if (!handler) {
     this->SetError(
       "internal CTest error. Cannot instantiate configure handler");
-    return 0;
+    return CM_NULLPTR;
   }
   handler->SetQuiet(this->Quiet);
   return handler;
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index 223d010cdf58750c7d37acf2e9e6bb8c5794ac52..86e3ce47d386452a94fddcb65bea034591a4023c 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -30,7 +30,7 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
     this->CTest->GetInitializedHandler("coverage"));
   if (!handler) {
     this->SetError("internal CTest error. Cannot instantiate test handler");
-    return 0;
+    return CM_NULLPTR;
   }
 
   // If a LABELS option was given, select only files with the labels.
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index a631db9582e405e254a191e41a48355162e3d4ea..7102533a90161813d7b3103d50d60dbc190d89c7 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -76,7 +76,7 @@ public:
          i != this->CommandLineStrings.end(); ++i) {
       args.push_back(i->c_str());
     }
-    args.push_back(0); // null terminate
+    args.push_back(CM_NULLPTR); // null terminate
     cmsysProcess_SetCommand(this->Process, &*args.begin());
     if (!this->WorkingDirectory.empty()) {
       cmsysProcess_SetWorkingDirectory(this->Process,
@@ -101,7 +101,7 @@ public:
   {
     cmsysProcess_SetPipeFile(this->Process, cmsysProcess_Pipe_STDERR, fname);
   }
-  int WaitForExit(double* timeout = 0)
+  int WaitForExit(double* timeout = CM_NULLPTR)
   {
     this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout);
     return this->PipeState;
@@ -1781,7 +1781,7 @@ const char* bullseyeHelp[] = {
   "      condition evaluated true or false, respectively.",
   "    * A k indicates a constant decision or condition.",
   "    * The slash / means this probe is excluded from summary results. ",
-  0
+  CM_NULLPTR
 };
 }
 
@@ -1809,7 +1809,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
   cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                      "run covbr: " << std::endl, this->Quiet);
 
-  if (!this->RunBullseyeCommand(cont, "covbr", 0, outputFile)) {
+  if (!this->RunBullseyeCommand(cont, "covbr", CM_NULLPTR, outputFile)) {
     cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for."
                  << "\n");
     return -1;
@@ -1882,7 +1882,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
         covLogXML.StartElement("Report");
         // write the bullseye header
         line = 0;
-        for (int k = 0; bullseyeHelp[k] != 0; ++k) {
+        for (int k = 0; bullseyeHelp[k] != CM_NULLPTR; ++k) {
           covLogXML.StartElement("Line");
           covLogXML.Attribute("Number", line);
           covLogXML.Attribute("Count", -1);
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 4818324fe71c473433106db213aca91c3bb4c80b..6b8e5b56f46914f797fe5282f29b0aa9e0f79ae0 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -147,7 +147,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
   ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION, curlDebugCallback);
   // Be sure to set Content-Type to satisfy fussy modsecurity rules
   struct curl_slist* headers =
-    ::curl_slist_append(NULL, "Content-Type: text/xml");
+    ::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
   ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
   std::vector<char> responseData;
   std::vector<char> debugData;
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 36a781e9e88a7a51b11ec37d3bd1ddd1022617a9..61dbe33b513ec68066f8f8becd8fe7c4d3f1f4bf 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -64,7 +64,8 @@ std::string cmCTestGIT::GetWorkingRevision()
 {
   // Run plumbing "git rev-list" to get work tree revision.
   const char* git = this->CommandLineTool.c_str();
-  const char* git_rev_list[] = { git, "rev-list", "-n", "1", "HEAD", "--", 0 };
+  const char* git_rev_list[] = { git,    "rev-list", "-n",      "1",
+                                 "HEAD", "--",       CM_NULLPTR };
   std::string rev;
   OneLineParser out(this, "rl-out> ", rev);
   OutputLogger err(this->Log, "rl-err> ");
@@ -93,7 +94,7 @@ std::string cmCTestGIT::FindGitDir()
 
   // Run "git rev-parse --git-dir" to locate the real .git directory.
   const char* git = this->CommandLineTool.c_str();
-  char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", 0 };
+  char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", CM_NULLPTR };
   std::string git_dir_line;
   OneLineParser rev_parse_out(this, "rev-parse-out> ", git_dir_line);
   OutputLogger rev_parse_err(this->Log, "rev-parse-err> ");
@@ -135,7 +136,8 @@ std::string cmCTestGIT::FindTopDir()
 
   // Run "git rev-parse --show-cdup" to locate the top of the tree.
   const char* git = this->CommandLineTool.c_str();
-  char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup", 0 };
+  char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup",
+                                  CM_NULLPTR };
   std::string cdup;
   OneLineParser rev_parse_out(this, "rev-parse-out> ", cdup);
   OutputLogger rev_parse_err(this->Log, "rev-parse-err> ");
@@ -169,7 +171,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
   }
 
   // Sentinel argument.
-  git_fetch.push_back(0);
+  git_fetch.push_back(CM_NULLPTR);
 
   // Fetch upstream refs.
   OutputLogger fetch_out(this->Log, "fetch-out> ");
@@ -204,7 +206,8 @@ bool cmCTestGIT::UpdateByFetchAndReset()
   }
 
   // Reset the local branch to point at that tracked from upstream.
-  char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(), 0 };
+  char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(),
+                              CM_NULLPTR };
   OutputLogger reset_out(this->Log, "reset-out> ");
   OutputLogger reset_err(this->Log, "reset-err> ");
   return this->RunChild(&git_reset[0], &reset_out, &reset_err);
@@ -219,7 +222,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom)
        i != git_custom_command.end(); ++i) {
     git_custom.push_back(i->c_str());
   }
-  git_custom.push_back(0);
+  git_custom.push_back(CM_NULLPTR);
 
   OutputLogger custom_out(this->Log, "custom-out> ");
   OutputLogger custom_err(this->Log, "custom-err> ");
@@ -248,7 +251,7 @@ bool cmCTestGIT::UpdateImpl()
 
   // Git < 1.6.5 did not support submodule --recursive
   if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) {
-    recursive = 0;
+    recursive = CM_NULLPTR;
     // No need to require >= 1.6.5 if there are no submodules.
     if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
       this->Log << "Git < 1.6.5 cannot update submodules recursively\n";
@@ -257,7 +260,7 @@ bool cmCTestGIT::UpdateImpl()
 
   // Git < 1.8.1 did not support sync --recursive
   if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) {
-    sync_recursive = 0;
+    sync_recursive = CM_NULLPTR;
     // No need to require >= 1.8.1 if there are no submodules.
     if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
       this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n";
@@ -272,7 +275,8 @@ bool cmCTestGIT::UpdateImpl()
   std::string init_submodules =
     this->CTest->GetCTestConfiguration("GITInitSubmodules");
   if (cmSystemTools::IsOn(init_submodules.c_str())) {
-    char const* git_submodule_init[] = { git, "submodule", "init", 0 };
+    char const* git_submodule_init[] = { git, "submodule", "init",
+                                         CM_NULLPTR };
     ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
                          top_dir.c_str());
 
@@ -282,7 +286,7 @@ bool cmCTestGIT::UpdateImpl()
   }
 
   char const* git_submodule_sync[] = { git, "submodule", "sync",
-                                       sync_recursive, 0 };
+                                       sync_recursive, CM_NULLPTR };
   ret = this->RunChild(git_submodule_sync, &submodule_out, &submodule_err,
                        top_dir.c_str());
 
@@ -290,7 +294,8 @@ bool cmCTestGIT::UpdateImpl()
     return false;
   }
 
-  char const* git_submodule[] = { git, "submodule", "update", recursive, 0 };
+  char const* git_submodule[] = { git, "submodule", "update", recursive,
+                                  CM_NULLPTR };
   return this->RunChild(git_submodule, &submodule_out, &submodule_err,
                         top_dir.c_str());
 }
@@ -299,7 +304,7 @@ unsigned int cmCTestGIT::GetGitVersion()
 {
   if (!this->CurrentGitVersion) {
     const char* git = this->CommandLineTool.c_str();
-    char const* git_version[] = { git, "--version", 0 };
+    char const* git_version[] = { git, "--version", CM_NULLPTR };
     std::string version;
     OneLineParser version_out(this, "version-out> ", version);
     OutputLogger version_err(this->Log, "version-err> ");
@@ -611,10 +616,10 @@ void cmCTestGIT::LoadRevisions()
   std::string range = this->OldRevision + ".." + this->NewRevision;
   const char* git = this->CommandLineTool.c_str();
   const char* git_rev_list[] = { git,           "rev-list", "--reverse",
-                                 range.c_str(), "--",       0 };
+                                 range.c_str(), "--",       CM_NULLPTR };
   const char* git_diff_tree[] = {
     git,  "diff-tree",    "--stdin",          "--always", "-z",
-    "-r", "--pretty=raw", "--encoding=utf-8", 0
+    "-r", "--pretty=raw", "--encoding=utf-8", CM_NULLPTR
   };
   this->Log << this->ComputeCommandLine(git_rev_list) << " | "
             << this->ComputeCommandLine(git_diff_tree) << "\n";
@@ -639,13 +644,15 @@ void cmCTestGIT::LoadModifications()
   const char* git = this->CommandLineTool.c_str();
 
   // Use 'git update-index' to refresh the index w.r.t. the work tree.
-  const char* git_update_index[] = { git, "update-index", "--refresh", 0 };
+  const char* git_update_index[] = { git, "update-index", "--refresh",
+                                     CM_NULLPTR };
   OutputLogger ui_out(this->Log, "ui-out> ");
   OutputLogger ui_err(this->Log, "ui-err> ");
   this->RunChild(git_update_index, &ui_out, &ui_err);
 
   // Use 'git diff-index' to get modified files.
-  const char* git_diff_index[] = { git, "diff-index", "-z", "HEAD", "--", 0 };
+  const char* git_diff_index[] = { git,    "diff-index", "-z",
+                                   "HEAD", "--",         CM_NULLPTR };
   DiffParser out(this, "di-out> ");
   OutputLogger err(this->Log, "di-err> ");
   this->RunChild(git_diff_index, &out, &err);
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 18caabe0a57b8c16b71b7ae7ace030f2f48199b2..7755ee994af14d6a05743d2312188a57928cd112 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -19,7 +19,7 @@
 cmCTestGenericHandler::cmCTestGenericHandler()
 {
   this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
-  this->CTest = 0;
+  this->CTest = CM_NULLPTR;
   this->SubmitIndex = 0;
   this->AppendXML = false;
   this->Quiet = false;
@@ -77,7 +77,7 @@ const char* cmCTestGenericHandler::GetOption(const std::string& op)
   cmCTestGenericHandler::t_StringToString::iterator remit =
     this->Options.find(op);
   if (remit == this->Options.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return remit->second.c_str();
 }
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index 298804b59da554a5cc7f9db5516fc2803d2d8d20..eb3d611bc00c3b6122add5d1d91ba4d7e2c11a6e 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -101,7 +101,7 @@ std::string cmCTestHG::GetWorkingRevision()
 {
   // Run plumbing "hg identify" to get work tree revision.
   const char* hg = this->CommandLineTool.c_str();
-  const char* hg_identify[] = { hg, "identify", "-i", 0 };
+  const char* hg_identify[] = { hg, "identify", "-i", CM_NULLPTR };
   std::string rev;
   IdentifyParser out(this, "rev-out> ", rev);
   OutputLogger err(this->Log, "rev-err> ");
@@ -129,7 +129,7 @@ bool cmCTestHG::UpdateImpl()
   // Use "hg pull" followed by "hg update" to update the working tree.
   {
     const char* hg = this->CommandLineTool.c_str();
-    const char* hg_pull[] = { hg, "pull", "-v", 0 };
+    const char* hg_pull[] = { hg, "pull", "-v", CM_NULLPTR };
     OutputLogger out(this->Log, "pull-out> ");
     OutputLogger err(this->Log, "pull-err> ");
     this->RunChild(&hg_pull[0], &out, &err);
@@ -154,7 +154,7 @@ bool cmCTestHG::UpdateImpl()
   }
 
   // Sentinel argument.
-  hg_update.push_back(0);
+  hg_update.push_back(CM_NULLPTR);
 
   OutputLogger out(this->Log, "update-out> ");
   OutputLogger err(this->Log, "update-err> ");
@@ -288,7 +288,8 @@ void cmCTestHG::LoadRevisions()
                               "  <file_dels>{file_dels}</file_dels>\n"
                               "</logentry>\n";
   const char* hg_log[] = {
-    hg, "log", "--removed", "-r", range.c_str(), "--template", hgXMLTemplate, 0
+    hg,           "log",         "--removed", "-r", range.c_str(),
+    "--template", hgXMLTemplate, CM_NULLPTR
   };
 
   LogParser out(this, "log-out> ");
@@ -303,7 +304,7 @@ void cmCTestHG::LoadModifications()
 {
   // Use 'hg status' to get modified files.
   const char* hg = this->CommandLineTool.c_str();
-  const char* hg_status[] = { hg, "status", 0 };
+  const char* hg_status[] = { hg, "status", CM_NULLPTR };
   StatusParser out(this, "status-out> ");
   OutputLogger err(this->Log, "status-err> ");
   this->RunChild(hg_status, &out, &err);
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 76f971dbece3bdf514d038f327fb4614866a2d81..e1361a19e7b5b13d083e987ebe7cdae80c7424bb 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -20,7 +20,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
   size_t cc;
   this->Arguments.reserve(INIT_SIZE);
   for (cc = 0; cc < INIT_SIZE; ++cc) {
-    this->Arguments.push_back(0);
+    this->Arguments.push_back(CM_NULLPTR);
   }
   this->Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
   this->Arguments[ct_SOURCE] = "SOURCE";
@@ -36,7 +36,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
 {
   // Allocate space for argument values.
   this->Values.clear();
-  this->Values.resize(this->Last, 0);
+  this->Values.resize(this->Last, CM_NULLPTR);
 
   // Process input arguments.
   this->ArgumentDoing = ArgumentDoingNone;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 99fa9e7c3fe1dcb842eb93267dbe28d21ed659fe..477f16ef06a730a57dad9b649027a5ce59a5762a 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -30,7 +30,7 @@
 cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
 {
   this->Passthru = true;
-  this->Process = 0;
+  this->Process = CM_NULLPTR;
   this->ExitCode = 1;
   this->CWD = cmSystemTools::GetCurrentWorkingDirectory();
 
@@ -128,7 +128,7 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
     return true;
   } else {
     this->RealArgC = 0;
-    this->RealArgV = 0;
+    this->RealArgV = CM_NULLPTR;
     std::cerr << "No launch/command separator ('--') found!\n";
     return false;
   }
@@ -227,9 +227,9 @@ void cmCTestLaunch::RunChild()
 
   // Record child stdout and stderr if necessary.
   if (!this->Passthru) {
-    char* data = 0;
+    char* data = CM_NULLPTR;
     int length = 0;
-    while (int p = cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+    while (int p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
       if (p == cmsysProcess_Pipe_STDOUT) {
         fout.write(data, length);
         std::cout.write(data, length);
@@ -243,7 +243,7 @@ void cmCTestLaunch::RunChild()
   }
 
   // Wait for the real command to finish.
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   this->ExitCode = cmsysProcess_GetExitValue(cp);
 }
 
@@ -384,7 +384,7 @@ void cmCTestLaunch::WriteXMLAction(cmXMLWriter& xml)
   }
 
   // OutputType
-  const char* outputType = 0;
+  const char* outputType = CM_NULLPTR;
   if (!this->OptionTargetType.empty()) {
     if (this->OptionTargetType == "EXECUTABLE") {
       outputType = "executable";
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 6f1a2c49553c81314d72d3f43092a06efc971161..dfa8a1a3b80abd56ba97bbe558c65d1ae8c6651e 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -42,7 +42,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = {
   { "Allocation Conflict", cmCTestMemCheckHandler::FMM },
   { "Bad Pointer Use", cmCTestMemCheckHandler::FMW },
   { "Dangling Pointer", cmCTestMemCheckHandler::FMR },
-  { 0, 0 }
+  { CM_NULLPTR, 0 }
 };
 
 static void xmlReportError(int line, const char* msg, void* data)
@@ -72,7 +72,7 @@ public:
     std::ostringstream ostr;
     ostr << name << ":\n";
     int i = 0;
-    for (; atts[i] != 0; i += 2) {
+    for (; atts[i] != CM_NULLPTR; i += 2) {
       ostr << "   " << atts[i] << " - " << atts[i + 1] << "\n";
     }
     ostr << "\n";
@@ -83,12 +83,12 @@ public:
   const char* GetAttribute(const char* name, const char** atts)
   {
     int i = 0;
-    for (; atts[i] != 0; ++i) {
+    for (; atts[i] != CM_NULLPTR; ++i) {
       if (strcmp(name, atts[i]) == 0) {
         return atts[i + 1];
       }
     }
-    return 0;
+    return CM_NULLPTR;
   }
   void ParseError(const char** atts)
   {
@@ -241,9 +241,9 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
   // define the standard set of errors
   //----------------------------------------------------------------------
   static const char* cmCTestMemCheckResultStrings[] = {
-    "ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM", "FMM",
-    "FMR", "FMW", "FUM",  "IPR", "IPW", "MAF", "MLK", "MPK",
-    "NPR", "ODS", "PAR",  "PLK", "UMC", "UMR", 0
+    "ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM",     "FMM",
+    "FMR", "FMW", "FUM",  "IPR", "IPW", "MAF", "MLK",     "MPK",
+    "NPR", "ODS", "PAR",  "PLK", "UMC", "UMR", CM_NULLPTR
   };
   static const char* cmCTestMemCheckResultLongStrings[] = {
     "Threading Problem",
@@ -268,10 +268,10 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
     "PLK",
     "Uninitialized Memory Conditional",
     "Uninitialized Memory Read",
-    0
+    CM_NULLPTR
   };
   this->GlobalResults.clear();
-  for (int i = 0; cmCTestMemCheckResultStrings[i] != 0; ++i) {
+  for (int i = 0; cmCTestMemCheckResultStrings[i] != CM_NULLPTR; ++i) {
     this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]);
     this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]);
     this->GlobalResults.push_back(0);
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 072da29f7a1d762723f995044b764db6d1043e01..d4a32f1f86cf9ee57c0abd938e1b573f0d6521a4 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -163,7 +163,7 @@ cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
     p4_users.push_back("-m");
     p4_users.push_back("1");
     p4_users.push_back(username.c_str());
-    p4_users.push_back(0);
+    p4_users.push_back(CM_NULLPTR);
 
     UserParser out(this, "users-out> ");
     OutputLogger err(this->Log, "users-err> ");
@@ -358,7 +358,7 @@ std::string cmCTestP4::GetWorkingRevision()
 
   std::string source = this->SourceDirectory + "/...#have";
   p4_identify.push_back(source.c_str());
-  p4_identify.push_back(0);
+  p4_identify.push_back(CM_NULLPTR);
 
   std::string rev;
   IdentifyParser out(this, "p4_changes-out> ", rev);
@@ -418,7 +418,7 @@ void cmCTestP4::LoadRevisions()
 
   p4_changes.push_back("changes");
   p4_changes.push_back(range.c_str());
-  p4_changes.push_back(0);
+  p4_changes.push_back(CM_NULLPTR);
 
   ChangesParser out(this, "p4_changes-out> ");
   OutputLogger err(this->Log, "p4_changes-err> ");
@@ -438,7 +438,7 @@ void cmCTestP4::LoadRevisions()
     p4_describe.push_back("describe");
     p4_describe.push_back("-s");
     p4_describe.push_back(i->c_str());
-    p4_describe.push_back(0);
+    p4_describe.push_back(CM_NULLPTR);
 
     DescribeParser outDescribe(this, "p4_describe-out> ");
     OutputLogger errDescribe(this->Log, "p4_describe-err> ");
@@ -457,7 +457,7 @@ void cmCTestP4::LoadModifications()
   p4_diff.push_back("-dn");
   std::string source = this->SourceDirectory + "/...";
   p4_diff.push_back(source.c_str());
-  p4_diff.push_back(0);
+  p4_diff.push_back(CM_NULLPTR);
 
   DiffParser out(this, "p4_diff-out> ");
   OutputLogger err(this->Log, "p4_diff-err> ");
@@ -474,7 +474,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom)
        i != p4_custom_command.end(); ++i) {
     p4_custom.push_back(i->c_str());
   }
-  p4_custom.push_back(0);
+  p4_custom.push_back(CM_NULLPTR);
 
   OutputLogger custom_out(this->Log, "p4_customsync-out> ");
   OutputLogger custom_err(this->Log, "p4_customsync-err> ");
@@ -525,7 +525,7 @@ bool cmCTestP4::UpdateImpl()
   }
 
   p4_sync.push_back(source.c_str());
-  p4_sync.push_back(0);
+  p4_sync.push_back(CM_NULLPTR);
 
   OutputLogger out(this->Log, "p4_sync-out> ");
   OutputLogger err(this->Log, "p4_sync-err> ");
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 48582c9a57cd7945835e9880b8f24b90df88c667..9e3802aae79dcc7dddbac50cd78a942bbe725689 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -24,12 +24,12 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler)
 {
   this->CTest = handler->CTest;
   this->TestHandler = handler;
-  this->TestProcess = 0;
+  this->TestProcess = CM_NULLPTR;
   this->TestResult.ExecutionTime = 0;
   this->TestResult.ReturnValue = 0;
   this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
   this->TestResult.TestCount = 0;
-  this->TestResult.Properties = 0;
+  this->TestResult.Properties = CM_NULLPTR;
   this->ProcessOutput = "";
   this->CompressedOutput = "";
   this->CompressionRatio = 2;
@@ -577,7 +577,7 @@ double cmCTestRunTest::ResolveTimeout()
     return timeout;
   }
   struct tm* lctime;
-  time_t current_time = time(0);
+  time_t current_time = time(CM_NULLPTR);
   lctime = gmtime(&current_time);
   int gm_hour = lctime->tm_hour;
   time_t gm_time = mktime(lctime);
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index e4b6e255cd1c27929e8cdde0e82eec7964b3adfb..eae0c6ce97378fae5f0cf7796d12c4451a2ae5ba 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -291,7 +291,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
     args.push_back(i->c_str());
   }
 
-  args.push_back(0);
+  args.push_back(CM_NULLPTR);
 
   if (strcmp(parameters[0], "update") == 0) {
     return RunUpdateCommand(&args[0], out, err);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 44b6b934b66d2ac346f3329938fbfc8a31c57636..b747c64c39c93193ae4090e16457df64435657b0 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -82,9 +82,9 @@ cmCTestScriptHandler::cmCTestScriptHandler()
   this->Backup = false;
   this->EmptyBinDir = false;
   this->EmptyBinDirOnce = false;
-  this->Makefile = 0;
-  this->CMake = 0;
-  this->GlobalGenerator = 0;
+  this->Makefile = CM_NULLPTR;
+  this->CMake = CM_NULLPTR;
+  this->GlobalGenerator = CM_NULLPTR;
 
   this->ScriptStartTime = 0;
 
@@ -121,10 +121,10 @@ void cmCTestScriptHandler::Initialize()
   this->ScriptStartTime = 0;
 
   delete this->Makefile;
-  this->Makefile = 0;
+  this->Makefile = CM_NULLPTR;
 
   delete this->GlobalGenerator;
-  this->GlobalGenerator = 0;
+  this->GlobalGenerator = CM_NULLPTR;
 
   delete this->CMake;
 }
@@ -200,7 +200,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
   for (size_t i = 1; i < initArgs.size(); ++i) {
     argv.push_back(initArgs[i].c_str());
   }
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   // Now create process object
   cmsysProcess* cp = cmsysProcess_New();
@@ -226,7 +226,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
   }
 
   // Properly handle output of the build command
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   int result = cmsysProcess_GetState(cp);
   int retVal = 0;
   bool failed = false;
@@ -863,7 +863,7 @@ bool cmCTestScriptHandler::WriteInitialCache(const char* directory,
     return false;
   }
 
-  if (text != 0) {
+  if (text != CM_NULLPTR) {
     fout.write(text, strlen(text));
   }
 
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 99d431af57d2b444b13c7d32e9d8d128d72ea06e..c64d16b53439bd06575fbbbffa79d05402c83dec 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -32,12 +32,12 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
 
   size_t cnt = 0;
   const char* smodel = args[cnt].c_str();
-  const char* src_dir = 0;
-  const char* bld_dir = 0;
+  const char* src_dir = CM_NULLPTR;
+  const char* bld_dir = CM_NULLPTR;
 
   cnt++;
 
-  this->CTest->SetSpecificTrack(0);
+  this->CTest->SetSpecificTrack(CM_NULLPTR);
   if (cnt < args.size() - 1) {
     if (args[cnt] == "TRACK") {
       cnt++;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 664552af99cd2c797fba213086826331197d082f..54da3834e4c305e5e8ea9236eda668e7cdc2ba2a 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -88,7 +88,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
                          extraFiles.end());
     if (!this->CTest->SubmitExtraFiles(newExtraFiles)) {
       this->SetError("problem submitting extra files.");
-      return 0;
+      return CM_NULLPTR;
     }
   }
 
@@ -96,7 +96,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
     this->CTest->GetInitializedHandler("submit");
   if (!handler) {
     this->SetError("internal CTest error. Cannot instantiate submit handler");
-    return 0;
+    return CM_NULLPTR;
   }
 
   // If no FILES or PARTS given, *all* PARTS are submitted by default.
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 3aacde09f2bc28115e057adb253d28787f06b8ac..67388ad06583cc5c587ed16c0694879c3d3f83bc 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -150,7 +150,7 @@ void cmCTestSubmitHandler::Initialize()
   this->HTTPProxyAuth = "";
   this->FTPProxy = "";
   this->FTPProxyType = 0;
-  this->LogFile = 0;
+  this->LogFile = CM_NULLPTR;
   this->Files.clear();
 }
 
@@ -308,7 +308,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
   FILE* ftpfile;
   char error_buffer[1024];
   struct curl_slist* headers =
-    ::curl_slist_append(NULL, "Content-Type: text/xml");
+    ::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
 
   /* In windows, this will init the winsock stuff */
   ::curl_global_init(CURL_GLOBAL_ALL);
@@ -507,10 +507,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
       // If curl failed for any reason, or checksum fails, wait and retry
       //
       if (res != CURLE_OK || this->HasErrors) {
-        std::string retryDelay = this->GetOption("RetryDelay") == NULL
+        std::string retryDelay = this->GetOption("RetryDelay") == CM_NULLPTR
           ? ""
           : this->GetOption("RetryDelay");
-        std::string retryCount = this->GetOption("RetryCount") == NULL
+        std::string retryCount = this->GetOption("RetryCount") == CM_NULLPTR
           ? ""
           : this->GetOption("RetryCount");
 
@@ -776,7 +776,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
   argv.push_back(scp_command.c_str()); // Scp command
   argv.push_back(scp_command.c_str()); // Dummy string for file
   argv.push_back(scp_command.c_str()); // Dummy string for remote url
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   cmsysProcess* cp = cmsysProcess_New();
   cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
@@ -807,12 +807,12 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
     char* data;
     int length;
 
-    while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+    while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
       cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                          cmCTestLogWrite(data, length), this->Quiet);
     }
 
-    cmsysProcess_WaitForExit(cp, 0);
+    cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 
     int result = cmsysProcess_GetState(cp);
 
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index c2c9a8536c813dc9c4e623d583c25b3ab043695b..4cca6eb0b6250e5bfd73ec553e27fd68f479eee1 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -26,7 +26,7 @@ public:
   cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler);
 
   cmCTestSubmitHandler();
-  ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = 0; }
+  ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = CM_NULLPTR; }
 
   /*
    * The main entry point for this class
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 7b437c6ac55256a09105a45b1c43109f2f3451b1..1d064db93917e687109a736637a86d1f56e1f548 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -27,7 +27,7 @@ cmCTestTestCommand::cmCTestTestCommand()
   this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
   this->Arguments[ctt_STOP_TIME] = "STOP_TIME";
   this->Arguments[ctt_TEST_LOAD] = "TEST_LOAD";
-  this->Arguments[ctt_LAST] = 0;
+  this->Arguments[ctt_LAST] = CM_NULLPTR;
   this->Last = ctt_LAST;
 }
 
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 3ee9c5f970d6f0e6c6499cacbe452c09c3378682..1b6b442083758f671e8d9b6f96047506b6736634 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -336,7 +336,7 @@ cmCTestTestHandler::cmCTestTestHandler()
 
   this->MemCheck = false;
 
-  this->LogFile = 0;
+  this->LogFile = CM_NULLPTR;
 
   // regex to detect <DartMeasurement>...</DartMeasurement>
   this->DartStuff.compile("(<DartMeasurement.*/DartMeasurement[a-zA-Z]*>)");
@@ -550,7 +550,7 @@ int cmCTestTestHandler::ProcessHandler()
       cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create "
                    << (this->MemCheck ? "memory check" : "testing")
                    << " XML file" << std::endl);
-      this->LogFile = 0;
+      this->LogFile = CM_NULLPTR;
       return 1;
     }
     cmXMLWriter xml(xmlfile);
@@ -558,15 +558,15 @@ int cmCTestTestHandler::ProcessHandler()
   }
 
   if (!this->PostProcessHandler()) {
-    this->LogFile = 0;
+    this->LogFile = CM_NULLPTR;
     return -1;
   }
 
   if (!failed.empty()) {
-    this->LogFile = 0;
+    this->LogFile = CM_NULLPTR;
     return -1;
   }
-  this->LogFile = 0;
+  this->LogFile = CM_NULLPTR;
   return 0;
 }
 
@@ -936,7 +936,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
 
   bool randomSchedule = this->CTest->GetScheduleType() == "Random";
   if (randomSchedule) {
-    srand((unsigned)time(0));
+    srand((unsigned)time(CM_NULLPTR));
   }
 
   for (ListOfTests::iterator it = this->TestList.begin();
@@ -1154,7 +1154,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
     int retVal = 0;
     cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                        "Run command: " << *it << std::endl, this->Quiet);
-    if (!cmSystemTools::RunSingleCommand(it->c_str(), 0, 0, &retVal, 0,
+    if (!cmSystemTools::RunSingleCommand(it->c_str(), CM_NULLPTR, CM_NULLPTR,
+                                         &retVal, CM_NULLPTR,
                                          cmSystemTools::OUTPUT_MERGE
                                          /*this->Verbose*/) ||
         retVal != 0) {
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index f1bae5d620f49c955a964ca64019e912a8313dfa..bc06da62849bacd09f24aafbf7ff8d50d74e4030 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -83,12 +83,12 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
     this->CTest->GetInitializedHandler("update");
   if (!handler) {
     this->SetError("internal CTest error. Cannot instantiate update handler");
-    return 0;
+    return CM_NULLPTR;
   }
   handler->SetCommand(this);
   if (source_dir.empty()) {
     this->SetError("source directory not specified. Please use SOURCE tag");
-    return 0;
+    return CM_NULLPTR;
   }
   handler->SetOption("SourceDirectory", source_dir.c_str());
   handler->SetQuiet(this->Quiet);
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 4eaa16b0af76f20700da9536926d9061b631cbff..8131c901f946d6230dd537828c32d03c861705ee 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -334,7 +334,7 @@ bool cmCTestUpdateHandler::SelectVCS()
 
   // If no update command was specified, lookup one for this VCS tool.
   if (this->UpdateCommand.empty()) {
-    const char* key = 0;
+    const char* key = CM_NULLPTR;
     switch (this->UpdateType) {
       case e_CVS:
         key = "CVSCommand";
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index c85db0208d74a1432a876ec95d8399cd4b2e54cf..7393d21d5874c0ddecc9daf0d3b7df2ae95a4b47 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -21,7 +21,7 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
     this->CTest->GetInitializedHandler("upload");
   if (!handler) {
     this->SetError("internal CTest error. Cannot instantiate upload handler");
-    return 0;
+    return CM_NULLPTR;
   }
   static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
 
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index e9934e50207903a437743b76f3e06a8d216e9101..3376588d0d5722e9ec21d33ec1043da91c90c0ea 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -65,7 +65,7 @@ bool cmCTestVC::InitialCheckout(const char* command)
        ai != args.end(); ++ai) {
     vc_co.push_back(ai->c_str());
   }
-  vc_co.push_back(0);
+  vc_co.push_back(CM_NULLPTR);
 
   // Run the initial checkout command and log its output.
   this->Log << "--- Begin Initial Checkout ---\n";
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 4ae38eb41937bd25b3a272cf01a13fb8cc7d190d..eb85a2363e56589a2f3643e7b37b6b23e712c344 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -104,8 +104,8 @@ protected:
     Revision const* PriorRev;
     File()
       : Status(PathUpdated)
-      , Rev(0)
-      , PriorRev(0)
+      , Rev(CM_NULLPTR)
+      , PriorRev(CM_NULLPTR)
     {
     }
     File(PathStatus status, Revision const* rev, Revision const* priorRev)
@@ -121,11 +121,11 @@ protected:
 
   /** Run a command line and send output to given parsers.  */
   bool RunChild(char const* const* cmd, OutputParser* out, OutputParser* err,
-                const char* workDir = 0);
+                const char* workDir = CM_NULLPTR);
 
   /** Run VC update command line and send output to given parsers.  */
   bool RunUpdateCommand(char const* const* cmd, OutputParser* out,
-                        OutputParser* err = 0);
+                        OutputParser* err = CM_NULLPTR);
 
   /** Write xml element for one file.  */
   void WriteXMLEntry(cmXMLWriter& xml, std::string const& path,
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index e5dd74a9fc0d8305be678ba60ad78e8d8b3dbe36..d786d7997a24806f0946c23187ba4344946736a0 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -130,8 +130,8 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
     return true;
   } else {
     // try some alternate names
-    const char* tryname[] = { "GUX", "GTM", "ONT", 0 };
-    for (int k = 0; tryname[k] != 0; k++) {
+    const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR };
+    for (int k = 0; tryname[k] != CM_NULLPTR; k++) {
       std::string routine2 = routine + tryname[k];
       i = this->RoutineToDirectory.find(routine2);
       if (i != this->RoutineToDirectory.end()) {
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index db5151c07e19f9f97b112af35e2c22f9f977d410..92fe64266796be639480b9c621db4423726cc031 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -16,7 +16,7 @@
 
 cmProcess::cmProcess()
 {
-  this->Process = 0;
+  this->Process = CM_NULLPTR;
   this->Timeout = 0;
   this->TotalTime = 0;
   this->ExitValue = 0;
@@ -52,7 +52,7 @@ bool cmProcess::StartProcess()
        i != this->Arguments.end(); ++i) {
     this->ProcessArgs.push_back(i->c_str());
   }
-  this->ProcessArgs.push_back(0); // null terminate the list
+  this->ProcessArgs.push_back(CM_NULLPTR); // null terminate the list
   this->Process = cmsysProcess_New();
   cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin());
   if (!this->WorkingDirectory.empty()) {
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index be8751cbb47e38e705ad67bed6430653b8454fc7..606c9541e144dca2acf2d18760d17348c5712429 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -24,29 +24,30 @@
 #include <form.h>
 
 static const char* cmDocumentationName[][2] = {
-  { 0, "  ccmake - Curses Interface for CMake." },
-  { 0, 0 }
+  { CM_NULLPTR, "  ccmake - Curses Interface for CMake." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationUsage[][2] = {
-  { 0, "  ccmake <path-to-source>\n"
-       "  ccmake <path-to-existing-build>" },
-  { 0, "Specify a source directory to (re-)generate a build system for "
-       "it in the current working directory.  Specify an existing build "
-       "directory to re-generate its build system." },
-  { 0, 0 }
+  { CM_NULLPTR, "  ccmake <path-to-source>\n"
+                "  ccmake <path-to-existing-build>" },
+  { CM_NULLPTR,
+    "Specify a source directory to (re-)generate a build system for "
+    "it in the current working directory.  Specify an existing build "
+    "directory to re-generate its build system." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationUsageNote[][2] = {
-  { 0, "Run 'ccmake --help' for more information." },
-  { 0, 0 }
+  { CM_NULLPTR, "Run 'ccmake --help' for more information." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationOptions[]
                                          [2] = { CMAKE_STANDARD_OPTIONS_TABLE,
-                                                 { 0, 0 } };
+                                                 { CM_NULLPTR, CM_NULLPTR } };
 
-cmCursesForm* cmCursesForm::CurrentForm = 0;
+cmCursesForm* cmCursesForm::CurrentForm = CM_NULLPTR;
 
 extern "C" {
 
@@ -176,7 +177,7 @@ int main(int argc, char const* const* argv)
   touchwin(stdscr);
   endwin();
   delete cmCursesForm::CurrentForm;
-  cmCursesForm::CurrentForm = 0;
+  cmCursesForm::CurrentForm = CM_NULLPTR;
 
   std::cout << std::endl << std::endl;
 
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index bdfc8e9b2c766025bf23492245b07494a9d1dd7b..ea12756cea1637abea6bacdb17a80c9d47df69b0 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -32,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
 {
   this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key);
   this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
-  this->Entry = 0;
+  this->Entry = CM_NULLPTR;
   this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
 }
 
@@ -50,7 +50,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
     this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
   }
 
-  this->Entry = 0;
+  this->Entry = CM_NULLPTR;
   const char* value = cm->GetState()->GetCacheEntryValue(key);
   assert(value);
   switch (cm->GetState()->GetCacheEntryType(key)) {
@@ -111,6 +111,6 @@ const char* cmCursesCacheEntryComposite::GetValue()
   if (this->Label) {
     return this->Label->GetValue();
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index aa4710f0682b66c23f9ca29ff0a056b1c3c45479..b3320c9f5e3497cfa2993092359b436226cb5e92 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -16,7 +16,7 @@ bool cmCursesForm::Debug = false;
 
 cmCursesForm::cmCursesForm()
 {
-  this->Form = 0;
+  this->Form = CM_NULLPTR;
 }
 
 cmCursesForm::~cmCursesForm()
@@ -24,7 +24,7 @@ cmCursesForm::~cmCursesForm()
   if (this->Form) {
     unpost_form(this->Form);
     free_form(this->Form);
-    this->Form = 0;
+    this->Form = CM_NULLPTR;
   }
 }
 
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index d03d3300d88c1cafbbadb144b39093df9484db08..48cc42c58fe7bdd5c206f9f1b71c7b5b93999e57 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -32,8 +32,8 @@ cmCursesLongMessageForm::cmCursesLongMessageForm(
     this->Messages += "\n\n";
   }
   this->Title = title;
-  this->Fields[0] = 0;
-  this->Fields[1] = 0;
+  this->Fields[0] = CM_NULLPTR;
+  this->Fields[1] = CM_NULLPTR;
 }
 
 cmCursesLongMessageForm::~cmCursesLongMessageForm()
@@ -110,7 +110,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
   if (this->Form) {
     unpost_form(this->Form);
     free_form(this->Form);
-    this->Form = 0;
+    this->Form = CM_NULLPTR;
   }
 
   const char* msg = this->Messages.c_str();
@@ -119,7 +119,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
 
   if (this->Fields[0]) {
     free_field(this->Fields[0]);
-    this->Fields[0] = 0;
+    this->Fields[0] = CM_NULLPTR;
   }
 
   this->Fields[0] = new_field(y - 6, x - 2, 1, 1, 0, 0);
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index b740eb0b2b2e8a798eda92b3ed6c46d074049338..9ae38d62d254d1b4b2456e9e39f5349ec4ffc27a 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -36,8 +36,8 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
   , InitialWidth(initWidth)
 {
   this->NumberOfPages = 0;
-  this->Fields = 0;
-  this->Entries = 0;
+  this->Fields = CM_NULLPTR;
+  this->Entries = CM_NULLPTR;
   this->AdvancedMode = false;
   this->NumberOfVisibleEntries = 0;
   this->OkToGenerate = false;
@@ -64,7 +64,7 @@ cmCursesMainForm::~cmCursesMainForm()
   if (this->Form) {
     unpost_form(this->Form);
     free_form(this->Form);
-    this->Form = 0;
+    this->Form = CM_NULLPTR;
   }
   delete[] this->Fields;
 
@@ -75,7 +75,7 @@ cmCursesMainForm::~cmCursesMainForm()
   delete this->Entries;
   if (this->CMakeInstance) {
     delete this->CMakeInstance;
-    this->CMakeInstance = 0;
+    this->CMakeInstance = CM_NULLPTR;
   }
 }
 
@@ -185,7 +185,7 @@ void cmCursesMainForm::RePost()
   if (this->Form) {
     unpost_form(this->Form);
     free_form(this->Form);
-    this->Form = 0;
+    this->Form = CM_NULLPTR;
   }
   delete[] this->Fields;
   if (this->AdvancedMode) {
@@ -215,7 +215,7 @@ void cmCursesMainForm::RePost()
   this->Fields = new FIELD*[3 * this->NumberOfVisibleEntries + 1];
   size_t cc;
   for (cc = 0; cc < 3 * this->NumberOfVisibleEntries + 1; cc++) {
-    this->Fields[cc] = 0;
+    this->Fields[cc] = CM_NULLPTR;
   }
 
   // Assign fields
@@ -244,7 +244,7 @@ void cmCursesMainForm::RePost()
     this->NumberOfVisibleEntries = 1;
   }
   // Has to be null terminated.
-  this->Fields[3 * this->NumberOfVisibleEntries] = 0;
+  this->Fields[3 * this->NumberOfVisibleEntries] = CM_NULLPTR;
 }
 
 void cmCursesMainForm::Render(int left, int top, int width, int height)
@@ -263,7 +263,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
     // Delete the previous form
     unpost_form(this->Form);
     free_form(this->Form);
-    this->Form = 0;
+    this->Form = CM_NULLPTR;
   }
 
   // Wrong window size
@@ -345,7 +345,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
   }
 
   // Give the current widget (if it exists), a chance to print keys
-  cmCursesWidget* cw = 0;
+  cmCursesWidget* cw = CM_NULLPTR;
   if (this->Form) {
     FIELD* currentField = current_field(this->Form);
     cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
@@ -434,7 +434,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
   // Get the key of the current entry
   FIELD* cur = current_field(this->Form);
   int findex = field_index(cur);
-  cmCursesWidget* lbl = 0;
+  cmCursesWidget* lbl = CM_NULLPTR;
   if (findex >= 0) {
     lbl = reinterpret_cast<cmCursesWidget*>(
       field_userptr(this->Fields[findex - 2]));
@@ -566,7 +566,7 @@ int cmCursesMainForm::Configure(int noconfigure)
   this->FillCacheManagerFromUI();
   this->CMakeInstance->SaveCache(
     this->CMakeInstance->GetHomeOutputDirectory());
-  this->LoadCache(0);
+  this->LoadCache(CM_NULLPTR);
 
   // Get rid of previous errors
   this->Errors = std::vector<std::string>();
@@ -583,7 +583,7 @@ int cmCursesMainForm::Configure(int noconfigure)
   } else {
     retVal = this->CMakeInstance->Configure();
   }
-  this->CMakeInstance->SetProgressCallback(0, 0);
+  this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
 
   keypad(stdscr, TRUE); /* Use key symbols as
                            KEY_DOWN*/
@@ -638,7 +638,7 @@ int cmCursesMainForm::Generate()
   // run the generate process
   int retVal = this->CMakeInstance->Generate();
 
-  this->CMakeInstance->SetProgressCallback(0, 0);
+  this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
   keypad(stdscr, TRUE); /* Use key symbols as
                            KEY_DOWN*/
 
@@ -888,7 +888,7 @@ void cmCursesMainForm::HandleInput()
         cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(
           field_userptr(this->Fields[findex - 2]));
         const char* curField = lbl->GetValue();
-        const char* helpString = 0;
+        const char* helpString = CM_NULLPTR;
 
         const char* existingValue =
           this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
@@ -973,7 +973,7 @@ void cmCursesMainForm::HandleInput()
         // (findex always corresponds to the value field)
         FIELD* nextCur;
         if (findex == 2) {
-          nextCur = 0;
+          nextCur = CM_NULLPTR;
         } else if (findex == 3 * this->NumberOfVisibleEntries - 1) {
           nextCur = this->Fields[findex - 5];
         } else {
@@ -1003,7 +1003,7 @@ void cmCursesMainForm::HandleInput()
 
           if (nextCur) {
             // make the next or prev. current field after deletion
-            nextCur = 0;
+            nextCur = CM_NULLPTR;
             std::vector<cmCursesCacheEntryComposite*>::iterator it;
             for (it = this->Entries->begin(); it != this->Entries->end();
                  ++it) {
@@ -1052,7 +1052,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
   int findex = start_index;
   for (;;) {
     if (!str.empty()) {
-      cmCursesWidget* lbl = 0;
+      cmCursesWidget* lbl = CM_NULLPTR;
       if (findex >= 0) {
         lbl = reinterpret_cast<cmCursesWidget*>(
           field_userptr(this->Fields[findex - 2]));
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index a8e99b6bab902ca2617c5dafd7d0f6ee46e55663..d17ee33f599ca4eeb917ba13692d23fa58b35982 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -67,7 +67,7 @@ public:
    * exception is during a resize. The optional argument specifies the
    * string to be displayed in the status bar.
    */
-  void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(0); }
+  void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(CM_NULLPTR); }
   virtual void UpdateStatusBar(const char* message);
 
   /**
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 3707d0d39c88848716fa1219ccaaf57d73b0f285..6eb5310a348a900f1b5bc0a70c8bd50e25082969 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -72,7 +72,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
     return false;
   }
 
-  this->OriginalString = 0;
+  this->OriginalString = CM_NULLPTR;
   this->Done = false;
 
   char debugMessage[128];
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 100ed1d58894c109c358296db472b786f18cb2e1..49f27958e1a0245262f8e93e8086dd19982d200a 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -23,7 +23,7 @@ cmCursesWidget::~cmCursesWidget()
 {
   if (this->Field) {
     free_field(this->Field);
-    this->Field = 0;
+    this->Field = CM_NULLPTR;
   }
 }
 
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index d8fd1d8629dc36a432dd76115d6ed9c5512c9eb7..400be7712f3147a8289ec2b904d3bd4b1c5ccd40 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -30,7 +30,7 @@ bool cmAddCustomCommandCommand::InitialPass(
 
   std::string source, target, main_dependency, working;
   std::string comment_buffer;
-  const char* comment = 0;
+  const char* comment = CM_NULLPTR;
   std::vector<std::string> depends, outputs, output, byproducts;
   bool verbatim = false;
   bool append = false;
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index ac08cb2602954761cae1ad167abc78e2a939bf14..9dc7c590ff76fd9de9ff8aeaf49b42996e129f67 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -47,7 +47,7 @@ bool cmAddCustomTargetCommand::InitialPass(
   bool verbatim = false;
   bool uses_terminal = false;
   std::string comment_buffer;
-  const char* comment = 0;
+  const char* comment = CM_NULLPTR;
   std::vector<std::string> sources;
 
   // Keep track of parser state.
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 235cf88c6d1603c5858bb79a1d1b3656df810ddf..ceb7d31cf2c0ae2daa9f012fe8092c0a2830032a 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -151,9 +151,9 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
   }
 
   if (archive_write_open(
-        this->Archive, this, 0,
+        this->Archive, this, CM_NULLPTR,
         reinterpret_cast<archive_write_callback*>(&Callback::Write),
-        0) != ARCHIVE_OK) {
+        CM_NULLPTR) != ARCHIVE_OK) {
     this->Error = "archive_write_open: ";
     this->Error += cm_archive_error_string(this->Archive);
     return;
@@ -229,7 +229,8 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
   Entry e;
   cm_archive_entry_copy_sourcepath(e, file);
   cm_archive_entry_copy_pathname(e, dest);
-  if (archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK) {
+  if (archive_read_disk_entry_from_file(this->Disk, e, -1, CM_NULLPTR) !=
+      ARCHIVE_OK) {
     this->Error = "archive_read_disk_entry_from_file '";
     this->Error += file;
     this->Error += "': ";
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 72d8f3a6d11a60c0f7ddbe9f5c63c90ce13d9145..f847d09b74922e800293e70c3171accb500c083c 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -72,13 +72,13 @@ public:
    * skip.  The remaining part of the input path is appended to the
    * "prefix" value to construct the final name in the archive.
    */
-  bool Add(std::string path, size_t skip = 0, const char* prefix = 0,
+  bool Add(std::string path, size_t skip = 0, const char* prefix = CM_NULLPTR,
            bool recursive = true);
 
   /** Returns true if there has been no error.  */
   operator safe_bool() const
   {
-    return this->Okay() ? &cmArchiveWrite::safe_bool_true : 0;
+    return this->Okay() ? &cmArchiveWrite::safe_bool_true : CM_NULLPTR;
   }
 
   /** Returns true if there has been an error.  */
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 586e8a8114e63b4c08e1b389536b55c00b209ac0..fb143a2b9a318b4edf805460e8417eac53ae8389 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -36,8 +36,8 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
   const char* variable = args[0].c_str();
 
   // Parse remaining arguments.
-  const char* configuration = 0;
-  const char* project_name = 0;
+  const char* configuration = CM_NULLPTR;
+  const char* project_name = CM_NULLPTR;
   std::string target;
   enum Doing
   {
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index a78300cb63bd69f52d7544d27c92446bf0ec56ef..f97791a6706ad4359b0e325b4cafc3175050a045 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -218,8 +218,8 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
   }
 
   // Pass the call to the makefile instance.
-  mf->AddUtilityCommand(utilityName, (all ? false : true), 0, depends2,
-                        commandLines);
+  mf->AddUtilityCommand(utilityName, (all ? false : true), CM_NULLPTR,
+                        depends2, commandLines);
 }
 void CCONV cmAddCustomCommand(void* arg, const char* source,
                               const char* command, int numArgs,
@@ -257,7 +257,7 @@ void CCONV cmAddCustomCommand(void* arg, const char* source,
   }
 
   // Pass the call to the makefile instance.
-  const char* no_comment = 0;
+  const char* no_comment = CM_NULLPTR;
   mf->AddCustomCommandOldStyle(target, outputs2, depends2, source,
                                commandLines, no_comment);
 }
@@ -291,8 +291,8 @@ void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
   }
 
   // Pass the call to the makefile instance.
-  const char* no_comment = 0;
-  const char* no_working_dir = 0;
+  const char* no_comment = CM_NULLPTR;
+  const char* no_working_dir = CM_NULLPTR;
   mf->AddCustomCommandToOutput(output, depends2, main_dependency, commandLines,
                                no_comment, no_working_dir);
 }
@@ -333,8 +333,8 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
   // Pass the call to the makefile instance.
   std::vector<std::string> no_byproducts;
   std::vector<std::string> no_depends;
-  const char* no_comment = 0;
-  const char* no_working_dir = 0;
+  const char* no_comment = CM_NULLPTR;
+  const char* no_working_dir = CM_NULLPTR;
   mf->AddCustomCommandToTarget(target, no_byproducts, no_depends, commandLines,
                                cctype, no_comment, no_working_dir);
 }
@@ -414,7 +414,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
     result.push_back(args[i]);
   }
   int resargc = static_cast<int>(result.size());
-  char** resargv = 0;
+  char** resargv = CM_NULLPTR;
   if (resargc) {
     resargv = (char**)malloc(resargc * sizeof(char*));
   }
@@ -453,7 +453,7 @@ int CCONV cmGetTotalArgumentSize(int argc, char** argv)
 struct cmCPluginAPISourceFile
 {
   cmCPluginAPISourceFile()
-    : RealSourceFile(0)
+    : RealSourceFile(CM_NULLPTR)
   {
   }
   cmSourceFile* RealSourceFile;
@@ -525,7 +525,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
     }
     return (void*)i->second;
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
@@ -534,7 +534,7 @@ void* CCONV cmAddSource(void* arg, void* arg2)
   cmMakefile* mf = static_cast<cmMakefile*>(arg);
   cmCPluginAPISourceFile* osf = static_cast<cmCPluginAPISourceFile*>(arg2);
   if (osf->FullPath.empty()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Create the real cmSourceFile instance and copy over saved information.
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 2e47298a22bc6288c6d26a05f2d9a3276cfb37d9..3694f09c73b3305272c31b8e3b64ede90245f3d3 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -70,7 +70,7 @@
 struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
 {
   struct tm* lctime;
-  time_t tctime = time(0);
+  time_t tctime = time(CM_NULLPTR);
   lctime = gmtime(&tctime);
   char buf[1024];
   // add todays year day and month to the time in str because
@@ -88,7 +88,7 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
   // As such, this time may be in the past or in the future.
   time_t ntime = curl_getdate(buf, &tctime);
   cmCTestLog(this, DEBUG, "   Get curl time: " << ntime << std::endl);
-  tctime = time(0);
+  tctime = time(CM_NULLPTR);
   cmCTestLog(this, DEBUG, "   Get the current time: " << tctime << std::endl);
 
   const int dayLength = 24 * 60 * 60;
@@ -134,7 +134,7 @@ std::string cmCTest::CleanString(const std::string& str)
 
 std::string cmCTest::CurrentTime()
 {
-  time_t currenttime = time(0);
+  time_t currenttime = time(CM_NULLPTR);
   struct tm* t = localtime(&currenttime);
   // return ::CleanString(ctime(&currenttime));
   char current_time[1024];
@@ -244,7 +244,7 @@ std::string cmCTest::DecodeURL(const std::string& in)
   for (const char* c = in.c_str(); *c; ++c) {
     if (*c == '%' && isxdigit(*(c + 1)) && isxdigit(*(c + 2))) {
       char buf[3] = { *(c + 1), *(c + 2), 0 };
-      out.append(1, char(strtoul(buf, 0, 16)));
+      out.append(1, char(strtoul(buf, CM_NULLPTR, 16)));
       c += 2;
     } else {
       out.append(1, *c);
@@ -288,7 +288,7 @@ cmCTest::cmCTest()
   this->ScheduleType = "";
   this->StopTime = "";
   this->NextDayStopTime = false;
-  this->OutputLogFile = 0;
+  this->OutputLogFile = CM_NULLPTR;
   this->OutputLogFileLastTag = -1;
   this->SuppressUpdatingCTestConfiguration = false;
   this->DartVersion = 1;
@@ -347,7 +347,7 @@ cmCTest::cmCTest()
 cmCTest::~cmCTest()
 {
   cmDeleteAll(this->TestingHandlers);
-  this->SetOutputLogFileName(0);
+  this->SetOutputLogFileName(CM_NULLPTR);
 }
 
 void cmCTest::SetParallelLevel(int level)
@@ -515,7 +515,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
     std::string tag;
 
     if (createNewTag) {
-      time_t tctime = time(0);
+      time_t tctime = time(CM_NULLPTR);
       if (this->TomorrowTag) {
         tctime += (24 * 60 * 60);
       }
@@ -540,7 +540,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
         }
         tfin.close();
       }
-      if (tag.empty() || (0 != command) || this->Parts[PartStart]) {
+      if (tag.empty() || (CM_NULLPTR != command) || this->Parts[PartStart]) {
         cmCTestOptionalLog(
           this, DEBUG,
           "TestModel: " << this->GetTestModelString() << std::endl, quiet);
@@ -562,7 +562,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
           ofs << this->GetTestModelString() << std::endl;
         }
         ofs.close();
-        if (0 == command) {
+        if (CM_NULLPTR == command) {
           cmCTestOptionalLog(this, OUTPUT, "Create new tag: "
                                << tag << " - " << this->GetTestModelString()
                                << std::endl,
@@ -860,7 +860,7 @@ cmCTestGenericHandler* cmCTest::GetInitializedHandler(const char* handler)
   cmCTest::t_TestingHandlers::iterator it =
     this->TestingHandlers.find(handler);
   if (it == this->TestingHandlers.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   it->second->Initialize();
   return it->second;
@@ -871,7 +871,7 @@ cmCTestGenericHandler* cmCTest::GetHandler(const char* handler)
   cmCTest::t_TestingHandlers::iterator it =
     this->TestingHandlers.find(handler);
   if (it == this->TestingHandlers.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return it->second;
 }
@@ -1029,7 +1029,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
        a != args.end(); ++a) {
     argv.push_back(a->c_str());
   }
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   output = "";
   cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:");
@@ -1057,7 +1057,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
   cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, "   Each . represents "
                << tick_len << " bytes of output" << std::endl
                << "    " << std::flush);
-  while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+  while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
     for (int cc = 0; cc < length; ++cc) {
       if (data[cc] == 0) {
         data[cc] = '\n';
@@ -1082,7 +1082,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
   cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size of output: "
                << int(double(output.size()) / 1024.0) << "K" << std::endl);
 
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 
   int result = cmsysProcess_GetState(cp);
 
@@ -1211,7 +1211,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
 
   char* data;
   int length;
-  while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
+  while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) {
     if (output) {
       tempOutput.insert(tempOutput.end(), data, data + length);
     }
@@ -1221,7 +1221,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
     }
   }
 
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   if (output && tempOutput.begin() != tempOutput.end()) {
     output->append(&*tempOutput.begin(), tempOutput.size());
   }
@@ -2181,7 +2181,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
         it->second->SetSubmitIndex(this->SubmitIndex);
       }
       std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
-      if (!this->Initialize(cwd.c_str(), 0)) {
+      if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) {
         res = 12;
         cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard."
                      << std::endl);
@@ -2325,7 +2325,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
   bool inBld = bldRelpath.find("..") == bldRelpath.npos;
   // TODO: Handle files with .. in their name
 
-  std::string* res = 0;
+  std::string* res = CM_NULLPTR;
 
   if (inSrc && inBld) {
     // If both have relative path with no dots, pick the shorter one
@@ -2375,7 +2375,7 @@ void cmCTest::EmptyCTestConfiguration()
 void cmCTest::DetermineNextDayStop()
 {
   struct tm* lctime;
-  time_t current_time = time(0);
+  time_t current_time = time(CM_NULLPTR);
   lctime = gmtime(&current_time);
   int gm_hour = lctime->tm_hour;
   time_t gm_time = mktime(lctime);
@@ -2459,7 +2459,7 @@ bool cmCTest::GetProduceXML()
 const char* cmCTest::GetSpecificTrack()
 {
   if (this->SpecificTrack.empty()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return this->SpecificTrack.c_str();
 }
@@ -2534,7 +2534,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
        a != args.end(); ++a) {
     argv.push_back(a->c_str());
   }
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   *stdOut = "";
   *stdErr = "";
@@ -2555,7 +2555,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
   int res;
   bool done = false;
   while (!done) {
-    res = cmsysProcess_WaitForData(cp, &data, &length, 0);
+    res = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR);
     switch (res) {
       case cmsysProcess_Pipe_STDOUT:
         tempOutput.insert(tempOutput.end(), data, data + length);
@@ -2572,7 +2572,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
     }
   }
 
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   if (!tempOutput.empty()) {
     stdOut->append(&*tempOutput.begin(), tempOutput.size());
   }
@@ -2614,7 +2614,7 @@ void cmCTest::SetOutputLogFileName(const char* name)
 {
   if (this->OutputLogFile) {
     delete this->OutputLogFile;
-    this->OutputLogFile = 0;
+    this->OutputLogFile = CM_NULLPTR;
   }
   if (name) {
     this->OutputLogFile = new cmGeneratedFileStream(name);
@@ -2628,7 +2628,7 @@ static const char* cmCTestStringLogType[] = { "DEBUG",
                                               "HANDLER_VERBOSE_OUTPUT",
                                               "WARNING",
                                               "ERROR_MESSAGE",
-                                              0 };
+                                              CM_NULLPTR };
 
 #ifdef cerr
 #undef cerr
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 65ecaa4dd6770c920d86fc2384350f6c9aa7451f..833cd969e0b218308361ff8c65ad569b9589823f 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -120,7 +120,7 @@ public:
   typedef std::set<std::string> SetOfStrings;
 
   ///! Process Command line arguments
-  int Run(std::vector<std::string>&, std::string* output = 0);
+  int Run(std::vector<std::string>&, std::string* output = CM_NULLPTR);
 
   /**
    * Initialize and finalize testing
@@ -271,8 +271,8 @@ public:
    * escaped for this to with spaces.
    */
   bool RunCommand(const char* command, std::string* stdOut,
-                  std::string* stdErr, int* retVal = 0, const char* dir = 0,
-                  double timeout = 0.0);
+                  std::string* stdErr, int* retVal = CM_NULLPTR,
+                  const char* dir = CM_NULLPTR, double timeout = 0.0);
 
   //! Clean/make safe for xml the given value such that it may be used as
   // one of the key fields by CDash when computing the buildid.
@@ -574,7 +574,7 @@ private:
 
   //! Check if the argument is the one specified
   bool CheckArgument(const std::string& arg, const char* varg1,
-                     const char* varg2 = 0);
+                     const char* varg2 = CM_NULLPTR);
 
   //! Output errors from a test
   void OutputTestErrors(std::vector<char> const& process_output);
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index bcef3c84c76cfc82b5e236d54c46c37224c58b9d..bdd73037ce16e36bd1000f1b7e058727053cd791 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -179,7 +179,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
 }
 
 const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED",
-                                                       "STRINGS", 0 };
+                                                       "STRINGS", CM_NULLPTR };
 
 bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
                                        CacheEntry& e)
@@ -447,7 +447,7 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
   if (i != this->Cache.end()) {
     return &i->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char* key)
@@ -462,7 +462,7 @@ const char* cmCacheManager::GetInitializedCacheValue(
   if (i != this->Cache.end() && i->second.Initialized) {
     return i->second.Value.c_str();
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 void cmCacheManager::PrintCache(std::ostream& out) const
@@ -616,7 +616,7 @@ const char* cmCacheManager::CacheIterator::GetProperty(
   if (!this->IsAtEnd()) {
     return this->GetEntry().GetProperty(prop);
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 void cmCacheManager::CacheIterator::SetProperty(const std::string& p,
@@ -653,5 +653,5 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
 bool cmCacheManager::CacheIterator::PropertyExists(
   const std::string& prop) const
 {
-  return this->GetProperty(prop) != NULL;
+  return this->GetProperty(prop) != CM_NULLPTR;
 }
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 153e9575c725c7527dd13c5b9a09f369fac1a372..23318673a59adad20621d940c2f9cd2d4abecf80 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -113,7 +113,7 @@ public:
   void PrintCache(std::ostream&) const;
 
   ///! Get the iterator for an entry with a given key.
-  cmCacheManager::CacheIterator GetCacheIterator(const char* key = 0);
+  cmCacheManager::CacheIterator GetCacheIterator(const char* key = CM_NULLPTR);
 
   ///! Remove an entry from the cache
   void RemoveCacheEntry(const std::string& key);
@@ -128,7 +128,7 @@ public:
   {
     cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
     if (it.IsAtEnd()) {
-      return 0;
+      return CM_NULLPTR;
     }
     return it.GetValue();
   }
@@ -171,7 +171,8 @@ public:
   void RemoveCacheEntryProperty(std::string const& key,
                                 std::string const& propName)
   {
-    this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
+    this->GetCacheIterator(key.c_str())
+      .SetProperty(propName, (void*)CM_NULLPTR);
   }
 
   void AppendCacheEntryProperty(std::string const& key,
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index be90a469e00b3f6842179c535fd540d2384e8f0b..a5f20e6df1a089c965ddf75cc5fffdb81a0bfa38 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -38,7 +38,7 @@ public:
    */
   cmCommand()
   {
-    this->Makefile = 0;
+    this->Makefile = CM_NULLPTR;
     this->Enabled = true;
   }
 
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index a4f3c7d56c101328bbbc7dc5f6ede1c7db9652ae..294117ca63b4b5bf9bde8d89e06c62d52bbf1640 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -25,7 +25,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
   this->WarnUninitialized = false;
   this->CheckSystemVars = false;
   this->FileLine = -1;
-  this->FileName = 0;
+  this->FileName = CM_NULLPTR;
   this->RemoveEmpty = true;
   this->EmptyVariable[0] = 0;
   strcpy(this->DCURLYVariable, "${");
@@ -96,13 +96,13 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
   e << "Syntax $" << key << "{} is not supported.  "
     << "Only ${}, $ENV{}, and $CACHE{} are allowed.";
   this->SetError(e.str());
-  return 0;
+  return CM_NULLPTR;
 }
 
 char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
 {
   if (!var) {
-    return 0;
+    return CM_NULLPTR;
   }
   if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
     std::ostringstream ostr;
@@ -125,7 +125,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
         this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
       }
     }
-    return 0;
+    return CM_NULLPTR;
   }
   if (this->EscapeQuotes && value) {
     return this->AddString(cmSystemTools::EscapeQuotes(value));
@@ -176,7 +176,7 @@ char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
 void cmCommandArgumentParserHelper::AllocateParserType(
   cmCommandArgumentParserHelper::ParserType* pt, const char* str, int len)
 {
-  pt->str = 0;
+  pt->str = CM_NULLPTR;
   if (len == 0) {
     len = static_cast<int>(strlen(str));
   }
diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx
index c336bc53b385d70c6ec343da319dd8849f8367cc..1345bd5e9d9a1847619c41f7ef68bfa731b818ab 100644
--- a/Source/cmCommandArgumentsHelper.cxx
+++ b/Source/cmCommandArgumentsHelper.cxx
@@ -21,11 +21,11 @@ cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args,
   , ArgumentsBeforeEmpty(true)
   , CurrentIndex(0)
 {
-  if (args != 0) {
+  if (args != CM_NULLPTR) {
     args->AddArgument(this);
   }
 
-  if (this->Group != 0) {
+  if (this->Group != CM_NULLPTR) {
     this->Group->ContainedArguments.push_back(this);
   }
 }
@@ -45,7 +45,7 @@ void cmCommandArgument::Follows(const cmCommandArgument* arg)
 
 void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group)
 {
-  if (group != 0) {
+  if (group != CM_NULLPTR) {
     this->ArgumentsBeforeEmpty = false;
     this->ArgumentsBefore.insert(group->ContainedArguments.begin(),
                                  group->ContainedArguments.end());
@@ -69,7 +69,7 @@ bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const
 
 bool cmCommandArgument::KeyMatches(const std::string& key) const
 {
-  if ((this->Key == 0) || (this->Key[0] == '\0')) {
+  if ((this->Key == CM_NULLPTR) || (this->Key[0] == '\0')) {
     return true;
   }
   return (key == this->Key);
@@ -77,7 +77,7 @@ bool cmCommandArgument::KeyMatches(const std::string& key) const
 
 void cmCommandArgument::ApplyOwnGroup()
 {
-  if (this->Group != 0) {
+  if (this->Group != CM_NULLPTR) {
     for (std::vector<cmCommandArgument*>::const_iterator it =
            this->Group->ContainedArguments.begin();
          it != this->Group->ContainedArguments.end(); ++it) {
@@ -105,9 +105,9 @@ cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args,
                                    const char* key,
                                    cmCommandArgumentGroup* group)
   : cmCommandArgument(args, key, group)
-  , Ignore(0)
+  , Ignore(CM_NULLPTR)
 {
-  if ((key == 0) || (*key == 0)) {
+  if ((key == CM_NULLPTR) || (*key == 0)) {
     this->DataStart = 0;
   } else {
     this->DataStart = 1;
@@ -117,7 +117,7 @@ cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args,
 bool cmCAStringVector::DoConsume(const std::string& arg, unsigned int index)
 {
   if (index >= this->DataStart) {
-    if ((this->Ignore == 0) || (arg != this->Ignore)) {
+    if ((this->Ignore == CM_NULLPTR) || (arg != this->Ignore)) {
       this->Vector.push_back(arg);
     }
   }
@@ -134,7 +134,7 @@ cmCAString::cmCAString(cmCommandArgumentsHelper* args, const char* key,
                        cmCommandArgumentGroup* group)
   : cmCommandArgument(args, key, group)
 {
-  if ((key == 0) || (*key == 0)) {
+  if ((key == CM_NULLPTR) || (*key == 0)) {
     this->DataStart = 0;
   } else {
     this->DataStart = 1;
@@ -216,7 +216,7 @@ void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group)
 void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
                                      std::vector<std::string>* unconsumedArgs)
 {
-  if (args == 0) {
+  if (args == CM_NULLPTR) {
     return;
   }
 
@@ -227,8 +227,8 @@ void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
     (*argIt)->Reset();
   }
 
-  cmCommandArgument* activeArgument = 0;
-  const cmCommandArgument* previousArgument = 0;
+  cmCommandArgument* activeArgument = CM_NULLPTR;
+  const cmCommandArgument* previousArgument = CM_NULLPTR;
   for (std::vector<std::string>::const_iterator it = args->begin();
        it != args->end(); ++it) {
     for (std::vector<cmCommandArgument*>::iterator argIt =
@@ -246,10 +246,10 @@ void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args,
       bool argDone = activeArgument->Consume(*it);
       previousArgument = activeArgument;
       if (argDone) {
-        activeArgument = 0;
+        activeArgument = CM_NULLPTR;
       }
     } else {
-      if (unconsumedArgs != 0) {
+      if (unconsumedArgs != CM_NULLPTR) {
         unconsumedArgs->push_back(*it);
       }
     }
diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h
index 27fef1f700efac109a9e696eb859a1efd81c0653..9133148816ebe8b4121b992fbc36d14ee102bc81 100644
--- a/Source/cmCommandArgumentsHelper.h
+++ b/Source/cmCommandArgumentsHelper.h
@@ -43,7 +43,7 @@ class cmCommandArgument
 {
 public:
   cmCommandArgument(cmCommandArgumentsHelper* args, const char* key,
-                    cmCommandArgumentGroup* group = 0);
+                    cmCommandArgumentGroup* group = CM_NULLPTR);
   virtual ~cmCommandArgument() {}
 
   /// this argument may follow after arg. 0 means it comes first.
@@ -95,7 +95,7 @@ class cmCAStringVector : public cmCommandArgument
 {
 public:
   cmCAStringVector(cmCommandArgumentsHelper* args, const char* key,
-                   cmCommandArgumentGroup* group = 0);
+                   cmCommandArgumentGroup* group = CM_NULLPTR);
 
   /// Return the vector of strings
   const std::vector<std::string>& GetVector() const { return this->Vector; }
@@ -118,7 +118,7 @@ class cmCAString : public cmCommandArgument
 {
 public:
   cmCAString(cmCommandArgumentsHelper* args, const char* key,
-             cmCommandArgumentGroup* group = 0);
+             cmCommandArgumentGroup* group = CM_NULLPTR);
 
   /// Return the string
   const std::string& GetString() const { return this->String; }
@@ -137,7 +137,7 @@ class cmCAEnabler : public cmCommandArgument
 {
 public:
   cmCAEnabler(cmCommandArgumentsHelper* args, const char* key,
-              cmCommandArgumentGroup* group = 0);
+              cmCommandArgumentGroup* group = CM_NULLPTR);
 
   /// Has it been enabled ?
   bool IsEnabled() const { return this->Enabled; }
@@ -154,7 +154,7 @@ class cmCADisabler : public cmCommandArgument
 {
 public:
   cmCADisabler(cmCommandArgumentsHelper* args, const char* key,
-               cmCommandArgumentGroup* group = 0);
+               cmCommandArgumentGroup* group = CM_NULLPTR);
 
   /// Is it still enabled ?
   bool IsEnabled() const { return this->Enabled; }
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 101093d7fe993574ddeb4a4d9f708db9eeaab338..7ad18f064f72d6115c794e9c6aa7778f41ee2b76 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -98,7 +98,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
     const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
     format = cmOutputConverter::GetFortranFormat(tgtfmt);
   }
-  const char* var = 0;
+  const char* var = CM_NULLPTR;
   switch (format) {
     case cmOutputConverter::FortranFormatFixed:
       var = "CMAKE_Fortran_FORMAT_FIXED_FLAG";
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 2129394a76d22f04f7044c20bb981b11bfbe22e9..fffb77d8ccfaae7f0bebc573d438fefe80d44f9c 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -194,7 +194,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
   this->OldLinkDirMode = false;
 
   // No computation has been done.
-  this->CCG = 0;
+  this->CCG = CM_NULLPTR;
 }
 
 cmComputeLinkDepends::~cmComputeLinkDepends()
@@ -286,7 +286,7 @@ std::map<std::string, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
   std::map<std::string, int>::iterator lei =
     this->LinkEntryIndex.insert(index_entry).first;
   this->EntryList.push_back(LinkEntry());
-  this->InferredDependSets.push_back(0);
+  this->InferredDependSets.push_back(CM_NULLPTR);
   this->EntryConstraintGraph.push_back(EdgeList());
   return lei;
 }
@@ -314,7 +314,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
   // If the item has dependencies queue it to follow them.
   if (entry.Target) {
     // Target dependencies are always known.  Follow them.
-    BFSEntry qe = { index, 0 };
+    BFSEntry qe = { index, CM_NULLPTR };
     this->BFSQueue.push(qe);
   } else {
     // Look for an old-style <item>_LIB_DEPENDS variable.
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 6aa40c31279505b1116b382dd4b23747e64ef641..4a33aff61838eec34f56249c0e167acb5b823828 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -44,7 +44,7 @@ public:
     bool IsFlag;
     LinkEntry()
       : Item()
-      , Target(0)
+      , Target(CM_NULLPTR)
       , IsSharedDep(false)
       , IsFlag(false)
     {
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 1eefbb1d76346b862970596cc1c5720b33da420e..7db5df3be0bac456bc849da96a8a3431c83f2064 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -262,7 +262,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
     this->GlobalGenerator, target, "linker search path");
   this->OrderRuntimeSearchPath = new cmOrderDirectories(
     this->GlobalGenerator, target, "runtime search path");
-  this->OrderDependentRPath = 0;
+  this->OrderDependentRPath = CM_NULLPTR;
 
   // Get the language used for linking this target.
   this->LinkLanguage = this->Target->GetLinkerLanguage(config);
@@ -283,7 +283,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
   // On platforms without import libraries there may be a special flag
   // to use when creating a plugin (module) that obtains symbols from
   // the program that will load it.
-  this->LoaderFlag = 0;
+  this->LoaderFlag = CM_NULLPTR;
   if (!this->UseImportLibrary &&
       this->Target->GetType() == cmState::MODULE_LIBRARY) {
     std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
@@ -561,7 +561,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
     for (std::vector<std::string>::const_iterator i = libsVec.begin();
          i != libsVec.end(); ++i) {
       if (this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end()) {
-        this->AddItem(*i, 0);
+        this->AddItem(*i, CM_NULLPTR);
       }
     }
   }
@@ -693,7 +693,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
 
   // Check if we need to include the dependent shared library in other
   // path ordering.
-  cmOrderDirectories* order = 0;
+  cmOrderDirectories* order = CM_NULLPTR;
   if (this->SharedDependencyMode == SharedDepModeLibDir &&
       !this->LinkWithRuntimePath /* AddLibraryRuntimeInfo adds it */) {
     // Add the item to the linker search path.
@@ -705,7 +705,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
   if (order) {
     if (tgt) {
       std::string soName = tgt->GetSOName(this->Config);
-      const char* soname = soName.empty() ? 0 : soName.c_str();
+      const char* soname = soName.empty() ? CM_NULLPTR : soName.c_str();
       order->AddRuntimeLibrary(lib, soname);
     } else {
       order->AddRuntimeLibrary(lib);
@@ -724,9 +724,9 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
   this->LinkTypeEnabled = false;
 
   // Lookup link type selection flags.
-  const char* static_link_type_flag = 0;
-  const char* shared_link_type_flag = 0;
-  const char* target_type_str = 0;
+  const char* static_link_type_flag = CM_NULLPTR;
+  const char* shared_link_type_flag = CM_NULLPTR;
+  const char* target_type_str = CM_NULLPTR;
   switch (this->Target->GetType()) {
     case cmState::EXECUTABLE:
       target_type_str = "EXE";
@@ -1606,7 +1606,7 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
   // Try to get the soname of the library.  Only files with this name
   // could possibly conflict.
   std::string soName = target->GetSOName(this->Config);
-  const char* soname = soName.empty() ? 0 : soName.c_str();
+  const char* soname = soName.empty() ? CM_NULLPTR : soName.c_str();
 
   // Include this library in the runtime path ordering.
   this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index c0ddc532a8f0054306ac3cd94861199b5917a556..023c781b61ae71d7131cf740762155e47aab1c7e 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -38,7 +38,7 @@ public:
     Item()
       : Value()
       , IsPath(true)
-      , Target(0)
+      , Target(CM_NULLPTR)
     {
     }
     Item(Item const& item)
@@ -47,7 +47,8 @@ public:
       , Target(item.Target)
     {
     }
-    Item(std::string const& v, bool p, cmGeneratorTarget const* target = 0)
+    Item(std::string const& v, bool p,
+         cmGeneratorTarget const* target = CM_NULLPTR)
       : Value(v)
       , IsPath(p)
       , Target(target)
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 570405a69a8eab357d5d8a8c465034be4e16bf0d..ff7eb0b83a1f80568b2a134508f4f104417dbcaa 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -291,7 +291,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
   // within the project.
   if (dependee && dependee->GetType() == cmState::EXECUTABLE &&
       !dependee->IsExecutableWithExports()) {
-    dependee = 0;
+    dependee = CM_NULLPTR;
   }
 
   if (dependee) {
@@ -355,7 +355,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
   // within the project.
   if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE &&
       !dependee->IsExecutableWithExports()) {
-    dependee = 0;
+    dependee = CM_NULLPTR;
   }
 
   if (dependee) {
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 7006b629ca0ccc3999da99105e3929f19f7c90b1..67b2571d7e786e1d049838788305417114709da3 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -130,7 +130,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
   if ((this->Policy54Status != cmPolicies::WARN &&
        this->Policy54Status != cmPolicies::OLD) &&
       argument.WasQuoted()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   const char* def = this->Makefile.GetDefinition(argument.GetValue());
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 0149fdfc74beeff77ad15c79a4e85bfaeaf42731..7d35a9e816ac8154afedc0c1e1be0e6963dac353 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -77,7 +77,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
   }
 
   const char* sourceDirectory = argv[2].c_str();
-  const char* projectName = 0;
+  const char* projectName = CM_NULLPTR;
   std::string targetName;
   std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
   std::vector<std::string> compileDefs;
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 85049ca9feca4e469133b4bd2af3930a3a0b73c7..e54b3c785929a659fe67236907803cee95b7eeb6 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -30,7 +30,7 @@ cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
   } else if (strcmp(algo, "SHA512") == 0) {
     return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512);
   } else {
-    return cmsys::auto_ptr<cmCryptoHash>(0);
+    return cmsys::auto_ptr<cmCryptoHash>(CM_NULLPTR);
   }
 }
 
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index eac7f1351caba0f6a8b6ebaf144af7ca52e87cc7..26bf94e0904714bb12a1f8f579599d9d50eaaf51 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -16,6 +16,6 @@
 
 #include "cm_curl.h"
 
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = 0);
+std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = CM_NULLPTR);
 
 #endif
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 4c5bd03207b29476136ac1aa31666dedf9a5ca61..2b9248d5774cc6458e1c04f86472e100b087556c 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -38,7 +38,7 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
   , Backtrace()
   , Comment(comment ? comment : "")
   , WorkingDirectory(workingDirectory ? workingDirectory : "")
-  , HaveComment(comment != NULL)
+  , HaveComment(comment != CM_NULLPTR)
   , EscapeAllowMakeVars(false)
   , EscapeOldStyle(true)
 {
@@ -69,7 +69,7 @@ const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
 
 const char* cmCustomCommand::GetComment() const
 {
-  const char* no_comment = 0;
+  const char* no_comment = CM_NULLPTR;
   return this->HaveComment ? this->Comment.c_str() : no_comment;
 }
 
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 99bb60116e693c952591fe2daa2916b1bb828133..315a1b6d4fd3fb71141ad619d1f150147dbb8591 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -45,7 +45,7 @@ bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const
   std::string const& argv0 = this->CC.GetCommandLines()[c][0];
   cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
   if (target && target->GetType() == cmState::EXECUTABLE) {
-    return target->GetProperty("CROSSCOMPILING_EMULATOR") != 0;
+    return target->GetProperty("CROSSCOMPILING_EMULATOR") != CM_NULLPTR;
   }
   return false;
 }
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 28b6677c863b7214633cfe868cfd9fd781079b6f..e0fb59b7dd9b9f1a2603d931bf2c3806dc894c7b 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -41,7 +41,7 @@ const char* cmDefinitions::Get(const std::string& key, StackIter begin,
                                StackIter end)
 {
   Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
-  return def.Exists ? def.c_str() : 0;
+  return def.Exists ? def.c_str() : CM_NULLPTR;
 }
 
 void cmDefinitions::Raise(const std::string& key, StackIter begin,
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 5df3cc120a12bbf022305fabaa4567eea7a1774c..b25e3cef214e9684f63b244b2862d8dafa8e0816 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -23,7 +23,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir)
   : CompileDirectory()
   , LocalGenerator(lg)
   , Verbose(false)
-  , FileComparison(0)
+  , FileComparison(CM_NULLPTR)
   , TargetDirectory(targetDir)
   , MaxPath(16384)
   , Dependee(new char[MaxPath])
@@ -140,7 +140,7 @@ bool cmDepends::CheckDependencies(
   // regenerated.
   bool okay = true;
   bool dependerExists = false;
-  DependencyVector* currentDependencies = 0;
+  DependencyVector* currentDependencies = CM_NULLPTR;
 
   while (internalDepends.getline(this->Dependee, this->MaxPath)) {
     if (this->Dependee[0] == 0 || this->Dependee[0] == '#' ||
@@ -182,7 +182,7 @@ bool cmDepends::CheckDependencies(
     bool regenerate = false;
     const char* dependee = this->Dependee + 1;
     const char* depender = this->Depender;
-    if (currentDependencies != 0) {
+    if (currentDependencies != CM_NULLPTR) {
       currentDependencies->push_back(dependee);
     }
 
@@ -242,9 +242,9 @@ bool cmDepends::CheckDependencies(
 
       // Remove the information of this depender from the map, it needs
       // to be rescanned
-      if (currentDependencies != 0) {
+      if (currentDependencies != CM_NULLPTR) {
         validDeps.erase(this->Depender);
-        currentDependencies = 0;
+        currentDependencies = CM_NULLPTR;
       }
 
       // Remove the depender to be sure it is rebuilt.
@@ -261,7 +261,7 @@ bool cmDepends::CheckDependencies(
 void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
 {
   // Look for the new per "TARGET_" variant first:
-  const char* includePath = 0;
+  const char* includePath = CM_NULLPTR;
   std::string includePathVar = "CMAKE_";
   includePathVar += lang;
   includePathVar += "_TARGET_INCLUDE_PATH";
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index a62f8c281bfbaae6f2db75cbc773f421c028730d..0e1cbb92582c095fc2a97c4ba006698d8619ed8e 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -29,7 +29,7 @@ class cmDepends
 public:
   /** Instances need to know the build directory name and the relative
       path from the build directory to the target file.  */
-  cmDepends(cmLocalGenerator* lg = 0, const char* targetDir = "");
+  cmDepends(cmLocalGenerator* lg = CM_NULLPTR, const char* targetDir = "");
 
   /** at what level will the compile be done from */
   void SetCompileDirectory(const char* dir) { this->CompileDirectory = dir; }
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 57e719cc8a00bf29cc244fa55837be0bfd4cc5bc..18e123e9c67b328c7e96c0ab7aa9d81af60e28ec 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -29,7 +29,7 @@
 #define INCLUDE_REGEX_TRANSFORM_MARKER "#IncludeRegexTransform: "
 
 cmDependsC::cmDependsC()
-  : ValidDeps(0)
+  : ValidDeps(CM_NULLPTR)
 {
 }
 
@@ -105,7 +105,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
   std::set<std::string> dependencies;
   bool haveDeps = false;
 
-  if (this->ValidDeps != 0) {
+  if (this->ValidDeps != CM_NULLPTR) {
     std::map<std::string, DependencyVector>::const_iterator tmpIt =
       this->ValidDeps->find(obj);
     if (tmpIt != this->ValidDeps->end()) {
@@ -269,12 +269,12 @@ void cmDependsC::ReadCacheFile()
   }
 
   std::string line;
-  cmIncludeLines* cacheEntry = 0;
+  cmIncludeLines* cacheEntry = CM_NULLPTR;
   bool haveFileName = false;
 
   while (cmSystemTools::GetLineFromStream(fin, line)) {
     if (line.empty()) {
-      cacheEntry = 0;
+      cacheEntry = CM_NULLPTR;
       haveFileName = false;
       continue;
     }
@@ -312,7 +312,7 @@ void cmDependsC::ReadCacheFile()
           }
         }
       }
-    } else if (cacheEntry != 0) {
+    } else if (cacheEntry != CM_NULLPTR) {
       UnscannedEntry entry;
       entry.FileName = line;
       if (cmSystemTools::GetLineFromStream(fin, line)) {
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index bbda688839648a9f4ce4ddaf75b3ab96960cddd3..9ea1e4851bd6a9698ca1977e7225877e4a476df4 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -53,7 +53,7 @@ public:
 };
 
 cmDependsFortran::cmDependsFortran()
-  : Internal(0)
+  : Internal(CM_NULLPTR)
 {
 }
 
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 238e7a149a610021d7826afba658ab772909eb73..79c46691945a322d938fe19b713d41947079c3fb 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -59,7 +59,7 @@ void cmDependsJavaParserHelper::DeallocateParserType(char** pt)
   if (!*pt) {
     return;
   }
-  *pt = 0;
+  *pt = CM_NULLPTR;
   this->UnionsAvailable--;
 }
 
@@ -160,13 +160,13 @@ void cmDependsJavaParserHelper::PrepareElement(
   cmDependsJavaParserHelper::ParserType* me)
 {
   // Inititalize self
-  me->str = 0;
+  me->str = CM_NULLPTR;
 }
 
 void cmDependsJavaParserHelper::AllocateParserType(
   cmDependsJavaParserHelper::ParserType* pt, const char* str, int len)
 {
-  pt->str = 0;
+  pt->str = CM_NULLPTR;
   if (len == 0) {
     len = (int)strlen(str);
   }
@@ -226,7 +226,7 @@ std::vector<std::string> cmDependsJavaParserHelper::GetFilesProduced()
   std::vector<CurrentClass>::const_iterator it;
   for (it = toplevel.NestedClasses.begin(); it != toplevel.NestedClasses.end();
        ++it) {
-    it->AddFileNamesForPrinting(&files, 0, "$");
+    it->AddFileNamesForPrinting(&files, CM_NULLPTR, "$");
   }
   return files;
 }
@@ -326,7 +326,7 @@ void cmDependsJavaParserHelper::Error(const char* str)
 void cmDependsJavaParserHelper::UpdateCombine(const char* str1,
                                               const char* str2)
 {
-  if (this->CurrentCombine == "" && str1 != 0) {
+  if (this->CurrentCombine == "" && str1 != CM_NULLPTR) {
     this->CurrentCombine = str1;
   }
   this->CurrentCombine += ".";
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 413dacd629f116cc028f0e8ef39e823a14f0918d..919a45ea126da32a520366fba23d84206bea4d03 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -49,12 +49,12 @@ static const char* cmDocumentationStandardOptions[][2] = {
   { "--help-variable-list [<f>]",
     "List variables with help available and exit." },
   { "--help-variables [<f>]", "Print cmake-variables manual and exit." },
-  { 0, 0 }
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationGeneratorsHeader[][2] = {
-  { 0, "The following generators are available on this platform:" },
-  { 0, 0 }
+  { CM_NULLPTR, "The following generators are available on this platform:" },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 cmDocumentation::cmDocumentation()
@@ -137,7 +137,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
     this->CurrentArgument = i->Argument;
     // If a file name was given, use it.  Otherwise, default to the
     // given stream.
-    cmsys::ofstream* fout = 0;
+    cmsys::ofstream* fout = CM_NULLPTR;
     std::ostream* s = &os;
     if (!i->Filename.empty()) {
       fout = new cmsys::ofstream(i->Filename.c_str());
@@ -420,7 +420,7 @@ void cmDocumentation::SetSections(
 
 void cmDocumentation::PrependSection(const char* name, const char* docs[][2])
 {
-  cmDocumentationSection* sec = 0;
+  cmDocumentationSection* sec = CM_NULLPTR;
   if (this->AllSections.find(name) == this->AllSections.end()) {
     sec =
       new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -434,7 +434,7 @@ void cmDocumentation::PrependSection(const char* name, const char* docs[][2])
 void cmDocumentation::PrependSection(const char* name,
                                      std::vector<cmDocumentationEntry>& docs)
 {
-  cmDocumentationSection* sec = 0;
+  cmDocumentationSection* sec = CM_NULLPTR;
   if (this->AllSections.find(name) == this->AllSections.end()) {
     sec =
       new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -447,7 +447,7 @@ void cmDocumentation::PrependSection(const char* name,
 
 void cmDocumentation::AppendSection(const char* name, const char* docs[][2])
 {
-  cmDocumentationSection* sec = 0;
+  cmDocumentationSection* sec = CM_NULLPTR;
   if (this->AllSections.find(name) == this->AllSections.end()) {
     sec =
       new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
@@ -461,7 +461,7 @@ void cmDocumentation::AppendSection(const char* name, const char* docs[][2])
 void cmDocumentation::AppendSection(const char* name,
                                     std::vector<cmDocumentationEntry>& docs)
 {
-  cmDocumentationSection* sec = 0;
+  cmDocumentationSection* sec = CM_NULLPTR;
   if (this->AllSections.find(name) == this->AllSections.end()) {
     sec =
       new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str());
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index dd99ca89f20fe40b82fd012428531188f01cbbee..ac36c8b0a806c350e3b758e16cef59279851fecd 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -39,7 +39,7 @@ public:
    * help arguments.
    */
   bool CheckOptions(int argc, const char* const* argv,
-                    const char* exitOpt = 0);
+                    const char* exitOpt = CM_NULLPTR);
 
   /**
    * Print help requested on the command line.  Call after
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 7d0bbdcf48f3430615f28c4ba69d408dc4591a3b..4c31733f7a1bff467f3b184a6f952fd70e2271f2 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -26,7 +26,7 @@ private:
   static cmDynamicLoaderCache* Instance;
 };
 
-cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = 0;
+cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = CM_NULLPTR;
 
 cmDynamicLoaderCache::~cmDynamicLoaderCache()
 {
@@ -75,7 +75,7 @@ void cmDynamicLoaderCache::FlushCache()
     cmsys::DynamicLoader::CloseLibrary(it->second);
   }
   delete cmDynamicLoaderCache::Instance;
-  cmDynamicLoaderCache::Instance = 0;
+  cmDynamicLoaderCache::Instance = CM_NULLPTR;
 }
 
 cmDynamicLoaderCache* cmDynamicLoaderCache::GetInstance()
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 16294ea4687962368d653bcfa46c403746cacd38..59667cd6b3a83789ac43a3dc8de8d58e7ba4172a 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -672,7 +672,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
     if (dssi->second.Position > 0) {
       return &dssi->second;
     }
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Create an entry for this tag.  Assume it is missing until found.
@@ -683,14 +683,14 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
 
   // Try reading the dynamic section.
   if (!this->LoadDynamicSection()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Get the string table referenced by the DYNAMIC section.
   ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
   if (sec.sh_link >= this->SectionHeaders.size()) {
     this->SetErrorMessage("Section DYNAMIC has invalid string table index.");
-    return 0;
+    return CM_NULLPTR;
   }
   ELF_Shdr const& strtab = this->SectionHeaders[sec.sh_link];
 
@@ -705,7 +705,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
       if (dyn.d_un.d_val >= strtab.sh_size) {
         this->SetErrorMessage("Section DYNAMIC references string beyond "
                               "the end of its string section.");
-        return 0;
+        return CM_NULLPTR;
       }
 
       // Seek to the position reported by the entry.
@@ -734,7 +734,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
       if (!this->Stream) {
         this->SetErrorMessage("Dynamic section specifies unreadable RPATH.");
         se.Value = "";
-        return 0;
+        return CM_NULLPTR;
       }
 
       // The value has been read successfully.  Report it.
@@ -745,14 +745,14 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
       return &se;
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 //============================================================================
 // External class implementation.
 
 cmELF::cmELF(const char* fname)
-  : Internal(0)
+  : Internal(CM_NULLPTR)
 {
   // Try to open the file.
   cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
@@ -879,7 +879,7 @@ cmELF::StringEntry const* cmELF::GetSOName()
       this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary) {
     return this->Internal->GetSOName();
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
@@ -890,7 +890,7 @@ cmELF::StringEntry const* cmELF::GetRPath()
        this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) {
     return this->Internal->GetRPath();
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
@@ -901,7 +901,7 @@ cmELF::StringEntry const* cmELF::GetRunPath()
        this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) {
     return this->Internal->GetRunPath();
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index f3f8c2f7e596c83f7cd6a94ed41ec0364c61261b..58bbc315632eb47d6772289370ce80b20a0d3082 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -90,7 +90,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
                                               args[1].c_str(), verbose);
   } else {
     result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal,
-                                              0, verbose);
+                                              CM_NULLPTR, verbose);
   }
   if (!result) {
     retVal = -1;
@@ -209,7 +209,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
   }
   fflush(stdout);
   fflush(stderr);
-  const char* cmd[] = { "/bin/sh", "-c", command, 0 };
+  const char* cmd[] = { "/bin/sh", "-c", command, CM_NULLPTR };
   cmsysProcess_SetCommand(cp, cmd);
 #endif
 
@@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
   int length;
   char* data;
   int p;
-  while ((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+  while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
     if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) {
       if (verbose) {
         cmSystemTools::Stdout(data, length);
@@ -229,7 +229,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
   }
 
   // All output has been read.  Wait for the process to exit.
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 
   // Check the result of running the process.
   std::string msg;
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index ef87aacdd168d5efdf3a08e2ab471b4b250deef3..7cd4f9f17ac7726ef51b6e8e945572ceacad5399 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -50,7 +50,8 @@ public:
 
 private:
   static bool RunCommand(const char* command, std::string& output, int& retVal,
-                         const char* directory = 0, bool verbose = true);
+                         const char* directory = CM_NULLPTR,
+                         bool verbose = true);
 };
 
 #endif
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 575cdc3150600bb66de66c18d51eee3b604ed71e..d97b25f8eeb16ace6aca3fa887e605da97e44395 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -161,7 +161,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
       return false;
     } else {
       // Add the null terminating pointer to the command argument list.
-      cmds[i].push_back(0);
+      cmds[i].push_back(CM_NULLPTR);
     }
   }
 
@@ -228,7 +228,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
   int length;
   char* data;
   int p;
-  while ((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+  while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
     // Put the output in the right place.
     if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) {
       if (output_variable.empty()) {
@@ -246,7 +246,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
   }
 
   // All output has been read.  Wait for the process to exit.
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 
   // Fix the text in the output strings.
   cmExecuteProcessCommandFixText(tempOutput, output_strip_trailing_whitespace);
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 8ca7a1199c9ec57db2bd2bb8bf99b8522eb932a9..a53d285daf4867e2ef6dbababed18a5c6e5640f9 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -18,8 +18,8 @@
 
 cmExportBuildFileGenerator::cmExportBuildFileGenerator()
 {
-  this->LG = 0;
-  this->ExportSet = 0;
+  this->LG = CM_NULLPTR;
+  this->ExportSet = CM_NULLPTR;
 }
 
 void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index a0e7e45e65566c4a8eb27e25a4c61bd7b430b110..3cb575ecb7a78ee8b24191b3b60395c5864436d3 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -35,7 +35,7 @@ cmExportCommand::cmExportCommand()
   , Filename(&Helper, "FILE", &ArgumentGroup)
   , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
 {
-  this->ExportSet = 0;
+  this->ExportSet = CM_NULLPTR;
 }
 
 // cmExportCommand
@@ -50,10 +50,10 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
   if (args[0] == "PACKAGE") {
     return this->HandlePackage(args);
   } else if (args[0] == "EXPORT") {
-    this->ExportSetName.Follows(0);
+    this->ExportSetName.Follows(CM_NULLPTR);
     this->ArgumentGroup.Follows(&this->ExportSetName);
   } else {
-    this->Targets.Follows(0);
+    this->Targets.Follows(CM_NULLPTR);
     this->ArgumentGroup.Follows(&this->Targets);
   }
 
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 5a826f2ba6766227f65468cbe4e06261622a7f10..fdc0760026ae79996aec4b76265176ac22ed55ca 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -63,7 +63,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
 
   cmGeneratorExpression ge;
 
-  cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName,
+                                             CM_NULLPTR, CM_NULLPTR);
 
   cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
 
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index 2ba9b8da7b3838f420a0ce4d304799d537ce25a0..0771a4eabc075987160dc211c9dfa480f77c53ba 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -21,7 +21,7 @@ int cmExpr_yyparse(yyscan_t yyscanner);
 cmExprParserHelper::cmExprParserHelper()
 {
   this->FileLine = -1;
-  this->FileName = 0;
+  this->FileName = CM_NULLPTR;
 }
 
 cmExprParserHelper::~cmExprParserHelper()
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index dee666b9bf83917761eb24ec161041e2f19ff211..fbfbccc984b8f28c442b5070e6430840730473e8 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -289,8 +289,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
 
   xml.StartElement("Build");
 
-  this->AppendTarget(xml, "all", 0, make.c_str(), lgs[0], compiler.c_str(),
-                     makeArgs);
+  this->AppendTarget(xml, "all", CM_NULLPTR, make.c_str(), lgs[0],
+                     compiler.c_str(), makeArgs);
 
   // add all executable and library targets and some of the GLOBAL
   // and UTILITY targets
@@ -306,7 +306,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
           // not from the subdirs
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory()) == 0) {
-            this->AppendTarget(xml, targetName, 0, make.c_str(), *lg,
+            this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
                                compiler.c_str(), makeArgs);
           }
         } break;
@@ -322,7 +322,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
             break;
           }
 
-          this->AppendTarget(xml, targetName, 0, make.c_str(), *lg,
+          this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
                              compiler.c_str(), makeArgs);
           break;
         case cmState::EXECUTABLE:
@@ -515,7 +515,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
   xml.StartElement("Target");
   xml.Attribute("title", targetName);
 
-  if (target != 0) {
+  if (target != CM_NULLPTR) {
     int cbTargetType = this->GetCBTargetType(target);
     std::string workingDir = lg->GetCurrentBinaryDirectory();
     if (target->GetType() == cmState::EXECUTABLE) {
@@ -523,12 +523,12 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
       // set the working directory to this dir.
       const char* runtimeOutputDir =
         makefile->GetDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY");
-      if (runtimeOutputDir != 0) {
+      if (runtimeOutputDir != CM_NULLPTR) {
         workingDir = runtimeOutputDir;
       } else {
         const char* executableOutputDir =
           makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
-        if (executableOutputDir != 0) {
+        if (executableOutputDir != CM_NULLPTR) {
           workingDir = executableOutputDir;
         }
       }
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index f964b97267304b3769fb04d180fafc59fc17dbbf..16cb0823605c5061eccfe28f064c06b2f20a6ebc 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -217,17 +217,17 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
 
   // now we have both, decide which one to use
   std::string valueToUse;
-  if (envVarValue == 0 && cacheValue == 0) {
+  if (envVarValue == CM_NULLPTR && cacheValue == CM_NULLPTR) {
     // nothing known, do nothing
     valueToUse = "";
-  } else if (envVarValue != 0 && cacheValue == 0) {
+  } else if (envVarValue != CM_NULLPTR && cacheValue == CM_NULLPTR) {
     // The variable is in the env, but not in the cache. Use it and put it
     // in the cache
     valueToUse = envVarValue;
     mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
                            cacheEntryName.c_str(), cmState::STRING, true);
     mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
-  } else if (envVarValue == 0 && cacheValue != 0) {
+  } else if (envVarValue == CM_NULLPTR && cacheValue != CM_NULLPTR) {
     // It is already in the cache, but not in the env, so use it from the cache
     valueToUse = cacheValue;
   } else {
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index ff6e4b65f6df756d12b5ee1445b4a0bd21b633d1..0400ad5e1042a2b90fbb2587a226b5e0e1918239 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -82,7 +82,7 @@ private:
                            const std::string& make,
                            const std::string& makeArguments,
                            const std::string& path, const char* prefix = "",
-                           const char* makeTarget = NULL);
+                           const char* makeTarget = CM_NULLPTR);
   static void AppendScannerProfile(
     cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled,
     const std::string& openActionFilePath, bool pParserEnabled,
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 02159dde3f2c50582c65b0b14ef0618fb6e93a5f..b757a49eb2406f44c036d6fe771714d2840c675d 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -137,9 +137,9 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
             if (targetName == "edit_cache") {
               const char* editCommand =
                 (*it)->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND");
-              if (editCommand == 0) {
+              if (editCommand == CM_NULLPTR) {
                 insertTarget = false;
-              } else if (strstr(editCommand, "ccmake") != NULL) {
+              } else if (strstr(editCommand, "ccmake") != CM_NULLPTR) {
                 insertTarget = false;
               }
             }
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 2b9f64fef428e4c2c894e82fa1a82e868c9fef3a..c166e26304dd721ebfcc90f5f3506833a20ee275 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -134,9 +134,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
   std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
   std::string compiler = "";
   if (!lgs.empty()) {
-    this->AppendTarget(fout, "all", lgs[0], 0, make.c_str(), mf,
+    this->AppendTarget(fout, "all", lgs[0], CM_NULLPTR, make.c_str(), mf,
                        compiler.c_str(), sourceFileFlags, true);
-    this->AppendTarget(fout, "clean", lgs[0], 0, make.c_str(), mf,
+    this->AppendTarget(fout, "clean", lgs[0], CM_NULLPTR, make.c_str(), mf,
                        compiler.c_str(), sourceFileFlags, false);
   }
 
@@ -155,7 +155,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
           // not from the subdirs
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory()) == 0) {
-            this->AppendTarget(fout, targetName, *lg, 0, make.c_str(),
+            this->AppendTarget(fout, targetName, *lg, CM_NULLPTR, make.c_str(),
                                makefile, compiler.c_str(), sourceFileFlags,
                                false);
           }
@@ -172,8 +172,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
             break;
           }
 
-          this->AppendTarget(fout, targetName, *lg, 0, make.c_str(), makefile,
-                             compiler.c_str(), sourceFileFlags, false);
+          this->AppendTarget(fout, targetName, *lg, CM_NULLPTR, make.c_str(),
+                             makefile, compiler.c_str(), sourceFileFlags,
+                             false);
           break;
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -204,7 +205,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
   MapSourceFileFlags& sourceFileFlags, bool firstTarget)
 {
 
-  if (target != 0) {
+  if (target != CM_NULLPTR) {
     std::vector<cmSourceFile*> sourceFiles;
     target->GetSourceFiles(sourceFiles,
                            makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index ebd62232d76282658aa6ef5c7599f7d44159952a..03ee31e40a5c1c06a71fb34ee85a10f2cd4a6a83 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -73,8 +73,8 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
 
       // Add command for generating the .h and .cxx files
       std::string no_main_dependency = "";
-      const char* no_comment = 0;
-      const char* no_working_dir = 0;
+      const char* no_comment = CM_NULLPTR;
+      const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
         cxxres, depends, no_main_dependency, commandLines, no_comment,
         no_working_dir);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c1fca517c0d4c63925b22da3d6d615561bd59dd9..4aecf7c622f42b8c76f55bf14ef0d1b33349d272 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -231,17 +231,17 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
   cmCommandArgumentGroup group;
 
   cmCAString readArg(&argHelper, "READ");
-  cmCAString fileNameArg(&argHelper, 0);
-  cmCAString resultArg(&argHelper, 0);
+  cmCAString fileNameArg(&argHelper, CM_NULLPTR);
+  cmCAString resultArg(&argHelper, CM_NULLPTR);
 
   cmCAString offsetArg(&argHelper, "OFFSET", &group);
   cmCAString limitArg(&argHelper, "LIMIT", &group);
   cmCAEnabler hexOutputArg(&argHelper, "HEX", &group);
-  readArg.Follows(0);
+  readArg.Follows(CM_NULLPTR);
   fileNameArg.Follows(&readArg);
   resultArg.Follows(&fileNameArg);
   group.Follows(&resultArg);
-  argHelper.Parse(&args, 0);
+  argHelper.Parse(&args, CM_NULLPTR);
 
   std::string fileName = fileNameArg.GetString();
   if (!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) {
@@ -901,9 +901,9 @@ bool cmFileCommand::HandleDifferentCommand(
    */
 
   // Evaluate arguments.
-  const char* file_lhs = 0;
-  const char* file_rhs = 0;
-  const char* var = 0;
+  const char* file_lhs = CM_NULLPTR;
+  const char* file_rhs = CM_NULLPTR;
+  const char* var = CM_NULLPTR;
   enum Doing
   {
     DoingNone,
@@ -958,7 +958,7 @@ struct cmFileCopier
     , MatchlessFiles(true)
     , FilePermissions(0)
     , DirPermissions(0)
-    , CurrentMatchRule(0)
+    , CurrentMatchRule(CM_NULLPTR)
     , UseGivenPermissionsFile(false)
     , UseGivenPermissionsDir(false)
     , UseSourcePermissions(true)
@@ -1942,9 +1942,9 @@ bool cmFileCommand::HandleRPathChangeCommand(
   std::vector<std::string> const& args)
 {
   // Evaluate arguments.
-  const char* file = 0;
-  const char* oldRPath = 0;
-  const char* newRPath = 0;
+  const char* file = CM_NULLPTR;
+  const char* oldRPath = CM_NULLPTR;
+  const char* newRPath = CM_NULLPTR;
   enum Doing
   {
     DoingNone,
@@ -2032,7 +2032,7 @@ bool cmFileCommand::HandleRPathRemoveCommand(
   std::vector<std::string> const& args)
 {
   // Evaluate arguments.
-  const char* file = 0;
+  const char* file = CM_NULLPTR;
   enum Doing
   {
     DoingNone,
@@ -2096,8 +2096,8 @@ bool cmFileCommand::HandleRPathCheckCommand(
   std::vector<std::string> const& args)
 {
   // Evaluate arguments.
-  const char* file = 0;
-  const char* rpath = 0;
+  const char* file = CM_NULLPTR;
+  const char* rpath = CM_NULLPTR;
   enum Doing
   {
     DoingNone,
@@ -2438,7 +2438,7 @@ public:
 
   inline void release(void)
   {
-    this->Easy = 0;
+    this->Easy = CM_NULLPTR;
     return;
   }
 
@@ -2934,7 +2934,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
   ::curl_global_cleanup();
 
   fclose(fin);
-  fin = NULL;
+  fin = CM_NULLPTR;
 
   if (!logVar.empty()) {
     std::string log;
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 638c1d1152d0a511377b82aaba64947c4004e79f..d255ceb76b5621fb4ddd4c36eaac8d4aae956bce 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -234,13 +234,13 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
 {
   // null-terminated list of paths.
   static const char* paths[] = { "CMAKE_SYSTEM_IGNORE_PATH",
-                                 "CMAKE_IGNORE_PATH", 0 };
+                                 "CMAKE_IGNORE_PATH", CM_NULLPTR };
 
   // Construct the list of path roots with no trailing slashes.
   for (const char** pathName = paths; *pathName; ++pathName) {
     // Get the list of paths to ignore from the variable.
     const char* ignorePath = this->Makefile->GetDefinition(*pathName);
-    if ((ignorePath == 0) || (strlen(ignorePath) == 0)) {
+    if ((ignorePath == CM_NULLPTR) || (strlen(ignorePath) == 0)) {
       continue;
     }
 
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index c133fcfc6310d8c219460dd7cbab0ca0048e57b1..09fa795c08ecd06a631e6d8b7d9b08c1c2ff5795 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1199,7 +1199,7 @@ public:
       cmSystemTools::RemoveFile(this->File);
     }
   }
-  void Release() { this->File = 0; }
+  void Release() { this->File = CM_NULLPTR; }
 };
 
 void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
@@ -1526,7 +1526,7 @@ class cmFileList
 public:
   cmFileList()
     : First()
-    , Last(0)
+    , Last(CM_NULLPTR)
   {
   }
   virtual ~cmFileList() {}
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 934e9284a65a7dce1f854b1239017176cd8675ac..a72204ae8a7e3d5e646b0cc1e6731d45f748791a 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -65,7 +65,8 @@ cmFortranParser_s::cmFortranParser_s(std::vector<std::string> const& includes,
 
   // Create a dummy buffer that is never read but is the fallback
   // buffer when the last file is popped off the stack.
-  YY_BUFFER_STATE buffer = cmFortran_yy_create_buffer(0, 4, this->Scanner);
+  YY_BUFFER_STATE buffer =
+    cmFortran_yy_create_buffer(CM_NULLPTR, 4, this->Scanner);
   cmFortran_yy_switch_to_buffer(buffer, this->Scanner);
 }
 
@@ -83,7 +84,7 @@ bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
     std::string dir = cmSystemTools::GetParentDirectory(fname);
     cmFortranFile f(file, current, dir);
     YY_BUFFER_STATE buffer =
-      cmFortran_yy_create_buffer(0, 16384, parser->Scanner);
+      cmFortran_yy_create_buffer(CM_NULLPTR, 16384, parser->Scanner);
     cmFortran_yy_switch_to_buffer(buffer, parser->Scanner);
     parser->FileStack.push(f);
     return 1;
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 71fbba3cd84fd060acabfb17360d27161e9217ef..5d02427b9ef20e335c8f402935932181065cb4cb 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -81,12 +81,12 @@ private:
 class cmCompiledGeneratorExpression
 {
 public:
-  const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
-                       bool quiet = false,
-                       cmGeneratorTarget const* headTarget = 0,
-                       cmGeneratorTarget const* currentTarget = 0,
-                       cmGeneratorExpressionDAGChecker* dagChecker = 0,
-                       std::string const& language = std::string()) const;
+  const char* Evaluate(
+    cmLocalGenerator* lg, const std::string& config, bool quiet = false,
+    cmGeneratorTarget const* headTarget = CM_NULLPTR,
+    cmGeneratorTarget const* currentTarget = CM_NULLPTR,
+    cmGeneratorExpressionDAGChecker* dagChecker = CM_NULLPTR,
+    std::string const& language = std::string()) const;
   const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
                        bool quiet, cmGeneratorTarget const* headTarget,
                        cmGeneratorExpressionDAGChecker* dagChecker,
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 28ca824a6e4922ac9ca63c08d2c20240455d11ea..6b7fe9ae5b4f06f70a641968170e12bacb4307b9 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -63,7 +63,7 @@ struct cmGeneratorExpressionDAGChecker
   void ReportError(cmGeneratorExpressionContext* context,
                    const std::string& expr);
 
-  bool EvaluatingLinkLibraries(const char* tgt = 0);
+  bool EvaluatingLinkLibraries(const char* tgt = CM_NULLPTR);
 
 #define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const;
 
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 5b48eea0d565b2e96d9f3e54725c435d0b87874a..f9dbc2d45485d5c8d1afbdcc7c1d0f9d3490cd65 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -40,8 +40,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(
 {
   std::string rawCondition = this->Condition->GetInput();
   if (!rawCondition.empty()) {
-    std::string condResult =
-      this->Condition->Evaluate(lg, config, false, 0, 0, 0, lang);
+    std::string condResult = this->Condition->Evaluate(
+      lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
     if (condResult == "0") {
       return;
     }
@@ -56,10 +56,10 @@ void cmGeneratorExpressionEvaluationFile::Generate(
     }
   }
 
-  const std::string outputFileName =
-    this->OutputFileExpr->Evaluate(lg, config, false, 0, 0, 0, lang);
-  const std::string outputContent =
-    inputExpression->Evaluate(lg, config, false, 0, 0, 0, lang);
+  const std::string outputFileName = this->OutputFileExpr->Evaluate(
+    lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
+  const std::string outputContent = inputExpression->Evaluate(
+    lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, lang);
 
   std::map<std::string, std::string>::iterator it =
     outputFiles.find(outputFileName);
@@ -97,8 +97,8 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
 
   for (std::vector<std::string>::const_iterator le = enabledLanguages.begin();
        le != enabledLanguages.end(); ++le) {
-    std::string name =
-      this->OutputFileExpr->Evaluate(lg, config, false, 0, 0, 0, *le);
+    std::string name = this->OutputFileExpr->Evaluate(
+      lg, config, false, CM_NULLPTR, CM_NULLPTR, CM_NULLPTR, *le);
     cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource(name);
     sf->SetProperty("GENERATED", "1");
 
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 599ea8d3a7addcbe9d93fdce7cafd74bdacf3415..830979fe87723bd7946830ff779cd4ac91ca51a5 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -627,7 +627,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
                        cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE
   {
     if (parameters.empty()) {
-      return configurationNode.Evaluate(parameters, context, content, 0);
+      return configurationNode.Evaluate(parameters, context, content,
+                                        CM_NULLPTR);
     }
     static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
     if (!configValidator.find(*parameters.begin())) {
@@ -646,8 +647,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
     }
 
     if (context->CurrentTarget && context->CurrentTarget->IsImported()) {
-      const char* loc = 0;
-      const char* imp = 0;
+      const char* loc = CM_NULLPTR;
+      const char* imp = CM_NULLPTR;
       std::string suffix;
       if (context->CurrentTarget->Target->GetMappedConfig(
             context->Config, &loc, &imp, suffix)) {
@@ -758,7 +759,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
 #define TRANSITIVE_PROPERTY_NAME(PROPERTY) , "INTERFACE_" #PROPERTY
 
 static const char* targetPropertyTransitiveWhitelist[] = {
-  0 CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
+  CM_NULLPTR CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
 };
 
 #undef TRANSITIVE_PROPERTY_NAME
@@ -1270,10 +1271,10 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
 } compileFeaturesNode;
 
 static const char* targetPolicyWhitelist[] = {
-  0
+  CM_NULLPTR
 #define TARGET_POLICY_STRING(POLICY) , #POLICY
 
-  CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
+    CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
 
 #undef TARGET_POLICY_STRING
 };
@@ -1683,7 +1684,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
   }
   NodeMap::const_iterator i = nodeMap.find(identifier);
   if (i == nodeMap.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return i->second;
 }
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3668c82976dc2c245d68aad914cd2f3ea261e5fe..c7dd3e4ecc21497eed544da5c6ab2445afdd6e19 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -491,7 +491,7 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
   if (i != this->SourceDepends.end()) {
     return &i->second.Depends;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 static void handleSystemIncludesDep(
@@ -802,7 +802,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
 
   if (iter == this->SystemIncludesCache.end()) {
     cmGeneratorExpressionDAGChecker dagChecker(
-      this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+      this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
 
     bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
 
@@ -998,7 +998,8 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
     this->DebugSourcesDone = true;
   }
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
+                                             CM_NULLPTR, CM_NULLPTR);
 
   UNORDERED_SET<std::string> uniqueSrcs;
   bool contextDependentDirectSources =
@@ -1506,7 +1507,7 @@ const char* cmGeneratorTarget::GetExportMacro() const
     }
     return this->ExportMacro.c_str();
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
@@ -1750,7 +1751,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
 {
   // There is no compile information for imported targets.
   if (this->IsImported()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   if (this->GetType() > cmState::OBJECT_LIBRARY) {
@@ -1759,7 +1760,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
     msg += " which has type ";
     msg += cmState::GetTargetTypeName(this->GetType());
     this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Lookup/compute/cache the compile information for this configuration.
@@ -1788,7 +1789,7 @@ cmSourceFile const* cmGeneratorTarget::GetModuleDefinitionFile(
     return data.front();
   }
 
-  return 0;
+  return CM_NULLPTR;
 }
 
 bool cmGeneratorTarget::IsDLLPlatform() const
@@ -1841,8 +1842,8 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
   }
   cmGeneratorExpression ge;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                             "AUTOUIC_OPTIONS", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "AUTOUIC_OPTIONS", CM_NULLPTR, CM_NULLPTR);
   cmSystemTools::ExpandListArgument(
     ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, this,
                              &dagChecker),
@@ -1927,7 +1928,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
   this->Makefile = target->Target->GetMakefile();
   this->LocalGenerator = target->GetLocalGenerator();
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
-  this->CurrentEntry = 0;
+  this->CurrentEntry = CM_NULLPTR;
 
   // Queue all the source files already specified for the target.
   if (target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -2002,7 +2003,7 @@ void cmTargetTraceDependencies::Trace()
       this->CheckCustomCommand(*cc);
     }
   }
-  this->CurrentEntry = 0;
+  this->CurrentEntry = CM_NULLPTR;
 
   this->GeneratorTarget->AddTracedSources(this->NewSources);
 }
@@ -2202,7 +2203,7 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
 void cmGeneratorTarget::GetAppleArchs(const std::string& config,
                                       std::vector<std::string>& archVec) const
 {
-  const char* archs = 0;
+  const char* archs = CM_NULLPTR;
   if (!config.empty()) {
     std::string defVarName = "OSX_ARCHITECTURES_";
     defVarName += cmSystemTools::UpperCase(config);
@@ -2360,8 +2361,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
   std::vector<std::string> includes;
   UNORDERED_SET<std::string> uniqueIncludes;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                             "INCLUDE_DIRECTORIES", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
 
   std::vector<std::string> debugProperties;
   const char* debugProp =
@@ -2487,8 +2488,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
 {
   UNORDERED_SET<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                             "COMPILE_OPTIONS", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
 
   std::vector<std::string> debugProperties;
   const char* debugProp =
@@ -2539,8 +2540,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
 {
   UNORDERED_SET<std::string> uniqueFeatures;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                             "COMPILE_FEATURES", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
 
   std::vector<std::string> debugProperties;
   const char* debugProp =
@@ -2589,8 +2590,8 @@ void cmGeneratorTarget::GetCompileDefinitions(
 {
   UNORDERED_SET<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                             "COMPILE_DEFINITIONS", 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
 
   std::vector<std::string> debugProperties;
   const char* debugProp =
@@ -2796,8 +2797,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
       this->IsFrameworkOnApple()) {
     // Versioning is supported only for shared libraries and modules,
     // and then only when the platform supports an soname flag.
-    version = 0;
-    soversion = 0;
+    version = CM_NULLPTR;
+    soversion = CM_NULLPTR;
   }
   if (version && !soversion) {
     // The soversion must be set if the library version is set.  Use
@@ -2871,7 +2872,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
   const char* version = this->GetProperty("VERSION");
   if (this->GetType() != cmState::EXECUTABLE ||
       this->Makefile->IsOn("XCODE")) {
-    version = 0;
+    version = CM_NULLPTR;
   }
 #endif
 
@@ -2971,7 +2972,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
                                      : this->GetProperty("PREFIX"));
   const char* targetSuffix = (implib ? this->GetProperty("IMPORT_SUFFIX")
                                      : this->GetProperty("SUFFIX"));
-  const char* configPostfix = 0;
+  const char* configPostfix = CM_NULLPTR;
   if (!config.empty()) {
     std::string configProp = cmSystemTools::UpperCase(config);
     configProp += "_POSTFIX";
@@ -2979,7 +2980,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
     // Mac application bundles and frameworks have no postfix.
     if (configPostfix &&
         (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) {
-      configPostfix = 0;
+      configPostfix = CM_NULLPTR;
     }
   }
   const char* prefixVar = this->Target->GetPrefixVariableInternal(implib);
@@ -3013,14 +3014,14 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
     fw_prefix = this->GetOutputName(config, false);
     fw_prefix += ".framework/";
     targetPrefix = fw_prefix.c_str();
-    targetSuffix = 0;
+    targetSuffix = CM_NULLPTR;
   }
 
   if (this->IsCFBundleOnApple()) {
     fw_prefix = this->GetCFBundleDirectory(config, false);
     fw_prefix += "/";
     targetPrefix = fw_prefix.c_str();
-    targetSuffix = 0;
+    targetSuffix = CM_NULLPTR;
   }
 
   // Begin the final name with the prefix.
@@ -3269,7 +3270,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
   switch (t) {
     case BoolType:
       assert(0 && "String compatibility check function called for boolean");
-      return 0;
+      return CM_NULLPTR;
     case StringType:
       return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
     case NumberMinType:
@@ -3278,7 +3279,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
       return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
   }
   assert(0 && "Unreachable!");
-  return 0;
+  return CM_NULLPTR;
 }
 
 template <typename PropertyType>
@@ -3316,7 +3317,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
     }
     if (emitted.insert(*pi).second) {
       getLinkInterfaceDependentProperty<PropertyType>(depender, *pi, config, t,
-                                                      0);
+                                                      CM_NULLPTR);
       if (cmSystemTools::GetErrorOccuredFlag()) {
         return;
       }
@@ -3394,24 +3395,25 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
     }
 
     checkPropertyConsistency<bool>(this, li->Target, strBool, emittedBools,
-                                   config, BoolType, 0);
+                                   config, BoolType, CM_NULLPTR);
     if (cmSystemTools::GetErrorOccuredFlag()) {
       return;
     }
-    checkPropertyConsistency<const char*>(
-      this, li->Target, strString, emittedStrings, config, StringType, 0);
+    checkPropertyConsistency<const char*>(this, li->Target, strString,
+                                          emittedStrings, config, StringType,
+                                          CM_NULLPTR);
     if (cmSystemTools::GetErrorOccuredFlag()) {
       return;
     }
     checkPropertyConsistency<const char*>(this, li->Target, strNumMin,
                                           emittedMinNumbers, config,
-                                          NumberMinType, 0);
+                                          NumberMinType, CM_NULLPTR);
     if (cmSystemTools::GetErrorOccuredFlag()) {
       return;
     }
     checkPropertyConsistency<const char*>(this, li->Target, strNumMax,
                                           emittedMaxNumbers, config,
-                                          NumberMaxType, 0);
+                                          NumberMaxType, CM_NULLPTR);
     if (cmSystemTools::GetErrorOccuredFlag()) {
       return;
     }
@@ -3544,7 +3546,7 @@ std::pair<bool, const char*> consistentStringProperty(const char* lhs,
                                                       const char* rhs)
 {
   const bool b = strcmp(lhs, rhs) == 0;
-  return std::make_pair(b, b ? lhs : 0);
+  return std::make_pair(b, b ? lhs : CM_NULLPTR);
 }
 
 std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
@@ -3553,7 +3555,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
 {
   char* pEnd;
 
-  const char* const null_ptr = 0;
+  const char* const null_ptr = CM_NULLPTR;
 
   long lnum = strtol(lhs, &pEnd, 0);
   if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) {
@@ -3587,7 +3589,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
     return std::make_pair(true, lhs);
   }
 
-  const char* const null_ptr = 0;
+  const char* const null_ptr = CM_NULLPTR;
 
   switch (t) {
     case BoolType:
@@ -3758,28 +3760,28 @@ bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
   const std::string& p, const std::string& config) const
 {
   return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
-                                                   BoolType, 0);
+                                                   BoolType, CM_NULLPTR);
 }
 
 const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
   const std::string& p, const std::string& config) const
 {
   return checkInterfacePropertyCompatibility<const char*>(
-    this, p, config, "empty", StringType, 0);
+    this, p, config, "empty", StringType, CM_NULLPTR);
 }
 
 const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
   const std::string& p, const std::string& config) const
 {
   return checkInterfacePropertyCompatibility<const char*>(
-    this, p, config, "empty", NumberMinType, 0);
+    this, p, config, "empty", NumberMinType, CM_NULLPTR);
 }
 
 const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
   const std::string& p, const std::string& config) const
 {
   return checkInterfacePropertyCompatibility<const char*>(
-    this, p, config, "empty", NumberMaxType, 0);
+    this, p, config, "empty", NumberMaxType, CM_NULLPTR);
 }
 
 cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
@@ -3794,7 +3796,7 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
       new cmComputeLinkInformation(this, config);
     if (!info || !info->Compute()) {
       delete info;
-      info = 0;
+      info = CM_NULLPTR;
     }
 
     // Store the information for this configuration.
@@ -3971,7 +3973,8 @@ void cmGeneratorTarget::ExpandLinkItems(
   std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition) const
 {
   cmGeneratorExpression ge;
-  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
+  cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, CM_NULLPTR,
+                                             CM_NULLPTR);
   // The $<LINK_ONLY> expression may be in a link interface to specify private
   // link dependencies that are otherwise excluded from usage requirements.
   if (usage_requirements_only) {
@@ -3999,7 +4002,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
   // export symbols.
   if (this->GetType() == cmState::EXECUTABLE &&
       !this->IsExecutableWithExports()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Lookup any existing link interface for this configuration.
@@ -4023,7 +4026,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
     }
   }
 
-  return iface.Exists ? &iface : 0;
+  return iface.Exists ? &iface : CM_NULLPTR;
 }
 
 void cmGeneratorTarget::ComputeLinkInterface(
@@ -4115,7 +4118,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
   // export symbols.
   if (this->GetType() == cmState::EXECUTABLE &&
       !this->IsExecutableWithExports()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Lookup any existing link interface for this configuration.
@@ -4138,7 +4141,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
                                         usage_requirements_only);
   }
 
-  return iface.Exists ? &iface : 0;
+  return iface.Exists ? &iface : CM_NULLPTR;
 }
 
 std::string cmGeneratorTarget::GetDirectory(const std::string& config,
@@ -4167,7 +4170,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
 {
   // There is no output information for imported targets.
   if (this->IsImported()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Only libraries and executables have well-defined output files.
@@ -4177,7 +4180,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
     msg += " which has type ";
     msg += cmState::GetTargetTypeName(this->GetType());
     this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Lookup/compute/cache the output information for this configuration.
@@ -4208,7 +4211,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
       cmake::FATAL_ERROR,
       "Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.",
       this->GetBacktrace());
-    return 0;
+    return CM_NULLPTR;
   }
   return &i->second;
 }
@@ -4222,7 +4225,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
   // Look for a target property defining the target output directory
   // based on the target type.
   std::string targetTypeName = this->GetOutputTargetType(implib);
-  const char* propertyName = 0;
+  const char* propertyName = CM_NULLPTR;
   std::string propertyNameStr = targetTypeName;
   if (!propertyNameStr.empty()) {
     propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4231,7 +4234,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
 
   // Check for a per-configuration output directory target property.
   std::string configUpper = cmSystemTools::UpperCase(conf);
-  const char* configProp = 0;
+  const char* configProp = CM_NULLPTR;
   std::string configPropStr = targetTypeName;
   if (!configPropStr.empty()) {
     configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4299,7 +4302,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
 {
   // Look for a target property defining the target output directory
   // based on the target type.
-  const char* propertyName = 0;
+  const char* propertyName = CM_NULLPTR;
   std::string propertyNameStr = kind;
   if (!propertyNameStr.empty()) {
     propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4309,7 +4312,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
 
   // Check for a per-configuration output directory target property.
   std::string configUpper = cmSystemTools::UpperCase(conf);
-  const char* configProp = 0;
+  const char* configProp = CM_NULLPTR;
   std::string configPropStr = kind;
   if (!configPropStr.empty()) {
     configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4367,7 +4370,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
 
   // An explicit list of interface libraries may be set for shared
   // libraries and executables that export symbols.
-  const char* explicitLibraries = 0;
+  const char* explicitLibraries = CM_NULLPTR;
   std::string linkIfaceProp;
   if (this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
       this->GetPolicyStatusCMP0022() != cmPolicies::WARN) {
@@ -4493,7 +4496,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
 {
   cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config);
   if (!info) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4529,7 +4532,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
 {
   // There is no imported information for non-imported targets.
   if (!this->IsImported()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Lookup/compute/cache the import information for this
@@ -4555,7 +4558,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
   // If the location is empty then the target is not available for
   // this configuration.
   if (i->second.Location.empty() && i->second.ImportLibrary.empty()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Return the import information.
@@ -4572,8 +4575,8 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
   // Initialize members.
   info.NoSOName = false;
 
-  const char* loc = 0;
-  const char* imp = 0;
+  const char* loc = CM_NULLPTR;
+  const char* imp = CM_NULLPTR;
   std::string suffix;
   if (!this->Target->GetMappedConfig(desired_config, &loc, &imp, suffix)) {
     return;
@@ -4715,7 +4718,7 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
 {
   // There is no link implementation for imported targets.
   if (this->IsImported()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4944,7 +4947,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
 {
   // There is no link implementation for imported targets.
   if (this->IsImported()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Populate the link implementation libraries for this configuration.
@@ -4984,8 +4987,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
                                      end = entryRange.end();
        le != end; ++le, ++btIt) {
     std::vector<std::string> llibs;
-    cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
-                                               "LINK_LIBRARIES", 0, 0);
+    cmGeneratorExpressionDAGChecker dagChecker(
+      this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR);
     cmGeneratorExpression ge(*btIt);
     cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
     std::string const evaluated =
@@ -5078,7 +5081,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
   // within the project.
   if (tgt && tgt->GetType() == cmState::EXECUTABLE &&
       !tgt->IsExecutableWithExports()) {
-    tgt = 0;
+    tgt = CM_NULLPTR;
   }
 
   if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
@@ -5092,7 +5095,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
          "with the ENABLE_EXPORTS property set.";
     cmake* cm = this->LocalGenerator->GetCMakeInstance();
     cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
-    tgt = 0;
+    tgt = CM_NULLPTR;
   }
 
   return tgt;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2ee9bef4d950d0a1d4d1d4593dd8aeebac17102e..f9987aa6ffa023ba489628e8c60eb8a7e798148a 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -215,7 +215,7 @@ public:
                                        bool contentOnly = true) const;
 
   /** @return the mac content directory for this target. */
-  std::string GetMacContentDirectory(const std::string& config = 0,
+  std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR,
                                      bool implib = false) const;
 
   cmTarget* Target;
@@ -402,7 +402,7 @@ public:
   {
     SourceFileFlags()
       : Type(SourceFileTypeNormal)
-      , MacFolder(0)
+      , MacFolder(CM_NULLPTR)
     {
     }
     SourceFileFlags(SourceFileFlags const& r)
@@ -453,7 +453,7 @@ public:
   /** Convert the given GNU import library name (.dll.a) to a name with a new
       extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}).  */
   bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
-                        const char* newExt = 0) const;
+                        const char* newExt = CM_NULLPTR) const;
 
   bool IsExecutableWithExports() const;
 
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 331aab9ec469f9df93821f568c834c9cef087563..c89d03019a63bc5c63049c876ff3afdd4a1124c6 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -42,7 +42,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
       this->Makefile->GetGlobalGenerator()->GetInstallComponents();
     output = cmJoin(*components, ";");
   } else {
-    const char* prop = 0;
+    const char* prop = CM_NULLPTR;
     if (!args[1].empty()) {
       prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
     }
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 1b5bcc9e2b4cd0141b1c9c174f79be8437ec9770..a331e78c96f8f9e620c7cf91daf53d09df17dd2b 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -73,7 +73,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
     return true;
   }
 
-  const char* prop = 0;
+  const char* prop = CM_NULLPTR;
   if (!i->empty()) {
     if (*i == "DEFINITIONS") {
       switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0059)) {
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 06f750446825947c9203a03944ec39e85d972d2e..7c49c9ac47923e15d23b4f83cd563d2f143cd70f 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -323,7 +323,7 @@ bool cmGetPropertyCommand::HandleCacheMode()
     return false;
   }
 
-  const char* value = 0;
+  const char* value = CM_NULLPTR;
   if (this->Makefile->GetState()->GetCacheEntryValue(this->Name)) {
     value = this->Makefile->GetState()->GetCacheEntryProperty(
       this->Name, this->PropertyName);
@@ -347,7 +347,7 @@ bool cmGetPropertyCommand::HandleInstallMode()
     std::string value;
     bool isSet = file->GetProperty(this->PropertyName, value);
 
-    return this->StoreResult(isSet ? value.c_str() : 0);
+    return this->StoreResult(isSet ? value.c_str() : CM_NULLPTR);
   } else {
     std::ostringstream e;
     e << "given INSTALL name that could not be found or created: "
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index e64befe144c8e44d0fa1f81823404b124b9970f1..7b30a7de7f914a3939ee883ac6f01d96d97bfa11 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -34,7 +34,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
       this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
       return true;
     }
-    const char* prop = 0;
+    const char* prop = CM_NULLPTR;
     if (!args[2].empty()) {
       prop = sf->GetPropertyForUser(args[2]);
     }
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index dded9f751ccbe946d2c01304347b6ccbf9c53b05..228ec6931f174eeb975d6fc66f056fec37b414ee 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -33,7 +33,7 @@ bool cmGetTargetPropertyCommand::InitialPass(
     }
   } else if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
     cmTarget& target = *tgt;
-    const char* prop_cstr = 0;
+    const char* prop_cstr = CM_NULLPTR;
     if (!args[2].empty()) {
       prop_cstr = target.GetProperty(args[2], this->Makefile);
     }
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index 65990210fd2e9dbd9236c5082c21e59a2590cc3f..5eaf87297bad27c293c9cd6d736c27d97780593a 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -27,7 +27,7 @@ bool cmGetTestPropertyCommand::InitialPass(
   std::string var = args[2];
   cmTest* test = this->Makefile->GetTest(testName);
   if (test) {
-    const char* prop = 0;
+    const char* prop = CM_NULLPTR;
     if (!args[1].empty()) {
       prop = test->GetProperty(args[1]);
     }
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 536c5d286ce1eefeedbad27dc952ce68d101edd1..3ec16c0e22f62d6e70d4d220b656d40b4de7f6a7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -81,9 +81,9 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
   // how long to let try compiles run
   this->TryCompileTimeout = 0;
 
-  this->ExtraGenerator = 0;
-  this->CurrentMakefile = 0;
-  this->TryCompileOuterMakefile = 0;
+  this->ExtraGenerator = CM_NULLPTR;
+  this->CurrentMakefile = CM_NULLPTR;
+  this->TryCompileOuterMakefile = CM_NULLPTR;
 
   this->ConfigureDoneCMP0026AndCMP0024 = false;
 
@@ -242,7 +242,7 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
     }
 
     delete it->second;
-    it->second = 0;
+    it->second = CM_NULLPTR;
     this->BuildExportSets.erase(it);
     return result;
   }
@@ -1081,7 +1081,7 @@ void cmGlobalGenerator::Configure()
     std::ostringstream msg;
     if (cmSystemTools::GetErrorOccuredFlag()) {
       msg << "Configuring incomplete, errors occurred!";
-      const char* logs[] = { "CMakeOutput.log", "CMakeError.log", 0 };
+      const char* logs[] = { "CMakeOutput.log", "CMakeError.log", CM_NULLPTR };
       for (const char** log = logs; *log; ++log) {
         std::string f = this->CMakeInstance->GetHomeOutputDirectory();
         f += this->CMakeInstance->GetCMakeFilesDirectory();
@@ -1128,7 +1128,7 @@ cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
 {
   std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it =
     this->BuildExportSets.find(filename);
-  return it == this->BuildExportSets.end() ? 0 : it->second;
+  return it == this->BuildExportSets.end() ? CM_NULLPTR : it->second;
 }
 
 void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
@@ -1269,7 +1269,7 @@ void cmGlobalGenerator::Generate()
       "Generating", (static_cast<float>(i) + 1.0f) /
         static_cast<float>(this->LocalGenerators.size()));
   }
-  this->SetCurrentMakefile(0);
+  this->SetCurrentMakefile(CM_NULLPTR);
 
   if (!this->GenerateCPackPropertiesFile()) {
     this->GetCMakeInstance()->IssueMessage(
@@ -1291,7 +1291,7 @@ void cmGlobalGenerator::Generate()
 
   this->WriteSummary();
 
-  if (this->ExtraGenerator != 0) {
+  if (this->ExtraGenerator != CM_NULLPTR) {
     this->ExtraGenerator->Generate();
   }
 
@@ -1698,7 +1698,8 @@ int cmGlobalGenerator::Build(const std::string&, const std::string& bindir,
     output += "\n";
 
     if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr, outputPtr,
-                                         &retVal, 0, outputflag, timeout)) {
+                                         &retVal, CM_NULLPTR, outputflag,
+                                         timeout)) {
       cmSystemTools::SetRunCommandHideConsole(hideconsole);
       cmSystemTools::Error("Generator: execution of make clean failed.");
       output += *outputPtr;
@@ -1718,7 +1719,8 @@ int cmGlobalGenerator::Build(const std::string&, const std::string& bindir,
   output += "\n";
 
   if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr, outputPtr,
-                                       &retVal, 0, outputflag, timeout)) {
+                                       &retVal, CM_NULLPTR, outputflag,
+                                       timeout)) {
     cmSystemTools::SetRunCommandHideConsole(hideconsole);
     cmSystemTools::Error(
       "Generator: execution of make failed. Make command was: ",
@@ -1945,7 +1947,7 @@ cmMakefile* cmGlobalGenerator::FindMakefile(const std::string& start_dir) const
       return *it;
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 ///! Find a local generator by its startdirectory
@@ -1960,7 +1962,7 @@ cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(
       return *it;
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 void cmGlobalGenerator::AddAlias(const std::string& name,
@@ -1994,7 +1996,7 @@ cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
   if (i != this->TargetSearchIndex.end()) {
     return i->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
@@ -2005,7 +2007,7 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
   if (i != this->GeneratorTargetSearchIndex.end()) {
     return i->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmTarget* cmGlobalGenerator::FindTarget(const std::string& name,
@@ -2135,7 +2137,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
     cpackCommandLines.push_back(singleLine);
     (*targets)[this->GetTestTargetName()] =
       this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...",
-                               &cpackCommandLines, depends, 0,
+                               &cpackCommandLines, depends, CM_NULLPTR,
                                /*uses_terminal*/ true);
   }
 
@@ -2156,7 +2158,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
       cpackCommandLines.push_back(singleLine);
       (*targets)[editCacheTargetName] = this->CreateGlobalTarget(
         editCacheTargetName, "Running CMake cache editor...",
-        &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+        &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
     } else {
       singleLine.push_back(cmSystemTools::GetCMakeCommand());
       singleLine.push_back("-E");
@@ -2165,7 +2167,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
       cpackCommandLines.push_back(singleLine);
       (*targets)[editCacheTargetName] = this->CreateGlobalTarget(
         editCacheTargetName, "No interactive CMake dialog available...",
-        &cpackCommandLines, depends, 0, /*uses_terminal*/ false);
+        &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false);
     }
   }
 
@@ -2182,7 +2184,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
     cpackCommandLines.push_back(singleLine);
     (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget(
       rebuildCacheTargetName, "Running CMake to regenerate build system...",
-      &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+      &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
   }
 
   // Install
@@ -2208,7 +2210,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
       singleLine.push_back(ostr.str());
       (*targets)["list_install_components"] = this->CreateGlobalTarget(
         "list_install_components", ostr.str().c_str(), &cpackCommandLines,
-        depends, 0, /*uses_terminal*/ false);
+        depends, CM_NULLPTR, /*uses_terminal*/ false);
     }
     std::string cmd = cmSystemTools::GetCMakeCommand();
     cpackCommandLines.erase(cpackCommandLines.begin(),
@@ -2249,7 +2251,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
     cpackCommandLines.push_back(singleLine);
     (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget(
       this->GetInstallTargetName(), "Install the project...",
-      &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+      &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
 
     // install_local
     if (const char* install_local = this->GetInstallLocalTargetName()) {
@@ -2263,12 +2265,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
 
       (*targets)[install_local] = this->CreateGlobalTarget(
         install_local, "Installing only the local directory...",
-        &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+        &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
     }
 
     // install_strip
     const char* install_strip = this->GetInstallStripTargetName();
-    if ((install_strip != 0) && (mf->IsSet("CMAKE_STRIP"))) {
+    if ((install_strip != CM_NULLPTR) && (mf->IsSet("CMAKE_STRIP"))) {
       cmCustomCommandLine stripCmdLine = singleLine;
 
       stripCmdLine.insert(stripCmdLine.begin() + 1,
@@ -2279,7 +2281,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
 
       (*targets)[install_strip] = this->CreateGlobalTarget(
         install_strip, "Installing the project stripped...",
-        &cpackCommandLines, depends, 0, /*uses_terminal*/ true);
+        &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true);
     }
   }
 }
@@ -2327,8 +2329,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
   std::vector<std::string> no_byproducts;
   std::vector<std::string> no_depends;
   // Store the custom command in the target.
-  cmCustomCommand cc(0, no_outputs, no_byproducts, no_depends, *commandLines,
-                     0, workingDirectory);
+  cmCustomCommand cc(CM_NULLPTR, no_outputs, no_byproducts, no_depends,
+                     *commandLines, CM_NULLPTR, workingDirectory);
   cc.SetUsesTerminal(uses_terminal);
   target.AddPostBuildCommand(cc);
   target.SetProperty("EchoString", message);
@@ -2406,7 +2408,7 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
   cmExternalMakefileProjectGenerator* extraGenerator)
 {
   this->ExtraGenerator = extraGenerator;
-  if (this->ExtraGenerator != 0) {
+  if (this->ExtraGenerator != CM_NULLPTR) {
     this->ExtraGenerator->SetGlobalGenerator(this);
   }
 }
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 789e51526f23d31df8b2ef75842b1ae31be9dd25..089a63701cc37fd66f251cdb9e39895eb617e2ad 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -277,15 +277,15 @@ public:
 
   virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
   virtual const char* GetInstallTargetName() const { return "INSTALL"; }
-  virtual const char* GetInstallLocalTargetName() const { return 0; }
-  virtual const char* GetInstallStripTargetName() const { return 0; }
-  virtual const char* GetPreinstallTargetName() const { return 0; }
+  virtual const char* GetInstallLocalTargetName() const { return CM_NULLPTR; }
+  virtual const char* GetInstallStripTargetName() const { return CM_NULLPTR; }
+  virtual const char* GetPreinstallTargetName() const { return CM_NULLPTR; }
   virtual const char* GetTestTargetName() const { return "RUN_TESTS"; }
   virtual const char* GetPackageTargetName() const { return "PACKAGE"; }
-  virtual const char* GetPackageSourceTargetName() const { return 0; }
-  virtual const char* GetEditCacheTargetName() const { return 0; }
-  virtual const char* GetRebuildCacheTargetName() const { return 0; }
-  virtual const char* GetCleanTargetName() const { return 0; }
+  virtual const char* GetPackageSourceTargetName() const { return CM_NULLPTR; }
+  virtual const char* GetEditCacheTargetName() const { return CM_NULLPTR; }
+  virtual const char* GetRebuildCacheTargetName() const { return CM_NULLPTR; }
+  virtual const char* GetCleanTargetName() const { return CM_NULLPTR; }
 
   // Lookup edit_cache target command preferred by this generator.
   virtual std::string GetEditCacheCommand() const { return ""; }
@@ -503,7 +503,7 @@ private:
 
   void ClearGeneratorMembers();
 
-  virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; }
+  virtual const char* GetBuildIgnoreErrorsFlag() const { return CM_NULLPTR; }
 
   // Cache directory content and target files to be built.
   struct DirectoryContent
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 40678da0a3c1ff0e81925a298a0fb365975f8316..67875197d07ff7ea7cf103aa4d4b73f75cde89c5 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -52,7 +52,7 @@ public:
                                            cmake* cm) const CM_OVERRIDE
   {
     if (name != T::GetActualName()) {
-      return 0;
+      return CM_NULLPTR;
     }
     return new T(cm);
   }
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 68a25389e0475cf35a99f00a3fb3d55e1fc50f0c..bbd6baaa505d70f162c291302961fa67eb358a2d 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -111,13 +111,13 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
       // make sure the file is part of this source tree
       if ((tmp[0] != '/') &&
           (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
-           0)) {
+           CM_NULLPTR)) {
         files.insert(tmp);
         tmp = cmSystemTools::GetFilenameName(tmp);
         // add all files which dont match the default
         // */CMakeLists.txt;*cmake; to the file pattern
         if ((tmp != "CMakeLists.txt") &&
-            (strstr(tmp.c_str(), ".cmake") == 0)) {
+            (strstr(tmp.c_str(), ".cmake") == CM_NULLPTR)) {
           cmakeFilePattern += tmp + ";";
         }
       }
@@ -142,7 +142,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
 
         if ((tmp[0] != '/') &&
             (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
-             0) &&
+             CM_NULLPTR) &&
             (cmSystemTools::GetFilenameExtension(tmp) != ".moc")) {
           files.insert(tmp);
 
@@ -166,7 +166,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
         cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
         if ((tmp[0] != '/') &&
             (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash()) ==
-             0)) {
+             CM_NULLPTR)) {
           files.insert(tmp);
         }
       }
@@ -296,12 +296,12 @@ void cmGlobalKdevelopGenerator::MergeProjectFiles(
        it != lines.end(); it++) {
     const char* line = (*it).c_str();
     // skip these tags as they are always replaced
-    if ((strstr(line, "<projectdirectory>") != 0) ||
-        (strstr(line, "<projectmanagement>") != 0) ||
-        (strstr(line, "<absoluteprojectpath>") != 0) ||
-        (strstr(line, "<filelistdirectory>") != 0) ||
-        (strstr(line, "<buildtool>") != 0) ||
-        (strstr(line, "<builddir>") != 0)) {
+    if ((strstr(line, "<projectdirectory>") != CM_NULLPTR) ||
+        (strstr(line, "<projectmanagement>") != CM_NULLPTR) ||
+        (strstr(line, "<absoluteprojectpath>") != CM_NULLPTR) ||
+        (strstr(line, "<filelistdirectory>") != CM_NULLPTR) ||
+        (strstr(line, "<buildtool>") != CM_NULLPTR) ||
+        (strstr(line, "<builddir>") != CM_NULLPTR)) {
       continue;
     }
 
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3aec630494d4537025b3806428591b20e3020063..91f08e64da759f92acffc031cbf301f2ab3a77fe 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -443,9 +443,9 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
 
 cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
   : cmGlobalCommonGenerator(cm)
-  , BuildFileStream(0)
-  , RulesFileStream(0)
-  , CompileCommandsStream(0)
+  , BuildFileStream(CM_NULLPTR)
+  , RulesFileStream(CM_NULLPTR)
+  , CompileCommandsStream(CM_NULLPTR)
   , Rules()
   , AllDependencies()
   , UsingGCCOnWindows(false)
@@ -531,8 +531,8 @@ void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
     command.push_back(this->NinjaCommand);
     command.push_back("--version");
     std::string version;
-    cmSystemTools::RunSingleCommand(command, &version, 0, 0, 0,
-                                    cmSystemTools::OUTPUT_NONE);
+    cmSystemTools::RunSingleCommand(command, &version, CM_NULLPTR, CM_NULLPTR,
+                                    CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
     this->NinjaVersion = cmSystemTools::TrimWhitespace(version);
   }
 }
@@ -676,7 +676,7 @@ void cmGlobalNinjaGenerator::CloseBuildFileStream()
 {
   if (this->BuildFileStream) {
     delete this->BuildFileStream;
-    this->BuildFileStream = 0;
+    this->BuildFileStream = CM_NULLPTR;
   } else {
     cmSystemTools::Error("Build file stream was not open.");
   }
@@ -717,7 +717,7 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream()
 {
   if (this->RulesFileStream) {
     delete this->RulesFileStream;
-    this->RulesFileStream = 0;
+    this->RulesFileStream = CM_NULLPTR;
   } else {
     cmSystemTools::Error("Rules file stream was not open.");
   }
@@ -805,7 +805,7 @@ void cmGlobalNinjaGenerator::CloseCompileCommandsStream()
   if (this->CompileCommandsStream) {
     *this->CompileCommandsStream << "\n]";
     delete this->CompileCommandsStream;
-    this->CompileCommandsStream = 0;
+    this->CompileCommandsStream = CM_NULLPTR;
   }
 }
 
@@ -914,7 +914,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
   // Mark the target's outputs as ambiguous to ensure that no other target uses
   // the output as an alias.
   for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) {
-    TargetAliases[*i] = 0;
+    TargetAliases[*i] = CM_NULLPTR;
   }
 
   // Insert the alias into the map.  If the alias was already present in the
@@ -922,7 +922,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
   std::pair<TargetAliasMap::iterator, bool> newAlias =
     TargetAliases.insert(std::make_pair(buildAlias, target));
   if (newAlias.second && newAlias.first->second != target) {
-    newAlias.first->second = 0;
+    newAlias.first->second = CM_NULLPTR;
   }
 }
 
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index ea51fbf6dabacccdd3749ec29f4fb4aa47e71b6b..69ec6cab89716e8da04d86acf17043d2983cecb9 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -93,7 +93,7 @@ public:
                   const cmNinjaDeps& orderOnlyDeps,
                   const cmNinjaVars& variables,
                   const std::string& rspfile = std::string(),
-                  int cmdLineLimit = 0, bool* usedResponseFile = 0);
+                  int cmdLineLimit = 0, bool* usedResponseFile = CM_NULLPTR);
 
   /**
    * Helper to write a build statement with the special 'phony' rule.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index cc5d1ba3e315d5c1ce77799f74b30a6a32e99d89..f115ecba9ac1b7193f9abda4e2fa25e5caa64eaa 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -32,7 +32,7 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
 #else
   this->UseLinkScript = true;
 #endif
-  this->CommandDatabase = NULL;
+  this->CommandDatabase = CM_NULLPTR;
 
   this->IncludeDirective = "include";
   this->DefineWindowsNULL = false;
@@ -155,10 +155,10 @@ void cmGlobalUnixMakefileGenerator3::Generate()
   this->WriteMainMakefile2();
   this->WriteMainCMakefile();
 
-  if (this->CommandDatabase != NULL) {
+  if (this->CommandDatabase != CM_NULLPTR) {
     *this->CommandDatabase << std::endl << "]";
     delete this->CommandDatabase;
-    this->CommandDatabase = NULL;
+    this->CommandDatabase = CM_NULLPTR;
   }
 }
 
@@ -166,7 +166,7 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
   const std::string& sourceFile, const std::string& workingDirectory,
   const std::string& compileCommand)
 {
-  if (this->CommandDatabase == NULL) {
+  if (this->CommandDatabase == CM_NULLPTR) {
     std::string commandDatabaseName =
       std::string(this->GetCMakeInstance()->GetHomeOutputDirectory()) +
       "/compile_commands.json";
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 3963cf8912e0bc9bc9dad77b3232402c7358792f..ed35ecdbc38797a328927041ba3b19a21051b280 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -149,7 +149,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
   for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
          this->TargetPtrs.begin();
        ptrIt != this->TargetPtrs.end(); ++ptrIt) {
-    if (ptrIt->second == NULL) {
+    if (ptrIt->second == CM_NULLPTR) {
       continue;
     }
 
@@ -193,7 +193,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
   for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
          this->TargetPtrs.begin();
        ptrIt != this->TargetPtrs.end(); ++ptrIt) {
-    if (ptrIt->second == NULL) {
+    if (ptrIt->second == CM_NULLPTR) {
       continue;
     }
 
@@ -239,7 +239,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
   for (std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
          this->TargetPtrs.begin();
        ptrIt != this->TargetPtrs.end(); ++ptrIt) {
-    if (ptrIt->second == NULL) {
+    if (ptrIt->second == CM_NULLPTR) {
       continue;
     }
 
@@ -278,7 +278,7 @@ void cmGraphVizWriter::WriteConnections(
 
   this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
 
-  if (targetPtrIt->second == NULL) // it's an external library
+  if (targetPtrIt->second == CM_NULLPTR) // it's an external library
   {
     return;
   }
@@ -329,7 +329,7 @@ void cmGraphVizWriter::WriteDependerConnections(
 
   this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
 
-  if (targetPtrIt->second == NULL) // it's an external library
+  if (targetPtrIt->second == CM_NULLPTR) // it's an external library
   {
     return;
   }
@@ -340,7 +340,7 @@ void cmGraphVizWriter::WriteDependerConnections(
   for (std::map<std::string, const cmGeneratorTarget*>::const_iterator
          dependerIt = this->TargetPtrs.begin();
        dependerIt != this->TargetPtrs.end(); ++dependerIt) {
-    if (dependerIt->second == NULL) {
+    if (dependerIt->second == CM_NULLPTR) {
       continue;
     }
 
@@ -468,7 +468,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
           std::ostringstream ostr;
           ostr << this->GraphNodePrefix << cnt++;
           this->TargetNamesNodes[libName] = ostr.str();
-          this->TargetPtrs[libName] = NULL;
+          this->TargetPtrs[libName] = CM_NULLPTR;
           // str << "    \"" << ostr << "\" [ label=\"" << libName
           // <<  "\" shape=\"ellipse\"];" << std::endl;
         }
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index 9609e952f3f6cc4aaaf282d3599b5074bb2c6bb1..34fd6268a33aa2bd89b826963a144b6d86abdf18 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -28,7 +28,7 @@ static bool cm_IsHexChar(char c)
 
 static unsigned int ChompStrlen(const char* line)
 {
-  if (line == 0) {
+  if (line == CM_NULLPTR) {
     return 0;
   }
   unsigned int length = static_cast<unsigned int>(strlen(line));
@@ -144,7 +144,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
 {
   char buf[1024];
   FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
-  if (inFile == 0) {
+  if (inFile == CM_NULLPTR) {
     return Binary;
   }
 
@@ -193,11 +193,11 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
   // try to open the file
   FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
   FILE* outFile = cmsys::SystemTools::Fopen(outFileName, "wb");
-  if ((inFile == 0) || (outFile == 0)) {
-    if (inFile != 0) {
+  if ((inFile == CM_NULLPTR) || (outFile == CM_NULLPTR)) {
+    if (inFile != CM_NULLPTR) {
       fclose(inFile);
     }
-    if (outFile != 0) {
+    if (outFile != CM_NULLPTR) {
       fclose(outFile);
     }
     return false;
@@ -206,7 +206,7 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
   // convert them line by line
   bool success = false;
   char buf[1024];
-  while (fgets(buf, 1024, inFile) != 0) {
+  while (fgets(buf, 1024, inFile) != CM_NULLPTR) {
     if (type == MotorolaSrec) {
       success = ConvertMotorolaSrecLine(buf, outFile);
     } else if (type == IntelHex) {
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index cb9b74d26435651a13f9348c99d0cb9d490cd9d7..360ebeb4b2af4559724bc68f88800ceff3858575 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -77,7 +77,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
 
   cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
   if (gg->IsExportedTargetsFile(fname_abs)) {
-    const char* modal = 0;
+    const char* modal = CM_NULLPTR;
     std::ostringstream e;
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
 
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index e9de8dffdc9e0f37526a1f43ba71f942ff3345ef..86ab85aee8a9794d051fb6f2a5c2da70f4a27cd6 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -186,7 +186,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
 
   cmCommandArgumentsHelper argHelper;
   cmCommandArgumentGroup group;
-  cmCAStringVector genericArgVector(&argHelper, 0);
+  cmCAStringVector genericArgVector(&argHelper, CM_NULLPTR);
   cmCAStringVector archiveArgVector(&argHelper, "ARCHIVE", &group);
   cmCAStringVector libraryArgVector(&argHelper, "LIBRARY", &group);
   cmCAStringVector runtimeArgVector(&argHelper, "RUNTIME", &group);
@@ -197,10 +197,10 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
                                           &group);
   cmCAStringVector publicHeaderArgVector(&argHelper, "PUBLIC_HEADER", &group);
   cmCAStringVector resourceArgVector(&argHelper, "RESOURCE", &group);
-  genericArgVector.Follows(0);
+  genericArgVector.Follows(CM_NULLPTR);
   group.Follows(&genericArgVector);
 
-  argHelper.Parse(&args, 0);
+  argHelper.Parse(&args, CM_NULLPTR);
 
   // now parse the generic args (i.e. the ones not specialized on LIBRARY/
   // ARCHIVE, RUNTIME etc. (see above)
@@ -210,7 +210,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
   cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
   cmCAString exports(&genericArgs.Parser, "EXPORT",
                      &genericArgs.ArgumentGroup);
-  targetList.Follows(0);
+  targetList.Follows(CM_NULLPTR);
   genericArgs.ArgumentGroup.Follows(&targetList);
   genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
   bool success = genericArgs.Finalize();
@@ -373,14 +373,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
        ti != targets.end(); ++ti) {
     // Handle each target type.
     cmTarget& target = *(*ti);
-    cmInstallTargetGenerator* archiveGenerator = 0;
-    cmInstallTargetGenerator* libraryGenerator = 0;
-    cmInstallTargetGenerator* runtimeGenerator = 0;
-    cmInstallTargetGenerator* frameworkGenerator = 0;
-    cmInstallTargetGenerator* bundleGenerator = 0;
-    cmInstallFilesGenerator* privateHeaderGenerator = 0;
-    cmInstallFilesGenerator* publicHeaderGenerator = 0;
-    cmInstallFilesGenerator* resourceGenerator = 0;
+    cmInstallTargetGenerator* archiveGenerator = CM_NULLPTR;
+    cmInstallTargetGenerator* libraryGenerator = CM_NULLPTR;
+    cmInstallTargetGenerator* runtimeGenerator = CM_NULLPTR;
+    cmInstallTargetGenerator* frameworkGenerator = CM_NULLPTR;
+    cmInstallTargetGenerator* bundleGenerator = CM_NULLPTR;
+    cmInstallFilesGenerator* privateHeaderGenerator = CM_NULLPTR;
+    cmInstallFilesGenerator* publicHeaderGenerator = CM_NULLPTR;
+    cmInstallFilesGenerator* resourceGenerator = CM_NULLPTR;
 
     // Track whether this is a namelink-only rule.
     bool namelinkOnly = false;
@@ -407,7 +407,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
             runtimeGenerator =
               CreateInstallTargetGenerator(target, runtimeArgs, false);
           }
-          if ((archiveGenerator == 0) && (runtimeGenerator == 0)) {
+          if ((archiveGenerator == CM_NULLPTR) &&
+              (runtimeGenerator == CM_NULLPTR)) {
             this->SetError("Library TARGETS given no DESTINATION!");
             return false;
           }
@@ -621,14 +622,15 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     }
 
     // Keep track of whether we're installing anything in each category
-    installsArchive = installsArchive || archiveGenerator != 0;
-    installsLibrary = installsLibrary || libraryGenerator != 0;
-    installsRuntime = installsRuntime || runtimeGenerator != 0;
-    installsFramework = installsFramework || frameworkGenerator != 0;
-    installsBundle = installsBundle || bundleGenerator != 0;
+    installsArchive = installsArchive || archiveGenerator != CM_NULLPTR;
+    installsLibrary = installsLibrary || libraryGenerator != CM_NULLPTR;
+    installsRuntime = installsRuntime || runtimeGenerator != CM_NULLPTR;
+    installsFramework = installsFramework || frameworkGenerator != CM_NULLPTR;
+    installsBundle = installsBundle || bundleGenerator != CM_NULLPTR;
     installsPrivateHeader =
-      installsPrivateHeader || privateHeaderGenerator != 0;
-    installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0;
+      installsPrivateHeader || privateHeaderGenerator != CM_NULLPTR;
+    installsPublicHeader =
+      installsPublicHeader || publicHeaderGenerator != CM_NULLPTR;
     installsResource = installsResource || resourceGenerator;
 
     this->Makefile->AddInstallGenerator(archiveGenerator);
@@ -704,7 +706,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
   bool programs = (args[0] == "PROGRAMS");
   cmInstallCommandArguments ica(this->DefaultComponentName);
   cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
-  files.Follows(0);
+  files.Follows(CM_NULLPTR);
   ica.ArgumentGroup.Follows(&files);
   std::vector<std::string> unknownArgs;
   ica.Parse(&args, &unknownArgs);
@@ -744,7 +746,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
   for (std::vector<std::string>::const_iterator fileIt = filesVector.begin();
        fileIt != filesVector.end(); ++fileIt) {
     if (gg->IsExportedTargetsFile(*fileIt)) {
-      const char* modal = 0;
+      const char* modal = CM_NULLPTR;
       std::ostringstream e;
       cmake::MessageType messageType = cmake::AUTHOR_WARNING;
 
@@ -820,7 +822,7 @@ bool cmInstallCommand::HandleDirectoryMode(
   bool exclude_from_all = false;
   bool message_never = false;
   std::vector<std::string> dirs;
-  const char* destination = 0;
+  const char* destination = CM_NULLPTR;
   std::string permissions_file;
   std::string permissions_dir;
   std::vector<std::string> configurations;
@@ -1103,7 +1105,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
   cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES",
                         &ica.ArgumentGroup);
   cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
-  exp.Follows(0);
+  exp.Follows(CM_NULLPTR);
 
   ica.ArgumentGroup.Follows(&exp);
   std::vector<std::string> unknownArgs;
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 57e37a3a1f52521db5082fd94611989af6796b40..312c50e06e3674c8c171cad3cbd66b538653f2e6 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -17,7 +17,7 @@
 const char* cmInstallCommandArguments::PermissionsTable[] = {
   "OWNER_READ",    "OWNER_WRITE",   "OWNER_EXECUTE", "GROUP_READ",
   "GROUP_WRITE",   "GROUP_EXECUTE", "WORLD_READ",    "WORLD_WRITE",
-  "WORLD_EXECUTE", "SETUID",        "SETGID",        0
+  "WORLD_EXECUTE", "SETUID",        "SETGID",        CM_NULLPTR
 };
 
 const std::string cmInstallCommandArguments::EmptyString;
@@ -35,7 +35,7 @@ cmInstallCommandArguments::cmInstallCommandArguments(
   , Optional(&Parser, "OPTIONAL", &ArgumentGroup)
   , NamelinkOnly(&Parser, "NAMELINK_ONLY", &ArgumentGroup)
   , NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup)
-  , GenericArguments(0)
+  , GenericArguments(CM_NULLPTR)
   , DefaultComponentName(defaultComponent)
 {
 }
@@ -45,7 +45,7 @@ const std::string& cmInstallCommandArguments::GetDestination() const
   if (!this->DestinationString.empty()) {
     return this->DestinationString;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetDestination();
   }
   return this->EmptyString;
@@ -56,7 +56,7 @@ const std::string& cmInstallCommandArguments::GetComponent() const
   if (!this->Component.GetString().empty()) {
     return this->Component.GetString();
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetComponent();
   }
   if (!this->DefaultComponentName.empty()) {
@@ -71,7 +71,7 @@ const std::string& cmInstallCommandArguments::GetRename() const
   if (!this->Rename.GetString().empty()) {
     return this->Rename.GetString();
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetRename();
   }
   return this->EmptyString;
@@ -82,7 +82,7 @@ const std::string& cmInstallCommandArguments::GetPermissions() const
   if (!this->PermissionsString.empty()) {
     return this->PermissionsString;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetPermissions();
   }
   return this->EmptyString;
@@ -93,7 +93,7 @@ bool cmInstallCommandArguments::GetOptional() const
   if (this->Optional.IsEnabled()) {
     return true;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetOptional();
   }
   return false;
@@ -104,7 +104,7 @@ bool cmInstallCommandArguments::GetExcludeFromAll() const
   if (this->ExcludeFromAll.IsEnabled()) {
     return true;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetExcludeFromAll();
   }
   return false;
@@ -115,7 +115,7 @@ bool cmInstallCommandArguments::GetNamelinkOnly() const
   if (this->NamelinkOnly.IsEnabled()) {
     return true;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetNamelinkOnly();
   }
   return false;
@@ -126,7 +126,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const
   if (this->NamelinkSkip.IsEnabled()) {
     return true;
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetNamelinkSkip();
   }
   return false;
@@ -138,7 +138,7 @@ const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations()
   if (!this->Configurations.GetVector().empty()) {
     return this->Configurations.GetVector();
   }
-  if (this->GenericArguments != 0) {
+  if (this->GenericArguments != CM_NULLPTR) {
     return this->GenericArguments->GetConfigurations();
   }
   return this->Configurations.GetVector();
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 671ab4ca60b7c7cbd7f05ecced6a2a461d87d3b6..a637b2557501b6ced30228377d5841a7284797b0 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -22,7 +22,7 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
   bool optional)
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all)
-  , LocalGenerator(0)
+  , LocalGenerator(CM_NULLPTR)
   , Directories(dirs)
   , FilePermissions(file_permissions)
   , DirPermissions(dir_permissions)
@@ -81,7 +81,7 @@ void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
   std::vector<std::string> const& dirs)
 {
   // Write code to install the directories.
-  const char* no_rename = 0;
+  const char* no_rename = CM_NULLPTR;
   this->AddInstallRule(os, this->GetDestination(config),
                        cmInstallType_DIRECTORY, dirs, this->Optional,
                        this->FilePermissions.c_str(),
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 2fef3a84071c267123e85e2a9f61ffc4a96f1ab0..62500127cb78ff1e08748fc3c057e50b9c520c13 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -37,7 +37,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
   , FileName(filename)
   , Namespace(name_space)
   , ExportOld(exportOld)
-  , LocalGenerator(0)
+  , LocalGenerator(CM_NULLPTR)
 {
   this->EFGen = new cmExportInstallFileGenerator(this);
   exportSet->AddInstallation(this);
@@ -161,8 +161,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
     std::string config_test = this->CreateConfigTest(i->first);
     os << indent << "if(" << config_test << ")\n";
     this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
-                         false, this->FilePermissions.c_str(), 0, 0, 0,
-                         indent.Next());
+                         false, this->FilePermissions.c_str(), CM_NULLPTR,
+                         CM_NULLPTR, CM_NULLPTR, indent.Next());
     os << indent << "endif()\n";
     files.clear();
   }
@@ -201,5 +201,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
   std::vector<std::string> files;
   files.push_back(this->MainImportFile);
   this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
-                       false, this->FilePermissions.c_str(), 0, 0, 0, indent);
+                       false, this->FilePermissions.c_str(), CM_NULLPTR,
+                       CM_NULLPTR, CM_NULLPTR, indent);
 }
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 8c1b357d3e8ab023b2325d30cf3d997a6d027c50..8885ef2f4932474e1312ed1272bf7686617786de 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -23,7 +23,7 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
   const char* rename, bool optional)
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all)
-  , LocalGenerator(0)
+  , LocalGenerator(CM_NULLPTR)
   , Files(files)
   , FilePermissions(file_permissions)
   , Rename(rename)
@@ -65,12 +65,12 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
   std::vector<std::string> const& files)
 {
   // Write code to install the files.
-  const char* no_dir_permissions = 0;
+  const char* no_dir_permissions = CM_NULLPTR;
   this->AddInstallRule(
     os, this->GetDestination(config),
     (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files,
     this->Optional, this->FilePermissions.c_str(), no_dir_permissions,
-    this->Rename.c_str(), 0, indent);
+    this->Rename.c_str(), CM_NULLPTR, indent);
 }
 
 void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index b003e783e44c66f46a21227f35d371b1ce1fe456..ad9fc28519976e032056eedb01a325f6332624b1 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -39,13 +39,12 @@ public:
                      bool exclude_from_all);
   ~cmInstallGenerator() CM_OVERRIDE;
 
-  void AddInstallRule(std::ostream& os, std::string const& dest,
-                      cmInstallType type,
-                      std::vector<std::string> const& files,
-                      bool optional = false, const char* permissions_file = 0,
-                      const char* permissions_dir = 0, const char* rename = 0,
-                      const char* literal_args = 0,
-                      Indent const& indent = Indent());
+  void AddInstallRule(
+    std::ostream& os, std::string const& dest, cmInstallType type,
+    std::vector<std::string> const& files, bool optional = false,
+    const char* permissions_file = CM_NULLPTR,
+    const char* permissions_dir = CM_NULLPTR, const char* rename = CM_NULLPTR,
+    const char* literal_args = CM_NULLPTR, Indent const& indent = Indent());
 
   /** Get the install destination as it should appear in the
       installation script.  */
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 1b0f1d19c2dcb0a21046a7ac7572c52ca9ea2f77..76d6b718fabd1a8db0211b48297195034348c01e 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -15,7 +15,7 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
                                                    bool code,
                                                    const char* component,
                                                    bool exclude_from_all)
-  : cmInstallGenerator(0, std::vector<std::string>(), component,
+  : cmInstallGenerator(CM_NULLPTR, std::vector<std::string>(), component,
                        MessageDefault, exclude_from_all)
   , Script(script)
   , Code(code)
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index d56bb053b6f09adbe4005414bc6618f5c46bb550..448d27853c142fe900518fa45d2c1ef32f046a7d 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -30,7 +30,7 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all)
   , TargetName(targetName)
-  , Target(0)
+  , Target(CM_NULLPTR)
   , FilePermissions(file_permissions)
   , ImportLibrary(implib)
   , Optional(optional)
@@ -294,8 +294,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
                  &cmInstallTargetGenerator::PreReplacementTweaks);
 
   // Write code to install the target file.
-  const char* no_dir_permissions = 0;
-  const char* no_rename = 0;
+  const char* no_dir_permissions = CM_NULLPTR;
+  const char* no_rename = CM_NULLPTR;
   bool optional = this->Optional || this->ImportLibrary;
   this->AddInstallRule(os, this->GetDestination(config), type, filesFrom,
                        optional, this->FilePermissions.c_str(),
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index ed0f74b5e1f7e93439c5cf66e895048989d2d34e..bfc5cf123bb9362c0c210bbdc40eb4749a78696c 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -16,7 +16,7 @@
 #include "cmSystemTools.h"
 
 cmInstalledFile::cmInstalledFile()
-  : NameExpression(0)
+  : NameExpression(CM_NULLPTR)
 {
 }
 
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 0fbe093fd6a9b186c22475a2e5d7bac3ab8935ea..8aa3981474186c6e1134a81b8b457d52b1600c3f 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -26,7 +26,7 @@ class cmLinkItem : public std::string
 public:
   cmLinkItem()
     : std_string()
-    , Target(0)
+    , Target(CM_NULLPTR)
   {
   }
   cmLinkItem(const std_string& n, cmGeneratorTarget const* t)
@@ -118,7 +118,7 @@ struct cmOptionalLinkInterface : public cmLinkInterface
     , AllDone(false)
     , Exists(false)
     , HadHeadSensitiveCondition(false)
-    , ExplicitLibraries(0)
+    , ExplicitLibraries(CM_NULLPTR)
   {
   }
   bool LibrariesDone;
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 1a853968195779b4eccf74d758bd5225f5c4acd8..6b3107444d909aeb18b9c3c4b59931d261ee709e 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -56,7 +56,7 @@ public:
 
   public:
     iterator()
-      : Tree(0)
+      : Tree(CM_NULLPTR)
       , Position(0)
     {
     }
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 44604186dde1a97f1c42e53633c5a35bdd36bfec..28b37814887611b81dd50d4e4b43726ecac2dfdf 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -71,7 +71,7 @@ bool cmListFileParser::ParseFile()
 
   // Verify the Byte-Order-Mark, if any.
   if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
-    cmListFileLexer_SetFileName(this->Lexer, 0, 0);
+    cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR);
     this->IssueFileOpenError(
       "File starts with a Byte-Order-Mark that is not UTF-8.");
     return false;
@@ -314,13 +314,13 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur)
 
 cmListFileBacktrace::cmListFileBacktrace()
   : Bottom()
-  , Cur(0)
+  , Cur(CM_NULLPTR)
 {
 }
 
 cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot)
   : Bottom(snapshot.GetCallStackBottom())
-  , Cur(0)
+  , Cur(CM_NULLPTR)
 {
 }
 
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index c2a5d46446ecc2928bb48956768acb03965a3918..ddf6ce6c9bdc44eb5cca8d4dc0f64c62056dbfb2 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -94,11 +94,11 @@ public:
 #endif
       signal(SIGILL, TrapsForSignalsCFunction);
     } else {
-      signal(SIGSEGV, 0);
+      signal(SIGSEGV, CM_NULLPTR);
 #ifdef SIGBUS
-      signal(SIGBUS, 0);
+      signal(SIGBUS, CM_NULLPTR);
 #endif
-      signal(SIGILL, 0);
+      signal(SIGILL, CM_NULLPTR);
     }
   }
 
@@ -112,7 +112,7 @@ extern "C" void TrapsForSignalsCFunction(int sig)
   cmLoadedCommand::TrapsForSignals(sig);
 }
 
-const char* cmLoadedCommand::LastName = 0;
+const char* cmLoadedCommand::LastName = CM_NULLPTR;
 
 bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
                                   cmExecutionStatus&)
@@ -128,7 +128,7 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
 
   // create argc and argv and then invoke the command
   int argc = static_cast<int>(args.size());
-  char** argv = 0;
+  char** argv = CM_NULLPTR;
   if (argc) {
     argv = (char**)malloc(argc * sizeof(char*));
   }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0de9895b5c2c7a5dd20cc619a98e6516cf83a752..ff767e644f749633dacfa273af2943f151d280e8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -272,7 +272,7 @@ void cmLocalGenerator::GenerateInstallRules()
   // Choose a default install configuration.
   std::string default_config = config;
   const char* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
-                                  "DEBUG", 0 };
+                                  "DEBUG", CM_NULLPTR };
   for (const char** c = default_order; *c && default_config.empty(); ++c) {
     for (std::vector<std::string>::iterator i = configurationTypes.begin();
          i != configurationTypes.end(); ++i) {
@@ -445,7 +445,7 @@ cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
   if (ti != this->GeneratorTargets.end()) {
     return *ti;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 void cmLocalGenerator::ComputeTargetManifest()
@@ -508,7 +508,7 @@ static const char* ruleReplaceVars[] = {
   "CMAKE_RANLIB",
   "CMAKE_LINKER",
   "CMAKE_CL_SHOWINCLUDES_PREFIX",
-  0
+  CM_NULLPTR
 };
 
 std::string cmLocalGenerator::ExpandRuleVariable(
@@ -704,13 +704,13 @@ std::string cmLocalGenerator::ExpandRuleVariable(
       std::string actualReplace = ruleReplaceVars[pos];
       // If this is the compiler then look for the extra variable
       // _COMPILER_ARG1 which must be the first argument to the compiler
-      const char* compilerArg1 = 0;
-      const char* compilerTarget = 0;
-      const char* compilerOptionTarget = 0;
-      const char* compilerExternalToolchain = 0;
-      const char* compilerOptionExternalToolchain = 0;
-      const char* compilerSysroot = 0;
-      const char* compilerOptionSysroot = 0;
+      const char* compilerArg1 = CM_NULLPTR;
+      const char* compilerTarget = CM_NULLPTR;
+      const char* compilerOptionTarget = CM_NULLPTR;
+      const char* compilerExternalToolchain = CM_NULLPTR;
+      const char* compilerOptionExternalToolchain = CM_NULLPTR;
+      const char* compilerSysroot = CM_NULLPTR;
+      const char* compilerOptionSysroot = CM_NULLPTR;
       if (actualReplace == "CMAKE_${LANG}_COMPILER") {
         std::string arg1 = actualReplace + "_ARG1";
         cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
@@ -872,7 +872,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
   // normal flag is repeated for each directory.
   std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
   sysFlagVar += lang;
-  const char* sysIncludeFlag = 0;
+  const char* sysIncludeFlag = CM_NULLPTR;
   if (repeatFlag) {
     sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar);
   }
@@ -1585,7 +1585,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
     target->GetAppleArchs(config, archs);
     const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
     if (sysroot && sysroot[0] == '/' && !sysroot[1]) {
-      sysroot = 0;
+      sysroot = CM_NULLPTR;
     }
     std::string sysrootFlagVar =
       std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
@@ -1925,7 +1925,7 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
   }
 
   std::string warnCMP0063;
-  std::string* pWarnCMP0063 = 0;
+  std::string* pWarnCMP0063 = CM_NULLPTR;
   if (target->GetType() != cmState::SHARED_LIBRARY &&
       target->GetType() != cmState::MODULE_LIBRARY &&
       !target->IsExecutableWithExports()) {
@@ -2036,7 +2036,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
                                                    std::string const& lang,
                                                    int targetType)
 {
-  const char* picFlags = 0;
+  const char* picFlags = CM_NULLPTR;
 
   if (targetType == cmState::EXECUTABLE) {
     std::string flagsVar = "CMAKE_";
@@ -2217,7 +2217,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
     }
     snp = snp.GetBuildsystemDirectoryParent();
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 std::string cmLocalGenerator::GetProjectName() const
@@ -2280,7 +2280,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
 
     // Include the user-specified pre-install script for this target.
     if (const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT")) {
-      cmInstallScriptGenerator g(preinstall, false, 0, false);
+      cmInstallScriptGenerator g(preinstall, false, CM_NULLPTR, false);
       g.Generate(os, config, configurationTypes);
     }
 
@@ -2333,7 +2333,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
 
     // Include the user-specified post-install script for this target.
     if (const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT")) {
-      cmInstallScriptGenerator g(postinstall, false, 0, false);
+      cmInstallScriptGenerator g(postinstall, false, CM_NULLPTR, false);
       g.Generate(os, config, configurationTypes);
     }
   }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 66fbe01c979786cad4d5434f684fd2fccbbef7e8..fa4bb3065eee40b9c8c2397ba98721a16ec18902 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -300,9 +300,9 @@ public:
   std::string ConstructComment(cmCustomCommandGenerator const& ccg,
                                const char* default_comment = "");
   // Compute object file names.
-  std::string GetObjectFileNameWithoutTarget(const cmSourceFile& source,
-                                             std::string const& dir_max,
-                                             bool* hasSourceExtension = 0);
+  std::string GetObjectFileNameWithoutTarget(
+    const cmSourceFile& source, std::string const& dir_max,
+    bool* hasSourceExtension = CM_NULLPTR);
 
   /** Fill out the static linker flags for the given target.  */
   void GetStaticLibraryFlags(std::string& flags, std::string const& config,
@@ -329,7 +329,7 @@ public:
 
   virtual void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
-    cmGeneratorTarget const* gt = 0);
+    cmGeneratorTarget const* gt = CM_NULLPTR);
 
   bool IsWindowsShell() const;
   bool IsWatcomWMake() const;
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 75da3289060e38b7524492b43be921ca9e2031d4..6e6108793da6ce46e88e116bde6e98e30f50a97b 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -78,7 +78,7 @@ public:
 
   void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
-    cmGeneratorTarget const* gt = 0) CM_OVERRIDE;
+    cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
 
 protected:
   std::string ConvertToIncludeReference(
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 0478a3aa396eb6ad43cf31836b2d4d0f5c252a6d..c6cfa88cbb7e699287642556818c02a701072941 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -340,8 +340,8 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
     std::vector<std::string> depends;
     depends.push_back(output);
     std::vector<std::string> no_commands;
-    this->WriteMakeRule(ruleFileStream, 0, outNoExt, depends, no_commands,
-                        true, true);
+    this->WriteMakeRule(ruleFileStream, CM_NULLPTR, outNoExt, depends,
+                        no_commands, true, true);
     inHelp = false;
   }
 
@@ -703,8 +703,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
   // Add a fake suffix to keep HP happy.  Must be max 32 chars for SGI make.
   std::vector<std::string> depends;
   depends.push_back(".hpux_make_needs_suffix_list");
-  this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands,
-                      false);
+  this->WriteMakeRule(makefileStream, CM_NULLPTR, ".SUFFIXES", depends,
+                      no_commands, false);
   if (this->IsWatcomWMake()) {
     // Switch on WMake feature, if an error or interrupt occurs during
     // makefile processing, the current target being made may be deleted
@@ -1164,7 +1164,7 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
       line = "";
 
       // Progress appears only on first line.
-      progress = 0;
+      progress = CM_NULLPTR;
 
       // Terminate on end-of-string.
       if (*c == '\0') {
@@ -1433,7 +1433,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
     std::string lang = *li;
 
     // Create the scanner for this language
-    cmDepends* scanner = 0;
+    cmDepends* scanner = CM_NULLPTR;
     if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM") {
       // TODO: Handle RC (resource files) dependencies correctly.
       scanner = new cmDependsC(this, targetDir, lang, &validDeps);
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 319a587cf3e98682421a586726ef2fa787c328b2..42d1d9167d9b04103746cdfd5eddfad3d2965d3b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -110,7 +110,8 @@ public:
     std::string Arg;
   };
   void AppendEcho(std::vector<std::string>& commands, std::string const& text,
-                  EchoColor color = EchoNormal, EchoProgress const* = 0);
+                  EchoColor color = EchoNormal,
+                  EchoProgress const* = CM_NULLPTR);
 
   /** Get whether the makefile is to have color.  */
   bool GetColorMakefile() const { return this->ColorMakefile; }
@@ -236,10 +237,11 @@ protected:
     std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
     cmGeneratorTarget* target, bool echo_comment = false,
     cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT,
-    std::ostream* content = 0);
+    std::ostream* content = CM_NULLPTR);
   void AppendCleanCommand(std::vector<std::string>& commands,
                           const std::vector<std::string>& files,
-                          cmGeneratorTarget* target, const char* filename = 0);
+                          cmGeneratorTarget* target,
+                          const char* filename = CM_NULLPTR);
 
   // Helper methods for dependeny updates.
   bool ScanDependencies(
@@ -256,7 +258,7 @@ private:
 
   void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
-    cmGeneratorTarget const* gt = 0) CM_OVERRIDE;
+    cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
 
   friend class cmMakefileTargetGenerator;
   friend class cmMakefileExecutableTargetGenerator;
@@ -273,7 +275,7 @@ private:
     cmGeneratorTarget* Target;
     std::string Language;
     LocalObjectEntry()
-      : Target(0)
+      : Target(CM_NULLPTR)
       , Language()
     {
     }
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index e69c32eb5b3b82cc84c944fdf330390fe920ffdc..f922c034196fbbac96e4662815ac04a47d50da47 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -22,7 +22,7 @@ class cmLocaleRAII
 
 public:
   cmLocaleRAII()
-    : OldLocale(setlocale(LC_CTYPE, 0))
+    : OldLocale(setlocale(LC_CTYPE, CM_NULLPTR))
   {
     setlocale(LC_CTYPE, "");
   }
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e8c1576b7e82be8d224f52e8ebccd79cb3767536..eae4258bbb550137858c2e2e5a9c22aacd45bba5 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -787,7 +787,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
   // Make sure there is at least one output.
   if (outputs.empty()) {
     cmSystemTools::Error("Attempt to add a custom rule with no output!");
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Validate custom commands.  TODO: More strict?
@@ -798,12 +798,12 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
       std::ostringstream e;
       e << "COMMAND may not contain literal quotes:\n  " << cl[0] << "\n";
       this->IssueMessage(cmake::FATAL_ERROR, e.str());
-      return 0;
+      return CM_NULLPTR;
     }
   }
 
   // Choose a source file on which to store the custom command.
-  cmSourceFile* file = 0;
+  cmSourceFile* file = CM_NULLPTR;
   if (!commandLines.empty() && !main_dependency.empty()) {
     // The main dependency was specified.  Use it unless a different
     // custom command already used it.
@@ -817,7 +817,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
       } else {
         // The existing custom command is different.  We need to
         // generate a rule file for this new command.
-        file = 0;
+        file = CM_NULLPTR;
       }
     } else if (!file) {
       file = this->CreateSource(main_dependency);
@@ -938,7 +938,7 @@ void cmMakefile::AddCustomCommandOldStyle(
     std::vector<std::string> no_byproducts;
     this->AddCustomCommandToTarget(target, no_byproducts, depends,
                                    commandLines, cmTarget::POST_BUILD, comment,
-                                   0);
+                                   CM_NULLPTR);
     return;
   }
 
@@ -956,14 +956,14 @@ void cmMakefile::AddCustomCommandOldStyle(
     if (sourceFiles.find(source)) {
       // The source looks like a real file.  Use it as the main dependency.
       sf = this->AddCustomCommandToOutput(output, depends, source,
-                                          commandLines, comment, 0);
+                                          commandLines, comment, CM_NULLPTR);
     } else {
       // The source may not be a real file.  Do not use a main dependency.
       std::string no_main_dependency = "";
       std::vector<std::string> depends2 = depends;
       depends2.push_back(source);
       sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
-                                          commandLines, comment, 0);
+                                          commandLines, comment, CM_NULLPTR);
     }
 
     // If the rule was added to the source (and not a .rule file),
@@ -1817,8 +1817,8 @@ void cmMakefile::RemoveDefinition(const std::string& name)
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
   if (vv) {
-    vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS, 0,
-                         this);
+    vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS,
+                         CM_NULLPTR, this);
   }
 #endif
 }
@@ -1951,7 +1951,7 @@ cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput(
   }
 
   // otherwise return NULL
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmSourceFile* cmMakefile::GetSourceFileWithOutput(
@@ -1967,14 +1967,14 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
   if (o != this->OutputToSource.end()) {
     return (*o).second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 cmSourceGroup* cmMakefile::GetSourceGroup(
   const std::vector<std::string>& name) const
 {
-  cmSourceGroup* sg = 0;
+  cmSourceGroup* sg = CM_NULLPTR;
 
   // first look for source group starting with the same as the one we want
   for (std::vector<cmSourceGroup>::const_iterator sgIt =
@@ -1987,11 +1987,11 @@ cmSourceGroup* cmMakefile::GetSourceGroup(
     }
   }
 
-  if (sg != 0) {
+  if (sg != CM_NULLPTR) {
     // iterate through its children to find match source group
     for (unsigned int i = 1; i < name.size(); ++i) {
       sg = sg->LookupChild(name[i].c_str());
-      if (sg == 0) {
+      if (sg == CM_NULLPTR) {
         break;
       }
     }
@@ -2009,14 +2009,14 @@ void cmMakefile::AddSourceGroup(const std::string& name, const char* regex)
 void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
                                 const char* regex)
 {
-  cmSourceGroup* sg = 0;
+  cmSourceGroup* sg = CM_NULLPTR;
   std::vector<std::string> currentName;
   int i = 0;
   const int lastElement = static_cast<int>(name.size() - 1);
   for (i = lastElement; i >= 0; --i) {
     currentName.assign(name.begin(), name.begin() + i + 1);
     sg = this->GetSourceGroup(currentName);
-    if (sg != 0) {
+    if (sg != CM_NULLPTR) {
       break;
     }
   }
@@ -2043,7 +2043,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
   }
   // build the whole source group path
   for (++i; i <= lastElement; ++i) {
-    sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
+    sg->AddChild(
+      cmSourceGroup(name[i].c_str(), CM_NULLPTR, sg->GetFullName()));
     sg = sg->LookupChild(name[i].c_str());
   }
 
@@ -2263,7 +2264,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
     }
   }
 #endif
-  return def != NULL;
+  return def != CM_NULLPTR;
 }
 
 const char* cmMakefile::GetDefinition(const std::string& name) const
@@ -2570,7 +2571,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
           openstack.pop_back();
           result.append(last, in - last);
           std::string const& lookup = result.substr(var.loc);
-          const char* value = NULL;
+          const char* value = CM_NULLPTR;
           std::string varresult;
           static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE";
           switch (var.domain) {
@@ -2623,7 +2624,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
         if (!atOnly) {
           t_lookup lookup;
           const char* next = in + 1;
-          const char* start = NULL;
+          const char* start = CM_NULLPTR;
           char nextc = *next;
           if (nextc == '{') {
             // Looking for a variable.
@@ -3107,7 +3108,7 @@ cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const
       return sf;
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName,
@@ -3277,7 +3278,7 @@ cmVariableWatch* cmMakefile::GetVariableWatch() const
       this->GetCMakeInstance()->GetVariableWatch()) {
     return this->GetCMakeInstance()->GetVariableWatch();
   }
-  return 0;
+  return CM_NULLPTR;
 }
 #endif
 
@@ -3438,8 +3439,8 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
   }
 
   // Perform variable replacements.
-  this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, 0, -1,
-                                true, true);
+  this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, CM_NULLPTR,
+                                -1, true, true);
 }
 
 int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
@@ -3578,7 +3579,7 @@ cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
   if (i != this->Targets.end()) {
     return &i->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmTest* cmMakefile::CreateTest(const std::string& testName)
@@ -3600,7 +3601,7 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const
   if (mi != this->Tests.end()) {
     return mi->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 void cmMakefile::AddCMakeDependFilesFromUser()
@@ -4061,10 +4062,10 @@ bool cmMakefile::IgnoreErrorsCMP0061() const
 }
 
 #define FEATURE_STRING(F) , #F
-static const char* const C_FEATURES[] = { 0 FOR_EACH_C_FEATURE(
+static const char* const C_FEATURES[] = { CM_NULLPTR FOR_EACH_C_FEATURE(
   FEATURE_STRING) };
 
-static const char* const CXX_FEATURES[] = { 0 FOR_EACH_CXX_FEATURE(
+static const char* const CXX_FEATURES[] = { CM_NULLPTR FOR_EACH_CXX_FEATURE(
   FEATURE_STRING) };
 #undef FEATURE_STRING
 
@@ -4178,7 +4179,7 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
       this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
                                              this->Backtrace);
     }
-    return 0;
+    return CM_NULLPTR;
   }
   return featuresKnown;
 }
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c68cd1c87bb63d574bfc5c374d044d653bae2591..642b6919c1f36d3ff3e4c7086e0cd9458ec5b0ba 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -182,24 +182,23 @@ public:
    * Add a utility to the build.  A utiltity target is a command that
    * is run every time the target is built.
    */
-  cmTarget* AddUtilityCommand(const std::string& utilityName,
-                              bool excludeFromAll,
-                              const std::vector<std::string>& depends,
-                              const char* workingDirectory,
-                              const char* command, const char* arg1 = 0,
-                              const char* arg2 = 0, const char* arg3 = 0,
-                              const char* arg4 = 0);
+  cmTarget* AddUtilityCommand(
+    const std::string& utilityName, bool excludeFromAll,
+    const std::vector<std::string>& depends, const char* workingDirectory,
+    const char* command, const char* arg1 = CM_NULLPTR,
+    const char* arg2 = CM_NULLPTR, const char* arg3 = CM_NULLPTR,
+    const char* arg4 = CM_NULLPTR);
   cmTarget* AddUtilityCommand(
     const std::string& utilityName, bool excludeFromAll,
     const char* workingDirectory, const std::vector<std::string>& depends,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
-    const char* comment = 0, bool uses_terminal = false);
+    const char* comment = CM_NULLPTR, bool uses_terminal = false);
   cmTarget* AddUtilityCommand(
     const std::string& utilityName, bool excludeFromAll,
     const char* workingDirectory, const std::vector<std::string>& byproducts,
     const std::vector<std::string>& depends,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
-    const char* comment = 0, bool uses_terminal = false);
+    const char* comment = CM_NULLPTR, bool uses_terminal = false);
 
   /**
    * Add a link library to the build.
@@ -274,14 +273,14 @@ public:
   /**
    * Add a root source group for consideration when adding a new source.
    */
-  void AddSourceGroup(const std::string& name, const char* regex = 0);
+  void AddSourceGroup(const std::string& name, const char* regex = CM_NULLPTR);
 
   /**
    * Add a source group for consideration when adding a new source.
    * name is tokenized.
    */
   void AddSourceGroup(const std::vector<std::string>& name,
-                      const char* regex = 0);
+                      const char* regex = CM_NULLPTR);
 
 #endif
 
@@ -519,8 +518,8 @@ public:
   const char* ExpandVariablesInString(std::string& source) const;
   const char* ExpandVariablesInString(std::string& source, bool escapeQuotes,
                                       bool noEscapes, bool atOnly = false,
-                                      const char* filename = 0, long line = -1,
-                                      bool removeEmpty = false,
+                                      const char* filename = CM_NULLPTR,
+                                      long line = -1, bool removeEmpty = false,
                                       bool replaceAt = false) const;
 
   /**
@@ -592,11 +591,11 @@ public:
    */
   bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
                        std::vector<std::string>& outArgs,
-                       const char* filename = 0) const;
+                       const char* filename = CM_NULLPTR) const;
 
   bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
                        std::vector<cmExpandedCommandArgument>& outArgs,
-                       const char* filename = 0) const;
+                       const char* filename = CM_NULLPTR) const;
 
   /**
    * Get the instance
@@ -743,7 +742,7 @@ public:
   bool PolicyOptionalWarningEnabled(std::string const& var);
 
   bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
-                                std::string* error = 0) const;
+                                std::string* error = CM_NULLPTR) const;
 
   bool CompileFeatureKnown(cmTarget const* target, const std::string& feature,
                            std::string& lang, std::string* error) const;
@@ -933,11 +932,11 @@ private:
   std::vector<cmSourceFile*> QtUiFilesWithOptions;
 
   bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
-                                 std::string* error = 0) const;
+                                 std::string* error = CM_NULLPTR) const;
 
   bool AddRequiredTargetCxxFeature(cmTarget* target,
                                    const std::string& feature,
-                                   std::string* error = 0) const;
+                                   std::string* error = CM_NULLPTR) const;
 
   void CheckNeededCLanguage(const std::string& feature, bool& needC90,
                             bool& needC99, bool& needC11) const;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index ba4c6e6b59bfaa7ad1b81f20ca662180f1325ac2..9a37a332b7c943692a9a520145c0a4399270f455 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -418,8 +418,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   }
 
   // Write the build rule.
-  this->LocalGenerator->WriteMakeRule(
-    *this->BuildFileStream, 0, targetFullPathReal, depends, commands, false);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      targetFullPathReal, depends, commands,
+                                      false);
 
   // The symlink name for the target should depend on the real target
   // so if the target version changes it rebuilds and recreates the
@@ -428,8 +429,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     depends.clear();
     commands.clear();
     depends.push_back(targetFullPathReal);
-    this->LocalGenerator->WriteMakeRule(
-      *this->BuildFileStream, 0, targetFullPath, depends, commands, false);
+    this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                        targetFullPath, depends, commands,
+                                        false);
   }
 
   // Write the main driver rule to build everything in this target.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 5348b8089070ea7acfd70e2c4b27d35b836cd08b..380fd7d4eae8b250aa94a2bbc7ceed2e44aaa643 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -111,7 +111,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
   this->AppendObjectDepends(depends);
 
   // Write the rule.
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
                                       this->GeneratorTarget->GetName(),
                                       depends, commands, true);
 
@@ -346,7 +346,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
   }
 
-  const char* forbiddenFlagVar = 0;
+  const char* forbiddenFlagVar = CM_NULLPTR;
   switch (this->GeneratorTarget->GetType()) {
     case cmState::SHARED_LIBRARY:
       forbiddenFlagVar = "_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS";
@@ -762,8 +762,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
   }
 
   // Write the build rule.
-  this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands,
-                      false);
+  this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, outputs, depends,
+                      commands, false);
 
   // Write the main driver rule to build everything in this target.
   this->WriteTargetDriverRule(targetFullPath, relink);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8b341a1ac02e577f2b5a185cba82eb06fcc678b9..e922fbd57e89efefb98a2a5881e996524fc3f1c9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -33,12 +33,12 @@
 
 cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
   : cmCommonTargetGenerator(target)
-  , OSXBundleGenerator(0)
-  , MacOSXContentGenerator(0)
+  , OSXBundleGenerator(CM_NULLPTR)
+  , MacOSXContentGenerator(CM_NULLPTR)
 {
-  this->BuildFileStream = 0;
-  this->InfoFileStream = 0;
-  this->FlagFileStream = 0;
+  this->BuildFileStream = CM_NULLPTR;
+  this->InfoFileStream = CM_NULLPTR;
+  this->FlagFileStream = CM_NULLPTR;
   this->CustomCommandDriver = OnBuild;
   this->LocalGenerator =
     static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator());
@@ -61,7 +61,7 @@ cmMakefileTargetGenerator::~cmMakefileTargetGenerator()
 cmMakefileTargetGenerator* cmMakefileTargetGenerator::New(
   cmGeneratorTarget* tgt)
 {
-  cmMakefileTargetGenerator* result = 0;
+  cmMakefileTargetGenerator* result = CM_NULLPTR;
 
   switch (tgt->GetType()) {
     case cmState::EXECUTABLE:
@@ -139,7 +139,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
 
     cmSystemTools::ExpandListArgument(
       cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget,
-                    0, 0),
+                    CM_NULLPTR, CM_NULLPTR),
       this->CleanFiles);
   }
 
@@ -320,7 +320,8 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
                                           cmOutputConverter::SHELL);
   commands.push_back(copyCommand);
   this->Generator->LocalGenerator->WriteMakeRule(
-    *this->Generator->BuildFileStream, 0, output, depends, commands, false);
+    *this->Generator->BuildFileStream, CM_NULLPTR, output, depends, commands,
+    false);
   this->Generator->ExtraFiles.insert(output);
 }
 
@@ -652,7 +653,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
   }
 
   // Write the rule.
-  this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands);
+  this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, outputs, depends,
+                      commands);
 
   bool do_preprocess_rules = lang_has_preprocessor &&
     this->LocalGenerator->GetCreatePreprocessedSourceRules();
@@ -708,7 +710,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
         commands.push_back(cmd);
       }
 
-      this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+      this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
                                           relativeObjI, force_depends,
                                           commands, false);
     }
@@ -754,7 +756,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
         commands.push_back(cmd);
       }
 
-      this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+      this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
                                           relativeObjS, force_depends,
                                           commands, false);
     }
@@ -766,8 +768,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
   objectRequires += ".requires";
   std::vector<std::string> p_depends;
   // always provide an empty requires target
-  this->LocalGenerator->WriteMakeRule(
-    *this->BuildFileStream, 0, objectRequires, p_depends, no_commands, true);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      objectRequires, p_depends, no_commands,
+                                      true);
 
   // write a build rule to recursively build what this obj provides
   std::string objectProvides = relativeObj;
@@ -783,13 +786,14 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
 
   p_depends.clear();
   p_depends.push_back(objectRequires);
-  this->LocalGenerator->WriteMakeRule(
-    *this->BuildFileStream, 0, objectProvides, p_depends, r_commands, true);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      objectProvides, p_depends, r_commands,
+                                      true);
 
   // write the provides.build rule dependency on the obj file
   p_depends.clear();
   p_depends.push_back(relativeObj);
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, temp,
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, temp,
                                       p_depends, no_commands, false);
 }
 
@@ -815,8 +819,8 @@ void cmMakefileTargetGenerator::WriteTargetRequiresRules()
   }
 
   // Write the rule.
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, depTarget,
-                                      depends, no_commands, true);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      depTarget, depends, no_commands, true);
 }
 
 void cmMakefileTargetGenerator::WriteTargetCleanRules()
@@ -837,8 +841,8 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
     cmOutputConverter::HOME_OUTPUT);
 
   // Write the rule.
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, cleanTarget,
-                                      depends, commands, true);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      cleanTarget, depends, commands, true);
 }
 
 bool cmMakefileTargetGenerator::WriteMakeRule(
@@ -892,7 +896,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
     if (!o_symbolic) {
       output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out);
     }
-    this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends,
+    this->LocalGenerator->WriteMakeRule(os, CM_NULLPTR, *o, output_depends,
                                         output_commands, o_symbolic, in_help);
 
     if (!o_symbolic) {
@@ -1025,8 +1029,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
   }
 
   // Write the rule.
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, depTarget,
-                                      depends, commands, true);
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      depTarget, depends, commands, true);
 }
 
 void cmMakefileTargetGenerator::DriveCustomCommands(
@@ -1088,8 +1092,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
 
   // Write the rule.
   const std::vector<std::string>& outputs = ccg.GetOutputs();
-  bool symbolic =
-    this->WriteMakeRule(*this->BuildFileStream, 0, outputs, depends, commands);
+  bool symbolic = this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+                                      outputs, depends, commands);
 
   // If the rule has changed make sure the output is rebuilt.
   if (!symbolic) {
@@ -1254,7 +1258,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
   std::vector<std::string> depends;
   depends.push_back(main_output);
 
-  const char* comment = 0;
+  const char* comment = CM_NULLPTR;
   if (relink) {
     // Setup the comment for the preinstall driver.
     comment = "Rule to relink during preinstall.";
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 6e44e8f78381e8347d3a73cbb503b0b1613d4c2f..27006eeea40315f1e157034939e42e714dc369e2 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -95,7 +95,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
   }
 
   // Write the rule.
-  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+  this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
                                       this->GeneratorTarget->GetName(),
                                       depends, commands, true);
 
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 07f1fa83482fd2837cc6f7e2fcaef68c9eb6272b..2fb6a75d8717935339647b49f1f7702ba70520a7 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -35,7 +35,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
     cmState* state = this->Makefile->GetState();
     if (!state->GetCacheEntryValue(variable)) {
       this->Makefile->GetCMakeInstance()->AddCacheEntry(
-        variable, 0, 0, cmState::UNINITIALIZED);
+        variable, CM_NULLPTR, CM_NULLPTR, cmState::UNINITIALIZED);
       overwrite = true;
     }
     if (!state->GetCacheEntryValue(variable)) {
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 04ba842d9b09aea49c2d92e7ad0d5bca4ac02413..77d3901dc158408bc8b3741ff25e2095ddc46c87 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -134,7 +134,7 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
     case cmState::EXECUTABLE:
       return "executable";
     default:
-      return 0;
+      return CM_NULLPTR;
   }
 }
 
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 954c73e0d2ad8e4f5b2e06598a600efd483d42ec..a876efa20ce9f96b92d31bdc050f44cb173563c8 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -53,14 +53,14 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
     }
 
     default:
-      return 0;
+      return CM_NULLPTR;
   }
 }
 
 cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
   : cmCommonTargetGenerator(target)
-  , MacOSXContentGenerator(0)
-  , OSXBundleGenerator(0)
+  , MacOSXContentGenerator(CM_NULLPTR)
+  , OSXBundleGenerator(CM_NULLPTR)
   , MacContentFolders()
   , LocalGenerator(
       static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
@@ -739,5 +739,5 @@ bool cmNinjaTargetGenerator::ForceResponseFile()
 {
   static std::string const forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
   return (this->GetMakefile()->IsDefinitionSet(forceRspFile) ||
-          cmSystemTools::GetEnv(forceRspFile) != 0);
+          cmSystemTools::GetEnv(forceRspFile) != CM_NULLPTR);
 }
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index c19cae0d00994eab755fe56725de96f114736fe5..dbfe6eb3471653903d31989c65ca5f474188c9ab 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -23,7 +23,7 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target,
   , Makefile(target->Target->GetMakefile())
   , LocalGenerator(target->GetLocalGenerator())
   , ConfigName(configName)
-  , MacContentFolders(0)
+  , MacContentFolders(CM_NULLPTR)
 {
   if (this->MustSkip()) {
     return;
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index fc1a388f28a403f84d790441bd268a5330769a9c..38e197c9514d1e4a5ae1375d72818edf1a815067 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -30,7 +30,8 @@ public:
   cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
                      const char* purpose);
   ~cmOrderDirectories();
-  void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
+  void AddRuntimeLibrary(std::string const& fullPath,
+                         const char* soname = CM_NULLPTR);
   void AddLinkLibrary(std::string const& fullPath);
   void AddUserDirectories(std::vector<std::string> const& extra);
   void AddLanguageDirectories(std::vector<std::string> const& dirs);
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index b92c074da5a80218d5e6a99f79f46597f627193f..411184c7b2ce534006870a4b1b33e50df2c4b81f 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -54,7 +54,7 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
   assert(remote != NONE);
 
   const char* remotePath = this->GetRelativeRootPath(remote);
-  assert(remotePath != 0);
+  assert(remotePath != CM_NULLPTR);
 
   return this->ConvertToOutputForExisting(remotePath, format);
 }
@@ -73,7 +73,7 @@ const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const
     default:
       break;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 std::string cmOutputConverter::Convert(const std::string& source,
@@ -155,7 +155,7 @@ std::string cmOutputConverter::Convert(RelativeRoot remote,
   assert(remote != NONE);
 
   const char* remotePath = this->GetRelativeRootPath(remote);
-  assert(remotePath != 0);
+  assert(remotePath != CM_NULLPTR);
 
   if (local.empty()) {
     return this->ConvertToOutputFormat(remotePath, output);
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 29f1accde7b94560936a8dfa3160330d0cf4f39a..ef636e72ebe30d3a145266704fc0d8663588222d 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -28,7 +28,7 @@ public:
    */
   cmDependInformation()
     : DependDone(false)
-    , SourceFile(0)
+    , SourceFile(CM_NULLPTR)
   {
   }
 
@@ -154,7 +154,7 @@ public:
    */
   const cmDependInformation* FindDependencies(const char* file)
   {
-    cmDependInformation* info = this->GetDependInformation(file, 0);
+    cmDependInformation* info = this->GetDependInformation(file, CM_NULLPTR);
     this->GenerateDependInformation(info);
     return info;
   }
@@ -203,7 +203,7 @@ protected:
             message += includeFile;
             message += " for file ";
             message += info->FullPath.c_str();
-            cmSystemTools::Error(message.c_str(), 0);
+            cmSystemTools::Error(message.c_str(), CM_NULLPTR);
           }
           continue;
         }
@@ -329,7 +329,7 @@ protected:
 
     // See if the cmSourceFile for it has any files specified as
     // dependency hints.
-    if (info->SourceFile != 0) {
+    if (info->SourceFile != CM_NULLPTR) {
 
       // Get the cmSourceFile corresponding to this.
       const cmSourceFile& cFile = *(info->SourceFile);
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 85f0fa34256647d18de232d5669ff973343551df..124fb6a3df21acfbe835b678d221b4fe1786369d 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -57,9 +57,9 @@ static const char* idToString(cmPolicies::PolicyID id)
     CM_FOR_EACH_POLICY_ID(POLICY_CASE)
 #undef POLICY_CASE
     case cmPolicies::CMPCOUNT:
-      return 0;
+      return CM_NULLPTR;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 static const char* idToVersion(cmPolicies::PolicyID id)
@@ -71,9 +71,9 @@ static const char* idToVersion(cmPolicies::PolicyID id)
     CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE)
 #undef POLICY_CASE
     case cmPolicies::CMPCOUNT:
-      return 0;
+      return CM_NULLPTR;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
@@ -102,9 +102,9 @@ const char* idToShortDescription(cmPolicies::PolicyID id)
     CM_FOR_EACH_POLICY_ID_DOC(POLICY_CASE)
 #undef POLICY_CASE
     case cmPolicies::CMPCOUNT:
-      return 0;
+      return CM_NULLPTR;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 static void DiagnoseAncientPolicies(
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index 446752e596f1543622df6025eda4a27d2354bbf3..34b8df2f09dbf02e6a47dd5b9f5909f94989e95a 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -17,27 +17,27 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
                                 OutputParser* err)
 {
   cmsysProcess_Execute(cp);
-  char* data = 0;
+  char* data = CM_NULLPTR;
   int length = 0;
   int p;
   while ((out || err) &&
-         (p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+         (p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
     if (out && p == cmsysProcess_Pipe_STDOUT) {
       if (!out->Process(data, length)) {
-        out = 0;
+        out = CM_NULLPTR;
       }
     } else if (err && p == cmsysProcess_Pipe_STDERR) {
       if (!err->Process(data, length)) {
-        err = 0;
+        err = CM_NULLPTR;
       }
     }
   }
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 }
 
 cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR)
-  : Log(0)
-  , Prefix(0)
+  : Log(CM_NULLPTR)
+  , Prefix(CM_NULLPTR)
   , Separator(sep)
   , LineEnd('\0')
   , IgnoreCR(ignoreCR)
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index 9d082b2f645e7c9f961de78589765e6dc0be0cf9..61bfc64064e2c0774505c9a3edf82e1399a5f0f4 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -73,7 +73,7 @@ public:
   class OutputLogger : public LineParser
   {
   public:
-    OutputLogger(std::ostream& log, const char* prefix = 0)
+    OutputLogger(std::ostream& log, const char* prefix = CM_NULLPTR)
     {
       this->SetLog(&log, prefix);
     }
@@ -84,7 +84,7 @@ public:
 
   /** Run a process and send output to given parsers.  */
   static void RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
-                         OutputParser* err = 0);
+                         OutputParser* err = CM_NULLPTR);
 };
 
 #endif
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 4910616bb930235dbac30d1639a01fdb3a3614c6..133258f4346ce4b61ce5af578d10a900973cfbd7 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -33,5 +33,5 @@ const char* cmProperty::GetValue() const
   if (this->ValueHasBeenSet) {
     return this->Value.c_str();
   }
-  return 0;
+  return CM_NULLPTR;
 }
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index de1281ebee2b2926dffa4222d423e3420debd365..1e1ff910a89675863557af8cfc6760ad81150b6c 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -70,7 +70,7 @@ const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
 
   cmPropertyMap::const_iterator it = this->find(name);
   if (it == this->end()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return it->second.GetValue();
 }
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index f63672b977276b93ef948d6767c3a5a09264b0f4..ef8255a0ec96260a84b1624babda468582979743 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -80,7 +80,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
       depends.push_back(hname);
 
       std::string no_main_dependency = "";
-      const char* no_working_dir = 0;
+      const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
         newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
         no_working_dir);
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 4c1da3627aba86ca39ed72959ca531ab02337151..a948dd6aafebe916b64bb2f5e260ee249b5afdfd 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -111,8 +111,8 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
       std::vector<std::string> depends;
       depends.push_back(uiName);
       std::string no_main_dependency = "";
-      const char* no_comment = 0;
-      const char* no_working_dir = 0;
+      const char* no_comment = CM_NULLPTR;
+      const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
         hName, depends, no_main_dependency, hCommandLines, no_comment,
         no_working_dir);
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 98851d629aa4d8d0b16db2f396233da8ffcc06b5..4a63aad75cb377ecafe8793b435f45463d80964b 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -195,7 +195,7 @@ static void SetupAutoMocTarget(
   cmMakefile* makefile = target->Target->GetMakefile();
 
   const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
-  std::string _moc_options = (tmp != 0 ? tmp : "");
+  std::string _moc_options = (tmp != CM_NULLPTR ? tmp : "");
   makefile->AddDefinition(
     "_moc_options", cmOutputConverter::EscapeForCMake(_moc_options).c_str());
   makefile->AddDefinition(
@@ -484,8 +484,9 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
     std::string rccStdOut;
     std::string rccStdErr;
     int retVal = 0;
-    bool result = cmSystemTools::RunSingleCommand(
-      command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE);
+    bool result =
+      cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
+                                      CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
     if (result && retVal == 0 &&
         rccStdOut.find("--list") != std::string::npos) {
       hasDashDashList = true;
@@ -505,8 +506,9 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
   std::string rccStdOut;
   std::string rccStdErr;
   int retVal = 0;
-  bool result = cmSystemTools::RunSingleCommand(
-    command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE);
+  bool result =
+    cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
+                                    CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
   if (!result || retVal) {
     std::ostringstream err;
     err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 6a6d72f47a6576f7194e7df61c2cd5b4cb7ad7cf..7ada43120086b9c63c18c81b78330ccdd196a1b7 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -34,8 +34,8 @@
 static bool requiresMocing(const std::string& text, std::string& macroName)
 {
   // this simple check is much much faster than the regexp
-  if (strstr(text.c_str(), "Q_OBJECT") == NULL &&
-      strstr(text.c_str(), "Q_GADGET") == NULL) {
+  if (strstr(text.c_str(), "Q_OBJECT") == CM_NULLPTR &&
+      strstr(text.c_str(), "Q_GADGET") == CM_NULLPTR) {
     return false;
   }
 
@@ -88,7 +88,7 @@ static std::string extractSubDir(const std::string& absPath,
 }
 
 cmQtAutoGenerators::cmQtAutoGenerators()
-  : Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
+  : Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != CM_NULLPTR)
   , ColorOutput(true)
   , RunMocFailed(false)
   , RunUicFailed(false)
@@ -588,7 +588,7 @@ void cmQtAutoGenerators::ParseCppFile(
   // first a simple string check for "moc" is *much* faster than the regexp,
   // and if the string search already fails, we don't have to try the
   // expensive regexp
-  if ((strstr(contentsString.c_str(), "moc") != NULL) &&
+  if ((strstr(contentsString.c_str(), "moc") != CM_NULLPTR) &&
       (mocIncludeRegExp.find(contentsString))) {
     // for every moc include in the file
     do {
@@ -765,7 +765,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
   // first a simple string check for "moc" is *much* faster than the regexp,
   // and if the string search already fails, we don't have to try the
   // expensive regexp
-  if ((strstr(contentsString.c_str(), "moc") != NULL) &&
+  if ((strstr(contentsString.c_str(), "moc") != CM_NULLPTR) &&
       (mocIncludeRegExp.find(contentsString))) {
     // for every moc include in the file
     do {
@@ -879,7 +879,7 @@ void cmQtAutoGenerators::ParseForUic(
   const std::string realName = cmsys::SystemTools::GetRealPath(absFilename);
 
   matchOffset = 0;
-  if ((strstr(contentsString.c_str(), "ui_") != NULL) &&
+  if ((strstr(contentsString.c_str(), "ui_") != CM_NULLPTR) &&
       (uiIncludeRegExp.find(contentsString))) {
     do {
       const std::string currentUi = uiIncludeRegExp.match(1);
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 5fed107088831510b9709844ebf80d6960f8aba3..b8aae5d5e09f63bf862cc70f25eb229efc70ab0d 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -19,7 +19,7 @@ cmScriptGenerator::cmScriptGenerator(
   : RuntimeConfigVariable(config_var)
   , Configurations(configurations)
   , ConfigurationName("")
-  , ConfigurationTypes(0)
+  , ConfigurationTypes(CM_NULLPTR)
   , ActionsPerConfig(false)
 {
 }
@@ -36,7 +36,7 @@ void cmScriptGenerator::Generate(
   this->ConfigurationTypes = &configurationTypes;
   this->GenerateScript(os);
   this->ConfigurationName = "";
-  this->ConfigurationTypes = 0;
+  this->ConfigurationTypes = CM_NULLPTR;
 }
 
 static void cmScriptGeneratorEncodeConfig(const std::string& config,
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index a0cce126db8720c96194773c95d0e22a72027a6f..ca3a57faada044f13b2f6d907b1748501064da3a 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -45,7 +45,7 @@ void cmSearchPath::AddPath(const std::string& path)
 
 void cmSearchPath::AddUserPath(const std::string& path)
 {
-  assert(this->FC != NULL);
+  assert(this->FC != CM_NULLPTR);
 
   std::vector<std::string> outPaths;
 
@@ -80,7 +80,7 @@ void cmSearchPath::AddUserPath(const std::string& path)
 
 void cmSearchPath::AddCMakePath(const std::string& variable)
 {
-  assert(this->FC != NULL);
+  assert(this->FC != CM_NULLPTR);
 
   // Get a path from a CMake variable.
   if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
@@ -107,7 +107,7 @@ void cmSearchPath::AddEnvPath(const std::string& variable)
 
 void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
 {
-  assert(this->FC != NULL);
+  assert(this->FC != CM_NULLPTR);
 
   // Get a path from a CMake variable.
   if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
@@ -172,7 +172,7 @@ void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes)
 void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
                                   const char* base)
 {
-  assert(this->FC != NULL);
+  assert(this->FC != CM_NULLPTR);
 
   // default for programs
   std::string subdir = "bin";
@@ -213,7 +213,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
 
 void cmSearchPath::AddPathInternal(const std::string& path, const char* base)
 {
-  assert(this->FC != NULL);
+  assert(this->FC != CM_NULLPTR);
 
   std::string collapsed = cmSystemTools::CollapseFullPath(path, base);
 
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 835196fd1937ec55ae8c9771c5d1714953f720a6..65f703fe785e89ef0e98c9aeebc628583f142d6c 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -28,7 +28,7 @@ public:
   // cmSearchPath must be initialized from a valid pointer.  The only reason
   // for the default is to allow it to be easily used in stl containers.
   // Attempting to initialize with a NULL value will fail an assertion
-  cmSearchPath(cmFindCommon* findCmd = 0);
+  cmSearchPath(cmFindCommon* findCmd = CM_NULLPTR);
   ~cmSearchPath();
 
   const std::vector<std::string>& GetPaths() const { return this->Paths; }
@@ -47,8 +47,8 @@ public:
 
 protected:
   void AddPrefixPaths(const std::vector<std::string>& paths,
-                      const char* base = 0);
-  void AddPathInternal(const std::string& path, const char* base = 0);
+                      const char* base = CM_NULLPTR);
+  void AddPathInternal(const std::string& path, const char* base = CM_NULLPTR);
 
   cmFindCommon* FC;
   std::vector<std::string> Paths;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5f4cfee3e8b43c8c6611628000c9bdaa48771df4..148436860a7569a8435fdf2feff363836d343338 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -59,7 +59,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
   // SET (VAR PARENT_SCOPE) // Removes the definition of VAR
   // in the parent scope.
   else if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") {
-    this->Makefile->RaiseScope(variable, 0);
+    this->Makefile->RaiseScope(variable, CM_NULLPTR);
     return true;
   }
 
@@ -73,7 +73,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
   bool force = false; // optional
   bool parentScope = false;
   cmState::CacheEntryType type = cmState::STRING; // required if cache
-  const char* docstring = 0;                      // required if cache
+  const char* docstring = CM_NULLPTR;             // required if cache
 
   unsigned int ignoreLastArgs = 0;
   // look for PARENT_SCOPE argument
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 73f7437469f7552abddb5d0966bdad518a8fa301..8fe8ade3b9159ebf3d2a26d14eeca34b62333d42 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -139,7 +139,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
-    value = 0;
+    value = CM_NULLPTR;
   }
   if (this->AppendMode) {
     cm->AppendProperty(name, value ? value : "", this->AppendAsString);
@@ -189,7 +189,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
-    value = 0;
+    value = CM_NULLPTR;
   }
   if (this->AppendMode) {
     mf->AppendProperty(name, value ? value : "", this->AppendAsString);
@@ -230,7 +230,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
-    value = 0;
+    value = CM_NULLPTR;
   }
   if (this->AppendMode) {
     target->AppendProperty(name, value, this->AppendAsString);
@@ -269,7 +269,7 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
-    value = 0;
+    value = CM_NULLPTR;
   }
 
   if (this->AppendMode) {
@@ -317,7 +317,7 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
-    value = 0;
+    value = CM_NULLPTR;
   }
   if (this->AppendMode) {
     test->AppendProperty(name, value, this->AppendAsString);
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 702af4dab03fd33257f47d189be3091e3a7fc34b..5c14991e2c5b21ad9f3abd9215e53a3faa38af95 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -55,7 +55,8 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args,
   // try to find the hostname for this computer
   if (!cmSystemTools::IsOff(hostname_cmd.c_str())) {
     std::string host;
-    cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, 0, 0, 0,
+    cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, CM_NULLPTR,
+                                    CM_NULLPTR, CM_NULLPTR,
                                     cmSystemTools::OUTPUT_NONE);
 
     // got the hostname
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5b0acee92569aade9befba8457ec81f839007928..04727b24ffbb6beca621f9b8acba8fd2abb25f18 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -19,7 +19,7 @@
 cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
   : Location(mf, name)
 {
-  this->CustomCommand = 0;
+  this->CustomCommand = CM_NULLPTR;
   this->FindFullPathFailed = false;
   this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(
                                this->Location.GetName()));
@@ -27,7 +27,7 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
 
 cmSourceFile::~cmSourceFile()
 {
-  this->SetCustomCommand(0);
+  this->SetCustomCommand(CM_NULLPTR);
 }
 
 std::string const& cmSourceFile::GetExtension() const
@@ -135,7 +135,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
 
   // The file is not generated.  It must exist on disk.
   cmMakefile const* mf = this->Location.GetMakefile();
-  const char* tryDirs[3] = { 0, 0, 0 };
+  const char* tryDirs[3] = { CM_NULLPTR, CM_NULLPTR, CM_NULLPTR };
   if (this->Location.DirectoryIsAmbiguous()) {
     tryDirs[0] = mf->GetCurrentSourceDirectory();
     tryDirs[1] = mf->GetCurrentBinaryDirectory();
@@ -294,7 +294,7 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
   // Check for computed properties.
   if (prop == "LOCATION") {
     if (this->FullPath.empty()) {
-      return 0;
+      return CM_NULLPTR;
     } else {
       return this->FullPath.c_str();
     }
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index b1623bdd41617f1b2ca841f36b0293bb231138c8..a3808f7bacbb975859faf7934e4ae1abbbfdc100 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -62,7 +62,7 @@ public:
    * horrible interface, but is necessary for backwards
    * compatibility).
    */
-  std::string const& GetFullPath(std::string* error = 0);
+  std::string const& GetFullPath(std::string* error = CM_NULLPTR);
   std::string const& GetFullPath() const;
 
   /**
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index a89d1e8e342191dd2e1d8d3ab79ee95ec2286c93..099a6f07ae3b7f27af66771587b43f63b528b749 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -19,7 +19,7 @@
 #include "assert.h"
 
 cmSourceFileLocation::cmSourceFileLocation()
-  : Makefile(0)
+  : Makefile(CM_NULLPTR)
   , AmbiguousDirectory(true)
   , AmbiguousExtension(true)
 {
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index f27b572fdc38391f5ba537d1a97776b4904571d2..d9529a24f3926da446430d8d7e21dada15268ae6 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -123,7 +123,7 @@ cmSourceGroup* cmSourceGroup::LookupChild(const char* name) const
   }
 
   // if no child with this name was found return NULL
-  return NULL;
+  return CM_NULLPTR;
 }
 
 cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const char* name)
@@ -143,7 +143,7 @@ cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const char* name)
       return result;
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const char* name)
@@ -164,7 +164,7 @@ cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const char* name)
     return this;
   }
 
-  return 0;
+  return CM_NULLPTR;
 }
 
 std::vector<cmSourceGroup> const& cmSourceGroup::GetGroupChildren() const
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 8603e95e78a3629fc1233f0b778f28d7628d43f0..1f5232e6049195efdf14462ce738a92efccf77ca 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -34,7 +34,7 @@ class cmSourceGroup
 {
 public:
   cmSourceGroup(const char* name, const char* regex,
-                const char* parentName = 0);
+                const char* parentName = CM_NULLPTR);
   cmSourceGroup(cmSourceGroup const& r);
   ~cmSourceGroup();
   cmSourceGroup& operator=(cmSourceGroup const&);
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 252819c8f6b8cd29ef2678a21ca69bf7d391850d..6db14c0a4fc7fd6f278a99caf65944e6a045f4fc 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -28,7 +28,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
   std::vector<std::string> folders =
     cmSystemTools::tokenize(args[0], delimiter);
 
-  cmSourceGroup* sg = 0;
+  cmSourceGroup* sg = CM_NULLPTR;
   sg = this->Makefile->GetSourceGroup(folders);
   if (!sg) {
     this->Makefile->AddSourceGroup(folders);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index d2cfaba718efa53ed585ef5dcd1d76fb902501bd..f2fe134bb6c6ecb8d380301644be3e862e8bb597 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -135,12 +135,12 @@ const char* cmState::GetTargetTypeName(cmState::TargetType targetType)
       return "UNKNOWN_LIBRARY";
   }
   assert(0 && "Unexpected target type");
-  return 0;
+  return CM_NULLPTR;
 }
 
 const char* cmCacheEntryTypes[] = { "BOOL",          "PATH",     "FILEPATH",
                                     "STRING",        "INTERNAL", "STATIC",
-                                    "UNINITIALIZED", 0 };
+                                    "UNINITIALIZED", CM_NULLPTR };
 
 const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
 {
@@ -204,7 +204,7 @@ const char* cmState::GetCacheEntryValue(std::string const& key) const
 {
   cmCacheManager::CacheEntry* e = this->CacheManager->GetCacheEntry(key);
   if (!e) {
-    return 0;
+    return CM_NULLPTR;
   }
   return e->Value.c_str();
 }
@@ -260,7 +260,7 @@ const char* cmState::GetCacheEntryProperty(std::string const& key,
   cmCacheManager::CacheIterator it =
     this->CacheManager->GetCacheIterator(key.c_str());
   if (!it.PropertyExists(propertyName)) {
-    return 0;
+    return CM_NULLPTR;
   }
   return it.GetProperty(propertyName);
 }
@@ -296,7 +296,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
                                        std::string const& propertyName)
 {
   this->CacheManager->GetCacheIterator(key.c_str())
-    .SetProperty(propertyName, (void*)0);
+    .SetProperty(propertyName, (void*)CM_NULLPTR);
 }
 
 cmState::Snapshot cmState::Reset()
@@ -374,7 +374,7 @@ cmPropertyDefinition const* cmState::GetPropertyDefinition(
       this->PropertyDefinitions.find(scope)->second;
     return &defs.find(name)->second;
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 bool cmState::IsPropertyDefined(const std::string& name,
@@ -491,7 +491,7 @@ void cmState::RemoveUnscriptableCommands()
 
 cmCommand* cmState::GetCommand(std::string const& name) const
 {
-  cmCommand* command = 0;
+  cmCommand* command = CM_NULLPTR;
   std::string sName = cmSystemTools::LowerCase(name);
   std::map<std::string, cmCommand*>::const_iterator pos =
     this->Commands.find(sName);
@@ -1197,7 +1197,7 @@ void cmState::Snapshot::SetDefinition(std::string const& name,
 
 void cmState::Snapshot::RemoveDefinition(std::string const& name)
 {
-  this->Position->Vars->Set(name, 0);
+  this->Position->Vars->Set(name, CM_NULLPTR);
 }
 
 std::vector<std::string> cmState::Snapshot::UnusedKeys() const
diff --git a/Source/cmState.h b/Source/cmState.h
index 935faecdad2ea07242f7d2ad7041ad8f56acdf92..e5f99173bf5c4e649068cc91622659d16ac455b2 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -55,7 +55,7 @@ public:
   class Snapshot
   {
   public:
-    Snapshot(cmState* state = 0);
+    Snapshot(cmState* state = CM_NULLPTR);
     Snapshot(cmState* state, PositionType position);
 
     const char* GetDefinition(std::string const& name) const;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 26cbfb6bffb95d6cc325376f2e43b6a326a537d4..2d463f315b87b2bb21cb33daf2ce2ecba2fa1e0e 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -583,7 +583,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
        a != command.end(); ++a) {
     argv.push_back(a->c_str());
   }
-  argv.push_back(0);
+  argv.push_back(CM_NULLPTR);
 
   cmsysProcess* cp = cmsysProcess_New();
   cmsysProcess_SetCommand(cp, &*argv.begin());
@@ -595,12 +595,12 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
   if (outputflag == OUTPUT_PASSTHROUGH) {
     cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
     cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
-    captureStdOut = 0;
-    captureStdErr = 0;
+    captureStdOut = CM_NULLPTR;
+    captureStdErr = CM_NULLPTR;
   } else if (outputflag == OUTPUT_MERGE ||
              (captureStdErr && captureStdErr == captureStdOut)) {
     cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1);
-    captureStdErr = 0;
+    captureStdErr = CM_NULLPTR;
   }
   assert(!captureStdErr || captureStdErr != captureStdOut);
 
@@ -614,7 +614,8 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
   int pipe;
   if (outputflag != OUTPUT_PASSTHROUGH &&
       (captureStdOut || captureStdErr || outputflag != OUTPUT_NONE)) {
-    while ((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) {
+    while ((pipe = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) >
+           0) {
       // Translate NULL characters in the output into valid text.
       // Visual Studio 7 puts these characters in the output of its
       // build process.
@@ -642,7 +643,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
     }
   }
 
-  cmsysProcess_WaitForExit(cp, 0);
+  cmsysProcess_WaitForExit(cp, CM_NULLPTR);
   if (captureStdOut) {
     captureStdOut->assign(tempStdOut.begin(), tempStdOut.end());
   }
@@ -1432,7 +1433,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
 
   /* Use uname if it's present, else uid. */
   p = archive_entry_uname(entry);
-  if ((p == NULL) || (*p == '\0')) {
+  if ((p == CM_NULLPTR) || (*p == '\0')) {
     sprintf(tmp, "%lu ", (unsigned long)archive_entry_uid(entry));
     p = tmp;
   }
@@ -1443,7 +1444,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
   fprintf(out, "%-*s ", (int)u_width, p);
   /* Use gname if it's present, else gid. */
   p = archive_entry_gname(entry);
-  if (p != NULL && p[0] != '\0') {
+  if (p != CM_NULLPTR && p[0] != '\0') {
     fprintf(out, "%s", p);
     w = strlen(p);
   } else {
@@ -1875,7 +1876,7 @@ unsigned int cmSystemTools::RandomSeed()
 
   // Try using a real random source.
   cmsys::ifstream fin;
-  fin.rdbuf()->pubsetbuf(0, 0); // Unbuffered read.
+  fin.rdbuf()->pubsetbuf(CM_NULLPTR, 0); // Unbuffered read.
   fin.open("/dev/urandom");
   if (fin.good() && fin.read(seed.bytes, sizeof(seed)) &&
       fin.gcount() == sizeof(seed)) {
@@ -1884,7 +1885,7 @@ unsigned int cmSystemTools::RandomSeed()
 
   // Fall back to the time and pid.
   struct timeval t;
-  gettimeofday(&t, 0);
+  gettimeofday(&t, CM_NULLPTR);
   unsigned int pid = static_cast<unsigned int>(getpid());
   unsigned int tv_sec = static_cast<unsigned int>(t.tv_sec);
   unsigned int tv_usec = static_cast<unsigned int>(t.tv_usec);
@@ -2199,8 +2200,8 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
 
     // Get the RPATH and RUNPATH entries from it.
     int se_count = 0;
-    cmELF::StringEntry const* se[2] = { 0, 0 };
-    const char* se_name[2] = { 0, 0 };
+    cmELF::StringEntry const* se[2] = { CM_NULLPTR, CM_NULLPTR };
+    const char* se_name[2] = { CM_NULLPTR, CM_NULLPTR };
     if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
       se[se_count] = se_rpath;
       se_name[se_count] = "RPATH";
@@ -2430,7 +2431,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
     // Get the RPATH and RUNPATH entries from it and sort them by index
     // in the dynamic section header.
     int se_count = 0;
-    cmELF::StringEntry const* se[2] = { 0, 0 };
+    cmELF::StringEntry const* se[2] = { CM_NULLPTR, CM_NULLPTR };
     if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
       se[se_count++] = se_rpath;
     }
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index df2c1f7437b62963ae0fe170325fa0c27718a319..39e79948ac51d24421e7cb50ea855058e8875c82 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -64,33 +64,35 @@ public:
    *  title as a const char*, and a reference to bool that when
    *  set to false, will disable furthur messages (cancel).
    */
-  static void SetMessageCallback(MessageCallback f, void* clientData = 0);
+  static void SetMessageCallback(MessageCallback f,
+                                 void* clientData = CM_NULLPTR);
 
   /**
    * Display an error message.
    */
-  static void Error(const char* m, const char* m2 = 0, const char* m3 = 0,
-                    const char* m4 = 0);
+  static void Error(const char* m, const char* m2 = CM_NULLPTR,
+                    const char* m3 = CM_NULLPTR, const char* m4 = CM_NULLPTR);
 
   /**
    * Display a message.
    */
-  static void Message(const char* m, const char* title = 0);
+  static void Message(const char* m, const char* title = CM_NULLPTR);
 
   typedef void (*OutputCallback)(const char*, size_t length, void*);
 
   ///! Send a string to stdout
   static void Stdout(const char* s);
   static void Stdout(const char* s, size_t length);
-  static void SetStdoutCallback(OutputCallback, void* clientData = 0);
+  static void SetStdoutCallback(OutputCallback, void* clientData = CM_NULLPTR);
 
   ///! Send a string to stderr
   static void Stderr(const char* s);
   static void Stderr(const char* s, size_t length);
-  static void SetStderrCallback(OutputCallback, void* clientData = 0);
+  static void SetStderrCallback(OutputCallback, void* clientData = CM_NULLPTR);
 
   typedef bool (*InterruptCallback)(void*);
-  static void SetInterruptCallback(InterruptCallback f, void* clientData = 0);
+  static void SetInterruptCallback(InterruptCallback f,
+                                   void* clientData = CM_NULLPTR);
   static bool GetInterruptFlag();
 
   ///! Return true if there was an error at any point.
@@ -220,9 +222,10 @@ public:
     OUTPUT_PASSTHROUGH
   };
   static bool RunSingleCommand(const char* command,
-                               std::string* captureStdOut = 0,
-                               std::string* captureStdErr = 0, int* retVal = 0,
-                               const char* dir = 0,
+                               std::string* captureStdOut = CM_NULLPTR,
+                               std::string* captureStdErr = CM_NULLPTR,
+                               int* retVal = CM_NULLPTR,
+                               const char* dir = CM_NULLPTR,
                                OutputOption outputflag = OUTPUT_MERGE,
                                double timeout = 0.0);
   /**
@@ -231,9 +234,10 @@ public:
    * be in comand[1]...command[command.size()]
    */
   static bool RunSingleCommand(std::vector<std::string> const& command,
-                               std::string* captureStdOut = 0,
-                               std::string* captureStdErr = 0, int* retVal = 0,
-                               const char* dir = 0,
+                               std::string* captureStdOut = CM_NULLPTR,
+                               std::string* captureStdErr = CM_NULLPTR,
+                               int* retVal = CM_NULLPTR,
+                               const char* dir = CM_NULLPTR,
                                OutputOption outputflag = OUTPUT_MERGE,
                                double timeout = 0.0);
 
@@ -435,12 +439,14 @@ public:
 
   /** Try to set the RPATH in an ELF binary.  */
   static bool ChangeRPath(std::string const& file, std::string const& oldRPath,
-                          std::string const& newRPath, std::string* emsg = 0,
-                          bool* changed = 0);
+                          std::string const& newRPath,
+                          std::string* emsg = CM_NULLPTR,
+                          bool* changed = CM_NULLPTR);
 
   /** Try to remove the RPATH from an ELF binary.  */
-  static bool RemoveRPath(std::string const& file, std::string* emsg = 0,
-                          bool* removed = 0);
+  static bool RemoveRPath(std::string const& file,
+                          std::string* emsg = CM_NULLPTR,
+                          bool* removed = CM_NULLPTR);
 
   /** Check whether the RPATH in an ELF binary contains the path
       given.  */
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5e5ed2b290af3106a435e6c5524e4a43f615033f..ceebf93158a8c1f10280d201a79b31a70afbd1e4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -57,7 +57,7 @@ public:
 
 cmTarget::cmTarget()
 {
-  this->Makefile = 0;
+  this->Makefile = CM_NULLPTR;
   this->HaveInstallRule = false;
   this->DLLPlatform = false;
   this->IsAndroid = false;
@@ -97,64 +97,64 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   // Setup default property values.
   if (this->GetType() != cmState::INTERFACE_LIBRARY &&
       this->GetType() != cmState::UTILITY) {
-    this->SetPropertyDefault("ANDROID_API", 0);
-    this->SetPropertyDefault("ANDROID_API_MIN", 0);
-    this->SetPropertyDefault("ANDROID_ARCH", 0);
-    this->SetPropertyDefault("ANDROID_STL_TYPE", 0);
-    this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", 0);
-    this->SetPropertyDefault("ANDROID_PROCESS_MAX", 0);
-    this->SetPropertyDefault("ANDROID_PROGUARD", 0);
-    this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", 0);
-    this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", 0);
-    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", 0);
-    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", 0);
-    this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", 0);
-    this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", 0);
-    this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", 0);
-    this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", 0);
-    this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", 0);
-    this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
+    this->SetPropertyDefault("ANDROID_API", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_API_MIN", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_ARCH", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_STL_TYPE", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_PROCESS_MAX", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_PROGUARD", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", CM_NULLPTR);
+    this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", CM_NULLPTR);
+    this->SetPropertyDefault("INSTALL_NAME_DIR", CM_NULLPTR);
     this->SetPropertyDefault("INSTALL_RPATH", "");
     this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
     this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF");
     this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF");
-    this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
-    this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
-    this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
-    this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0);
-    this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", 0);
-    this->SetPropertyDefault("Fortran_FORMAT", 0);
-    this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
-    this->SetPropertyDefault("GNUtoMS", 0);
-    this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
-    this->SetPropertyDefault("IOS_INSTALL_COMBINED", 0);
-    this->SetPropertyDefault("AUTOMOC", 0);
-    this->SetPropertyDefault("AUTOUIC", 0);
-    this->SetPropertyDefault("AUTORCC", 0);
-    this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
-    this->SetPropertyDefault("AUTOUIC_OPTIONS", 0);
-    this->SetPropertyDefault("AUTORCC_OPTIONS", 0);
-    this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0);
-    this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
-    this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
-    this->SetPropertyDefault("MACOSX_BUNDLE", 0);
-    this->SetPropertyDefault("MACOSX_RPATH", 0);
-    this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
-    this->SetPropertyDefault("C_CLANG_TIDY", 0);
-    this->SetPropertyDefault("C_COMPILER_LAUNCHER", 0);
-    this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", 0);
-    this->SetPropertyDefault("LINK_WHAT_YOU_USE", 0);
-    this->SetPropertyDefault("C_STANDARD", 0);
-    this->SetPropertyDefault("C_STANDARD_REQUIRED", 0);
-    this->SetPropertyDefault("C_EXTENSIONS", 0);
-    this->SetPropertyDefault("CXX_CLANG_TIDY", 0);
-    this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", 0);
-    this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", 0);
-    this->SetPropertyDefault("CXX_STANDARD", 0);
-    this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0);
-    this->SetPropertyDefault("CXX_EXTENSIONS", 0);
-    this->SetPropertyDefault("LINK_SEARCH_START_STATIC", 0);
-    this->SetPropertyDefault("LINK_SEARCH_END_STATIC", 0);
+    this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("Fortran_FORMAT", CM_NULLPTR);
+    this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", CM_NULLPTR);
+    this->SetPropertyDefault("GNUtoMS", CM_NULLPTR);
+    this->SetPropertyDefault("OSX_ARCHITECTURES", CM_NULLPTR);
+    this->SetPropertyDefault("IOS_INSTALL_COMBINED", CM_NULLPTR);
+    this->SetPropertyDefault("AUTOMOC", CM_NULLPTR);
+    this->SetPropertyDefault("AUTOUIC", CM_NULLPTR);
+    this->SetPropertyDefault("AUTORCC", CM_NULLPTR);
+    this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", CM_NULLPTR);
+    this->SetPropertyDefault("AUTOUIC_OPTIONS", CM_NULLPTR);
+    this->SetPropertyDefault("AUTORCC_OPTIONS", CM_NULLPTR);
+    this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", CM_NULLPTR);
+    this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", CM_NULLPTR);
+    this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR);
+    this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR);
+    this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR);
+    this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR);
+    this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR);
+    this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR);
+    this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR);
+    this->SetPropertyDefault("LINK_WHAT_YOU_USE", CM_NULLPTR);
+    this->SetPropertyDefault("C_STANDARD", CM_NULLPTR);
+    this->SetPropertyDefault("C_STANDARD_REQUIRED", CM_NULLPTR);
+    this->SetPropertyDefault("C_EXTENSIONS", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_CLANG_TIDY", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_STANDARD", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_STANDARD_REQUIRED", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_EXTENSIONS", CM_NULLPTR);
+    this->SetPropertyDefault("LINK_SEARCH_START_STATIC", CM_NULLPTR);
+    this->SetPropertyDefault("LINK_SEARCH_END_STATIC", CM_NULLPTR);
   }
 
   // Collect the set of configuration types.
@@ -171,7 +171,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
       "PDB_OUTPUT_DIRECTORY_",
       "COMPILE_PDB_OUTPUT_DIRECTORY_",
       "MAP_IMPORTED_CONFIG_",
-      0
+      CM_NULLPTR
     };
     for (std::vector<std::string>::iterator ci = configNames.begin();
          ci != configNames.end(); ++ci) {
@@ -183,7 +183,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
         }
         std::string property = *p;
         property += configUpper;
-        this->SetPropertyDefault(property, 0);
+        this->SetPropertyDefault(property, CM_NULLPTR);
       }
 
       // Initialize per-configuration name postfix property from the
@@ -195,7 +195,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
           this->TargetTypeValue != cmState::INTERFACE_LIBRARY) {
         std::string property = cmSystemTools::UpperCase(*ci);
         property += "_POSTFIX";
-        this->SetPropertyDefault(property, 0);
+        this->SetPropertyDefault(property, CM_NULLPTR);
       }
     }
   }
@@ -239,27 +239,27 @@ void cmTarget::SetMakefile(cmMakefile* mf)
 
   if (this->GetType() != cmState::INTERFACE_LIBRARY &&
       this->GetType() != cmState::UTILITY) {
-    this->SetPropertyDefault("C_VISIBILITY_PRESET", 0);
-    this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0);
-    this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0);
+    this->SetPropertyDefault("C_VISIBILITY_PRESET", CM_NULLPTR);
+    this->SetPropertyDefault("CXX_VISIBILITY_PRESET", CM_NULLPTR);
+    this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", CM_NULLPTR);
   }
 
   if (this->TargetTypeValue == cmState::EXECUTABLE) {
-    this->SetPropertyDefault("ANDROID_GUI", 0);
-    this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0);
-    this->SetPropertyDefault("ENABLE_EXPORTS", 0);
+    this->SetPropertyDefault("ANDROID_GUI", CM_NULLPTR);
+    this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", CM_NULLPTR);
+    this->SetPropertyDefault("ENABLE_EXPORTS", CM_NULLPTR);
   }
   if (this->TargetTypeValue == cmState::SHARED_LIBRARY ||
       this->TargetTypeValue == cmState::MODULE_LIBRARY) {
     this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
   }
   if (this->TargetTypeValue == cmState::SHARED_LIBRARY) {
-    this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", 0);
+    this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", CM_NULLPTR);
   }
 
   if (this->GetType() != cmState::INTERFACE_LIBRARY &&
       this->GetType() != cmState::UTILITY) {
-    this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
+    this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", CM_NULLPTR);
   }
 
   // Record current policies for later use.
@@ -274,8 +274,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
 
   if (this->GetType() != cmState::INTERFACE_LIBRARY &&
       this->GetType() != cmState::UTILITY) {
-    this->SetPropertyDefault("JOB_POOL_COMPILE", 0);
-    this->SetPropertyDefault("JOB_POOL_LINK", 0);
+    this->SetPropertyDefault("JOB_POOL_COMPILE", CM_NULLPTR);
+    this->SetPropertyDefault("JOB_POOL_LINK", CM_NULLPTR);
   }
 }
 
@@ -293,7 +293,7 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
   std::map<std::string, cmListFileBacktrace>::const_iterator i =
     this->UtilityBacktraces.find(u);
   if (i == this->UtilityBacktraces.end()) {
-    return 0;
+    return CM_NULLPTR;
   }
 
   return &i->second;
@@ -409,7 +409,7 @@ cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
 {
   std::string src = this->ProcessSourceItemCMP0049(s);
   if (!s.empty() && src.empty()) {
-    return 0;
+    return CM_NULLPTR;
   }
   return this->AddSource(src);
 }
@@ -480,7 +480,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
     this->Internal->SourceBacktraces.push_back(lfbt);
   }
   if (cmGeneratorExpression::Find(src) != std::string::npos) {
-    return 0;
+    return CM_NULLPTR;
   }
   return this->Makefile->GetOrCreateSource(src);
 }
@@ -1064,7 +1064,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
     return true;
   }
   std::ostringstream e;
-  const char* modal = 0;
+  const char* modal = CM_NULLPTR;
   cmake::MessageType messageType = cmake::AUTHOR_WARNING;
   switch (context->GetPolicyStatus(cmPolicies::CMP0026)) {
     case cmPolicies::WARN:
@@ -1106,7 +1106,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
          "The property \""
       << prop << "\" is not allowed.";
     context->IssueMessage(cmake::FATAL_ERROR, e.str());
-    return 0;
+    return CM_NULLPTR;
   }
 
   // Watch for special "computed" properties that are dependent on
@@ -1119,7 +1119,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
     static const std::string propLOCATION = "LOCATION";
     if (prop == propLOCATION) {
       if (!this->HandleLocationPropertyPolicy(context)) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       // Set the LOCATION property of the target.
@@ -1148,7 +1148,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
     // Support "LOCATION_<CONFIG>".
     else if (cmHasLiteralPrefix(prop, "LOCATION_")) {
       if (!this->HandleLocationPropertyPolicy(context)) {
-        return 0;
+        return CM_NULLPTR;
       }
       const char* configName = prop.c_str() + 9;
 
@@ -1170,7 +1170,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       std::string configName(prop.c_str(), prop.size() - 9);
       if (configName != "IMPORTED") {
         if (!this->HandleLocationPropertyPolicy(context)) {
-          return 0;
+          return CM_NULLPTR;
         }
         if (this->IsImported()) {
           this->Properties.SetProperty(
@@ -1217,7 +1217,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
   if (specialProps.count(prop)) {
     if (prop == propLINK_LIBRARIES) {
       if (this->Internal->LinkImplementationPropertyEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       static std::string output;
@@ -1229,7 +1229,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       return cmState::GetTargetTypeName(this->GetType());
     } else if (prop == propINCLUDE_DIRECTORIES) {
       if (this->Internal->IncludeDirectoriesEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       static std::string output;
@@ -1237,7 +1237,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       return output.c_str();
     } else if (prop == propCOMPILE_FEATURES) {
       if (this->Internal->CompileFeaturesEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       static std::string output;
@@ -1245,7 +1245,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       return output.c_str();
     } else if (prop == propCOMPILE_OPTIONS) {
       if (this->Internal->CompileOptionsEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       static std::string output;
@@ -1253,7 +1253,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       return output.c_str();
     } else if (prop == propCOMPILE_DEFINITIONS) {
       if (this->Internal->CompileDefinitionsEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       static std::string output;
@@ -1269,7 +1269,7 @@ const char* cmTarget::GetProperty(const std::string& prop,
       return this->GetMakefile()->GetCurrentSourceDirectory();
     } else if (prop == propSOURCES) {
       if (this->Internal->SourceEntries.empty()) {
-        return 0;
+        return CM_NULLPTR;
       }
 
       std::ostringstream ss;
@@ -1434,8 +1434,8 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config,
 
   std::string result;
 
-  const char* loc = 0;
-  const char* imp = 0;
+  const char* loc = CM_NULLPTR;
+  const char* imp = CM_NULLPTR;
   std::string suffix;
 
   if (this->GetType() != cmState::INTERFACE_LIBRARY &&
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9e095c2de7618cae0c39ea69bbdfb05e1989d47e..5829d4f345341bee0d3ca20b62d6ea67e5b86f31 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -195,7 +195,7 @@ public:
    * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
    * commands. It is not a full path nor does it have an extension.
    */
-  void AddUtility(const std::string& u, cmMakefile* makefile = 0);
+  void AddUtility(const std::string& u, cmMakefile* makefile = CM_NULLPTR);
   ///! Get the utilities used by this target
   std::set<std::string> const& GetUtilities() const { return this->Utilities; }
   cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 774577a3a6cfe4946ebbf9d70abbcc84b858d2de..1c4a9ceca37fd1122d06eb8dded53174b2dfb766 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -91,7 +91,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
 
   if (this->Target->GetType() == cmState::UTILITY) {
     std::ostringstream e;
-    const char* modal = 0;
+    const char* modal = CM_NULLPTR;
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
     switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) {
       case cmPolicies::WARN:
@@ -307,7 +307,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
   if (!this->Target->PushTLLCommandTrace(
         sig, this->Makefile->GetExecutionContext())) {
     std::ostringstream e;
-    const char* modal = 0;
+    const char* modal = CM_NULLPTR;
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
     switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) {
       case cmPolicies::WARN:
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index e5998259ac78faf3397db1be3a43e2ba6ee311c2..462edf9371a8d7177c12e92724bd3287fcf79311 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -24,7 +24,7 @@ cmTestGenerator::cmTestGenerator(
 {
   this->ActionsPerConfig = !test->GetOldStyle();
   this->TestGenerated = false;
-  this->LG = 0;
+  this->LG = CM_NULLPTR;
 }
 
 cmTestGenerator::~cmTestGenerator()
@@ -83,7 +83,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
 
     // Prepend with the emulator when cross compiling if required.
     const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
-    if (emulator != 0) {
+    if (emulator != CM_NULLPTR) {
       std::vector<std::string> emulatorWithArgs;
       cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
       std::string emulatorExe(emulatorWithArgs[0]);
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index 2a70ed04ced90076a19c62af9a3a30e1ce009716..c3c1d17ad4c82769c52844eb07cc051798ad2720 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -22,7 +22,7 @@
 std::string cmTimestamp::CurrentTime(const std::string& formatString,
                                      bool utcFlag)
 {
-  time_t currentTimeT = time(0);
+  time_t currentTimeT = time(CM_NULLPTR);
   if (currentTimeT == time_t(-1)) {
     return std::string();
   }
@@ -56,14 +56,14 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT,
   struct tm timeStruct;
   memset(&timeStruct, 0, sizeof(timeStruct));
 
-  struct tm* ptr = (struct tm*)0;
+  struct tm* ptr = (struct tm*)CM_NULLPTR;
   if (utcFlag) {
     ptr = gmtime(&timeT);
   } else {
     ptr = localtime(&timeT);
   }
 
-  if (ptr == 0) {
+  if (ptr == CM_NULLPTR) {
     return std::string();
   }
 
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 19837a7ae71417234b538ac28e0be944703a1690..7b190483dd0baa3603a4edbdef5d55ee256d2a96 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -124,8 +124,9 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
       std::string runOutputContents;
       if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") &&
           !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) {
-        this->DoNotRunExecutable(runArgs, argv[3],
-                                 captureRunOutput ? &runOutputContents : 0);
+        this->DoNotRunExecutable(runArgs, argv[3], captureRunOutput
+                                   ? &runOutputContents
+                                   : CM_NULLPTR);
       } else {
         this->RunExecutable(runArgs, &runOutputContents);
       }
@@ -186,9 +187,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
     finalCommand += runArgs;
   }
   int timeout = 0;
-  bool worked =
-    cmSystemTools::RunSingleCommand(finalCommand.c_str(), out, out, &retVal, 0,
-                                    cmSystemTools::OUTPUT_NONE, timeout);
+  bool worked = cmSystemTools::RunSingleCommand(
+    finalCommand.c_str(), out, out, &retVal, CM_NULLPTR,
+    cmSystemTools::OUTPUT_NONE, timeout);
   // set the run var
   char retChar[1000];
   if (worked) {
@@ -230,7 +231,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
     this->RunResultVariable + "__TRYRUN_OUTPUT";
   bool error = false;
 
-  if (this->Makefile->GetDefinition(this->RunResultVariable) == 0) {
+  if (this->Makefile->GetDefinition(this->RunResultVariable) == CM_NULLPTR) {
     // if the variables doesn't exist, create it with a helpful error text
     // and mark it as advanced
     std::string comment;
@@ -252,8 +253,8 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
   }
 
   // is the output from the executable used ?
-  if (out != 0) {
-    if (this->Makefile->GetDefinition(internalRunOutputName) == 0) {
+  if (out != CM_NULLPTR) {
+    if (this->Makefile->GetDefinition(internalRunOutputName) == CM_NULLPTR) {
       // if the variables doesn't exist, create it with a helpful error text
       // and mark it as advanced
       std::string comment;
@@ -301,7 +302,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
       comment += " to\n"
                  "   the exit code (in many cases 0 for success), otherwise "
                  "enter \"FAILED_TO_RUN\".\n";
-      if (out != 0) {
+      if (out != CM_NULLPTR) {
         comment += internalRunOutputName;
         comment +=
           "\n   contains the text the executable "
@@ -332,7 +333,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
            << this->Makefile->GetDefinition(this->RunResultVariable)
            << "\"\n     CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n";
 
-      if (out != 0) {
+      if (out != CM_NULLPTR) {
         file << "set( " << internalRunOutputName << " \n     \""
              << this->Makefile->GetDefinition(internalRunOutputName)
              << "\"\n     CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n";
@@ -345,7 +346,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
                                "please set the following cache variables "
                                "appropriately:\n";
     errorMessage += "   " + this->RunResultVariable + " (advanced)\n";
-    if (out != 0) {
+    if (out != CM_NULLPTR) {
       errorMessage += "   " + internalRunOutputName + " (advanced)\n";
     }
     errorMessage += detailsString;
@@ -353,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
     return;
   }
 
-  if (out != 0) {
+  if (out != CM_NULLPTR) {
     (*out) = this->Makefile->GetDefinition(internalRunOutputName);
   }
 }
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index c04c44ad8d3a50f2c29c301f61cf22b1f51d2280..05ba65a16f5e51b2754faac9d05c6d1bfae3e37c 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -47,7 +47,7 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
   }
   // unset(VAR PARENT_SCOPE)
   else if ((args.size() == 2) && (args[1] == "PARENT_SCOPE")) {
-    this->Makefile->RaiseScope(variable, 0);
+    this->Makefile->RaiseScope(variable, CM_NULLPTR);
     return true;
   }
   // ERROR: second argument isn't CACHE or PARENT_SCOPE
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index f7d766e3b71cc1ce4639f118fefe7e568f57d1f7..c50cbfbbcfa8c2053bef9a470486d94196790248 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -38,7 +38,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
 
   bool haveCacheValue = false;
   if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
-    haveCacheValue = (cacheValue != 0);
+    haveCacheValue = (cacheValue != CM_NULLPTR);
     if (!haveCacheValue) {
       std::string msg = "UTILITY_SOURCE is used in cross compiling mode for ";
       msg += cacheEntry;
@@ -50,7 +50,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
   } else {
     cmState* state = this->Makefile->GetState();
     haveCacheValue =
-      (cacheValue && (strstr(cacheValue, "(IntDir)") == 0 ||
+      (cacheValue && (strstr(cacheValue, "(IntDir)") == CM_NULLPTR ||
                       (intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
        (state->GetCacheMajorVersion() != 0 &&
         state->GetCacheMinorVersion() != 0));
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index be8f72fb33d89df612cea94ff3264f81bcfcb6d9..5ddb9075af32a608ef5f4b5c6e0c8297b5a0fd3e 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -36,9 +36,10 @@ public:
    * Add watch to the variable
    */
   bool AddWatch(const std::string& variable, WatchMethod method,
-                void* client_data = 0, DeleteData delete_data = 0);
+                void* client_data = CM_NULLPTR,
+                DeleteData delete_data = CM_NULLPTR);
   void RemoveWatch(const std::string& variable, WatchMethod method,
-                   void* client_data = 0);
+                   void* client_data = CM_NULLPTR);
 
   /**
    * This method is called when variable is accessed
@@ -71,9 +72,9 @@ protected:
     void* ClientData;
     DeleteData DeleteDataCall;
     Pair()
-      : Method(0)
-      , ClientData(0)
-      , DeleteDataCall(0)
+      : Method(CM_NULLPTR)
+      , ClientData(CM_NULLPTR)
+      , DeleteDataCall(CM_NULLPTR)
     {
     }
     ~Pair()
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 654100bf89e5f33732839be0e61788ea47608023..79e7c2b924e3f38109bef7350ff60c5222932ccc 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -145,9 +145,9 @@ cmake::cmake()
   }
 #endif
 
-  this->GlobalGenerator = 0;
-  this->ProgressCallback = 0;
-  this->ProgressCallbackClientData = 0;
+  this->GlobalGenerator = CM_NULLPTR;
+  this->ProgressCallback = CM_NULLPTR;
+  this->ProgressCallbackClientData = CM_NULLPTR;
   this->CurrentWorkingMode = NORMAL_MODE;
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
@@ -191,7 +191,7 @@ cmake::~cmake()
   delete this->State;
   if (this->GlobalGenerator) {
     delete this->GlobalGenerator;
-    this->GlobalGenerator = 0;
+    this->GlobalGenerator = CM_NULLPTR;
   }
   cmDeleteAll(this->Generators);
 #ifdef CMAKE_BUILD_WITH_CMAKE
@@ -463,7 +463,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
 
     gg->CreateGenerationObjects();
     cmLocalGenerator* lg = gg->LocalGenerators[0];
-    std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language);
+    std::string includeFlags =
+      lg->GetIncludeFlags(includeDirs, CM_NULLPTR, language);
 
     std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
     printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
@@ -870,7 +871,7 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators)
 
 cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
 {
-  cmExternalMakefileProjectGenerator* extraGenerator = 0;
+  cmExternalMakefileProjectGenerator* extraGenerator = CM_NULLPTR;
   std::string name = gname;
   RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
     this->ExtraGenerators.find(name);
@@ -879,7 +880,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
     name = extraGenerator->GetGlobalGeneratorName(name);
   }
 
-  cmGlobalGenerator* generator = 0;
+  cmGlobalGenerator* generator = CM_NULLPTR;
   for (RegisteredGeneratorsVector::const_iterator i = this->Generators.begin();
        i != this->Generators.end(); ++i) {
     generator = (*i)->CreateGlobalGenerator(name, this);
@@ -1707,8 +1708,8 @@ int cmake::CheckBuildSystem()
   // the make system's VERBOSE environment variable to enable verbose
   // output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set
   // by the Eclipse and KDevelop generators).
-  bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) &&
-                  (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+  bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != CM_NULLPTR) &&
+                  (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == CM_NULLPTR));
 
   // This method will check the integrity of the build system if the
   // option was given on the command line.  It reads the given file to
@@ -1973,7 +1974,7 @@ cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
     cmInstalledFile const& file = i->second;
     return &file;
   } else {
-    return 0;
+    return CM_NULLPTR;
   }
 }
 
diff --git a/Source/cmake.h b/Source/cmake.h
index 9ac69354baa340ae7eb0ee9e45051c9c82bb8028..4a5376d99d13e5ab3b4281982897525afd2c8829 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -250,7 +250,8 @@ public:
    *  number provided may be negative in cases where a message is
    *  to be displayed without any progress percentage.
    */
-  void SetProgressCallback(ProgressCallbackType f, void* clientData = 0);
+  void SetProgressCallback(ProgressCallbackType f,
+                           void* clientData = CM_NULLPTR);
 
   ///! this is called by generators to update the progress
   void UpdateProgress(const char* msg, float prog);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 495aae54f2baa06b8edb62e635b3a44919ade096..521a5bf16d638e1ae46c2a69c1874761e1a7d7ef 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -29,22 +29,23 @@
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
 static const char* cmDocumentationName[][2] = {
-  { 0, "  cmake - Cross-Platform Makefile Generator." },
-  { 0, 0 }
+  { CM_NULLPTR, "  cmake - Cross-Platform Makefile Generator." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationUsage[][2] = {
-  { 0, "  cmake [options] <path-to-source>\n"
-       "  cmake [options] <path-to-existing-build>" },
-  { 0, "Specify a source directory to (re-)generate a build system for "
-       "it in the current working directory.  Specify an existing build "
-       "directory to re-generate its build system." },
-  { 0, 0 }
+  { CM_NULLPTR, "  cmake [options] <path-to-source>\n"
+                "  cmake [options] <path-to-existing-build>" },
+  { CM_NULLPTR,
+    "Specify a source directory to (re-)generate a build system for "
+    "it in the current working directory.  Specify an existing build "
+    "directory to re-generate its build system." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 static const char* cmDocumentationUsageNote[][2] = {
-  { 0, "Run 'cmake --help' for more information." },
-  { 0, 0 }
+  { CM_NULLPTR, "Run 'cmake --help' for more information." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 #define CMAKE_BUILD_OPTIONS                                                   \
@@ -80,7 +81,7 @@ static const char* cmDocumentationOptions[][2] = {
   { "--no-warn-unused-cli", "Don't warn about command line options." },
   { "--check-system-vars", "Find problems with variable usage in system "
                            "files." },
-  { 0, 0 }
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 #endif
@@ -106,7 +107,7 @@ static cmMakefile* cmakemainGetMakefile(void* clientdata)
       return gg->GetCurrentMakefile();
     }
   }
-  return 0;
+  return CM_NULLPTR;
 }
 
 static std::string cmakemainGetStack(void* clientdata)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 161256e25bb820648fac72bbb425f31403ee2cc8..2427286ea2fa0462e4b85454a1f7e2d72b9c2d8d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -315,7 +315,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
         // Run the iwyu command line.  Capture its stderr and hide its stdout.
         std::string stdErr;
-        if (!cmSystemTools::RunSingleCommand(iwyu_cmd, 0, &stdErr, &ret, 0,
+        if (!cmSystemTools::RunSingleCommand(iwyu_cmd, CM_NULLPTR, &stdErr,
+                                             &ret, CM_NULLPTR,
                                              cmSystemTools::OUTPUT_NONE)) {
           std::cerr << "Error running '" << iwyu_cmd[0] << "': " << stdErr
                     << "\n";
@@ -343,7 +344,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
         // Run the tidy command line.  Capture its stdout and hide its stderr.
         std::string stdOut;
-        if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, 0, &ret, 0,
+        if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, CM_NULLPTR,
+                                             &ret, CM_NULLPTR,
                                              cmSystemTools::OUTPUT_NONE)) {
           std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
           return 1;
@@ -363,7 +365,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         // Run the ldd -u -r command line.
         // Capture its stdout and hide its stderr.
         std::string stdOut;
-        if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, 0, &ret, 0,
+        if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, CM_NULLPTR,
+                                             &ret, CM_NULLPTR,
                                              cmSystemTools::OUTPUT_NONE)) {
           std::cerr << "Error running '" << lwyu_cmd[0] << "'\n";
           return 1;
@@ -379,7 +382,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       // Now run the real compiler command and return its result value.
       if (lwyu.empty() &&
           !cmSystemTools::RunSingleCommand(
-            orig_cmd, 0, 0, &ret, 0, cmSystemTools::OUTPUT_PASSTHROUGH)) {
+            orig_cmd, CM_NULLPTR, CM_NULLPTR, &ret, CM_NULLPTR,
+            cmSystemTools::OUTPUT_PASSTHROUGH)) {
         std::cerr << "Error running '" << orig_cmd[0] << "'\n";
         return 1;
       }
@@ -429,7 +433,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       // Execute command from remaining arguments.
       std::vector<std::string> cmd(ai, ae);
       int retval;
-      if (cmSystemTools::RunSingleCommand(cmd, 0, 0, &retval, NULL,
+      if (cmSystemTools::RunSingleCommand(cmd, CM_NULLPTR, CM_NULLPTR, &retval,
+                                          CM_NULLPTR,
                                           cmSystemTools::OUTPUT_PASSTHROUGH)) {
         return retval;
       }
@@ -537,7 +542,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       time(&time_start);
       clock_start = clock();
       int ret = 0;
-      cmSystemTools::RunSingleCommand(command, 0, 0, &ret);
+      cmSystemTools::RunSingleCommand(command, CM_NULLPTR, CM_NULLPTR, &ret);
 
       clock_finish = clock();
       time(&time_finish);
@@ -588,8 +593,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       int retval = 0;
       int timeout = 0;
       if (cmSystemTools::RunSingleCommand(
-            command.c_str(), 0, 0, &retval, directory.c_str(),
-            cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
+            command.c_str(), CM_NULLPTR, CM_NULLPTR, &retval,
+            directory.c_str(), cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
         return retval;
       }
 
@@ -695,8 +700,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       // Use the make system's VERBOSE environment variable to enable
       // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
       // (which is set by the Eclipse and KDevelop generators).
-      bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) &&
-                      (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+      bool verbose =
+        ((cmSystemTools::GetEnv("VERBOSE") != CM_NULLPTR) &&
+         (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == CM_NULLPTR));
 
       // Create a cmake object instance to process dependencies.
       cmake cm;
@@ -1146,7 +1152,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
     }
 
     // Setup this command line.
-    const char* cmd[2] = { command.c_str(), 0 };
+    const char* cmd[2] = { command.c_str(), CM_NULLPTR };
     cmsysProcess_SetCommand(cp, cmd);
 
     // Report the command if verbose output is enabled.
@@ -1156,7 +1162,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
 
     // Run the command and wait for it to exit.
     cmsysProcess_Execute(cp);
-    cmsysProcess_WaitForExit(cp, 0);
+    cmsysProcess_WaitForExit(cp, CM_NULLPTR);
 
     // Report failure if any.
     switch (cmsysProcess_GetState(cp)) {
@@ -1249,7 +1255,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
   if (args.size() < 2) {
     return -1;
   }
-  bool verbose = cmSystemTools::GetEnv("VERBOSE") != NULL;
+  bool verbose = cmSystemTools::GetEnv("VERBOSE") != CM_NULLPTR;
   std::vector<std::string> expandedArgs;
   for (std::vector<std::string>::iterator i = args.begin(); i != args.end();
        ++i) {
@@ -1273,7 +1279,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
 }
 
 static bool RunCommand(const char* comment, std::vector<std::string>& command,
-                       bool verbose, int* retCodeOut = 0)
+                       bool verbose, int* retCodeOut = CM_NULLPTR)
 {
   if (verbose) {
     std::cout << comment << ":\n";
@@ -1282,8 +1288,9 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
   std::string output;
   int retCode = 0;
   // use rc command to create .res file
-  bool res = cmSystemTools::RunSingleCommand(
-    command, &output, &output, &retCode, 0, cmSystemTools::OUTPUT_NONE);
+  bool res =
+    cmSystemTools::RunSingleCommand(command, &output, &output, &retCode,
+                                    CM_NULLPTR, cmSystemTools::OUTPUT_NONE);
   // always print the output of the command, unless
   // it is the dumb rc command banner, but if the command
   // returned an error code then print the output anyway as
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 4edd62e4b018942a7c458c26c43851c704b4bc9d..38ff64f237ff814b759a3d25340f4f2843f7685c 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -21,12 +21,13 @@
 #include "cmsys/Encoding.hxx"
 
 static const char* cmDocumentationName[][2] = {
-  { 0, "  ctest - Testing driver provided by CMake." },
-  { 0, 0 }
+  { CM_NULLPTR, "  ctest - Testing driver provided by CMake." },
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
-static const char* cmDocumentationUsage[][2] = { { 0, "  ctest [options]" },
-                                                 { 0, 0 } };
+static const char* cmDocumentationUsage[][2] = { { CM_NULLPTR,
+                                                   "  ctest [options]" },
+                                                 { CM_NULLPTR, CM_NULLPTR } };
 
 static const char* cmDocumentationOptions[][2] = {
   { "-C <cfg>, --build-config <cfg>", "Choose configuration to test." },
@@ -108,7 +109,7 @@ static const char* cmDocumentationOptions[][2] = {
   { "--http1.0", "Submit using HTTP 1.0." },
   { "--no-compress-output", "Do not compress test output when submitting." },
   { "--print-labels", "Print all available test labels." },
-  { 0, 0 }
+  { CM_NULLPTR, CM_NULLPTR }
 };
 
 // this is a test driver program for cmCTest.