From d6754d37d593a0189809dcf98bc4fdf3a609f0a3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Jun 2016 10:59:26 -0400 Subject: [PATCH 001/929] Begin post-3.6 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 000000000..e4cc01e23 --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 92c3b63ad..e93b8804d 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6de224363..d8920e662 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 20160601) +#set(CMake_VERSION_RC 1) From 18bfbc972fd3daf3e973f80072c4de09ec7e852b Mon Sep 17 00:00:00 2001 From: Nicolas BUNEL Date: Fri, 27 May 2016 16:03:43 +0200 Subject: [PATCH 002/929] Add option to control 'bin' directory of CMake's own installation (#16076) Add a `CMAKE_BIN_DIR` cache entry to CMake's own build configuration. Add a `--bindir` option to the `bootstrap` script to set it. --- CMakeCPack.cmake | 2 +- Source/CMakeInstallDestinations.cmake | 5 +++++ Source/CMakeLists.txt | 2 +- Source/CursesDialog/CMakeLists.txt | 2 +- Source/cmConfigure.cmake.h.in | 1 + Source/cmSystemTools.cxx | 21 ++++++++++++++------- bootstrap | 8 ++++++++ 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 320327999..72fc97c8d 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -166,7 +166,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_PACKAGE_CONTACT "cmake@cmake.org") if(UNIX) - set(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest") + set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest") set(CPACK_SOURCE_STRIP_FILES "") set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") endif() diff --git a/Source/CMakeInstallDestinations.cmake b/Source/CMakeInstallDestinations.cmake index 2f9d95ae5..023f6c03f 100644 --- a/Source/CMakeInstallDestinations.cmake +++ b/Source/CMakeInstallDestinations.cmake @@ -1,27 +1,32 @@ # Keep formatting here consistent with bootstrap script expectations. if(BEOS) + set(CMAKE_BIN_DIR_DEFAULT "bin") # HAIKU set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_XDGDATA_DIR_DEFAULT "share") # HAIKU elseif(CYGWIN) + set(CMAKE_BIN_DIR_DEFAULT "bin") # CYGWIN set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN set(CMAKE_XDGDATA_DIR_DEFAULT "share") # CYGWIN else() + set(CMAKE_BIN_DIR_DEFAULT "bin") # OTHER set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER set(CMAKE_XDGDATA_DIR_DEFAULT "share") # OTHER endif() +set(CMAKE_BIN_DIR_DESC "bin") set(CMAKE_DATA_DIR_DESC "data") set(CMAKE_DOC_DIR_DESC "docs") set(CMAKE_MAN_DIR_DESC "man pages") set(CMAKE_XDGDATA_DIR_DESC "XDG specific files") foreach(v + CMAKE_BIN_DIR CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3223831f0..3f00c8e29 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -786,7 +786,7 @@ endif() foreach(_tool ${_tools}) CMake_OPTIONAL_COMPONENT(${_tool}) - install(TARGETS ${_tool} DESTINATION bin ${COMPONENT}) + install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT}) endforeach() install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include) diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 93ff4256e..55599b69e 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -48,4 +48,4 @@ else() endif() CMake_OPTIONAL_COMPONENT(ccmake) -install(TARGETS ccmake DESTINATION bin ${COMPONENT}) +install(TARGETS ccmake DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT}) diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 62128a793..11ff00bd5 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -15,4 +15,5 @@ #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 #cmakedefine CMake_HAVE_CXX11_UNORDERED_MAP +#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7dece4789..99d8569f5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1930,11 +1930,11 @@ void cmSystemTools::FindCMakeResources(const char* argv0) } if (cmSystemTools::GetFilenameName(exe_dir) == "MacOS") { // The executable is inside an application bundle. - // Look for ../bin (install tree) and then fall back to + // Look for .. (install tree) and then fall back to // ../../../bin (build tree). exe_dir = cmSystemTools::GetFilenamePath(exe_dir); - if (cmSystemTools::FileExists((exe_dir + "/bin/cmake").c_str())) { - exe_dir += "/bin"; + if (cmSystemTools::FileExists(exe_dir + CMAKE_BIN_DIR "/cmake")) { + exe_dir += CMAKE_BIN_DIR; } else { exe_dir = cmSystemTools::GetFilenamePath(exe_dir); exe_dir = cmSystemTools::GetFilenamePath(exe_dir); @@ -1985,13 +1985,20 @@ void cmSystemTools::FindCMakeResources(const char* argv0) } #ifdef CMAKE_BUILD_WITH_CMAKE - // Install tree has "/bin/cmake" and "". - std::string dir = cmSystemTools::GetFilenamePath(exe_dir); - cmSystemToolsCMakeRoot = dir + CMAKE_DATA_DIR; - if (!cmSystemTools::FileExists( + // Install tree has + // - "/cmake" + // - "" + if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) { + std::string const prefix = + exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR)); + cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR; + } + if (cmSystemToolsCMakeRoot.empty() || + !cmSystemTools::FileExists( (cmSystemToolsCMakeRoot + "/Modules/CMake.cmake").c_str())) { // Build tree has "/bin[/]/cmake" and // "/CMakeFiles/CMakeSourceDir.txt". + std::string dir = cmSystemTools::GetFilenamePath(exe_dir); std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt"; cmsys::ifstream fin(src_dir_txt.c_str()); std::string src_dir; diff --git a/bootstrap b/bootstrap index b3f06a138..27cf9d861 100755 --- a/bootstrap +++ b/bootstrap @@ -60,10 +60,12 @@ fi cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`" +cmake_bin_dir_keyword="OTHER" cmake_data_dir_keyword="OTHER" cmake_doc_dir_keyword="OTHER" cmake_man_dir_keyword="OTHER" cmake_xdgdata_dir_keyword="OTHER" +cmake_bin_dir="" cmake_data_dir="" cmake_doc_dir="" cmake_man_dir="" @@ -213,6 +215,7 @@ else fi # Lookup default install destinations. +cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`" cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`" cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`" cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`" @@ -422,6 +425,8 @@ Configuration: Directory and file names: --prefix=PREFIX install files in tree rooted at PREFIX ['"${cmake_default_prefix}"'] + --bindir=DIR install binaries in PREFIX/DIR + ['"${cmake_bin_dir_default}"'] --datadir=DIR install data files in PREFIX/DIR ['"${cmake_data_dir_default}"'] --docdir=DIR install documentation files in PREFIX/DIR @@ -627,6 +632,7 @@ while test $# != 0; do --prefix=*) dir=`cmake_arg "$1"` cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;; --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;; + --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;; --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;; --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;; --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;; @@ -1263,6 +1269,7 @@ cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_versi cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\"" +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" @@ -1374,6 +1381,7 @@ echo ' set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) +set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE) set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" From 2175e5bfa5a2f9f08d6f4f4db652b8f5fae08d79 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 31 May 2016 13:53:19 +0200 Subject: [PATCH 003/929] cmGlobalGenerator: Make IsMultiConfig() const --- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 2575911ff..68ff042ad 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -319,7 +319,7 @@ public: /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ - virtual bool IsMultiConfig() { return false; } + virtual bool IsMultiConfig() const { return false; } std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index fb2cdbdf7..1d456ffb6 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -85,7 +85,7 @@ public: /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ - virtual bool IsMultiConfig() { return true; } + virtual bool IsMultiConfig() const { return true; } /** Return true if building for Windows CE */ virtual bool TargetsWindowsCE() const { return false; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6628cfca6..b666594c1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3437,7 +3437,7 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation( // Return true if the generated build tree may contain multiple builds. // i.e. "Can I build Debug and Release in the same tree?" -bool cmGlobalXCodeGenerator::IsMultiConfig() +bool cmGlobalXCodeGenerator::IsMultiConfig() const { // Old Xcode 1.5 is single config: if (this->XcodeVersion == 15) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 2ca4c19dc..0485d4f94 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -79,7 +79,7 @@ public: /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ - virtual bool IsMultiConfig(); + virtual bool IsMultiConfig() const; virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); From 50a3d34005ec923db3d76d0a5d118437a7632617 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 4 Apr 2016 18:53:05 -0600 Subject: [PATCH 004/929] PackageMaker: factor out common code for creating pkg files. --- Source/CMakeLists.txt | 1 + Source/CPack/cmCPackPKGGenerator.cxx | 368 ++++++++++++++++++ Source/CPack/cmCPackPKGGenerator.h | 103 +++++ Source/CPack/cmCPackPackageMakerGenerator.cxx | 324 --------------- Source/CPack/cmCPackPackageMakerGenerator.h | 68 +--- 5 files changed, 476 insertions(+), 388 deletions(-) create mode 100644 Source/CPack/cmCPackPKGGenerator.cxx create mode 100644 Source/CPack/cmCPackPKGGenerator.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3223831f0..f85f14326 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -717,6 +717,7 @@ if(APPLE) CPack/cmCPackBundleGenerator.cxx CPack/cmCPackDragNDropGenerator.cxx CPack/cmCPackOSXX11Generator.cxx + CPack/cmCPackPKGGenerator.cxx CPack/cmCPackPackageMakerGenerator.cxx ) endif() diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx new file mode 100644 index 000000000..8282714a7 --- /dev/null +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -0,0 +1,368 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCPackPKGGenerator.h" + +#include "cmake.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmSystemTools.h" +#include "cmMakefile.h" +#include "cmGeneratedFileStream.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackLog.h" + +#include +#include + +cmCPackPKGGenerator::cmCPackPKGGenerator() +{ + this->componentPackageMethod = ONE_PACKAGE; +} + +cmCPackPKGGenerator::~cmCPackPKGGenerator() +{ +} + +bool cmCPackPKGGenerator::SupportsComponentInstallation() const +{ + return true; +} + +int cmCPackPKGGenerator::InitializeInternal() +{ + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "cmCPackPKGGenerator::Initialize()" << std::endl); + this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); + + return this->Superclass::InitializeInternal(); +} + + +std::string cmCPackPKGGenerator::GetPackageName( + const cmCPackComponent& component) +{ + if (component.ArchiveFile.empty()) { + std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); + packagesDir += ".dummy"; + std::ostringstream out; + out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) + << "-" << component.Name << ".pkg"; + return out.str(); + } else { + return component.ArchiveFile + ".pkg"; + } +} + +void cmCPackPKGGenerator::WriteDistributionFile( + const char* metapackageFile) +{ + std::string distributionTemplate = + this->FindTemplate("CPack.distribution.dist.in"); + if (distributionTemplate.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find input file: " + << distributionTemplate << std::endl); + return; + } + + std::string distributionFile = metapackageFile; + distributionFile += "/Contents/distribution.dist"; + + // Create the choice outline, which provides a tree-based view of + // the components in their groups. + std::ostringstream choiceOut; + choiceOut << "" << std::endl; + + // Emit the outline for the groups + std::map::iterator groupIt; + for (groupIt = this->ComponentGroups.begin(); + groupIt != this->ComponentGroups.end(); ++groupIt) { + if (groupIt->second.ParentGroup == 0) { + CreateChoiceOutline(groupIt->second, choiceOut); + } + } + + // Emit the outline for the non-grouped components + std::map::iterator compIt; + for (compIt = this->Components.begin(); compIt != this->Components.end(); + ++compIt) { + if (!compIt->second.Group) { + choiceOut << "first << "Choice\">" + << std::endl; + } + } + if (!this->PostFlightComponent.Name.empty()) { + choiceOut << "" << std::endl; + } + choiceOut << "" << std::endl; + + // Create the actual choices + for (groupIt = this->ComponentGroups.begin(); + groupIt != this->ComponentGroups.end(); ++groupIt) { + CreateChoice(groupIt->second, choiceOut); + } + for (compIt = this->Components.begin(); compIt != this->Components.end(); + ++compIt) { + CreateChoice(compIt->second, choiceOut); + } + + if (!this->PostFlightComponent.Name.empty()) { + CreateChoice(PostFlightComponent, choiceOut); + } + + this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); + + // Create the distribution.dist file in the metapackage to turn it + // into a distribution package. + this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str()); +} + +void cmCPackPKGGenerator::CreateChoiceOutline( + const cmCPackComponentGroup& group, std::ostringstream& out) +{ + out << "" << std::endl; + std::vector::const_iterator groupIt; + for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end(); + ++groupIt) { + CreateChoiceOutline(**groupIt, out); + } + + std::vector::const_iterator compIt; + for (compIt = group.Components.begin(); compIt != group.Components.end(); + ++compIt) { + out << " Name << "Choice\">" + << std::endl; + } + out << "" << std::endl; +} + +void cmCPackPKGGenerator::CreateChoice( + const cmCPackComponentGroup& group, std::ostringstream& out) +{ + out << "" << std::endl; +} + +void cmCPackPKGGenerator::CreateChoice( + const cmCPackComponent& component, std::ostringstream& out) +{ + std::string packageId = "com."; + packageId += this->GetOption("CPACK_PACKAGE_VENDOR"); + packageId += '.'; + packageId += this->GetOption("CPACK_PACKAGE_NAME"); + packageId += '.'; + packageId += component.Name; + + out << " visited; + AddDependencyAttributes(component, visited, out); + visited.clear(); + AddReverseDependencyAttributes(component, visited, out); + out << "\""; + } + out << ">" << std::endl; + out << " " << std::endl; + out << "" << std::endl; + + // Create a description of the package associated with this + // component. + std::string relativePackageLocation = "Contents/Packages/"; + relativePackageLocation += this->GetPackageName(component); + + // Determine the installed size of the package. + std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); + dirName += '/'; + dirName += component.Name; + dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + unsigned long installedSize = + component.GetInstalledSizeInKbytes(dirName.c_str()); + + out << "GetOption("CPACK_PACKAGE_VERSION") << "\" " + << "installKBytes=\"" << installedSize << "\" " + << ">"; + if (component.IsDownloaded) { + out << this->GetOption("CPACK_DOWNLOAD_SITE") + << this->GetPackageName(component); + } else { + out << "file:./" << relativePackageLocation; + } + out << "" << std::endl; +} + +void cmCPackPKGGenerator::AddDependencyAttributes( + const cmCPackComponent& component, + std::set& visited, std::ostringstream& out) +{ + if (visited.find(&component) != visited.end()) { + return; + } + visited.insert(&component); + + std::vector::const_iterator dependIt; + for (dependIt = component.Dependencies.begin(); + dependIt != component.Dependencies.end(); ++dependIt) { + out << " && choices['" << (*dependIt)->Name << "Choice'].selected"; + AddDependencyAttributes(**dependIt, visited, out); + } +} + +void cmCPackPKGGenerator::AddReverseDependencyAttributes( + const cmCPackComponent& component, + std::set& visited, std::ostringstream& out) +{ + if (visited.find(&component) != visited.end()) { + return; + } + visited.insert(&component); + + std::vector::const_iterator dependIt; + for (dependIt = component.ReverseDependencies.begin(); + dependIt != component.ReverseDependencies.end(); ++dependIt) { + out << " || choices['" << (*dependIt)->Name << "Choice'].selected"; + AddReverseDependencyAttributes(**dependIt, visited, out); + } +} + +std::string cmCPackPKGGenerator::EscapeForXML(std::string str) +{ + cmSystemTools::ReplaceString(str, "&", "&"); + cmSystemTools::ReplaceString(str, "<", "<"); + cmSystemTools::ReplaceString(str, ">", ">"); + cmSystemTools::ReplaceString(str, "\"", """); + return str; +} + +bool cmCPackPKGGenerator::CopyCreateResourceFile( + const std::string& name, const std::string& dirName) +{ + std::string uname = cmSystemTools::UpperCase(name); + std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; + const char* inFileName = this->GetOption(cpackVar.c_str()); + if (!inFileName) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " + << cpackVar.c_str() + << " not specified. It should point to " + << (!name.empty() ? name : "") << ".rtf, " << name + << ".html, or " << name << ".txt file" << std::endl); + return false; + } + if (!cmSystemTools::FileExists(inFileName)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " + << (!name.empty() ? name : "") + << " resource file: " << inFileName << std::endl); + return false; + } + std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName); + if (ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt") { + cmCPackLogger( + cmCPackLog::LOG_ERROR, "Bad file extension specified: " + << ext + << ". Currently only .rtfd, .rtf, .html, and .txt files allowed." + << std::endl); + return false; + } + + std::string destFileName = dirName; + destFileName += '/'; + destFileName += name + ext; + + // Set this so that distribution.dist gets the right name (without + // the path). + this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(), + (name + ext).c_str()); + + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + << (inFileName ? inFileName : "(NULL)") << " to " + << destFileName.c_str() << std::endl); + this->ConfigureFile(inFileName, destFileName.c_str()); + return true; +} + +bool cmCPackPKGGenerator::CopyResourcePlistFile( + const std::string& name, const char* outName) +{ + if (!outName) { + outName = name.c_str(); + } + + std::string inFName = "CPack."; + inFName += name; + inFName += ".in"; + std::string inFileName = this->FindTemplate(inFName.c_str()); + if (inFileName.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find input file: " << inFName << std::endl); + return false; + } + + std::string destFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + destFileName += "/"; + destFileName += outName; + + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Configure file: " << inFileName.c_str() << " to " + << destFileName.c_str() << std::endl); + this->ConfigureFile(inFileName.c_str(), destFileName.c_str()); + return true; +} + +int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name) +{ + std::string dst = resdir; + dst += "/"; + dst += name; + cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); + cmSystemTools::SetPermissions(dst.c_str(), 0777); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " + << script << "\ninto " << dst.c_str() << std::endl); + + return 1; +} diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h new file mode 100644 index 000000000..3011f7838 --- /dev/null +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -0,0 +1,103 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackPKGGenerator_h +#define cmCPackPKGGenerator_h + + +#include "cmCPackGenerator.h" + +class cmCPackComponent; + +/** \class cmCPackPKGGenerator + * \brief A generator for pkg files + * + */ +class cmCPackPKGGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator); + + /** + * Construct generator + */ + cmCPackPKGGenerator(); + virtual ~cmCPackPKGGenerator(); + + virtual bool SupportsComponentInstallation() const; + +protected: + virtual int InitializeInternal(); + virtual const char* GetOutputPostfix() { return "darwin"; } + + // Copies or creates the resource file with the given name to the + // package or package staging directory dirName. The variable + // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased + // version of name) specifies the input file to use for this file, + // which will be configured via ConfigureFile. + bool CopyCreateResourceFile(const std::string& name, + const std::string& dirName); + bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); + + int CopyInstallScript(const std::string& resdir, const std::string& script, + const std::string& name); + + // Retrieve the name of package file that will be generated for this + // component. The name is just the file name with extension, and + // does not include the subdirectory. + std::string GetPackageName(const cmCPackComponent& component); + + // Writes a distribution.dist file, which turns a metapackage into a + // full-fledged distribution. This file is used to describe + // inter-component dependencies. metapackageFile is the name of the + // metapackage for the distribution. Only valid for a + // component-based install. + void WriteDistributionFile(const char* metapackageFile); + + // Subroutine of WriteDistributionFile that writes out the + // dependency attributes for inter-component dependencies. + void AddDependencyAttributes(const cmCPackComponent& component, + std::set& visited, + std::ostringstream& out); + + // Subroutine of WriteDistributionFile that writes out the + // reverse dependency attributes for inter-component dependencies. + void AddReverseDependencyAttributes( + const cmCPackComponent& component, + std::set& visited, std::ostringstream& out); + + // Generates XML that encodes the hierarchy of component groups and + // their components in a form that can be used by distribution + // metapackages. + void CreateChoiceOutline(const cmCPackComponentGroup& group, + std::ostringstream& out); + + /// Create the "choice" XML element to describe a component group + /// for the installer GUI. + void CreateChoice(const cmCPackComponentGroup& group, + std::ostringstream& out); + + /// Create the "choice" XML element to describe a component for the + /// installer GUI. + void CreateChoice(const cmCPackComponent& component, + std::ostringstream& out); + + // Escape the given string to make it usable as an XML attribute + // value. + std::string EscapeForXML(std::string str); + + // The PostFlight component when creating a metapackage + cmCPackComponent PostFlightComponent; + +}; + +#endif diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 5ca3ff7b8..e50c2e681 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -46,21 +46,6 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const return this->PackageCompatibilityVersion >= getVersion(10, 4); } -int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir, - const std::string& script, - const std::string& name) -{ - std::string dst = resdir; - dst += "/"; - dst += name; - cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); - cmSystemTools::SetPermissions(dst.c_str(), 0777); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " - << script << "\ninto " << dst.c_str() << std::endl); - - return 1; -} - int cmCPackPackageMakerGenerator::PackageFiles() { // TODO: Use toplevel @@ -344,10 +329,6 @@ int cmCPackPackageMakerGenerator::PackageFiles() int cmCPackPackageMakerGenerator::InitializeInternal() { - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "cmCPackPackageMakerGenerator::Initialize()" << std::endl); - this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); - // Starting with Xcode 4.3, PackageMaker is a separate app, and you // can put it anywhere you want. So... use a variable for its location. // People who put it in unexpected places can use the variable to tell @@ -481,80 +462,6 @@ int cmCPackPackageMakerGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( - const std::string& name, const std::string& dirName) -{ - std::string uname = cmSystemTools::UpperCase(name); - std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; - const char* inFileName = this->GetOption(cpackVar.c_str()); - if (!inFileName) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " - << cpackVar.c_str() - << " not specified. It should point to " - << (!name.empty() ? name : "") << ".rtf, " << name - << ".html, or " << name << ".txt file" << std::endl); - return false; - } - if (!cmSystemTools::FileExists(inFileName)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " - << (!name.empty() ? name : "") - << " resource file: " << inFileName << std::endl); - return false; - } - std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName); - if (ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt") { - cmCPackLogger( - cmCPackLog::LOG_ERROR, "Bad file extension specified: " - << ext - << ". Currently only .rtfd, .rtf, .html, and .txt files allowed." - << std::endl); - return false; - } - - std::string destFileName = dirName; - destFileName += '/'; - destFileName += name + ext; - - // Set this so that distribution.dist gets the right name (without - // the path). - this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(), - (name + ext).c_str()); - - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " - << (inFileName ? inFileName : "(NULL)") << " to " - << destFileName.c_str() << std::endl); - this->ConfigureFile(inFileName, destFileName.c_str()); - return true; -} - -bool cmCPackPackageMakerGenerator::CopyResourcePlistFile( - const std::string& name, const char* outName) -{ - if (!outName) { - outName = name.c_str(); - } - - std::string inFName = "CPack."; - inFName += name; - inFName += ".in"; - std::string inFileName = this->FindTemplate(inFName.c_str()); - if (inFileName.empty()) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find input file: " << inFName << std::endl); - return false; - } - - std::string destFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - destFileName += "/"; - destFileName += outName; - - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Configure file: " << inFileName.c_str() << " to " - << destFileName.c_str() << std::endl); - this->ConfigureFile(inFileName.c_str(), destFileName.c_str()); - return true; -} - bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command, const char* packageFile) { @@ -597,21 +504,6 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command, return true; } -std::string cmCPackPackageMakerGenerator::GetPackageName( - const cmCPackComponent& component) -{ - if (component.ArchiveFile.empty()) { - std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - packagesDir += ".dummy"; - std::ostringstream out; - out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-" - << component.Name << ".pkg"; - return out.str(); - } else { - return component.ArchiveFile + ".pkg"; - } -} - bool cmCPackPackageMakerGenerator::GenerateComponentPackage( const char* packageFile, const char* packageDir, const cmCPackComponent& component) @@ -686,219 +578,3 @@ bool cmCPackPackageMakerGenerator::GenerateComponentPackage( // Run PackageMaker return RunPackageMaker(pkgCmd.str().c_str(), packageFile); } - -void cmCPackPackageMakerGenerator::WriteDistributionFile( - const char* metapackageFile) -{ - std::string distributionTemplate = - this->FindTemplate("CPack.distribution.dist.in"); - if (distributionTemplate.empty()) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find input file: " - << distributionTemplate << std::endl); - return; - } - - std::string distributionFile = metapackageFile; - distributionFile += "/Contents/distribution.dist"; - - // Create the choice outline, which provides a tree-based view of - // the components in their groups. - std::ostringstream choiceOut; - choiceOut << "" << std::endl; - - // Emit the outline for the groups - std::map::iterator groupIt; - for (groupIt = this->ComponentGroups.begin(); - groupIt != this->ComponentGroups.end(); ++groupIt) { - if (groupIt->second.ParentGroup == 0) { - CreateChoiceOutline(groupIt->second, choiceOut); - } - } - - // Emit the outline for the non-grouped components - std::map::iterator compIt; - for (compIt = this->Components.begin(); compIt != this->Components.end(); - ++compIt) { - if (!compIt->second.Group) { - choiceOut << "first << "Choice\">" - << std::endl; - } - } - if (!this->PostFlightComponent.Name.empty()) { - choiceOut << "" << std::endl; - } - choiceOut << "" << std::endl; - - // Create the actual choices - for (groupIt = this->ComponentGroups.begin(); - groupIt != this->ComponentGroups.end(); ++groupIt) { - CreateChoice(groupIt->second, choiceOut); - } - for (compIt = this->Components.begin(); compIt != this->Components.end(); - ++compIt) { - CreateChoice(compIt->second, choiceOut); - } - - if (!this->PostFlightComponent.Name.empty()) { - CreateChoice(PostFlightComponent, choiceOut); - } - - this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); - - // Create the distribution.dist file in the metapackage to turn it - // into a distribution package. - this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str()); -} - -void cmCPackPackageMakerGenerator::CreateChoiceOutline( - const cmCPackComponentGroup& group, std::ostringstream& out) -{ - out << "" << std::endl; - std::vector::const_iterator groupIt; - for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end(); - ++groupIt) { - CreateChoiceOutline(**groupIt, out); - } - - std::vector::const_iterator compIt; - for (compIt = group.Components.begin(); compIt != group.Components.end(); - ++compIt) { - out << " Name << "Choice\">" - << std::endl; - } - out << "" << std::endl; -} - -void cmCPackPackageMakerGenerator::CreateChoice( - const cmCPackComponentGroup& group, std::ostringstream& out) -{ - out << "" << std::endl; -} - -void cmCPackPackageMakerGenerator::CreateChoice( - const cmCPackComponent& component, std::ostringstream& out) -{ - std::string packageId = "com."; - packageId += this->GetOption("CPACK_PACKAGE_VENDOR"); - packageId += '.'; - packageId += this->GetOption("CPACK_PACKAGE_NAME"); - packageId += '.'; - packageId += component.Name; - - out << " visited; - AddDependencyAttributes(component, visited, out); - visited.clear(); - AddReverseDependencyAttributes(component, visited, out); - out << "\""; - } - out << ">" << std::endl; - out << " " << std::endl; - out << "" << std::endl; - - // Create a description of the package associated with this - // component. - std::string relativePackageLocation = "Contents/Packages/"; - relativePackageLocation += this->GetPackageName(component); - - // Determine the installed size of the package. - std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - dirName += '/'; - dirName += component.Name; - dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); - unsigned long installedSize = - component.GetInstalledSizeInKbytes(dirName.c_str()); - - out << "GetOption("CPACK_PACKAGE_VERSION") << "\" " - << "installKBytes=\"" << installedSize << "\" " - << "auth=\"Admin\" onConclusion=\"None\">"; - if (component.IsDownloaded) { - out << this->GetOption("CPACK_DOWNLOAD_SITE") - << this->GetPackageName(component); - } else { - out << "file:./" << relativePackageLocation; - } - out << "" << std::endl; -} - -void cmCPackPackageMakerGenerator::AddDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out) -{ - if (visited.find(&component) != visited.end()) { - return; - } - visited.insert(&component); - - std::vector::const_iterator dependIt; - for (dependIt = component.Dependencies.begin(); - dependIt != component.Dependencies.end(); ++dependIt) { - out << " && choices['" << (*dependIt)->Name << "Choice'].selected"; - AddDependencyAttributes(**dependIt, visited, out); - } -} - -void cmCPackPackageMakerGenerator::AddReverseDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out) -{ - if (visited.find(&component) != visited.end()) { - return; - } - visited.insert(&component); - - std::vector::const_iterator dependIt; - for (dependIt = component.ReverseDependencies.begin(); - dependIt != component.ReverseDependencies.end(); ++dependIt) { - out << " || choices['" << (*dependIt)->Name << "Choice'].selected"; - AddReverseDependencyAttributes(**dependIt, visited, out); - } -} - -std::string cmCPackPackageMakerGenerator::EscapeForXML(std::string str) -{ - cmSystemTools::ReplaceString(str, "&", "&"); - cmSystemTools::ReplaceString(str, "<", "<"); - cmSystemTools::ReplaceString(str, ">", ">"); - cmSystemTools::ReplaceString(str, "\"", """); - return str; -} diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index 2b8d2536d..5192377b7 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -13,7 +13,7 @@ #ifndef cmCPackPackageMakerGenerator_h #define cmCPackPackageMakerGenerator_h -#include "cmCPackGenerator.h" +#include "cmCPackPKGGenerator.h" class cmCPackComponent; @@ -23,46 +23,28 @@ class cmCPackComponent; * http://developer.apple.com/documentation/Darwin * /Reference/ManPages/man1/packagemaker.1.html */ -class cmCPackPackageMakerGenerator : public cmCPackGenerator +class cmCPackPackageMakerGenerator : public cmCPackPKGGenerator { public: - cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator); + cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackPKGGenerator); /** * Construct generator */ cmCPackPackageMakerGenerator(); virtual ~cmCPackPackageMakerGenerator(); - - virtual bool SupportsComponentInstallation() const; + bool SupportsComponentInstallation() const; protected: - int CopyInstallScript(const std::string& resdir, const std::string& script, - const std::string& name); virtual int InitializeInternal(); int PackageFiles(); virtual const char* GetOutputExtension() { return ".dmg"; } - virtual const char* GetOutputPostfix() { return "darwin"; } - - // Copies or creates the resource file with the given name to the - // package or package staging directory dirName. The variable - // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased - // version of name) specifies the input file to use for this file, - // which will be configured via ConfigureFile. - bool CopyCreateResourceFile(const std::string& name, - const std::string& dirName); - bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if // successful) produce the given package file. Returns true if // PackageMaker succeeds, false otherwise. bool RunPackageMaker(const char* command, const char* packageFile); - // Retrieve the name of package file that will be generated for this - // component. The name is just the file name with extension, and - // does not include the subdirectory. - std::string GetPackageName(const cmCPackComponent& component); - // Generate a package in the file packageFile for the given // component. All of the files within this component are stored in // the directory packageDir. Returns true if successful, false @@ -71,48 +53,6 @@ protected: const char* packageDir, const cmCPackComponent& component); - // Writes a distribution.dist file, which turns a metapackage into a - // full-fledged distribution. This file is used to describe - // inter-component dependencies. metapackageFile is the name of the - // metapackage for the distribution. Only valid for a - // component-based install. - void WriteDistributionFile(const char* metapackageFile); - - // Subroutine of WriteDistributionFile that writes out the - // dependency attributes for inter-component dependencies. - void AddDependencyAttributes(const cmCPackComponent& component, - std::set& visited, - std::ostringstream& out); - - // Subroutine of WriteDistributionFile that writes out the - // reverse dependency attributes for inter-component dependencies. - void AddReverseDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out); - - // Generates XML that encodes the hierarchy of component groups and - // their components in a form that can be used by distribution - // metapackages. - void CreateChoiceOutline(const cmCPackComponentGroup& group, - std::ostringstream& out); - - /// Create the "choice" XML element to describe a component group - /// for the installer GUI. - void CreateChoice(const cmCPackComponentGroup& group, - std::ostringstream& out); - - /// Create the "choice" XML element to describe a component for the - /// installer GUI. - void CreateChoice(const cmCPackComponent& component, - std::ostringstream& out); - - // Escape the given string to make it usable as an XML attribute - // value. - std::string EscapeForXML(std::string str); - - // The PostFlight component when creating a metapackage - cmCPackComponent PostFlightComponent; - double PackageMakerVersion; unsigned int PackageCompatibilityVersion; }; From 34d07d7cccc146b167e45f8d158204de049150d9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 2 Jun 2016 00:01:10 -0400 Subject: [PATCH 005/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d8920e662..390e4088d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160601) +set(CMake_VERSION_PATCH 20160602) #set(CMake_VERSION_RC 1) From 7f6b8d3399dd841b0d29bf74d2b31021738c4ef8 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 1 Jun 2016 23:29:53 +0200 Subject: [PATCH 006/929] Simplify boolean expressions Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes. --- Source/CPack/IFW/cmCPackIFWRepository.cxx | 14 +++++--------- Source/CPack/cmCPackArchiveGenerator.cxx | 6 +----- Source/CPack/cmCPackDebGenerator.cxx | 6 +----- Source/CPack/cmCPackRPMGenerator.cxx | 6 +----- Source/CPack/cpack.cxx | 6 +----- Source/CTest/cmCTestCoverageHandler.cxx | 16 ++++------------ Source/CTest/cmCTestLaunch.cxx | 8 ++------ Source/CTest/cmCTestMemCheckHandler.cxx | 15 +++------------ Source/CTest/cmCTestSubmitHandler.cxx | 9 +-------- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/CTest/cmParsePHPCoverage.cxx | 5 +---- Source/CursesDialog/cmCursesBoolWidget.cxx | 6 +----- Source/cmCacheManager.cxx | 2 +- Source/cmComputeLinkInformation.cxx | 3 +-- Source/cmCustomCommand.cxx | 2 +- Source/cmDependsC.cxx | 6 +++--- Source/cmDependsFortran.cxx | 5 ++--- Source/cmELF.cxx | 6 +++--- Source/cmExtraCodeBlocksGenerator.cxx | 8 ++++---- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGeneratedFileStream.cxx | 4 ++-- Source/cmGeneratorTarget.cxx | 6 +----- Source/cmGlobalGenerator.cxx | 3 +-- Source/cmGlobalNinjaGenerator.cxx | 6 +++--- Source/cmGraphVizWriter.cxx | 14 +++++++------- Source/cmListFileCache.cxx | 5 +---- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmMakefile.cxx | 17 ++++------------- Source/cmMakefileLibraryTargetGenerator.cxx | 3 +-- Source/cmNinjaTargetGenerator.cxx | 3 +-- Source/cmPropertyDefinitionMap.cxx | 7 +------ Source/cmQtAutoGenerators.cxx | 11 +++++------ Source/cmSourceFileLocation.cxx | 5 +---- Source/cmSourceGroup.cxx | 6 +----- Source/cmSystemTools.cxx | 7 ++----- Source/cmcmd.cxx | 8 ++------ 37 files changed, 73 insertions(+), 169 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index b149f8143..18380054d 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -45,16 +45,16 @@ bool cmCPackIFWRepository::IsValid() const switch (Update) { case None: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Add: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Remove: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Replace: - valid = (OldUrl.empty() || NewUrl.empty()) ? false : true; + valid = !OldUrl.empty() && !NewUrl.empty(); break; } @@ -244,11 +244,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() fout.Close(); - if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) { - return false; - } - - return true; + return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data()); } void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 7db20a429..baf6719ca 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -269,9 +269,5 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const // The Component installation support should only // be activated if explicitly requested by the user // (for backward compatibility reason) - if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"); } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 1ad415251..ddaa483b6 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -675,11 +675,7 @@ int cmCPackDebGenerator::createDeb() bool cmCPackDebGenerator::SupportsComponentInstallation() const { - if (IsOn("CPACK_DEB_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_DEB_COMPONENT_INSTALL"); } std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 9827b7099..bc101118f 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -228,11 +228,7 @@ int cmCPackRPMGenerator::PackageFiles() bool cmCPackRPMGenerator::SupportsComponentInstallation() const { - if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_RPM_COMPONENT_INSTALL"); } std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 94e16154b..425afd9e8 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -209,11 +209,7 @@ int main(int argc, char const* const* argv) * should launch cpack using "cpackConfigFile" if it exists * in the current directory. */ - if ((doc.CheckOptions(argc, argv, "-G")) && !(argc == 1)) { - help = true; - } else { - help = false; - } + help = doc.CheckOptions(argc, argv, "-G") && argc != 1; // This part is used for cpack documentation lookup as well. cminst.AddCMakePaths(); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index daefb5914..ba9e5469e 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -90,11 +90,8 @@ public: cmsysProcess_Execute(this->Process); this->PipeState = cmsysProcess_GetState(this->Process); // if the process is running or exited return true - if (this->PipeState == cmsysProcess_State_Executing || - this->PipeState == cmsysProcess_State_Exited) { - return true; - } - return false; + return this->PipeState == cmsysProcess_State_Executing || + this->PipeState == cmsysProcess_State_Exited; } void SetStdoutFile(const char* fname) { @@ -705,13 +702,8 @@ bool IsFileInDir(const std::string& infile, const std::string& indir) std::string file = cmSystemTools::CollapseFullPath(infile); std::string dir = cmSystemTools::CollapseFullPath(indir); - if (file.size() > dir.size() && - (fnc(file.substr(0, dir.size())) == fnc(dir)) && - file[dir.size()] == '/') { - return true; - } - - return false; + return file.size() > dir.size() && + fnc(file.substr(0, dir.size())) == fnc(dir) && file[dir.size()] == '/'; } int cmCTestCoverageHandler::HandlePHPCoverage( diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 4a408a278..99fa9e7c3 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -594,12 +594,8 @@ bool cmCTestLaunch::Match(std::string const& line, bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const { - if (!this->OptionFilterPrefix.empty() && - cmSystemTools::StringStartsWith(line.c_str(), - this->OptionFilterPrefix.c_str())) { - return true; - } - return false; + return !this->OptionFilterPrefix.empty() && + cmSystemTools::StringStartsWith(line, this->OptionFilterPrefix.c_str()); } int cmCTestLaunch::Main(int argc, const char* const argv[]) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5ae98aff5..f8ffd432a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -722,10 +722,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( ostr << *i << std::endl; } log = ostr.str(); - if (defects) { - return false; - } - return true; + return defects == 0; } bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, std::vector& results) @@ -766,10 +763,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( } log = ostr.str(); - if (defects) { - return false; - } - return true; + return defects == 0; } bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( @@ -904,10 +898,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); log = ostr.str(); - if (defects) { - return false; - } - return true; + return defects == 0; } bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index f37334867..32975df62 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -845,10 +845,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, } } cmsysProcess_Delete(cp); - if (problems) { - return false; - } - return true; + return problems == 0; } bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix, @@ -870,7 +867,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix, } cmCTest::SetOfStrings::const_iterator file; - bool problems = false; for (file = files.begin(); file != files.end(); ++file) { std::string lfname = localprefix; cmSystemTools::ConvertToUnixSlashes(lfname); @@ -883,9 +879,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix, } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; cmSystemTools::Touch(tagDoneFile, true); - if (problems) { - return false; - } return true; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 20ef6930d..55a6518f9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1406,7 +1406,7 @@ void cmCTestTestHandler::UseIncludeRegExp() void cmCTestTestHandler::UseExcludeRegExp() { this->UseExcludeRegExpFlag = true; - this->UseExcludeRegExpFirst = this->UseIncludeRegExpFlag ? false : true; + this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag; } const char* cmCTestTestHandler::GetTestStatus(int status) diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index eb0d962d6..5ec27189b 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -27,10 +27,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until) char c = 0; while (in.get(c) && c != until) { } - if (c != until) { - return false; - } - return true; + return c == until; } bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in, std::string const& fileName) diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 0055e8836..9bcf0507b 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -54,9 +54,5 @@ void cmCursesBoolWidget::SetValueAsBool(bool value) bool cmCursesBoolWidget::GetValueAsBool() { - if (this->Value == "ON") { - return true; - } else { - return false; - } + return this->Value == "ON"; } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index d143193f1..676e84a2a 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -642,5 +642,5 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v) bool cmCacheManager::CacheIterator::PropertyExists( const std::string& prop) const { - return this->GetProperty(prop) ? true : false; + return this->GetProperty(prop) != NULL; } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e1a7bee30..1eefbb1d7 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -274,8 +274,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( // Check whether we should use an import library for linking a target. this->UseImportLibrary = - this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX") ? true - : false; + this->Makefile->IsDefinitionSet("CMAKE_IMPORT_LIBRARY_SUFFIX"); // Check whether we should skip dependencies on shared library files. this->LinkDependsNoShared = diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 7c00c80a1..4c5bd0320 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 ? true : false) + , HaveComment(comment != NULL) , EscapeAllowMakeVars(false) , EscapeOldStyle(true) { diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 78bb1b276..5be527ccd 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -278,21 +278,21 @@ void cmDependsC::ReadCacheFile() continue; } // the first line after an empty line is the name of the parsed file - if (haveFileName == false) { + if (!haveFileName) { haveFileName = true; int newer = 0; cmFileTimeComparison comp; bool res = comp.FileTimeCompare(this->CacheFileName.c_str(), line.c_str(), &newer); - if ((res == true) && (newer == 1)) // cache is newer than the parsed file + if (res && newer == 1) // cache is newer than the parsed file { cacheEntry = new cmIncludeLines; this->FileCache[line] = cacheEntry; } // file doesn't exist, check that the regular expressions // haven't changed - else if (res == false) { + else if (!res) { if (line.find(INCLUDE_REGEX_LINE_MARKER) == 0) { if (line != this->IncludeRegexLineString) { return; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 38e319d72..a20fb9819 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -654,10 +654,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // but also do not include a date so we can fall through to // compare them without skipping any prefix. unsigned char hdr[2]; - bool okay = - finModFile.read(reinterpret_cast(hdr), 2) ? true : false; + bool okay = !finModFile.read(reinterpret_cast(hdr), 2).fail(); finModFile.seekg(0); - if (!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) { + if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) { const char seq[1] = { '\n' }; const int seqlen = 1; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 26f1a44e8..c7f8a2d62 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -143,7 +143,7 @@ public: { this->Stream.seekg(pos); this->Stream.read(buf, size); - return this->Stream ? true : false; + return !this->Stream.fail(); } // Lookup the SONAME in the DYNAMIC section. @@ -497,7 +497,7 @@ private: this->NeedSwap) { ByteSwap(x); } - return this->Stream ? true : false; + return !this->Stream.fail(); } bool Read(ELF_Dyn& x) { @@ -505,7 +505,7 @@ private: this->NeedSwap) { ByteSwap(x); } - return this->Stream ? true : false; + return !this->Stream.fail(); } bool LoadSectionHeader(ELF_Half i) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 2070b1f7f..40cff785c 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -655,11 +655,11 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) // projects with C/C++ and Fortran are handled as C/C++ projects bool pureFortran = false; std::string compilerIdVar; - if (this->GlobalGenerator->GetLanguageEnabled("CXX") == true) { + if (this->GlobalGenerator->GetLanguageEnabled("CXX")) { compilerIdVar = "CMAKE_CXX_COMPILER_ID"; - } else if (this->GlobalGenerator->GetLanguageEnabled("C") == true) { + } else if (this->GlobalGenerator->GetLanguageEnabled("C")) { compilerIdVar = "CMAKE_C_COMPILER_ID"; - } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran") == true) { + } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran")) { compilerIdVar = "CMAKE_Fortran_COMPILER_ID"; pureFortran = true; } @@ -667,7 +667,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) std::string compilerId = mf->GetSafeDefinition(compilerIdVar); std::string compiler = "gcc"; // default to gcc if (compilerId == "MSVC") { - if (mf->IsDefinitionSet("MSVC10") == true) { + if (mf->IsDefinitionSet("MSVC10")) { compiler = "msvc10"; } else { compiler = "msvc8"; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index ba5876736..dd10b656a 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -407,7 +407,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName( // figure out which language to use // for now care only for C and C++ std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID"; - if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false) { + if (!this->GlobalGenerator->GetLanguageEnabled("CXX")) { compilerIdVar = "CMAKE_C_COMPILER_ID"; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index f24e7fb43..bc217afb9 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -129,7 +129,7 @@ void cmExtraEclipseCDT4Generator::Generate() (this->IsOutOfSourceBuild && mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT")); - if ((this->GenerateSourceProject == false) && + if (!this->GenerateSourceProject && (mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"))) { mf->IssueMessage( cmake::WARNING, diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 2c059139a..dee174b7f 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -42,7 +42,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream() // stream will be destroyed which will close the temporary file. // Finally the base destructor will be called to replace the // destination file. - this->Okay = (*this) ? true : false; + this->Okay = !this->fail(); } cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, @@ -71,7 +71,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, bool cmGeneratedFileStream::Close() { // Save whether the temporary output file is valid before closing. - this->Okay = (*this) ? true : false; + this->Okay = !this->fail(); // Close the temporary output file. this->Stream::close(); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3856091c7..1607dd937 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1306,11 +1306,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const this->GetName()); } - if (cmp0042 == cmPolicies::NEW) { - return true; - } - - return false; + return cmp0042 == cmPolicies::NEW; } std::string cmGeneratorTarget::GetSOName(const std::string& config) const diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a1764a38a..fc34b8b21 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -180,8 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang, } else { path = name; } - if ((path.empty() || !cmSystemTools::FileExists(path.c_str())) && - (optional == false)) { + if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) { return; } const char* cname = diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 143ad9213..3abcba398 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1227,9 +1227,9 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const bool cmGlobalNinjaGenerator::SupportsConsolePool() const { - return cmSystemTools::VersionCompare( - cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), - RequiredNinjaVersionForConsolePool().c_str()) == false; + return !cmSystemTools::VersionCompare( + cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), + RequiredNinjaVersionForConsolePool().c_str()); } void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 20cd17119..6b3a87073 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -140,7 +140,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, // which other targets depend on it. void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) { - if (this->GenerateDependers == false) { + if (!this->GenerateDependers) { return; } @@ -153,7 +153,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) continue; } - if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) { + if (!this->GenerateForTargetType(ptrIt->second->GetType())) { continue; } @@ -184,7 +184,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) // on which targets it depends. void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) { - if (this->GeneratePerTarget == false) { + if (!this->GeneratePerTarget) { return; } @@ -197,7 +197,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) continue; } - if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) { + if (!this->GenerateForTargetType(ptrIt->second->GetType())) { continue; } @@ -243,7 +243,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) continue; } - if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) { + if (!this->GenerateForTargetType(ptrIt->second->GetType())) { continue; } @@ -344,7 +344,7 @@ void cmGraphVizWriter::WriteDependerConnections( continue; } - if (this->GenerateForTargetType(dependerIt->second->GetType()) == false) { + if (!this->GenerateForTargetType(dependerIt->second->GetType())) { continue; } @@ -403,7 +403,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName, void cmGraphVizWriter::CollectTargetsAndLibs() { - if (this->HaveTargetsAndLibs == false) { + if (!this->HaveTargetsAndLibs) { this->HaveTargetsAndLibs = true; int cnt = this->CollectAllTargets(); if (this->GenerateForExternals) { diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index f47e9b66f..33731e047 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -202,10 +202,7 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf) this->Functions.insert(this->Functions.begin(), project); } } - if (parseError) { - return false; - } - return true; + return !parseError; } bool cmListFileParser::ParseFunction(const char* name, long line) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f60a595e4..4b5af8b87 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1322,7 +1322,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, // not be considered. std::map validDependencies; bool needRescanDependencies = false; - if (needRescanDirInfo == false) { + if (!needRescanDirInfo) { cmDependsC checker; checker.SetVerbose(verbose); checker.SetFileComparison(ftc); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e684689f0..45fb7cf34 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2124,20 +2124,11 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const // If we are doing an in-source build, then the test will always fail if (cmSystemTools::SameFile(this->GetHomeDirectory(), this->GetHomeOutputDirectory())) { - if (this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD")) { - return false; - } - return true; + return !this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD"); } - // Check if this is a subdirectory of the source tree but not a - // subdirectory of the build tree - if (cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) && - !cmSystemTools::IsSubDirectory(fileName, - this->GetHomeOutputDirectory())) { - return false; - } - return true; + return !cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) || + cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory()); } const char* cmMakefile::GetRequiredDefinition(const std::string& name) const @@ -2166,7 +2157,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const } } #endif - return def ? true : false; + return def != NULL; } const char* cmMakefile::GetDefinition(const std::string& name) const diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 8f7dd7e44..128291d29 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -454,8 +454,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::vector archiveFinishCommands; std::string::size_type archiveCommandLimit = std::string::npos; if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) { - haveStaticLibraryRule = - this->Makefile->GetDefinition(linkRuleVar) ? true : false; + haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar); std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; arCreateVar += "_ARCHIVE_CREATE"; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1aa2ddb28..b0f0d9b47 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -130,8 +130,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, // Add include directory flags. std::string includeFlags = this->LocalGenerator->GetIncludeFlags( includes, this->GeneratorTarget, language, - language == "RC" ? true : false, // full include paths for RC - // needed by cmcldeps + language == "RC", // full include paths for RC needed by cmcldeps false, this->GetConfigName()); if (this->GetGlobalGenerator()->IsGCCOnWindows()) std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/'); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index ebc2caa3b..0ba35e716 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -31,12 +31,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name, bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const { - cmPropertyDefinitionMap::const_iterator it = this->find(name); - if (it == this->end()) { - return false; - } - - return true; + return this->find(name) != this->end(); } bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ac64397cd..dc44f3e6a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -636,14 +636,14 @@ void cmQtAutoGenerators::ParseCppFile( } } else { std::string fileToMoc = absFilename; - if ((basename != scannedFileBasename) || (requiresMoc == false)) { + if (!requiresMoc || basename != scannedFileBasename) { std::string mocSubDir = extractSubDir(absPath, currentMoc); std::string headerToMoc = findMatchingHeader(absPath, mocSubDir, basename, headerExtensions); if (!headerToMoc.empty()) { // this is for KDE4 compatibility: fileToMoc = headerToMoc; - if ((requiresMoc == false) && (basename == scannedFileBasename)) { + if (!requiresMoc && basename == scannedFileBasename) { std::stringstream err; err << "AUTOGEN: warning: " << absFilename << ": The file " @@ -696,8 +696,8 @@ void cmQtAutoGenerators::ParseCppFile( // If this is the case, the moc_foo.cpp should probably be generated from // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. - if ((dotMocIncluded == false) && (requiresMoc == true)) { - if (mocUnderscoreIncluded == true) { + if (!dotMocIncluded && requiresMoc) { + if (mocUnderscoreIncluded) { // this is for KDE4 compatibility: std::stringstream err; err << "AUTOGEN: warning: " << absFilename << ": The file " @@ -833,8 +833,7 @@ void cmQtAutoGenerators::StrictParseCppFile( // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. std::string macroName; - if ((dotMocIncluded == false) && - (requiresMocing(contentsString, macroName))) { + if (!dotMocIncluded && requiresMocing(contentsString, macroName)) { // otherwise always error out since it will not compile: std::stringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 3219f3678..a89d1e8e3 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -177,10 +177,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension( } std::vector hdrExts = mf->GetCMakeInstance()->GetHeaderExtensions(); - if (std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) { - return true; - } - return false; + return std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end(); } bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 394b33a47..f27b572fd 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -86,11 +86,7 @@ bool cmSourceGroup::MatchesRegex(const char* name) bool cmSourceGroup::MatchesFiles(const char* name) { - std::set::const_iterator i = this->GroupFiles.find(name); - if (i != this->GroupFiles.end()) { - return true; - } - return false; + return this->GroupFiles.find(name) != this->GroupFiles.end(); } void cmSourceGroup::AssignSource(const cmSourceFile* sf) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7dece4789..71569483a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2108,11 +2108,8 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, // If the symlink points at an extended version of the same name // assume it is the soname. std::string name = cmSystemTools::GetFilenameName(fullPath); - if (soname.length() > name.length() && - soname.substr(0, name.length()) == name) { - return true; - } - return false; + return soname.length() > name.length() && + soname.compare(0, name.length(), name) == 0; } bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 471028a2f..535dead22 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1027,11 +1027,7 @@ int cmcmd::ExecuteEchoColor(std::vector& args) // Enable or disable color based on the switch value. std::string value = args[i].substr(9); if (!value.empty()) { - if (cmSystemTools::IsOn(value.c_str())) { - enabled = true; - } else { - enabled = false; - } + enabled = cmSystemTools::IsOn(value.c_str()); } } else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) { progressDir = args[i].substr(15); @@ -1226,7 +1222,7 @@ int cmcmd::VisualStudioLink(std::vector& args, int type) if (args.size() < 2) { return -1; } - bool verbose = cmSystemTools::GetEnv("VERBOSE") ? true : false; + bool verbose = cmSystemTools::GetEnv("VERBOSE") != NULL; std::vector expandedArgs; for (std::vector::iterator i = args.begin(); i != args.end(); ++i) { From b66d4739b5e0944a58d4a94431ed7ad042fad05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Tue, 31 May 2016 21:10:40 +0200 Subject: [PATCH 007/929] FindOpenCL: Add an imported target --- .../dev/FindOpenCL-imported-target.rst | 4 ++++ Modules/FindOpenCL.cmake | 20 +++++++++++++++++-- Tests/CMakeLists.txt | 4 ++++ Tests/FindOpenCL/CMakeLists.txt | 10 ++++++++++ Tests/FindOpenCL/Test/CMakeLists.txt | 14 +++++++++++++ Tests/FindOpenCL/Test/main.c | 16 +++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/FindOpenCL-imported-target.rst create mode 100644 Tests/FindOpenCL/CMakeLists.txt create mode 100644 Tests/FindOpenCL/Test/CMakeLists.txt create mode 100644 Tests/FindOpenCL/Test/main.c diff --git a/Help/release/dev/FindOpenCL-imported-target.rst b/Help/release/dev/FindOpenCL-imported-target.rst new file mode 100644 index 000000000..259c745b0 --- /dev/null +++ b/Help/release/dev/FindOpenCL-imported-target.rst @@ -0,0 +1,4 @@ +FindOpenCL-imported-target +-------------------------- + +* The :module:`FindOpenCL` module now provides imported targets. diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 4d3ed842c..feda31565 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -4,7 +4,16 @@ # # Try to find OpenCL # -# Once done this will define:: +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if +# OpenCL has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables:: # # OpenCL_FOUND - True if OpenCL was found # OpenCL_INCLUDE_DIRS - include directories for OpenCL @@ -20,7 +29,7 @@ # #============================================================================= -# Copyright 2014 Matthaeus G. Chajdas +# Copyright 2014-2016 Matthaeus G. Chajdas # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -134,3 +143,10 @@ find_package_handle_standard_args( mark_as_advanced( OpenCL_INCLUDE_DIR OpenCL_LIBRARY) + +if(OpenCL_FOUND AND NOT TARGET OpenCL::OpenCL) + add_library(OpenCL::OpenCL UNKNOWN IMPORTED) + set_target_properties(OpenCL::OpenCL PROPERTIES + IMPORTED_LOCATION "${OpenCL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${OpenCL_INCLUDE_DIRS}") +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2db5deda3..b72ecf5da 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1378,6 +1378,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindLTTngUST) endif() + if(CMake_TEST_FindOpenCL) + add_subdirectory(FindOpenCL) + endif() + if(CMake_TEST_FindOpenSSL) add_subdirectory(FindOpenSSL) endif() diff --git a/Tests/FindOpenCL/CMakeLists.txt b/Tests/FindOpenCL/CMakeLists.txt new file mode 100644 index 000000000..88d2eaee0 --- /dev/null +++ b/Tests/FindOpenCL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindOpenCL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOpenCL/Test" + "${CMake_BINARY_DIR}/Tests/FindOpenCL/Test" + ${build_generator_args} + --build-project TestFindOpenCL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindOpenCL/Test/CMakeLists.txt b/Tests/FindOpenCL/Test/CMakeLists.txt new file mode 100644 index 000000000..f8a65877b --- /dev/null +++ b/Tests/FindOpenCL/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindOpenCL C) +include(CTest) + +find_package(OpenCL REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt OpenCL::OpenCL) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${OpenCL_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${OpenCL_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindOpenCL/Test/main.c b/Tests/FindOpenCL/Test/main.c new file mode 100644 index 000000000..b075caf19 --- /dev/null +++ b/Tests/FindOpenCL/Test/main.c @@ -0,0 +1,16 @@ +#ifdef __APPLE__ + #include +#else + #include +#endif + +int main() +{ + cl_uint platformIdCount; + + // We can't assert on the result because this may return an error if no ICD is + // found + clGetPlatformIDs (0, NULL, &platformIdCount); + + return 0; +} From 0c7951a9397f4703d61d346c64c27a99a30f4dac Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jun 2016 09:47:29 -0400 Subject: [PATCH 008/929] cmLocalGenerator: Consolidate conditions in AddArchitectureFlags Make room for possible future non-Apple architecture flags. --- Source/cmLocalGenerator.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e91eb4688..b748b9c8e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1475,11 +1475,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, const std::string& config) { // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): - if (!this->Makefile->IsOn("APPLE")) { - return; - } - - if (this->EmitUniversalBinaryFlags) { + if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) { std::vector archs; target->GetAppleArchs(config, archs); const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); From f6c21894952fb07e50e511efaa3baded794d631f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 26 May 2016 14:41:23 -0400 Subject: [PATCH 009/929] Modules: Rename internal platform-specific compiler determination modules Rename Modules/Platform/-.cmake files to Modules/Platform/-Determine-.cmake to clarify their role. For compatibility with user-provided modules, load the old names if they exist. --- Modules/CMakeDetermineCCompiler.cmake | 1 + Modules/CMakeDetermineCXXCompiler.cmake | 1 + Modules/CMakeDetermineFortranCompiler.cmake | 1 + .../Platform/{CYGWIN-CXX.cmake => CYGWIN-Determine-CXX.cmake} | 0 .../Platform/{Darwin-CXX.cmake => Darwin-Determine-CXX.cmake} | 0 Modules/Platform/{Linux-CXX.cmake => Linux-Determine-CXX.cmake} | 0 .../Platform/{Windows-CXX.cmake => Windows-Determine-CXX.cmake} | 0 7 files changed, 3 insertions(+) rename Modules/Platform/{CYGWIN-CXX.cmake => CYGWIN-Determine-CXX.cmake} (100%) rename Modules/Platform/{Darwin-CXX.cmake => Darwin-Determine-CXX.cmake} (100%) rename Modules/Platform/{Linux-CXX.cmake => Linux-Determine-CXX.cmake} (100%) rename Modules/Platform/{Windows-CXX.cmake => Windows-Determine-CXX.cmake} (100%) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index f8c630324..73d9fb3fc 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -34,6 +34,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) # Load system-specific compiler preferences for this language. +include(Platform/${CMAKE_SYSTEM_NAME}-Determine-C OPTIONAL) include(Platform/${CMAKE_SYSTEM_NAME}-C OPTIONAL) if(NOT CMAKE_C_COMPILER_NAMES) set(CMAKE_C_COMPILER_NAMES cc) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 3c9bbc26a..063b68e1e 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -33,6 +33,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) # Load system-specific compiler preferences for this language. +include(Platform/${CMAKE_SYSTEM_NAME}-Determine-CXX OPTIONAL) include(Platform/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL) if(NOT CMAKE_CXX_COMPILER_NAMES) set(CMAKE_CXX_COMPILER_NAMES CC) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 4f2a70c4d..0f27a789c 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -20,6 +20,7 @@ # as a default compiler include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +include(Platform/${CMAKE_SYSTEM_NAME}-Determine-Fortran OPTIONAL) include(Platform/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL) if(NOT CMAKE_Fortran_COMPILER_NAMES) set(CMAKE_Fortran_COMPILER_NAMES f95) diff --git a/Modules/Platform/CYGWIN-CXX.cmake b/Modules/Platform/CYGWIN-Determine-CXX.cmake similarity index 100% rename from Modules/Platform/CYGWIN-CXX.cmake rename to Modules/Platform/CYGWIN-Determine-CXX.cmake diff --git a/Modules/Platform/Darwin-CXX.cmake b/Modules/Platform/Darwin-Determine-CXX.cmake similarity index 100% rename from Modules/Platform/Darwin-CXX.cmake rename to Modules/Platform/Darwin-Determine-CXX.cmake diff --git a/Modules/Platform/Linux-CXX.cmake b/Modules/Platform/Linux-Determine-CXX.cmake similarity index 100% rename from Modules/Platform/Linux-CXX.cmake rename to Modules/Platform/Linux-Determine-CXX.cmake diff --git a/Modules/Platform/Windows-CXX.cmake b/Modules/Platform/Windows-Determine-CXX.cmake similarity index 100% rename from Modules/Platform/Windows-CXX.cmake rename to Modules/Platform/Windows-Determine-CXX.cmake From e847b6c86455682377dea8cd53e182c00a3e2d3c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jun 2016 11:49:07 -0400 Subject: [PATCH 010/929] CPack/NSIS: Remove duplicate include from NSIS.template.in (#16132) In commit v2.6.0~3438 (ENH: Better support for adding and removing path, 2006-04-27) an include of "WinMessages.NSH" was added without removing the original include. Remove it now. --- Modules/NSIS.template.in | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 1ef3d28c7..2de9e1d55 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -157,13 +157,6 @@ Var AR_RegFlags !define MUI_HEADERIMAGE !define MUI_ABORTWARNING -;-------------------------------- -; path functions - -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - ;---------------------------------------- ; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" ;---------------------------------------- From a7d1c4ec3f6e955262e3ae49e77430259e0bc12f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jun 2016 14:32:07 -0400 Subject: [PATCH 011/929] CMakeDetermineCompilerId: Fix compiler id with square brackets in the path We use file(GLOB) to load the list of files produced by compiling the compiler identification source. Encode square brackets in the path to the directory so that they are not treated as special characters in the globbing expression. Otherwise we fail to find any files when the path contains square brackets and the compiler id is unknown. Reported-by: Esch Nigma --- Modules/CMakeDetermineCompilerId.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 465989de1..70ceaa6f8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -365,14 +365,15 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # Find the executable produced by the compiler, try all files in the # binary dir. + string(REGEX REPLACE "([][])" "[\\1]" _glob_id_dir "${CMAKE_${lang}_COMPILER_ID_DIR}") file(GLOB files RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} # normal case - ${CMAKE_${lang}_COMPILER_ID_DIR}/* + ${_glob_id_dir}/* # com.apple.package-type.bundle.unit-test - ${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/* + ${_glob_id_dir}/*.xctest/* ) list(REMOVE_ITEM files "${src}") set(COMPILER_${lang}_PRODUCED_FILES "") From c6220de27605f33b2793729680c32714cd126690 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 26 May 2016 23:05:30 +0200 Subject: [PATCH 012/929] Use the empty() method to check for emptyness. Apply fix-its from clang-tidy's readability-container-size-empty checker. --- Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestCurl.cxx | 14 +++++++------- Source/CTest/cmCTestMemCheckHandler.cxx | 11 ++++++----- Source/CTest/cmCTestReadCustomFilesCommand.cxx | 2 +- Source/CTest/cmCTestRunScriptCommand.cxx | 2 +- Source/CTest/cmCTestRunTest.cxx | 5 +++-- Source/CTest/cmCTestSleepCommand.cxx | 2 +- Source/CTest/cmCTestStartCommand.cxx | 2 +- Source/CTest/cmCTestSubmitHandler.cxx | 4 ++-- Source/CTest/cmCTestTestHandler.cxx | 6 +++--- Source/CTest/cmParseJacocoCoverage.cxx | 2 +- Source/cmArchiveWrite.cxx | 2 +- Source/cmCTest.cxx | 4 ++-- Source/cmExtraCodeBlocksGenerator.cxx | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmSystemTools.cxx | 2 +- 16 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 7141daf76..a4d9deeaa 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -790,7 +790,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, // First generate the command and arguments std::vector args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 59675dd0e..4818324fe 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -88,10 +88,10 @@ bool cmCTestCurl::InitCurl() if (this->VerifyHostOff) { curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0); } - if (this->HTTPProxy.size()) { + if (!this->HTTPProxy.empty()) { curl_easy_setopt(this->Curl, CURLOPT_PROXY, this->HTTPProxy.c_str()); curl_easy_setopt(this->Curl, CURLOPT_PROXYTYPE, this->HTTPProxyType); - if (this->HTTPProxyAuth.size() > 0) { + if (!this->HTTPProxyAuth.empty()) { curl_easy_setopt(this->Curl, CURLOPT_PROXYUSERPWD, this->HTTPProxyAuth.c_str()); } @@ -160,17 +160,17 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL); ::curl_slist_free_all(headers); - if (responseData.size() > 0) { + if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: [" << response << "]\n"); } std::string curlDebug; - if (debugData.size() > 0) { + if (!debugData.empty()) { curlDebug = std::string(debugData.begin(), debugData.end()); cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); } - if (response.size() == 0) { + if (response.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" << curlDebug); return false; @@ -205,11 +205,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url, CURLcode res = ::curl_easy_perform(this->Curl); - if (responseData.size() > 0) { + if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n"); } - if (debugData.size() > 0) { + if (!debugData.empty()) { std::string curlDebug = std::string(debugData.begin(), debugData.end()); cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5ae98aff5..f9f7ab7ba 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -499,11 +499,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // Setup the options std::string memoryTesterOptions; - if (this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size()) { + if (!this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions") + .empty()) { memoryTesterOptions = this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions"); - } else if (this->CTest->GetCTestConfiguration("ValgrindCommandOptions") - .size()) { + } else if (!this->CTest->GetCTestConfiguration("ValgrindCommandOptions") + .empty()) { memoryTesterOptions = this->CTest->GetCTestConfiguration("ValgrindCommandOptions"); } @@ -522,8 +523,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("--show-reachable=yes"); this->MemoryTesterOptions.push_back("--num-callers=50"); } - if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") - .size()) { + if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") + .empty()) { if (!cmSystemTools::FileExists( this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .c_str())) { diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index 2613c1c52..fec23e91f 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -16,7 +16,7 @@ bool cmCTestReadCustomFilesCommand::InitialPass( std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index e143d5028..6b5e6ed5a 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -16,7 +16,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->CTestScriptHandler->RunCurrentScript(); return true; } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9dda8652e..48582c9a5 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -207,7 +207,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } if (res == cmsysProcess_State_Exited) { bool success = !forceFail && - (retVal == 0 || this->TestProperties->RequiredRegularExpressions.size()); + (retVal == 0 || + !this->TestProperties->RequiredRegularExpressions.empty()); if (this->TestProperties->SkipReturnCode >= 0 && this->TestProperties->SkipReturnCode == retVal) { this->TestResult.Status = cmCTestTestHandler::NOT_RUN; @@ -537,7 +538,7 @@ void cmCTestRunTest::ComputeArguments() << " command: " << testCommand << std::endl); // Print any test-specific env vars in verbose mode - if (this->TestProperties->Environment.size()) { + if (!this->TestProperties->Environment.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Environment variables: " << std::endl); diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx index 102a3036c..a6dd6bc97 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -17,7 +17,7 @@ bool cmCTestSleepCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index d56139357..99d431af5 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -25,7 +25,7 @@ cmCTestStartCommand::cmCTestStartCommand() bool cmCTestStartCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index f37334867..155294e2d 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -999,12 +999,12 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, dropMethod = this->CTest->GetCTestConfiguration("DropMethod"); url = dropMethod; url += "://"; - if (this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0) { + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); cmCTestOptionalLog( this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), this->Quiet); - if (this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0) { + if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 20ef6930d..b461f97c7 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -69,7 +69,7 @@ public: bool cmCTestSubdirCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } @@ -150,7 +150,7 @@ public: bool cmCTestAddSubdirectoryCommand::InitialPass( std::vector const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } @@ -1125,7 +1125,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml, cmCTestTestResult* result) { if (result->Status != cmCTestTestHandler::COMPLETED && - result->Properties->AttachOnFail.size()) { + !result->Properties->AttachOnFail.empty()) { result->Properties->AttachedFiles.insert( result->Properties->AttachedFiles.end(), result->Properties->AttachOnFail.begin(), diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 335535d92..e456f39f9 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -111,7 +111,7 @@ protected: gl.RecurseThroughSymlinksOn(); gl.FindFiles(packageGlob); std::vector const& files = gl.GetFiles(); - if (files.size() == 0) { + if (files.empty()) { return false; } diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index a0150ec60..235cf88c6 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -255,7 +255,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) archive_entry_set_gid(e, this->Gid.Get()); } - if (this->Uname.size() && this->Gname.size()) { + if (!this->Uname.empty() && !this->Gname.empty()) { archive_entry_set_uname(e, this->Uname.c_str()); archive_entry_set_gname(e, this->Gname.c_str()); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index bc36c5adc..6e0893296 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1020,7 +1020,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, // First generate the command and arguments std::vector args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } @@ -2525,7 +2525,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut, { std::vector args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 2070b1f7f..162d98dde 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -248,7 +248,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // We don't want paths with CMakeFiles in them // or do we? // In speedcrunch those where purely internal - if (splitted.size() >= 1 && + if (!splitted.empty() && relative.find("CMakeFiles") == std::string::npos) { tree.InsertPath(splitted, 1, fileName); } @@ -729,7 +729,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( const std::string& makeFlags) { std::string command = make; - if (makeFlags.size() > 0) { + if (!makeFlags.empty()) { command += " "; command += makeFlags; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 93f9e498b..3086bb106 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -848,7 +848,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule( const std::vector& commands, bool in_help) { bool symbolic = false; - if (outputs.size() == 0) { + if (outputs.empty()) { return symbolic; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 99d8569f5..44e76e770 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -702,7 +702,7 @@ bool cmSystemTools::RunSingleCommand(const char* command, std::vector args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr, From 8b289db739c8d0a288e532c560b6dbcf4bd67c30 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 3 Jun 2016 00:01:19 -0400 Subject: [PATCH 013/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 390e4088d..117eca18b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160602) +set(CMake_VERSION_PATCH 20160603) #set(CMake_VERSION_RC 1) From 3720d5f4a3c6edfdb1533ac60c9ade0adee92e09 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Fri, 3 Jun 2016 13:29:42 +0700 Subject: [PATCH 014/929] FindBoost: Test `CMAKE_CXX_COMPILER_{ID,VERSION}` instead of `MSVC*` --- Modules/FindBoost.cmake | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 67d71d0bf..25840b3e3 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -442,24 +442,26 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) endif() elseif (GHSMULTI) set(_boost_COMPILER "-ghs") - elseif (MSVC14) - set(_boost_COMPILER "-vc140") - elseif (MSVC12) - set(_boost_COMPILER "-vc120") - elseif (MSVC11) - set(_boost_COMPILER "-vc110") - elseif (MSVC10) - set(_boost_COMPILER "-vc100") - elseif (MSVC90) - set(_boost_COMPILER "-vc90") - elseif (MSVC80) - set(_boost_COMPILER "-vc80") - elseif (MSVC71) - set(_boost_COMPILER "-vc71") - elseif (MSVC70) # Good luck! - set(_boost_COMPILER "-vc7") # yes, this is correct - elseif (MSVC60) # Good luck! - set(_boost_COMPILER "-vc6") # yes, this is correct + elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + set(_boost_COMPILER "-vc140") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) + set(_boost_COMPILER "-vc120") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + set(_boost_COMPILER "-vc110") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + set(_boost_COMPILER "-vc100") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + set(_boost_COMPILER "-vc90") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + set(_boost_COMPILER "-vc80") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) + set(_boost_COMPILER "-vc71") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck! + set(_boost_COMPILER "-vc7") # yes, this is correct + else() # MSVC60 Good luck! + set(_boost_COMPILER "-vc6") # yes, this is correct + endif() elseif (BORLAND) set(_boost_COMPILER "-bcb") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") @@ -1261,7 +1263,8 @@ endif() # g using debug versions of the standard and runtime # support libraries if(WIN32 AND Boost_USE_DEBUG_RUNTIME) - if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") endif() From c3a281fd327cce529ca3507f00a62608b26627ee Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Fri, 3 Jun 2016 13:32:10 +0700 Subject: [PATCH 015/929] FindBoost: Search in official Windows prebuilt binary library directory Avoid the need to specify `BOOST_LIBRARYDIR` along with `BOOST_ROOT` when using prebuilt binaries such as these: https://sourceforge.net/projects/boost/files/boost-binaries/ --- Modules/FindBoost.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 25840b3e3..6bf640195 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -209,6 +209,7 @@ # Copyright 2007 Mike Jackson # Copyright 2008 Andreas Pakulat # Copyright 2008-2012 Philip Lowman +# Copyright 2016 Alex Turbov # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -863,6 +864,37 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar) set(${extravar} ${_boost_extra_components} PARENT_SCOPE) endfunction() +# +# Update library search directory hint variable with paths used by prebuilt boost binaries. +# +# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) +# have library directories named using MSVC compiler version and architecture. +# This function would append corresponding directories if MSVC is a current compiler, +# so having `BOOST_ROOT` would be enough to specify to find everything. +# +macro(_Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir) + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_arch_suffix 64) + else() + set(_arch_suffix 32) + endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-14.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-12.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-11.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-10.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-9.0) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-8.0) + endif() + endif() +endmacro() + # # End functions/macros # @@ -1322,8 +1354,10 @@ foreach(c DEBUG RELEASE) if(BOOST_ROOT) list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) + _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} BOOST_ROOT) elseif(_ENV_BOOST_ROOT) list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) + _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} _ENV_BOOST_ROOT) endif() list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} From 2e3c67d1b636f752eea35ef407c5243a79742d63 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 2 Nov 2013 10:24:53 -0600 Subject: [PATCH 016/929] productbuild: Add new productbuild cpack generator. This cpack generator basically replaces the obsolete PackageMaker generator. --- Help/manual/cmake-modules.7.rst | 1 + Help/module/CPackProductBuild.rst | 1 + Modules/CPack.cmake | 3 + Modules/CPackProductBuild.cmake | 38 +++ Source/CMakeLists.txt | 1 + Source/CPack/cmCPackGeneratorFactory.cxx | 5 + Source/CPack/cmCPackPKGGenerator.cxx | 1 - Source/CPack/cmCPackPackageMakerGenerator.cxx | 2 + Source/CPack/cmCPackProductBuildGenerator.cxx | 260 ++++++++++++++++++ Source/CPack/cmCPackProductBuildGenerator.h | 60 ++++ Tests/CMakeLists.txt | 11 + 11 files changed, 382 insertions(+), 1 deletion(-) create mode 100644 Help/module/CPackProductBuild.rst create mode 100644 Modules/CPackProductBuild.cmake create mode 100644 Source/CPack/cmCPackProductBuildGenerator.cxx create mode 100644 Source/CPack/cmCPackProductBuildGenerator.h diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 62910cf5a..f91166299 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -60,6 +60,7 @@ All Modules /module/CPackIFW /module/CPackNSIS /module/CPackPackageMaker + /module/CPackProductBuild /module/CPackRPM /module/CPack /module/CPackWIX diff --git a/Help/module/CPackProductBuild.rst b/Help/module/CPackProductBuild.rst new file mode 100644 index 000000000..6081fe48a --- /dev/null +++ b/Help/module/CPackProductBuild.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CPackProductBuild.cmake diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 77f854d5e..4d51a3ee3 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -455,6 +455,7 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF) option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF) + option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF) else() option(CPACK_BINARY_TZ "Enable to build TZ packages" ON) endif() @@ -483,6 +484,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) @@ -531,6 +533,7 @@ mark_as_advanced( CPACK_BINARY_NSIS CPACK_BINARY_OSXX11 CPACK_BINARY_PACKAGEMAKER + CPACK_BINARY_PRODUCTBUILD CPACK_BINARY_RPM CPACK_BINARY_STGZ CPACK_BINARY_TBZ2 diff --git a/Modules/CPackProductBuild.cmake b/Modules/CPackProductBuild.cmake new file mode 100644 index 000000000..6545a3a8e --- /dev/null +++ b/Modules/CPackProductBuild.cmake @@ -0,0 +1,38 @@ +#.rst: +# CPackProductBuild +# ----------------- +# +# productbuild CPack generator (Mac OS X). +# +# Variables specific to CPack productbuild generator +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# The following variable is specific to installers built on Mac +# OS X using productbuild: +# +# .. variable:: CPACK_COMMAND_PRODUCTBUILD +# +# Path to the productbuild(1) command used to generate a product archive for +# the OS X Installer or Mac App Store. This variable can be used to override +# the automatically detected command (or specify its location if the +# auto-detection fails to find it.) +# +# .. variable:: CPACK_COMMAND_PKGBUILD +# +# Path to the pkgbuild(1) command used to generate an OS X component package +# on OS X. This variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to find it.) +# + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f85f14326..7cf11caa2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -719,6 +719,7 @@ if(APPLE) CPack/cmCPackOSXX11Generator.cxx CPack/cmCPackPKGGenerator.cxx CPack/cmCPackPackageMakerGenerator.cxx + CPack/cmCPackProductBuildGenerator.cxx ) endif() diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index b17f52ef5..cf072bbe6 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -28,6 +28,7 @@ #include "cmCPackDragNDropGenerator.h" #include "cmCPackOSXX11Generator.h" #include "cmCPackPackageMakerGenerator.h" +#include "cmCPackProductBuildGenerator.h" #endif #ifdef __CYGWIN__ @@ -122,6 +123,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle", cmCPackOSXX11Generator::CreateGenerator); } + if (cmCPackProductBuildGenerator::CanGenerate()) { + this->RegisterGenerator("productbuild", "Mac OSX pkg", + cmCPackProductBuildGenerator::CreateGenerator); + } #endif #if !defined(_WIN32) && !defined(__QNXNTO__) && !defined(__BEOS__) && \ !defined(__HAIKU__) diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 8282714a7..ff0fa8cc7 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -41,7 +41,6 @@ int cmCPackPKGGenerator::InitializeInternal() { cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackPKGGenerator::Initialize()" << std::endl); - this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); return this->Superclass::InitializeInternal(); } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index e50c2e681..5bb24c0ba 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -329,6 +329,8 @@ int cmCPackPackageMakerGenerator::PackageFiles() int cmCPackPackageMakerGenerator::InitializeInternal() { + this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); + // Starting with Xcode 4.3, PackageMaker is a separate app, and you // can put it anywhere you want. So... use a variable for its location. // People who put it in unexpected places can use the variable to tell diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx new file mode 100644 index 000000000..c1f63cc23 --- /dev/null +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -0,0 +1,260 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCPackProductBuildGenerator.h" + +#include "cmake.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmSystemTools.h" +#include "cmMakefile.h" +#include "cmGeneratedFileStream.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackLog.h" + +#include +#include + +cmCPackProductBuildGenerator::cmCPackProductBuildGenerator() +{ + this->componentPackageMethod = ONE_PACKAGE; +} + +cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator() +{ +} + +int cmCPackProductBuildGenerator::PackageFiles() +{ + // TODO: Use toplevel + // It is used! Is this an obsolete comment? + + std::string packageDirFileName + = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); + + // Create the directory where component packages will be built. + std::string basePackageDir = packageDirFileName; + basePackageDir += "/Contents/Packages"; + if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating component packages directory: " + << basePackageDir.c_str() << std::endl); + return 0; + } + + if (!this->Components.empty()) + { + std::map::iterator compIt; + for (compIt = this->Components.begin(); compIt != this->Components.end(); + ++compIt) + { + std::string packageDir = toplevel; + packageDir += '/'; + packageDir += compIt->first; + if (!this->GenerateComponentPackage(basePackageDir, + GetPackageName(compIt->second), + packageDir, + &compIt->second)) + { + return 0; + } + } + } + else + { + if(!this->GenerateComponentPackage(basePackageDir, + this->GetOption("CPACK_PACKAGE_NAME"), + toplevel, NULL)) + { + return 0; + } + } + + // Copy or create all of the resource files we need. + std::string resDir = packageDirFileName + "/Contents"; + if ( !this->CopyCreateResourceFile("License", resDir.c_str()) + || !this->CopyCreateResourceFile("ReadMe", resDir.c_str()) + || !this->CopyCreateResourceFile("Welcome", resDir.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" + << std::endl); + return 0; + } + + // combine package(s) into a distribution + WriteDistributionFile(packageDirFileName.c_str()); + std::ostringstream pkgCmd; + + std::string version = this->GetOption("CPACK_PACKAGE_VERSION"); + std::string productbuild = this->GetOption("CPACK_COMMAND_PRODUCTBUILD"); + + pkgCmd << productbuild + << " --distribution \"" << packageDirFileName + << "/Contents/distribution.dist\"" + << " --package-path \"" << packageDirFileName << "/Contents/Packages" << "\"" + << " --resources \"" << resDir << "\"" + << " --version \"" << version << "\"" + << " \"" << packageFileNames[0] << "\""; + + // Run ProductBuild + return RunProductBuild(pkgCmd.str()); +} + +int cmCPackProductBuildGenerator::InitializeInternal() +{ + this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/Applications"); + + std::vector no_paths; + std::string program = + cmSystemTools::FindProgram("pkgbuild", no_paths, false); + if (program.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find pkgbuild executable" + << std::endl); + return 0; + } + this->SetOptionIfNotSet("CPACK_COMMAND_PKGBUILD", program.c_str()); + + + program = cmSystemTools::FindProgram("productbuild", no_paths, false); + if (program.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find productbuild executable" + << std::endl); + return 0; + } + this->SetOptionIfNotSet("CPACK_COMMAND_PRODUCTBUILD", program.c_str()); + + return this->Superclass::InitializeInternal(); +} + + +bool cmCPackProductBuildGenerator::RunProductBuild( + const std::string& command) +{ + std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + tmpFile += "/ProductBuildOutput.log"; + + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); + std::string output, error_output; + int retVal = 1; + bool res = cmSystemTools::RunSingleCommand(command.c_str(), + &output, &error_output, &retVal, 0, this->GeneratorVerbose, 0); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" + << std::endl); + if ( !res || retVal ) + { + cmGeneratedFileStream ofs(tmpFile.c_str()); + ofs << "# Run command: " << command << std::endl + << "# Output:" << std::endl + << output.c_str() << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running command: " << command + << std::endl << "Please check " << tmpFile.c_str() << " for errors" + << std::endl); + return false; + } + return true; +} + +bool cmCPackProductBuildGenerator::GenerateComponentPackage( + const std::string& packageFileDir, + const std::string& packageFileName, + const std::string& packageDir, + const cmCPackComponent* component) +{ + std::string packageFile = packageFileDir; + packageFile += '/'; + packageFile += packageFileName; + + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Building component package: " << + packageFile << std::endl); + + const char* comp_name = component ? component->Name.c_str() : NULL; + + const char* preflight = this->GetComponentScript("PREFLIGHT", comp_name); + const char* postflight = this->GetComponentScript("POSTFLIGHT", comp_name); + + std::string resDir = packageFileDir; + if(component) + { + resDir += "/"; + resDir += component->Name; + } + std::string scriptDir = resDir + "/scripts"; + + if ( !cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << scriptDir.c_str() << std::endl); + return 0; + } + + // if preflight, postflight, or postupgrade are set + // then copy them into the script directory and make + // them executable + if(preflight) + { + this->CopyInstallScript(scriptDir.c_str(), + preflight, + "preinstall"); + } + if(postflight) + { + this->CopyInstallScript(scriptDir.c_str(), + postflight, + "postinstall"); + } + + + // The command that will be used to run ProductBuild + std::ostringstream pkgCmd; + + std::string pkgId = "com."; + pkgId += this->GetOption("CPACK_PACKAGE_VENDOR"); + pkgId += '.'; + pkgId += this->GetOption("CPACK_PACKAGE_NAME"); + if(component) + { + pkgId += '.'; + pkgId += component->Name; + } + + std::string version = this->GetOption("CPACK_PACKAGE_VERSION"); + std::string pkgbuild = this->GetOption("CPACK_COMMAND_PKGBUILD"); + + pkgCmd << pkgbuild + << " --root \"" << packageDir << "\"" + << " --identifier \"" << pkgId << "\"" + << " --scripts \"" << scriptDir << "\"" + << " --version \"" << version << "\"" + << " --install-location \"/\"" + << " \"" << packageFile << "\""; + + // Run ProductBuild + return RunProductBuild(pkgCmd.str()); +} + +const char* cmCPackProductBuildGenerator::GetComponentScript( + const char* script, + const char* component_name) +{ + std::string scriptname = std::string("CPACK_") + script + "_"; + if(component_name) + { + scriptname += cmSystemTools::UpperCase(component_name); + scriptname += "_"; + } + scriptname += "SCRIPT"; + + return this->GetOption(scriptname); +} diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h new file mode 100644 index 000000000..0740f8933 --- /dev/null +++ b/Source/CPack/cmCPackProductBuildGenerator.h @@ -0,0 +1,60 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackProductBuildGenerator_h +#define cmCPackProductBuildGenerator_h + + +#include "cmCPackPKGGenerator.h" + +class cmCPackComponent; + +/** \class cmCPackProductBuildGenerator + * \brief A generator for ProductBuild files + * + */ +class cmCPackProductBuildGenerator : public cmCPackPKGGenerator +{ +public: + cmCPackTypeMacro(cmCPackProductBuildGenerator, cmCPackPKGGenerator); + + /** + * Construct generator + */ + cmCPackProductBuildGenerator(); + virtual ~cmCPackProductBuildGenerator(); + +protected: + virtual int InitializeInternal(); + int PackageFiles(); + virtual const char* GetOutputExtension() { return ".pkg"; } + + // Run ProductBuild with the given command line, which will (if + // successful) produce the given package file. Returns true if + // ProductBuild succeeds, false otherwise. + bool RunProductBuild(const std::string& command); + + // Generate a package in the file packageFile for the given + // component. All of the files within this component are stored in + // the directory packageDir. Returns true if successful, false + // otherwise. + bool GenerateComponentPackage(const std::string& packageFileDir, + const std::string& packageFileName, + const std::string& packageDir, + const cmCPackComponent* component); + + const char* GetComponentScript(const char* script, + const char* script_component); + +}; + +#endif diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2db5deda3..bffa4b7f8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -951,6 +951,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CPackComponents_BUILD_OPTIONS) if(APPLE) set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6") + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_PRODUCTBUILD:BOOL=ON) + endif() endif() if(NSIS_MAKENSIS_EXECUTABLE) set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} @@ -995,6 +999,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND ACTIVE_CPACK_GENERATORS "ZIP") if(APPLE) list(APPEND ACTIVE_CPACK_GENERATORS "DragNDrop") + if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6") + list(APPEND ACTIVE_CPACK_GENERATORS "productbuild") + endif() endif() # set up list of component packaging ways @@ -1105,6 +1112,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CPackComponents_BUILD_OPTIONS) if(APPLE) set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6") + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_PRODUCTBUILD:BOOL=ON) + endif() endif() if(NOT NSIS_MAKENSIS_EXECUTABLE) set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} From 6a22a7cf71c0f564a150717a31651f9730c808fc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 4 Jun 2016 00:01:05 -0400 Subject: [PATCH 017/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 117eca18b..9a9c09a0e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160603) +set(CMake_VERSION_PATCH 20160604) #set(CMake_VERSION_RC 1) From 1503a67bf43cbf9aa4227a8865b512203299eabf Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 5 Jun 2016 00:01:05 -0400 Subject: [PATCH 018/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9a9c09a0e..877ec90b3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160604) +set(CMake_VERSION_PATCH 20160605) #set(CMake_VERSION_RC 1) From fc45ecfc50913206f3058eefb85e8df3f7ae7d66 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 6 Jun 2016 00:01:05 -0400 Subject: [PATCH 019/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 877ec90b3..93d02c320 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160605) +set(CMake_VERSION_PATCH 20160606) #set(CMake_VERSION_RC 1) From 63e5eb5fd37691190e80bed142b7f08c3420f625 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Jun 2016 09:25:39 -0400 Subject: [PATCH 020/929] Help: Add notes for 'productbuild' topic --- Help/release/dev/productbuild.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/productbuild.rst diff --git a/Help/release/dev/productbuild.rst b/Help/release/dev/productbuild.rst new file mode 100644 index 000000000..ebe213b5b --- /dev/null +++ b/Help/release/dev/productbuild.rst @@ -0,0 +1,5 @@ +productbuild +------------ + +* CPack gained a ``productbuild`` generator on OS X, configured by + the :module:`CPackProductBuild` module. From ba5fb16519d095051ea90e642cbf41a28be6a03d Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 5 Jun 2016 23:44:39 +0200 Subject: [PATCH 021/929] call static cmOutputConverter::GetFortranFormat without object --- Source/cmCommonTargetGenerator.cxx | 4 ++-- Source/cmGlobalXCodeGenerator.cxx | 4 ++-- Source/cmLocalVisualStudio7Generator.cxx | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index c630971ce..a6f2a2e60 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -178,10 +178,10 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( { const char* srcfmt = source.GetProperty("Fortran_FORMAT"); cmOutputConverter::FortranFormat format = - this->LocalGenerator->GetFortranFormat(srcfmt); + cmOutputConverter::GetFortranFormat(srcfmt); if (format == cmOutputConverter::FortranFormatNone) { const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT"); - format = this->LocalGenerator->GetFortranFormat(tgtfmt); + format = cmOutputConverter::GetFortranFormat(tgtfmt); } const char* var = 0; switch (format) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b666594c1..93ce88b5c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -659,7 +659,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( // Add flags from target and source file properties. std::string flags; const char* srcfmt = sf->GetProperty("Fortran_FORMAT"); - switch (this->CurrentLocalGenerator->GetFortranFormat(srcfmt)) { + switch (cmOutputConverter::GetFortranFormat(srcfmt)) { case cmOutputConverter::FortranFormatFixed: flags = "-fixed " + flags; break; @@ -1981,7 +1981,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add Fortran source format attribute if property is set. const char* format = 0; const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT"); - switch (this->CurrentLocalGenerator->GetFortranFormat(tgtfmt)) { + switch (cmOutputConverter::GetFortranFormat(tgtfmt)) { case cmOutputConverter::FortranFormatFixed: format = "fixed"; break; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6e7d7d2ea..36a1f2972 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -683,7 +683,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( } if (this->FortranProject) { - switch (this->GetFortranFormat(target->GetProperty("Fortran_FORMAT"))) { + switch (cmOutputConverter::GetFortranFormat( + target->GetProperty("Fortran_FORMAT"))) { case cmOutputConverter::FortranFormatFixed: flags += " -fixed"; break; @@ -1474,7 +1475,8 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( needfc = true; } if (lg->FortranProject) { - switch (lg->GetFortranFormat(sf.GetProperty("Fortran_FORMAT"))) { + switch (cmOutputConverter::GetFortranFormat( + sf.GetProperty("Fortran_FORMAT"))) { case cmOutputConverter::FortranFormatFixed: fc.CompileFlags = "-fixed " + fc.CompileFlags; needfc = true; From fa277b29e41a8de43913f0a63b273bb3dbc759e8 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 6 Jun 2016 23:53:32 +0200 Subject: [PATCH 022/929] Remove c_str() calls from stream arguments. Mostly automated: git grep -l '.c_str() <<' | xargs sed -i 's|\.c_str() <<| <<|g' --- Source/CPack/OSXScriptLauncher.cxx | 2 +- Source/CPack/cmCPackBundleGenerator.cxx | 8 +++--- Source/CPack/cmCPackOSXX11Generator.cxx | 22 +++++++--------- Source/CPack/cmCPackPKGGenerator.cxx | 15 +++++------ Source/CPack/cmCPackPackageMakerGenerator.cxx | 26 +++++++++---------- Source/CPack/cmCPackProductBuildGenerator.cxx | 16 ++++++------ Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 4 +-- Source/CTest/cmCTestMemCheckHandler.cxx | 8 +++--- Source/CTest/cmCTestMultiProcessHandler.cxx | 6 ++--- Source/CTest/cmCTestSubmitHandler.cxx | 15 +++++------ Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 8 +++--- Source/cmCallVisualStudioMacro.cxx | 4 +-- Source/cmDependsC.cxx | 6 ++--- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 4 +-- Source/cmGraphVizWriter.cxx | 4 +-- Source/cmLocalVisualStudio7Generator.cxx | 8 +++--- Source/cmMakefile.cxx | 2 +- Tests/Plugin/src/example_exe.cxx | 3 +-- 21 files changed, 81 insertions(+), 86 deletions(-) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index 19204a207..a233e7669 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(fullScriptPath); - ofs << fullScriptPath.c_str() << std::endl; + ofs << fullScriptPath << std::endl; std::vector args; args.push_back(fullScriptPath.c_str()); int cc; diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 1164021f0..9276e3a5a 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -232,12 +232,12 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID"); temp_sign_file_cmd << " \""; temp_sign_file_cmd << bundle_path; - temp_sign_file_cmd << it->c_str() << "\""; + temp_sign_file_cmd << *it << "\""; if (!this->RunCommand(temp_sign_file_cmd, &output)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing file:" - << bundle_path << it->c_str() << std::endl - << output << std::endl); + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error signing file:" << bundle_path << *it << std::endl + << output << std::endl); return 0; } diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index d5691bed5..c0d255338 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -158,11 +158,10 @@ int cmCPackOSXX11Generator::PackageFiles() tmpFile += "/hdiutilOutput.log"; std::ostringstream dmgCmd; dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE") - << "\" create -ov -format UDZO -srcfolder \"" - << diskImageDirectory.c_str() << "\" \"" << packageFileNames[0] - << "\""; + << "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory + << "\" \"" << packageFileNames[0] << "\""; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: " - << dmgCmd.str().c_str() << std::endl); + << dmgCmd.str() << std::endl); // since we get random dashboard failures with this one // try running it more than once int retVal = 1; @@ -181,12 +180,12 @@ int cmCPackOSXX11Generator::PackageFiles() } if (!res || retVal) { cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl + ofs << "# Run command: " << dmgCmd.str() << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: " - << dmgCmd.str().c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + << dmgCmd.str() << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -249,7 +248,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? inFileName : "(NULL)") - << " to " << destFileName.c_str() << std::endl); + << " to " << destFileName << std::endl); this->ConfigureFile(inFileName, destFileName.c_str()); return true; } @@ -277,9 +276,8 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile( destFileName += "/"; destFileName += outputFileName; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Configure file: " << inFileName.c_str() << " to " - << destFileName.c_str() << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + << inFileName << " to " << destFileName << std::endl); this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly); return true; } diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index ff0fa8cc7..7bc05d0b1 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -316,9 +316,9 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile( this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(), (name + ext).c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " - << (inFileName ? inFileName : "(NULL)") << " to " - << destFileName.c_str() << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Configure file: " << (inFileName ? inFileName : "(NULL)") + << " to " << destFileName << std::endl); this->ConfigureFile(inFileName, destFileName.c_str()); return true; } @@ -344,9 +344,8 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile( destFileName += "/"; destFileName += outName; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Configure file: " << inFileName.c_str() << " to " - << destFileName.c_str() << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + << inFileName << " to " << destFileName << std::endl); this->ConfigureFile(inFileName.c_str(), destFileName.c_str()); return true; } @@ -360,8 +359,8 @@ int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir, dst += name; cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); cmSystemTools::SetPermissions(dst.c_str(), 0777); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " - << script << "\ninto " << dst.c_str() << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "copy script : " << script << "\ninto " << dst << std::endl); return 1; } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 5bb24c0ba..891d0f471 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -101,7 +101,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (!cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating installer directory: " - << preflightDirName.c_str() << std::endl); + << preflightDirName << std::endl); return 0; } } @@ -109,7 +109,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (!cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating installer directory: " - << postflightDirName.c_str() << std::endl); + << postflightDirName << std::endl); return 0; } } @@ -137,7 +137,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating component packages directory: " - << packageDir.c_str() << std::endl); + << packageDir << std::endl); return 0; } @@ -147,7 +147,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() cmCPackLogger( cmCPackLog::LOG_ERROR, "Problem creating component PostFlight Packages directory: " - << packageFileDir.c_str() << std::endl); + << packageFileDir << std::endl); return 0; } std::string packageFile = @@ -169,7 +169,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating component packages directory: " - << basePackageDir.c_str() << std::endl); + << basePackageDir << std::endl); return 0; } @@ -314,12 +314,12 @@ int cmCPackPackageMakerGenerator::PackageFiles() } if (!res || retVal) { cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl + ofs << "# Run command: " << dmgCmd.str() << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: " - << dmgCmd.str().c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + << dmgCmd.str() << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -382,7 +382,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal() if (!cmSystemTools::FileExists(versionFile.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find PackageMaker compiler version file: " - << versionFile.c_str() << std::endl); + << versionFile << std::endl); return 0; } @@ -416,7 +416,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal() if (!cmSystemTools::GetLineFromStream(ifs, line) || !rexVersion.find(line)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem reading the PackageMaker compiler version file: " - << versionFile.c_str() << std::endl); + << versionFile << std::endl); return 0; } this->PackageMakerVersion = atof(rexVersion.match(1).c_str()); @@ -481,11 +481,11 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command, cmGeneratedFileStream ofs(tmpFile.c_str()); ofs << "# Run command: " << command << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger( cmCPackLog::LOG_ERROR, "Problem running PackageMaker command: " << command << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << "Please check " << tmpFile << " for errors" << std::endl); return false; } // sometimes the command finishes but the directory is not yet diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index c1f63cc23..aa9a27d6a 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -47,7 +47,7 @@ int cmCPackProductBuildGenerator::PackageFiles() { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating component packages directory: " - << basePackageDir.c_str() << std::endl); + << basePackageDir << std::endl); return 0; } @@ -153,12 +153,12 @@ bool cmCPackProductBuildGenerator::RunProductBuild( { cmGeneratedFileStream ofs(tmpFile.c_str()); ofs << "# Run command: " << command << std::endl - << "# Output:" << std::endl - << output.c_str() << std::endl; + << "# Output:" << std::endl + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running command: " << command - << std::endl << "Please check " << tmpFile.c_str() << " for errors" - << std::endl); + "Problem running command: " << command << std::endl + << "Please check " << tmpFile + << " for errors" << std::endl); return false; } return true; @@ -194,8 +194,8 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( if ( !cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << scriptDir.c_str() << std::endl); + "Problem creating installer directory: " << scriptDir + << std::endl); return 0; } diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 0cba8b2a4..632f45211 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -302,7 +302,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) out << "Could not find path to executable, perhaps it was not built: " << this->TestCommand << "\n"; out << "tried to find it in these places:\n"; - out << fullPath.c_str() << "\n"; + out << fullPath << "\n"; for (unsigned int i = 0; i < failed.size(); ++i) { out << failed[i] << "\n"; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index ba9e5469e..a631db958 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1012,7 +1012,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "-o \"" + fileDir + "\" " + "\"" + *it + "\""; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - command.c_str() << std::endl, this->Quiet); + command << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; @@ -1377,7 +1377,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( "Current coverage dir: " << fileDir << std::endl, this->Quiet); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - command.c_str() << std::endl, this->Quiet); + command << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5b5caeab8..5f70f66df 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -991,7 +991,7 @@ void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest( cmsys::ifstream ifs(ofile.c_str()); if (!ifs) { std::string log = "Cannot read memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); return; } res.Output += BOUNDS_CHECKER_MARKER; @@ -1024,7 +1024,7 @@ void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, cmsys::ifstream ifs(ofile.c_str()); if (!ifs) { std::string log = "Cannot read memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); return; } std::string line; @@ -1056,7 +1056,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames( g.FindFiles(ofile); if (g.GetFiles().empty()) { std::string log = "Cannot find memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); ofile = ""; } else { files = g.GetFiles(); @@ -1064,7 +1064,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames( } } else if (!cmSystemTools::FileExists(ofile.c_str())) { std::string log = "Cannot find memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); ofile = ""; } files.push_back(ofile); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 6f19b325a..7b384addb 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -449,7 +449,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() fout << "---\n"; for (std::vector::iterator i = this->Failed->begin(); i != this->Failed->end(); ++i) { - fout << i->c_str() << "\n"; + fout << *i << "\n"; } fout.close(); cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str()); @@ -710,8 +710,8 @@ void cmCTestMultiProcessHandler::PrintTestList() << indexStr.str(), this->Quiet); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - p.Name.c_str() << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, p.Name << std::endl, + this->Quiet); // pop working dir cmSystemTools::ChangeDirectory(current_dir); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 015b9087a..69f2ac5b0 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -902,8 +902,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( /* Call the famous server at UserLand. */ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " - << realURL.c_str() << " (" << remoteprefix.c_str() - << ")" << std::endl, + << realURL << " (" << remoteprefix << ")" << std::endl, this->Quiet); cmCTest::SetOfStrings::const_iterator file; for (file = files.begin(); file != files.end(); ++file) { @@ -914,12 +913,12 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( local_file = localprefix + "/" + *file; } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Submit file: " << local_file.c_str() << std::endl, + " Submit file: " << local_file << std::endl, this->Quiet); struct stat st; if (::stat(local_file.c_str(), &st)) { cmCTestLog(this->CTest, ERROR_MESSAGE, - " Cannot find file: " << local_file.c_str() << std::endl); + " Cannot find file: " << local_file << std::endl); return false; } @@ -927,15 +926,15 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( // make sure the file is not too big. if (static_cast(static_cast(st.st_size)) != static_cast(st.st_size)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - " File too big: " << local_file.c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, " File too big: " << local_file + << std::endl); return false; } size_t fileSize = static_cast(st.st_size); FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); if (!fp) { cmCTestLog(this->CTest, ERROR_MESSAGE, - " Cannot open file: " << local_file.c_str() << std::endl); + " Cannot open file: " << local_file << std::endl); return false; } @@ -944,7 +943,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( delete[] fileBuffer; fclose(fp); cmCTestLog(this->CTest, ERROR_MESSAGE, - " Cannot read file: " << local_file.c_str() << std::endl); + " Cannot read file: " << local_file << std::endl); return false; } fclose(fp); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f461ca8f3..96a22d9c6 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1321,7 +1321,7 @@ std::string cmCTestTestHandler::FindExecutable( << "Looked in the following places:\n"); for (std::vector::iterator i = failed.begin(); i != failed.end(); ++i) { - cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n"); + cmCTestLog(ctest, HANDLER_OUTPUT, *i << "\n"); } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6e0893296..2e47298a2 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1245,16 +1245,16 @@ int cmCTest::RunTest(std::vector argv, std::string* output, if (output) { *output += outerr; } - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl - << std::flush); + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl + << std::flush); } else if (result == cmsysProcess_State_Error) { std::string outerr = "\n*** ERROR executing: "; outerr += cmsysProcess_GetErrorString(cp); if (output) { *output += outerr; } - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl - << std::flush); + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl + << std::flush); } cmsysProcess_Delete(cp); diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index e608d6b58..515699db4 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -105,8 +105,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, std::ostringstream oss; oss << std::endl; oss << "Invoke(ExecuteCommand)" << std::endl; - oss << " Macro: " << macro.c_str() << std::endl; - oss << " Args: " << args.c_str() << std::endl; + oss << " Macro: " << macro << std::endl; + oss << " Args: " << args << std::endl; if (DISP_E_EXCEPTION == hr) { oss << "DISP_E_EXCEPTION EXCEPINFO:" << excep.wCode << std::endl; diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 5be527ccd..f81bf068d 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -343,16 +343,16 @@ void cmDependsC::WriteCacheFile() const this->FileCache.begin(); fileIt != this->FileCache.end(); ++fileIt) { if (fileIt->second->Used) { - cacheOut << fileIt->first.c_str() << std::endl; + cacheOut << fileIt->first << std::endl; for (std::vector::const_iterator incIt = fileIt->second->UnscannedEntries.begin(); incIt != fileIt->second->UnscannedEntries.end(); ++incIt) { - cacheOut << incIt->FileName.c_str() << std::endl; + cacheOut << incIt->FileName << std::endl; if (incIt->QuotedLocation.empty()) { cacheOut << "-" << std::endl; } else { - cacheOut << incIt->QuotedLocation.c_str() << std::endl; + cacheOut << incIt->QuotedLocation << std::endl; } } cacheOut << std::endl; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 5c1e7330d..68a25389e 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -213,7 +213,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile( cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); // only put relative paths if (!tmp.empty() && tmp[0] != '/') { - fout << tmp.c_str() << "\n"; + fout << tmp << "\n"; } } return true; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 93ce88b5c..4d778ee17 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1544,7 +1544,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( std::string echo_cmd = "echo "; echo_cmd += (this->CurrentLocalGenerator->EscapeForShell( comment, ccg.GetCC().GetEscapeAllowMakeVars())); - makefileStream << "\t" << echo_cmd.c_str() << "\n"; + makefileStream << "\t" << echo_cmd << "\n"; } // Add each command line to the set of commands. @@ -1562,7 +1562,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } cmd += cmd2; ccg.AppendArguments(c, cmd); - makefileStream << "\t" << cmd.c_str() << "\n"; + makefileStream << "\t" << cmd << "\n"; } } } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 6b3a87073..3963cf891 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -427,7 +427,7 @@ int cmGraphVizWriter::CollectAllTargets() // Skip ignored targets continue; } - // std::cout << "Found target: " << tit->first.c_str() << std::endl; + // std::cout << "Found target: " << tit->first << std::endl; std::ostringstream ostr; ostr << this->GraphNodePrefix << cnt++; this->TargetNamesNodes[realTargetName] = ostr.str(); @@ -469,7 +469,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) ostr << this->GraphNodePrefix << cnt++; this->TargetNamesNodes[libName] = ostr.str(); this->TargetPtrs[libName] = NULL; - // str << " \"" << ostr.c_str() << "\" [ label=\"" << libName + // str << " \"" << ostr << "\" [ label=\"" << libName // << "\" shape=\"ellipse\"];" << std::endl; } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 36a1f2972..2f6bf0725 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1688,12 +1688,12 @@ bool cmLocalVisualStudio7Generator::WriteGroup( ppLang); } if (!fc.AdditionalDeps.empty()) { - fout << "\t\t\t\t\tAdditionalDependencies=\"" - << fc.AdditionalDeps.c_str() << "\"\n"; + fout << "\t\t\t\t\tAdditionalDependencies=\"" << fc.AdditionalDeps + << "\"\n"; } if (!fc.ObjectName.empty()) { - fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" - << fc.ObjectName.c_str() << "\"\n"; + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" << fc.ObjectName + << "\"\n"; } fout << "\t\t\t\t\t/>\n" << "\t\t\t\t\n"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 45fb7cf34..ca30b3d66 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3416,7 +3416,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, while (cmSystemTools::GetLineFromStream(fin, inLine)) { outLine = ""; this->ConfigureString(inLine, outLine, atOnly, escapeQuotes); - fout << outLine.c_str() << newLineCharacters; + fout << outLine << newLineCharacters; } // close the files before attempting to copy fin.close(); diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx index 857ad5469..86b54f709 100644 --- a/Tests/Plugin/src/example_exe.cxx +++ b/Tests/Plugin/src/example_exe.cxx @@ -31,8 +31,7 @@ int main() kwsys::DynamicLoader::LibraryHandle handle = kwsys::DynamicLoader::OpenLibrary(libName.c_str()); if (!handle) { - std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!" - << std::endl; + std::cerr << "Could not open plugin \"" << libName << "\"!" << std::endl; return 1; } kwsys::DynamicLoader::SymbolPointer sym = From 14de21d7d21db8aa177327f61e51c7c50a7e1ffa Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 7 Jun 2016 00:01:07 -0400 Subject: [PATCH 023/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 93d02c320..8428ac0ac 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160606) +set(CMake_VERSION_PATCH 20160607) #set(CMake_VERSION_RC 1) From 3b2844328c116cba71c71365507f33f98611e3dc Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jun 2016 08:37:04 -0400 Subject: [PATCH 024/929] Tests/FindOpenCL: Run clang-format to fix style --- Tests/FindOpenCL/Test/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tests/FindOpenCL/Test/main.c b/Tests/FindOpenCL/Test/main.c index b075caf19..dc7763645 100644 --- a/Tests/FindOpenCL/Test/main.c +++ b/Tests/FindOpenCL/Test/main.c @@ -1,16 +1,17 @@ #ifdef __APPLE__ - #include +#include #else - #include +#include #endif int main() { cl_uint platformIdCount; - // We can't assert on the result because this may return an error if no ICD is + // We can't assert on the result because this may return an error if no ICD + // is // found - clGetPlatformIDs (0, NULL, &platformIdCount); + clGetPlatformIDs(0, NULL, &platformIdCount); return 0; } From ff08a80af19530c95db4faa921168fb9ab346047 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jun 2016 08:39:45 -0400 Subject: [PATCH 025/929] Source/CPack: Run clang-format to fix style --- Source/CPack/cmCPackDebGenerator.cxx | 12 +- Source/CPack/cmCPackGeneratorFactory.cxx | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 42 +++--- Source/CPack/cmCPackPKGGenerator.h | 2 - Source/CPack/cmCPackProductBuildGenerator.cxx | 129 +++++++----------- Source/CPack/cmCPackProductBuildGenerator.h | 2 - 6 files changed, 77 insertions(+), 112 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index ddaa483b6..bef0fb4ff 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -57,9 +57,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, // Begin the archive for this pack std::string localToplevel(initialTopLevel); std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); - std::string outputFileName(std::string( - this->GetOption("CPACK_PACKAGE_FILE_NAME")) + - "-" + packageName + this->GetOutputExtension()); + std::string outputFileName( + std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + "-" + + packageName + this->GetOutputExtension()); localToplevel += "/" + packageName; /* replace the TEMP DIRECTORY with the component one */ @@ -174,9 +174,9 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( // The ALL GROUPS in ONE package case std::string localToplevel(initialTopLevel); std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); - std::string outputFileName(std::string( - this->GetOption("CPACK_PACKAGE_FILE_NAME")) + - this->GetOutputExtension()); + std::string outputFileName( + std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + + this->GetOutputExtension()); // all GROUP in one vs all COMPONENT in one localToplevel += "/" + compInstDirName; diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index cf072bbe6..22108351b 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -125,7 +125,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() } if (cmCPackProductBuildGenerator::CanGenerate()) { this->RegisterGenerator("productbuild", "Mac OSX pkg", - cmCPackProductBuildGenerator::CreateGenerator); + cmCPackProductBuildGenerator::CreateGenerator); } #endif #if !defined(_WIN32) && !defined(__QNXNTO__) && !defined(__BEOS__) && \ diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 7bc05d0b1..3d3ef31a3 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -11,17 +11,17 @@ ============================================================================*/ #include "cmCPackPKGGenerator.h" -#include "cmake.h" -#include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" -#include "cmSystemTools.h" -#include "cmMakefile.h" -#include "cmGeneratedFileStream.h" #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" +#include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmSystemTools.h" +#include "cmake.h" -#include #include +#include cmCPackPKGGenerator::cmCPackPKGGenerator() { @@ -39,13 +39,12 @@ bool cmCPackPKGGenerator::SupportsComponentInstallation() const int cmCPackPKGGenerator::InitializeInternal() { - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "cmCPackPKGGenerator::Initialize()" << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackPKGGenerator::Initialize()" + << std::endl); return this->Superclass::InitializeInternal(); } - std::string cmCPackPKGGenerator::GetPackageName( const cmCPackComponent& component) { @@ -53,16 +52,15 @@ std::string cmCPackPKGGenerator::GetPackageName( std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); packagesDir += ".dummy"; std::ostringstream out; - out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) - << "-" << component.Name << ".pkg"; + out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-" + << component.Name << ".pkg"; return out.str(); } else { return component.ArchiveFile + ".pkg"; } } -void cmCPackPKGGenerator::WriteDistributionFile( - const char* metapackageFile) +void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) { std::string distributionTemplate = this->FindTemplate("CPack.distribution.dist.in"); @@ -144,8 +142,8 @@ void cmCPackPKGGenerator::CreateChoiceOutline( out << "" << std::endl; } -void cmCPackPKGGenerator::CreateChoice( - const cmCPackComponentGroup& group, std::ostringstream& out) +void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, + std::ostringstream& out) { out << "" << std::endl; } -void cmCPackPKGGenerator::CreateChoice( - const cmCPackComponent& component, std::ostringstream& out) +void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, + std::ostringstream& out) { std::string packageId = "com."; packageId += this->GetOption("CPACK_PACKAGE_VENDOR"); @@ -277,8 +275,8 @@ std::string cmCPackPKGGenerator::EscapeForXML(std::string str) return str; } -bool cmCPackPKGGenerator::CopyCreateResourceFile( - const std::string& name, const std::string& dirName) +bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, + const std::string& dirName) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -323,8 +321,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile( return true; } -bool cmCPackPKGGenerator::CopyResourcePlistFile( - const std::string& name, const char* outName) +bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name, + const char* outName) { if (!outName) { outName = name.c_str(); diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index 3011f7838..20ba94c7b 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -13,7 +13,6 @@ #ifndef cmCPackPKGGenerator_h #define cmCPackPKGGenerator_h - #include "cmCPackGenerator.h" class cmCPackComponent; @@ -97,7 +96,6 @@ protected: // The PostFlight component when creating a metapackage cmCPackComponent PostFlightComponent; - }; #endif diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index aa9a27d6a..c2a13d044 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -11,17 +11,17 @@ ============================================================================*/ #include "cmCPackProductBuildGenerator.h" -#include "cmake.h" -#include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" -#include "cmSystemTools.h" -#include "cmMakefile.h" -#include "cmGeneratedFileStream.h" #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" +#include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmSystemTools.h" +#include "cmake.h" -#include #include +#include cmCPackProductBuildGenerator::cmCPackProductBuildGenerator() { @@ -37,56 +37,47 @@ int cmCPackProductBuildGenerator::PackageFiles() // TODO: Use toplevel // It is used! Is this an obsolete comment? - std::string packageDirFileName - = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); + std::string packageDirFileName = + this->GetOption("CPACK_TEMPORARY_DIRECTORY"); // Create the directory where component packages will be built. std::string basePackageDir = packageDirFileName; basePackageDir += "/Contents/Packages"; - if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) - { + if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating component packages directory: " << basePackageDir << std::endl); return 0; } - if (!this->Components.empty()) - { + if (!this->Components.empty()) { std::map::iterator compIt; for (compIt = this->Components.begin(); compIt != this->Components.end(); - ++compIt) - { + ++compIt) { std::string packageDir = toplevel; packageDir += '/'; packageDir += compIt->first; if (!this->GenerateComponentPackage(basePackageDir, GetPackageName(compIt->second), - packageDir, - &compIt->second)) - { + packageDir, &compIt->second)) { return 0; - } } } - else - { - if(!this->GenerateComponentPackage(basePackageDir, - this->GetOption("CPACK_PACKAGE_NAME"), - toplevel, NULL)) - { + } else { + if (!this->GenerateComponentPackage(basePackageDir, + this->GetOption("CPACK_PACKAGE_NAME"), + toplevel, NULL)) { return 0; } } // Copy or create all of the resource files we need. std::string resDir = packageDirFileName + "/Contents"; - if ( !this->CopyCreateResourceFile("License", resDir.c_str()) - || !this->CopyCreateResourceFile("ReadMe", resDir.c_str()) - || !this->CopyCreateResourceFile("Welcome", resDir.c_str())) - { + if (!this->CopyCreateResourceFile("License", resDir.c_str()) || + !this->CopyCreateResourceFile("ReadMe", resDir.c_str()) || + !this->CopyCreateResourceFile("Welcome", resDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" - << std::endl); + << std::endl); return 0; } @@ -97,13 +88,13 @@ int cmCPackProductBuildGenerator::PackageFiles() std::string version = this->GetOption("CPACK_PACKAGE_VERSION"); std::string productbuild = this->GetOption("CPACK_COMMAND_PRODUCTBUILD"); - pkgCmd << productbuild - << " --distribution \"" << packageDirFileName - << "/Contents/distribution.dist\"" - << " --package-path \"" << packageDirFileName << "/Contents/Packages" << "\"" - << " --resources \"" << resDir << "\"" - << " --version \"" << version << "\"" - << " \"" << packageFileNames[0] << "\""; + pkgCmd << productbuild << " --distribution \"" << packageDirFileName + << "/Contents/distribution.dist\"" + << " --package-path \"" << packageDirFileName << "/Contents/Packages" + << "\"" + << " --resources \"" << resDir << "\"" + << " --version \"" << version << "\"" + << " \"" << packageFileNames[0] << "\""; // Run ProductBuild return RunProductBuild(pkgCmd.str()); @@ -123,7 +114,6 @@ int cmCPackProductBuildGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_PKGBUILD", program.c_str()); - program = cmSystemTools::FindProgram("productbuild", no_paths, false); if (program.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find productbuild executable" @@ -135,9 +125,7 @@ int cmCPackProductBuildGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } - -bool cmCPackProductBuildGenerator::RunProductBuild( - const std::string& command) +bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/ProductBuildOutput.log"; @@ -145,12 +133,11 @@ bool cmCPackProductBuildGenerator::RunProductBuild( cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); std::string output, error_output; int retVal = 1; - bool res = cmSystemTools::RunSingleCommand(command.c_str(), - &output, &error_output, &retVal, 0, this->GeneratorVerbose, 0); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" - << std::endl); - if ( !res || retVal ) - { + bool res = + cmSystemTools::RunSingleCommand(command.c_str(), &output, &error_output, + &retVal, 0, this->GeneratorVerbose, 0); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl); + if (!res || retVal) { cmGeneratedFileStream ofs(tmpFile.c_str()); ofs << "# Run command: " << command << std::endl << "# Output:" << std::endl @@ -160,23 +147,20 @@ bool cmCPackProductBuildGenerator::RunProductBuild( << "Please check " << tmpFile << " for errors" << std::endl); return false; - } + } return true; } bool cmCPackProductBuildGenerator::GenerateComponentPackage( - const std::string& packageFileDir, - const std::string& packageFileName, - const std::string& packageDir, - const cmCPackComponent* component) + const std::string& packageFileDir, const std::string& packageFileName, + const std::string& packageDir, const cmCPackComponent* component) { std::string packageFile = packageFileDir; packageFile += '/'; packageFile += packageFileName; - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Building component package: " << - packageFile << std::endl); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Building component package: " + << packageFile << std::endl); const char* comp_name = component ? component->Name.c_str() : NULL; @@ -184,15 +168,13 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( const char* postflight = this->GetComponentScript("POSTFLIGHT", comp_name); std::string resDir = packageFileDir; - if(component) - { + if (component) { resDir += "/"; resDir += component->Name; } std::string scriptDir = resDir + "/scripts"; - if ( !cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) - { + if (!cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating installer directory: " << scriptDir << std::endl); @@ -202,20 +184,13 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( // if preflight, postflight, or postupgrade are set // then copy them into the script directory and make // them executable - if(preflight) - { - this->CopyInstallScript(scriptDir.c_str(), - preflight, - "preinstall"); + if (preflight) { + this->CopyInstallScript(scriptDir.c_str(), preflight, "preinstall"); } - if(postflight) - { - this->CopyInstallScript(scriptDir.c_str(), - postflight, - "postinstall"); + if (postflight) { + this->CopyInstallScript(scriptDir.c_str(), postflight, "postinstall"); } - // The command that will be used to run ProductBuild std::ostringstream pkgCmd; @@ -223,17 +198,15 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( pkgId += this->GetOption("CPACK_PACKAGE_VENDOR"); pkgId += '.'; pkgId += this->GetOption("CPACK_PACKAGE_NAME"); - if(component) - { + if (component) { pkgId += '.'; pkgId += component->Name; - } + } std::string version = this->GetOption("CPACK_PACKAGE_VERSION"); std::string pkgbuild = this->GetOption("CPACK_COMMAND_PKGBUILD"); - pkgCmd << pkgbuild - << " --root \"" << packageDir << "\"" + pkgCmd << pkgbuild << " --root \"" << packageDir << "\"" << " --identifier \"" << pkgId << "\"" << " --scripts \"" << scriptDir << "\"" << " --version \"" << version << "\"" @@ -245,12 +218,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( } const char* cmCPackProductBuildGenerator::GetComponentScript( - const char* script, - const char* component_name) + const char* script, const char* component_name) { std::string scriptname = std::string("CPACK_") + script + "_"; - if(component_name) - { + if (component_name) { scriptname += cmSystemTools::UpperCase(component_name); scriptname += "_"; } diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h index 0740f8933..b05b50a02 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.h +++ b/Source/CPack/cmCPackProductBuildGenerator.h @@ -13,7 +13,6 @@ #ifndef cmCPackProductBuildGenerator_h #define cmCPackProductBuildGenerator_h - #include "cmCPackPKGGenerator.h" class cmCPackComponent; @@ -54,7 +53,6 @@ protected: const char* GetComponentScript(const char* script, const char* script_component); - }; #endif From d91ec04402bce94cb29662e0de548438876d86d5 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Tue, 31 May 2016 10:51:50 -0400 Subject: [PATCH 026/929] Tests/Java: Clean up style of Java test code --- Tests/Java/A.java | 10 +++++----- Tests/Java/HelloWorld.java | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/Java/A.java b/Tests/Java/A.java index 403a7f889..b7fdb498e 100644 --- a/Tests/Java/A.java +++ b/Tests/Java/A.java @@ -1,11 +1,11 @@ class A { public A() - { - } + { + } public void printName() - { - System.out.println("A"); - } + { + System.out.println("A"); + } } diff --git a/Tests/Java/HelloWorld.java b/Tests/Java/HelloWorld.java index 378e37193..995ee4853 100644 --- a/Tests/Java/HelloWorld.java +++ b/Tests/Java/HelloWorld.java @@ -1,11 +1,11 @@ class HelloWorld { - public static void main(String args[]) - { - A a; - a = new A(); - a.printName(); - System.out.println("Hello World!"); - } + public static void main(String args[]) + { + A a; + a = new A(); + a.printName(); + System.out.println("Hello World!"); + } } From 5341c0d84af50c2ac5e4041885ab96f8d157ddfe Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Mon, 9 May 2016 14:59:58 -0400 Subject: [PATCH 027/929] UseJava: Add infrastructure to export targets Add additional functions to UseJava.cmake to create "exported" targets, similar to those of C/C++ libraries. In support of this, ensure that the JAR_FILE property of jar targets is always an absolute path. --- Modules/UseJava.cmake | 153 +++++++++++++++++++++++++++++++++++ Modules/javaTargets.cmake.in | 39 +++++++++ 2 files changed, 192 insertions(+) create mode 100644 Modules/javaTargets.cmake.in diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 7b3416ed4..6644bd4cc 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -217,6 +217,19 @@ # This command installs the TARGET_NAME files to the given DESTINATION. # It should be called in the same scope as add_jar() or it will fail. # +# Target Properties: +# +# :: +# +# The install_jar() function sets the INSTALL_DESTINATION target property +# on jars so installed. This property holds the DESTINATION as described +# above, and is used by install_jar_exports(). You can get this property +# with the +# get_property(TARGET PROPERTY INSTALL_DESTINATION) +# command. +# +# +# # :: # # install_jni_symlink(target_name destination) @@ -228,6 +241,24 @@ # # :: # +# install_jar_exports(TARGETS jar1 [jar2 ...] +# FILE export_filename +# DESTINATION destination [COMPONENT component]) +# +# This command installs a target export file export_filename for the named jar +# targets to the given DESTINATION. Its function is similar to that of +# install(EXPORTS). +# +# :: +# +# export_jars(TARGETS jar1 [jar2 ...] +# FILE export_filename) +# +# This command writes a target export file export_filename for the named jar +# targets. Its function is similar to that of export(). +# +# :: +# # create_javadoc( # PACKAGES pkg1 [pkg2 ...] # [SOURCEPATH ] @@ -396,7 +427,29 @@ function (__java_copy_file src dest comment) COMMENT ${comment}) endfunction () +function(__java_lcat VAR) + foreach(_line ${ARGN}) + set(${VAR} "${${VAR}}${_line}\n") + endforeach() + + set(${VAR} "${${VAR}}" PARENT_SCOPE) +endfunction() + +function(__java_export_jar VAR TARGET PATH) + get_target_property(_jarpath ${TARGET} JAR_FILE) + get_filename_component(_jarname ${_jarpath} NAME) + __java_lcat(${VAR} + "# Create imported target ${TARGET}" + "add_custom_target(${TARGET})" + "set_target_properties(${TARGET} PROPERTIES" + " JAR_FILE \"${PATH}/${_jarname}\")" + "" + ) + set(${VAR} "${${VAR}}" PARENT_SCOPE) +endfunction() + # define helper scripts +set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in) set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) @@ -435,6 +488,8 @@ function(add_jar _TARGET_NAME) if (NOT DEFINED _add_jar_OUTPUT_DIR) set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + else() + get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE) endif() if (_add_jar_ENTRY_POINT) @@ -716,6 +771,13 @@ function(INSTALL_JAR _TARGET_NAME) PROPERTY INSTALL_FILES ) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_DESTINATION + ${_DESTINATION} + ) if (__FILES) install( @@ -1288,3 +1350,94 @@ function (create_javah) set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE) endif() endfunction() + +function(export_jars) + # Parse and validate arguments + cmake_parse_arguments(_export_jars + "" + "FILE" + "TARGETS" + ${ARGN} + ) + if (NOT _export_jars_FILE) + message(SEND_ERROR "export_jars: FILE must be specified.") + endif() + if (NOT _export_jars_TARGETS) + message(SEND_ERROR "export_jars: TARGETS must be specified.") + endif() + + # Set content of generated exports file + string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}") + set(__targetdefs__ "") + foreach(_target ${_export_jars_TARGETS}) + get_target_property(_jarpath ${_target} JAR_FILE) + get_filename_component(_jarpath ${_jarpath} PATH) + __java_export_jar(__targetdefs__ ${_target} "${_jarpath}") + endforeach() + + # Generate exports file + configure_file( + ${_JAVA_EXPORT_TARGETS_SCRIPT} + ${_export_jars_FILE} + @ONLY + ) +endfunction() + +function(install_jar_exports) + # Parse and validate arguments + cmake_parse_arguments(_install_jar_exports + "" + "FILE;DESTINATION;COMPONENT" + "TARGETS" + ${ARGN} + ) + if (NOT _install_jar_exports_FILE) + message(SEND_ERROR "install_jar_exports: FILE must be specified.") + endif() + if (NOT _install_jar_exports_DESTINATION) + message(SEND_ERROR "install_jar_exports: DESTINATION must be specified.") + endif() + if (NOT _install_jar_exports_TARGETS) + message(SEND_ERROR "install_jar_exports: TARGETS must be specified.") + endif() + + if (_install_jar_exports_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_exports_COMPONENT}) + endif() + + # Determine relative path from installed export file to install prefix + if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION}) + file(RELATIVE_PATH _relpath + ${_install_jar_exports_DESTINATION} + ${CMAKE_INSTALL_PREFIX} + ) + else() + file(RELATIVE_PATH _relpath + ${CMAKE_INSTALL_PREFIX}/${_install_jar_exports_DESTINATION} + ${CMAKE_INSTALL_PREFIX} + ) + endif() + + # Set up unique location for generated exports file + string(SHA256 _hash "${_install_jar_exports_DESTINATION}") + set(_tmpdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/JavaExports/${_hash}) + + # Set content of generated exports file + string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}") + set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n") + foreach(_target ${_install_jar_exports_TARGETS}) + get_target_property(_dir ${_target} INSTALL_DESTINATION) + __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}") + endforeach() + __java_lcat(__targetdefs__ "\nunset(_prefix)") + + # Generate and install exports file + configure_file( + ${_JAVA_EXPORT_TARGETS_SCRIPT} + ${_tmpdir}/${_install_jar_exports_FILE} + @ONLY + ) + install(FILES ${_tmpdir}/${_install_jar_exports_FILE} + DESTINATION ${_install_jar_exports_DESTINATION} + ${_COMPONENT}) +endfunction() diff --git a/Modules/javaTargets.cmake.in b/Modules/javaTargets.cmake.in new file mode 100644 index 000000000..c5f9c7835 --- /dev/null +++ b/Modules/javaTargets.cmake.in @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8) +cmake_policy(PUSH) +cmake_policy(VERSION 2.8) + +#---------------------------------------------------------------- +# Generated CMake Java target import file. +#---------------------------------------------------------------- + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget @__targets__@) + list(APPEND _expectedTargets ${_expectedTarget}) + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + else() + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() +endforeach() +if("%${_targetsDefined}" STREQUAL "%${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR + "Some (but not all) targets in this export set were already defined.\n" + "Targets Defined: ${_targetsDefined}\n" + "Targets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + +@__targetdefs__@ +cmake_policy(POP) From 95d84369b802473e22bcb662a86175621bba54c6 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Tue, 31 May 2016 10:51:25 -0400 Subject: [PATCH 028/929] Tests: Add test for exported JARs Add a unit test to test the new functions to export JAR targets. The test builds three sub-projects: two that generate and export a JAR (one does a build-directory-only export, one an install-only export), and a third that consumes the first two as imported targets. --- Tests/CMakeLists.txt | 4 + .../BuildExport/CMakeLists.txt | 10 ++ Tests/JavaExportImport/BuildExport/Foo.java | 11 ++ Tests/JavaExportImport/CMakeLists.txt | 104 ++++++++++++++++++ Tests/JavaExportImport/Import/CMakeLists.txt | 14 +++ Tests/JavaExportImport/Import/Import.java | 10 ++ Tests/JavaExportImport/InitialCache.cmake.in | 5 + Tests/JavaExportImport/InstallExport/Bar.java | 11 ++ .../InstallExport/CMakeLists.txt | 14 +++ Tests/JavaExportImport/main.c | 4 + 10 files changed, 187 insertions(+) create mode 100644 Tests/JavaExportImport/BuildExport/CMakeLists.txt create mode 100644 Tests/JavaExportImport/BuildExport/Foo.java create mode 100644 Tests/JavaExportImport/CMakeLists.txt create mode 100644 Tests/JavaExportImport/Import/CMakeLists.txt create mode 100644 Tests/JavaExportImport/Import/Import.java create mode 100644 Tests/JavaExportImport/InitialCache.cmake.in create mode 100644 Tests/JavaExportImport/InstallExport/Bar.java create mode 100644 Tests/JavaExportImport/InstallExport/CMakeLists.txt create mode 100644 Tests/JavaExportImport/main.c diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9442ea75c..24b42eea0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3104,6 +3104,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release find_package(Java COMPONENTS Development QUIET) if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW AND NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") + + set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) + ADD_TEST_MACRO(JavaExportImport JavaExportImport) + get_filename_component(JNIPATH ${JAVA_COMPILE} PATH) find_file(JNI_H jni.h "${JNIPATH}/../include" diff --git a/Tests/JavaExportImport/BuildExport/CMakeLists.txt b/Tests/JavaExportImport/BuildExport/CMakeLists.txt new file mode 100644 index 000000000..953f9d005 --- /dev/null +++ b/Tests/JavaExportImport/BuildExport/CMakeLists.txt @@ -0,0 +1,10 @@ +project(foo Java) + +cmake_minimum_required (VERSION 3.5) +set(CMAKE_VERBOSE_MAKEFILE 1) + +find_package(Java COMPONENTS Development) +include(UseJava) + +add_jar(${PROJECT_NAME} Foo.java) +export_jars(TARGETS ${PROJECT_NAME} FILE JavaBuildExportTestConfig.cmake) diff --git a/Tests/JavaExportImport/BuildExport/Foo.java b/Tests/JavaExportImport/BuildExport/Foo.java new file mode 100644 index 000000000..20815ba94 --- /dev/null +++ b/Tests/JavaExportImport/BuildExport/Foo.java @@ -0,0 +1,11 @@ +class Foo +{ + public Foo() + { + } + + public void printName() + { + System.out.println("Foo"); + } +} diff --git a/Tests/JavaExportImport/CMakeLists.txt b/Tests/JavaExportImport/CMakeLists.txt new file mode 100644 index 000000000..a075301f9 --- /dev/null +++ b/Tests/JavaExportImport/CMakeLists.txt @@ -0,0 +1,104 @@ +cmake_minimum_required (VERSION 3.5) +project(JavaExportImport) +if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") +endif() + +find_package(Java COMPONENTS Development) + +# Wipe out the install tree to make sure the exporter works. +add_custom_command( + OUTPUT ${JavaExportImport_BINARY_DIR}/CleanupProject + COMMAND ${CMAKE_COMMAND} -E remove_directory ${JavaExportImport_BINARY_DIR}/Root + ) +add_custom_target(CleanupTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/CleanupProject) +set_property( + SOURCE ${JavaExportImport_BINARY_DIR}/CleanupProject + PROPERTY SYMBOLIC 1 + ) + +if(CMAKE_CONFIGURATION_TYPES) + set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") +else() + if(CMAKE_BUILD_TYPE) + set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}") + else() + set(NESTED_CONFIG_TYPE) + endif() +endif() + +configure_file(${JavaExportImport_SOURCE_DIR}/InitialCache.cmake.in + ${JavaExportImport_BINARY_DIR}/InitialCache.cmake @ONLY) + +# Build the build exporter. +add_custom_command( + OUTPUT ${JavaExportImport_BINARY_DIR}/BuildExportProject + COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE} + --build-and-test + ${JavaExportImport_SOURCE_DIR}/BuildExport + ${JavaExportImport_BINARY_DIR}/BuildExport + --build-noclean + --build-project BuildExport + --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options -C${JavaExportImport_BINARY_DIR}/InitialCache.cmake + VERBATIM + ) +add_custom_target(BuildExportTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/BuildExportProject) +add_dependencies(BuildExportTarget CleanupTarget) +set_property( + SOURCE ${JavaExportImport_BINARY_DIR}/BuildExportProject + PROPERTY SYMBOLIC 1 + ) + +# Build and install the install exporter. +add_custom_command( + OUTPUT ${JavaExportImport_BINARY_DIR}/InstallExportProject + COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE} + --build-and-test + ${JavaExportImport_SOURCE_DIR}/InstallExport + ${JavaExportImport_BINARY_DIR}/InstallExport + --build-noclean + --build-project InstallExport + --build-target install + --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options -C${JavaExportImport_BINARY_DIR}/InitialCache.cmake + VERBATIM + ) +add_custom_target(InstallExportTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/InstallExportProject) +add_dependencies(InstallExportTarget CleanupTarget) +set_property( + SOURCE ${JavaExportImport_BINARY_DIR}/InstallExportProject + PROPERTY SYMBOLIC 1 + ) + +# Build and install the importer. +add_custom_command( + OUTPUT ${JavaExportImport_BINARY_DIR}/ImportProject + COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE} + --build-and-test + ${JavaExportImport_SOURCE_DIR}/Import + ${JavaExportImport_BINARY_DIR}/Import + --build-noclean + --build-project Import + --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options + -C${JavaExportImport_BINARY_DIR}/InitialCache.cmake + -DJavaBuildExportTest_DIR:PATH=${JavaExportImport_BINARY_DIR}/BuildExport + -DJavaInstallExportTest_DIR:PATH=${JavaExportImport_BINARY_DIR}/Root/share/cmake + VERBATIM + ) +add_custom_target(ImportTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/ImportProject) +add_dependencies(ImportTarget BuildExportTarget InstallExportTarget) +set_property( + SOURCE ${JavaExportImport_BINARY_DIR}/ImportProject + PROPERTY SYMBOLIC 1 + ) + +add_executable(JavaExportImport main.c) +add_dependencies(JavaExportImport ImportTarget) diff --git a/Tests/JavaExportImport/Import/CMakeLists.txt b/Tests/JavaExportImport/Import/CMakeLists.txt new file mode 100644 index 000000000..79a14477a --- /dev/null +++ b/Tests/JavaExportImport/Import/CMakeLists.txt @@ -0,0 +1,14 @@ +project(import Java) + +cmake_minimum_required (VERSION 3.5) +set(CMAKE_VERBOSE_MAKEFILE 1) + +find_package(Java COMPONENTS Development) +include(UseJava) + +find_package(JavaBuildExportTest REQUIRED) +find_package(JavaInstallExportTest REQUIRED) + +add_jar(${PROJECT_NAME} + SOURCES Import.java + INCLUDE_JARS foo bar) diff --git a/Tests/JavaExportImport/Import/Import.java b/Tests/JavaExportImport/Import/Import.java new file mode 100644 index 000000000..08eb03ff6 --- /dev/null +++ b/Tests/JavaExportImport/Import/Import.java @@ -0,0 +1,10 @@ +class Import +{ + public static void main(String args[]) + { + Foo foo = new Foo(); + Bar bar = new Bar(); + foo.printName(); + bar.printName(); + } +} diff --git a/Tests/JavaExportImport/InitialCache.cmake.in b/Tests/JavaExportImport/InitialCache.cmake.in new file mode 100644 index 000000000..d15e6d1be --- /dev/null +++ b/Tests/JavaExportImport/InitialCache.cmake.in @@ -0,0 +1,5 @@ +set(CMAKE_MAKE_PROGRAM "@CMake_TEST_NESTED_MAKE_PROGRAM@" CACHE FILEPATH "Make Program") +set(Java_JAVA_EXECUTABLE "@Java_JAVA_EXECUTABLE@" CACHE STRING "Java Interpreter") +set(Java_JAVAC_EXECUTABLE "@Java_JAVAC_EXECUTABLE@" CACHE STRING "Java Compiler") +set(Java_JAR_EXECUTABLE "@Java_JAR_EXECUTABLE@" CACHE STRING "Java Archive Tool") +set(CMAKE_INSTALL_PREFIX "@JavaExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix") diff --git a/Tests/JavaExportImport/InstallExport/Bar.java b/Tests/JavaExportImport/InstallExport/Bar.java new file mode 100644 index 000000000..a1068a8a7 --- /dev/null +++ b/Tests/JavaExportImport/InstallExport/Bar.java @@ -0,0 +1,11 @@ +class Bar +{ + public Bar() + { + } + + public void printName() + { + System.out.println("Bar"); + } +} diff --git a/Tests/JavaExportImport/InstallExport/CMakeLists.txt b/Tests/JavaExportImport/InstallExport/CMakeLists.txt new file mode 100644 index 000000000..0a9afd9cf --- /dev/null +++ b/Tests/JavaExportImport/InstallExport/CMakeLists.txt @@ -0,0 +1,14 @@ +project(bar Java) + +cmake_minimum_required (VERSION 3.5) +set(CMAKE_VERBOSE_MAKEFILE 1) + +find_package(Java COMPONENTS Development) +include(UseJava) + +add_jar(${PROJECT_NAME} Bar.java) +install_jar(${PROJECT_NAME} DESTINATION share/java) +install_jar_exports( + TARGETS ${PROJECT_NAME} + FILE JavaInstallExportTestConfig.cmake + DESTINATION share/cmake) diff --git a/Tests/JavaExportImport/main.c b/Tests/JavaExportImport/main.c new file mode 100644 index 000000000..f8b643afb --- /dev/null +++ b/Tests/JavaExportImport/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} From 89df91b938f22e14f647244093b08d49ddb41385 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jun 2016 08:49:59 -0400 Subject: [PATCH 029/929] Help: Add notes for topic 'java-export-targets' --- Help/release/dev/java-export-targets.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/java-export-targets.rst diff --git a/Help/release/dev/java-export-targets.rst b/Help/release/dev/java-export-targets.rst new file mode 100644 index 000000000..5b70e976c --- /dev/null +++ b/Help/release/dev/java-export-targets.rst @@ -0,0 +1,6 @@ +java-export-targets +------------------- + +* The :module:`UseJava` module gained APIs to "export" jar targets + for use by external CMake projects. See the ``install_jar_exports`` + and ``export_jars`` functions. From 188baef00c3b19c6ee6ed8c3735817bae50f110e Mon Sep 17 00:00:00 2001 From: Harry Mallon Date: Wed, 25 May 2016 18:18:47 +0100 Subject: [PATCH 030/929] find_path: Fix location of in a framework on OS X After finding it in `foo.Framework/Headers/dir/header.h`, we should report the `foo.Framework/Headers` directory, not `foo.Framework/Headers/dir`, because the former is what actually contains the path the caller wishes to include. --- Source/cmFindPathCommand.cxx | 2 +- .../Frameworks/Foo.framework/Headers/Some/Dir/Header.h | 0 Tests/RunCMake/find_path/FrameworksWithSubdirs-stdout.txt | 1 + Tests/RunCMake/find_path/FrameworksWithSubdirs.cmake | 3 +++ Tests/RunCMake/find_path/RunCMakeTest.cmake | 4 ++++ 5 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/find_path/Frameworks/Foo.framework/Headers/Some/Dir/Header.h create mode 100644 Tests/RunCMake/find_path/FrameworksWithSubdirs-stdout.txt create mode 100644 Tests/RunCMake/find_path/FrameworksWithSubdirs.cmake diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index d24be6aeb..d71fc1ae9 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -117,7 +117,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, if (this->IncludeFileInPath) { return fheader; } - fheader = cmSystemTools::GetFilenamePath(fheader); + fheader.resize(fheader.size() - file.size()); return fheader; } return ""; diff --git a/Tests/RunCMake/find_path/Frameworks/Foo.framework/Headers/Some/Dir/Header.h b/Tests/RunCMake/find_path/Frameworks/Foo.framework/Headers/Some/Dir/Header.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/find_path/FrameworksWithSubdirs-stdout.txt b/Tests/RunCMake/find_path/FrameworksWithSubdirs-stdout.txt new file mode 100644 index 000000000..001a3e9c7 --- /dev/null +++ b/Tests/RunCMake/find_path/FrameworksWithSubdirs-stdout.txt @@ -0,0 +1 @@ +-- SOME_INCLUDE_DIR='[^']*Tests/RunCMake/find_path/Frameworks/Foo.framework/Headers' diff --git a/Tests/RunCMake/find_path/FrameworksWithSubdirs.cmake b/Tests/RunCMake/find_path/FrameworksWithSubdirs.cmake new file mode 100644 index 000000000..b28602151 --- /dev/null +++ b/Tests/RunCMake/find_path/FrameworksWithSubdirs.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FRAMEWORK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Frameworks") +find_path(SOME_INCLUDE_DIR "Some/Dir/Header.h") +message(STATUS "SOME_INCLUDE_DIR='${SOME_INCLUDE_DIR}'") diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake index 5ce96e0e8..bf0fa8951 100644 --- a/Tests/RunCMake/find_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -3,3 +3,7 @@ include(RunCMake) if(WIN32 OR CYGWIN) run_cmake(PrefixInPATH) endif() + +if(APPLE) + run_cmake(FrameworksWithSubdirs) +endif() From 132b8989680b50cb9cc9c72e2ffb806cfb3534c2 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 7 Jun 2016 22:46:40 +0100 Subject: [PATCH 031/929] FindBZip2: Search for additional bz2d debug library name --- Modules/FindBZip2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 6af42ddb5..b6700258e 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -37,7 +37,7 @@ find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include) if (NOT BZIP2_LIBRARIES) find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib) - find_library(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) + find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(BZIP2) From 1cfc750150065ee3b65ad66d2b37a3b28a9e799d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 8 Jun 2016 00:01:07 -0400 Subject: [PATCH 032/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8428ac0ac..1991a6d0e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160607) +set(CMake_VERSION_PATCH 20160608) #set(CMake_VERSION_RC 1) From ea59867187e8bdb8a7ffda37ad58e7f8493ebf7c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jun 2016 10:15:29 -0400 Subject: [PATCH 033/929] Run ranlib on archives only if the tool is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CMakeFindBinUtils sets CMAKE_RANLIB to `:` if it is not available in order to get a no-op. This does not work on a Windows host build environment that runs commands in `cmd` instead of `sh`. Teach the Ninja and Makefile generators to simply skip the command if it is `:`. This this was already done by the Makefile generator since commit v2.6.0~3161 (BUG: Do not write link script lines that use the ':', 2006-06-18), but only when using a link script. Reported-by: Michael Jäntsch --- Source/cmMakefileLibraryTargetGenerator.cxx | 5 ++++- Source/cmNinjaNormalTargetGenerator.cxx | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 128291d29..0998eb811 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -676,7 +676,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( i != archiveFinishCommands.end(); ++i) { std::string cmd = *i; this->LocalGenerator->ExpandRuleVariables(cmd, vars); - real_link_commands.push_back(cmd); + // If there is no ranlib the command will be ":". Skip it. + if (!cmd.empty() && cmd[0] != ':') { + real_link_commands.push_back(cmd); + } } } else { // Get the set of commands. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3e915450e..be6afeef6 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -144,6 +144,14 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule() const this->GetGeneratorTarget()->GetName()); } +struct cmNinjaRemoveNoOpCommands +{ + bool operator()(std::string const& cmd) + { + return cmd.empty() || cmd[0] == ':'; + } +}; + void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) { cmState::TargetType targetType = this->GetGeneratorTarget()->GetType(); @@ -231,6 +239,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) i != linkCmds.end(); ++i) { this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); } + { + // If there is no ranlib the command will be ":". Skip it. + std::vector::iterator newEnd = std::remove_if( + linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands()); + linkCmds.erase(newEnd, linkCmds.end()); + } + linkCmds.insert(linkCmds.begin(), "$PRE_LINK"); linkCmds.push_back("$POST_BUILD"); std::string linkCmd = From adf4df28caf621569d9d0d62011fc38773710319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Sat, 4 Jun 2016 20:48:23 +0200 Subject: [PATCH 034/929] Add FindVulkan.cmake. This adds FindVulkan with corresponding tests. --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindVulkan.rst | 1 + Help/release/dev/FindVulkan.rst | 4 ++ Modules/FindVulkan.cmake | 85 ++++++++++++++++++++++++++++ Tests/CMakeLists.txt | 4 ++ Tests/FindVulkan/CMakeLists.txt | 10 ++++ Tests/FindVulkan/Test/CMakeLists.txt | 15 +++++ Tests/FindVulkan/Test/main.c | 29 ++++++++++ 8 files changed, 149 insertions(+) create mode 100644 Help/module/FindVulkan.rst create mode 100644 Help/release/dev/FindVulkan.rst create mode 100644 Modules/FindVulkan.cmake create mode 100644 Tests/FindVulkan/CMakeLists.txt create mode 100644 Tests/FindVulkan/Test/CMakeLists.txt create mode 100644 Tests/FindVulkan/Test/main.c diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 62910cf5a..8c9c4be62 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -209,6 +209,7 @@ All Modules /module/FindTIFF /module/FindUnixCommands /module/FindVTK + /module/FindVulkan /module/FindWget /module/FindWish /module/FindwxWidgets diff --git a/Help/module/FindVulkan.rst b/Help/module/FindVulkan.rst new file mode 100644 index 000000000..adf824ebe --- /dev/null +++ b/Help/module/FindVulkan.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindVulkan.cmake diff --git a/Help/release/dev/FindVulkan.rst b/Help/release/dev/FindVulkan.rst new file mode 100644 index 000000000..bb5447eff --- /dev/null +++ b/Help/release/dev/FindVulkan.rst @@ -0,0 +1,4 @@ +FindVulkan +---------- + +* A :module:`FindVulkan` module was added. diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake new file mode 100644 index 000000000..b335f5f24 --- /dev/null +++ b/Modules/FindVulkan.cmake @@ -0,0 +1,85 @@ +#.rst: +# FindVulkan +# ---------- +# +# Try to find Vulkan +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if +# Vulkan has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables:: +# +# Vulkan_FOUND - True if Vulkan was found +# Vulkan_INCLUDE_DIRS - include directories for Vulkan +# Vulkan_LIBRARIES - link against this library to use Vulkan +# +# The module will also define two cache variables:: +# +# Vulkan_INCLUDE_DIR - the Vulkan include directory +# Vulkan_LIBRARY - the path to the Vulkan library +# + +#============================================================================= +# Copyright 2016 Matthaeus G. Chajdas +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if(WIN32) + find_path(Vulkan_INCLUDE_DIR + NAMES vulkan/vulkan.h + PATHS + "$ENV{VULKAN_SDK}/Include" + ) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(Vulkan_LIBRARY + NAMES vulkan-1 + PATHS + "$ENV{VULKAN_SDK}/Bin") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(Vulkan_LIBRARY + NAMES vulkan-1 + PATHS + "$ENV{VULKAN_SDK}/Bin32") + endif() +else() + find_path(Vulkan_INCLUDE_DIR + NAMES vulkan/vulkan.h + PATHS + "$ENV{VULKAN_SDK}/include") + find_library(Vulkan_LIBRARY + NAMES vulkan + PATHS + "$ENV{VULKAN_SDK}/lib") +endif() + +set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) +set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Vulkan + DEFAULT_MSG + Vulkan_LIBRARY Vulkan_INCLUDE_DIR) + +mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) + +if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) + add_library(Vulkan::Vulkan UNKNOWN IMPORTED) + set_target_properties(Vulkan::Vulkan PROPERTIES + IMPORTED_LOCATION "${Vulkan_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b72ecf5da..20f6c35bf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1394,6 +1394,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindTIFF) endif() + if(CMake_TEST_FindVulkan) + add_subdirectory(FindVulkan) + endif() + if(CMake_TEST_FindXalanC) add_subdirectory(FindXalanC) endif() diff --git a/Tests/FindVulkan/CMakeLists.txt b/Tests/FindVulkan/CMakeLists.txt new file mode 100644 index 000000000..46ce1c65e --- /dev/null +++ b/Tests/FindVulkan/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindVulkan.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindVulkan/Test" + "${CMake_BINARY_DIR}/Tests/FindVulkan/Test" + ${build_generator_args} + --build-project TestFindVulkan + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt new file mode 100644 index 000000000..0b13d5320 --- /dev/null +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindVulkan C) +include(CTest) + +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../) +find_package(Vulkan REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt Vulkan::Vulkan) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${Vulkan_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${Vulkan_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c new file mode 100644 index 000000000..78dcb65ed --- /dev/null +++ b/Tests/FindVulkan/Test/main.c @@ -0,0 +1,29 @@ +#include + +int main() +{ + VkInstanceCreateInfo instanceCreateInfo = {}; + instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + + VkApplicationInfo applicationInfo = {}; + applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + applicationInfo.apiVersion = VK_API_VERSION_1_0; + applicationInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); + applicationInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0); + applicationInfo.pApplicationName = "CMake Test application"; + applicationInfo.pEngineName = "CMake Test Engine"; + + instanceCreateInfo.pApplicationInfo = &applicationInfo; + + VkInstance instance = VK_NULL_HANDLE; + vkCreateInstance(&instanceCreateInfo, NULL, &instance); + + // We can't assert here because in general vkCreateInstance will return an + // error if no driver is found - but if we get here, FindVulkan is working + + if (instance != VK_NULL_HANDLE) { + vkDestroyInstance (instance, NULL); + } + + return 0; +} From b8a00b6721948f0eebb1bf53cdfa9a242b26f03c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jun 2016 12:56:50 -0400 Subject: [PATCH 035/929] Tests/FindVulkan: Run clang-format --- Tests/FindVulkan/Test/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c index 78dcb65ed..b29c9ec9e 100644 --- a/Tests/FindVulkan/Test/main.c +++ b/Tests/FindVulkan/Test/main.c @@ -22,7 +22,7 @@ int main() // error if no driver is found - but if we get here, FindVulkan is working if (instance != VK_NULL_HANDLE) { - vkDestroyInstance (instance, NULL); + vkDestroyInstance(instance, NULL); } return 0; From b0d3e693f1ab466451c7a0d17bbbdd3cae76e93a Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 7 Jun 2016 16:30:58 +0200 Subject: [PATCH 036/929] cmLocalGenerator: Pass configuration to GetTargetFlags Move the configuration lookup to call sites. This will allow multi-configuration callers to use the method. --- Source/cmGhsMultiTargetGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 10 ++++------ Source/cmLocalGenerator.h | 8 ++++---- Source/cmNinjaNormalTargetGenerator.cxx | 6 +++--- Source/cmake.cxx | 7 +++++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 8565fdb9c..3d35114eb 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -371,7 +371,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( bool useWatcomQuote = this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE"); this->LocalGenerator->GetTargetFlags( - linkLibraries, flags, linkFlags, frameworkPath, linkPath, + config, linkLibraries, flags, linkFlags, frameworkPath, linkPath, this->GeneratorTarget, useWatcomQuote); linkFlags = cmSystemTools::TrimWhitespace(linkFlags); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b748b9c8e..b3694201b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1152,13 +1152,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, } void cmLocalGenerator::GetTargetFlags( - std::string& linkLibs, std::string& flags, std::string& linkFlags, - std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target, - bool useWatcomQuote) + const std::string& config, std::string& linkLibs, std::string& flags, + std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, + cmGeneratorTarget* target, bool useWatcomQuote) { - std::string buildType = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - buildType = cmSystemTools::UpperCase(buildType); + const std::string buildType = cmSystemTools::UpperCase(config); const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5c603a6be..5ced64862 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -308,10 +308,10 @@ public: /** Fill out these strings for the given target. Libraries to link, * flags, and linkflags. */ - void GetTargetFlags(std::string& linkLibs, std::string& flags, - std::string& linkFlags, std::string& frameworkPath, - std::string& linkPath, cmGeneratorTarget* target, - bool useWatcomQuote); + void GetTargetFlags(const std::string& config, std::string& linkLibs, + std::string& flags, std::string& linkFlags, + std::string& frameworkPath, std::string& linkPath, + cmGeneratorTarget* target, bool useWatcomQuote); virtual void ComputeObjectFilenames( std::map& mapping, diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3e915450e..60eb904f9 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -434,9 +434,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() vars["TARGET_FILE"] = localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL); - localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], - vars["LINK_FLAGS"], frameworkPath, linkPath, - &genTarget, useWatcomQuote); + localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"], + vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, + linkPath, &genTarget, useWatcomQuote); if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") && gt.GetType() == cmState::SHARED_LIBRARY) { if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 89ea9559d..f35939b25 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -482,6 +482,9 @@ bool cmake::FindPackage(const std::vector& args) mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType); } + std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); + buildType = cmSystemTools::UpperCase(buildType); + std::string linkLibs; std::string frameworkPath; std::string linkPath; @@ -490,8 +493,8 @@ bool cmake::FindPackage(const std::vector& args) gg->CreateGenerationObjects(); cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName()); cmLocalGenerator* lg = gtgt->GetLocalGenerator(); - lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - gtgt, false); + lg->GetTargetFlags(buildType, linkLibs, frameworkPath, linkPath, flags, + linkFlags, gtgt, false); linkLibs = frameworkPath + linkPath + linkLibs; printf("%s\n", linkLibs.c_str()); From de4ee088e7ab60213b551ecf98bc9e1b512ee393 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 8 Jun 2016 11:29:35 +0200 Subject: [PATCH 037/929] cmCommonTargetGenerator: De-duplicate CMAKE_BUILD_TYPE lookup --- Source/cmCommonTargetGenerator.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a6f2a2e60..cb62bde4d 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -159,8 +159,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) if (const char* modpath_flag = this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = this->ConfigName; this->LocalGenerator->GetIncludeDirectories( includes, this->GeneratorTarget, "C", config); for (std::vector::const_iterator idi = includes.begin(); @@ -202,6 +201,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) { + std::string const& config = this->ConfigName; if (!this->Makefile->IsOn("APPLE")) { return std::string(); } @@ -218,8 +218,6 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) #endif std::vector includes; - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); // check all include directories for frameworks as this @@ -235,9 +233,8 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) } std::string flags; - const char* cfg = this->LocalGenerator->GetConfigName().c_str(); if (cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(cfg)) { + this->GeneratorTarget->GetLinkInformation(config)) { std::vector const& frameworks = cli->GetFrameworkPaths(); for (std::vector::const_iterator i = frameworks.begin(); i != frameworks.end(); ++i) { From fa169fe8a7f2066eaa40393b4b7979daf42065e4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:26 +0100 Subject: [PATCH 038/929] Parser: Merge identical conditions --- Source/cmListFileCache.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 33731e047..036a2b116 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -181,9 +181,6 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf) mf->SetPolicyVersion("2.4"); } } - } - - if (topLevel) { bool hasProject = false; // search for a project command for (std::vector::iterator i = this->Functions.begin(); From 87ffd76d1a33885a4cddff70a9909ad88c2aeacc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:25 +0100 Subject: [PATCH 039/929] cmake: Make internal method file static --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 89ea9559d..4d2dfe855 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2225,7 +2225,7 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t) return isVisible; } -bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) +static bool printMessagePreamble(cmake::MessageType t, std::ostream& msg) { // Construct the message header. if (t == cmake::FATAL_ERROR) { @@ -2312,7 +2312,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } std::ostringstream msg; - if (!this->PrintMessagePreamble(t, msg)) { + if (!printMessagePreamble(t, msg)) { return; } diff --git a/Source/cmake.h b/Source/cmake.h index 266c33d3d..f6d335fe8 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -500,8 +500,6 @@ private: * warning and error output CMake variables, in the cache. */ bool IsMessageTypeVisible(cmake::MessageType t); - - bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg); }; #define CMAKE_STANDARD_OPTIONS_TABLE \ From 6e65808516994fe268c4ec87107fca6da6600a9c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:23 +0100 Subject: [PATCH 040/929] cmake: Fix constness of methods --- Source/cmake.cxx | 15 ++++++++------- Source/cmake.h | 14 +++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4d2dfe855..605da8145 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2176,7 +2176,7 @@ static bool cmakeCheckStampList(const char* stampList) return true; } -cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) +cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) const { bool warningsAsErrors; @@ -2200,7 +2200,7 @@ cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) return t; } -bool cmake::IsMessageTypeVisible(cmake::MessageType t) +bool cmake::IsMessageTypeVisible(cmake::MessageType t) const { bool isVisible = true; @@ -2296,7 +2296,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) } void cmake::IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace, bool force) + cmListFileBacktrace const& backtrace, + bool force) const { if (!force) { // override the message type, if needed, for warnings and errors @@ -2448,7 +2449,7 @@ void cmake::RunCheckForUnusedVariables() #endif } -bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) +bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) const { /* * The suppression CMake variable may be set in the CMake configuration file @@ -2482,7 +2483,7 @@ void cmake::SetSuppressDevWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) +bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) const { /* * The suppression CMake variable may be set in the CMake configuration file @@ -2517,7 +2518,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) +bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) const { if (mf) { return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && @@ -2548,7 +2549,7 @@ void cmake::SetDevWarningsAsErrors(bool b) cmState::INTERNAL); } -bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) +bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) const { if (mf) { return mf->IsOn("CMAKE_ERROR_DEPRECATED"); diff --git a/Source/cmake.h b/Source/cmake.h index f6d335fe8..29c010de4 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -339,7 +339,7 @@ public: * Returns false, by default, if developer warnings should be shown, true * otherwise. */ - bool GetSuppressDevWarnings(cmMakefile const* mf = NULL); + bool GetSuppressDevWarnings(cmMakefile const* mf = NULL) const; /* * Set the state of the suppression of developer (author) warnings. */ @@ -350,7 +350,7 @@ public: * Returns false, by default, if deprecated warnings should be shown, true * otherwise. */ - bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL); + bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL) const; /* * Set the state of the suppression of deprecated warnings. */ @@ -361,7 +361,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL); + bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL) const; /** * Set the state of treating developer (author) warnings as errors. */ @@ -372,7 +372,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL); + bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL) const; /** * Set the state of treating developer (author) warnings as errors. */ @@ -382,7 +382,7 @@ public: void IssueMessage( cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace(), - bool force = false); + bool force = false) const; ///! run the --build option int Build(const std::string& dir, const std::string& target, @@ -493,13 +493,13 @@ private: * Convert a message type between a warning and an error, based on the state * of the error output CMake variables, in the cache. */ - cmake::MessageType ConvertMessageType(cmake::MessageType t); + cmake::MessageType ConvertMessageType(cmake::MessageType t) const; /* * Check if messages of this type should be output, based on the state of the * warning and error output CMake variables, in the cache. */ - bool IsMessageTypeVisible(cmake::MessageType t); + bool IsMessageTypeVisible(cmake::MessageType t) const; }; #define CMAKE_STANDARD_OPTIONS_TABLE \ From f9cc43ea37d8b4e2a482cb9004cec2bd8f824857 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 8 Jun 2016 15:18:28 +0200 Subject: [PATCH 041/929] cmake: remove unnused member Verbose --- Source/cmake.cxx | 9 ++------- Source/cmake.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 605da8145..b76342611 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -145,7 +145,6 @@ cmake::cmake() } #endif - this->Verbose = false; this->GlobalGenerator = 0; this->ProgressCallback = 0; this->ProgressCallbackClientData = 0; @@ -555,9 +554,7 @@ void cmake::SetArgs(const std::vector& args, this->VSSolutionFile = args[++i]; } #endif - else if (arg.find("-V", 0) == 0) { - this->Verbose = true; - } else if (arg.find("-D", 0) == 0) { + else if (arg.find("-D", 0) == 0) { // skip for now } else if (arg.find("-U", 0) == 0) { // skip for now @@ -1989,9 +1986,7 @@ int cmake::GetSystemInformation(std::vector& args) bool writeToStdout = true; for (unsigned int i = 1; i < args.size(); ++i) { std::string arg = args[i]; - if (arg.find("-V", 0) == 0) { - this->Verbose = true; - } else if (arg.find("-G", 0) == 0) { + if (arg.find("-G", 0) == 0) { std::string value = arg.substr(2); if (value.empty()) { ++i; diff --git a/Source/cmake.h b/Source/cmake.h index 29c010de4..4958a05dc 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -455,7 +455,6 @@ private: void operator=(const cmake&); // Not implemented. ProgressCallbackType ProgressCallback; void* ProgressCallbackClientData; - bool Verbose; bool InTryCompile; WorkingMode CurrentWorkingMode; bool DebugOutput; From 9f25fc4dbb0fa3c027beb46c03c8b18507811cab Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 8 Jun 2016 22:29:15 +0200 Subject: [PATCH 042/929] Prefer std::ostream& over derivatives as parameters --- Source/CPack/cmCPackNSISGenerator.cxx | 8 ++++---- Source/CPack/cmCPackNSISGenerator.h | 6 +++--- Source/CTest/cmCTestBatchTestHandler.cxx | 4 ++-- Source/CTest/cmCTestBatchTestHandler.h | 4 ++-- Source/cmTarget.cxx | 3 +-- Source/cmTarget.h | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 9fa588d07..5123edda2 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -516,8 +516,8 @@ int cmCPackNSISGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str, - std::ostringstream& deleteStr) +void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str, + std::ostream& deleteStr) { const char* cpackMenuLinks = this->GetOption("CPACK_NSIS_MENU_LINKS"); if (!cpackMenuLinks) { @@ -621,7 +621,7 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const } std::string cmCPackNSISGenerator::CreateComponentDescription( - cmCPackComponent* component, std::ostringstream& macrosOut) + cmCPackComponent* component, std::ostream& macrosOut) { // Basic description of the component std::string componentCode = "Section "; @@ -873,7 +873,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription( } std::string cmCPackNSISGenerator::CreateComponentGroupDescription( - cmCPackComponentGroup* group, std::ostringstream& macrosOut) + cmCPackComponentGroup* group, std::ostream& macrosOut) { if (group->Components.empty() && group->Subgroups.empty()) { // Silently skip empty groups. NSIS doesn't support them. diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index fa52902d6..ae3ccca6e 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -40,7 +40,7 @@ public: protected: virtual int InitializeInternal(); - void CreateMenuLinks(std::ostringstream& str, std::ostringstream& deleteStr); + void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr); int PackageFiles(); virtual const char* GetOutputExtension() { return ".exe"; } virtual const char* GetOutputPostfix() { return "win32"; } @@ -56,7 +56,7 @@ protected: /// particular component. Any added macros will be emitted via /// macrosOut. std::string CreateComponentDescription(cmCPackComponent* component, - std::ostringstream& macrosOut); + std::ostream& macrosOut); /// Produce NSIS code that selects all of the components that this component /// depends on, recursively. @@ -72,7 +72,7 @@ protected: /// particular component group, including its components. Any /// added macros will be emitted via macrosOut. std::string CreateComponentGroupDescription(cmCPackComponentGroup* group, - std::ostringstream& macrosOut); + std::ostream& macrosOut); /// Translations any newlines found in the string into \\r\\n, so that the /// resulting string can be used within NSIS. diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx index 386c8d523..70f84cb1a 100644 --- a/Source/CTest/cmCTestBatchTestHandler.cxx +++ b/Source/CTest/cmCTestBatchTestHandler.cxx @@ -45,7 +45,7 @@ void cmCTestBatchTestHandler::WriteBatchScript() fout.close(); } -void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout) +void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::ostream& fout) { cmCTestTestHandler::cmCTestTestProperties* properties = this->Properties[test]; @@ -73,7 +73,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout) } } -void cmCTestBatchTestHandler::WriteTestCommand(int test, cmsys::ofstream& fout) +void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout) { std::vector args = this->Properties[test]->Args; std::vector processArgs; diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h index 7a2a4a263..ed60ea3c9 100644 --- a/Source/CTest/cmCTestBatchTestHandler.h +++ b/Source/CTest/cmCTestBatchTestHandler.h @@ -33,8 +33,8 @@ public: protected: void WriteBatchScript(); - void WriteSrunArgs(int test, cmsys::ofstream& fout); - void WriteTestCommand(int test, cmsys::ofstream& fout); + void WriteSrunArgs(int test, std::ostream& fout); + void WriteTestCommand(int test, std::ostream& fout); void SubmitBatchScript(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f435a1d7a..da2a64993 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -580,8 +580,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature, return ret; } -void cmTarget::GetTllSignatureTraces(std::ostringstream& s, - TLLSignature sig) const +void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const { const char* sigString = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 71ba0cd7c..f91e5c68d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -156,7 +156,7 @@ public: }; bool PushTLLCommandTrace(TLLSignature signature, cmListFileContext const& lfc); - void GetTllSignatureTraces(std::ostringstream& s, TLLSignature sig) const; + void GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const; void MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, const LinkLibraryVectorType& libs); From 39699947589e96b59d7f56d9c0b1dcb1bef27f8a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 9 Jun 2016 00:01:07 -0400 Subject: [PATCH 043/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1991a6d0e..a5492657d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160608) +set(CMake_VERSION_PATCH 20160609) #set(CMake_VERSION_RC 1) From e937b4c3879e1ee0770b465c0cdcbb6a960ba892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 9 Jun 2016 14:03:47 +0200 Subject: [PATCH 044/929] FindOpenSSL: Do not assume that the version regex finds something BoringSSL's openslv.h does not have the version information. --- Modules/FindOpenSSL.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 8dbaf11de..6393f2edc 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -328,11 +328,11 @@ function(from_hex HEX DEC) set(${DEC} ${_res} PARENT_SCOPE) endfunction() -if (OPENSSL_INCLUDE_DIR) - if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") - file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") +if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") + file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str + REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + if(openssl_version_str) # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. # Major, minor, and fix directly translate into the version numbers shown in From 746a4245738c7b3c0b29754cb09b2230697f13fc Mon Sep 17 00:00:00 2001 From: Stuart Mentzer Date: Wed, 8 Jun 2016 00:26:31 -0400 Subject: [PATCH 045/929] FindFreetype: Factor out common find command arguments --- Modules/FindFreetype.cmake | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 7d46d1563..dc6336ddf 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -51,9 +51,8 @@ # wants explicit full paths and this trickery doesn't work too well. # I'm going to attempt to cut out the middleman and hope # everything still works. -find_path( - FREETYPE_INCLUDE_DIR_ft2build - ft2build.h + +set(FREETYPE_FIND_ARGS HINTS ENV FREETYPE_DIR PATHS @@ -64,6 +63,12 @@ find_path( ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] +) + +find_path( + FREETYPE_INCLUDE_DIR_ft2build + ft2build.h + ${FREETYPE_FIND_ARGS} PATH_SUFFIXES include/freetype2 include @@ -75,16 +80,7 @@ find_path( NAMES freetype/config/ftheader.h config/ftheader.h - HINTS - ENV FREETYPE_DIR - PATHS - /usr/X11R6 - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware - ENV GTKMM_BASEPATH - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] + ${FREETYPE_FIND_ARGS} PATH_SUFFIXES include/freetype2 include @@ -96,20 +92,13 @@ find_library(FREETYPE_LIBRARY freetype libfreetype freetype219 - HINTS - ENV FREETYPE_DIR - PATHS - /usr/X11R6 - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware - ENV GTKMM_BASEPATH - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] + ${FREETYPE_FIND_ARGS} PATH_SUFFIXES lib ) +unset(FREETYPE_FIND_ARGS) + # set the user variables if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") From ceebac93f66c3927997b708caf6f2eb2d1827593 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jun 2016 09:08:59 -0400 Subject: [PATCH 046/929] Tests: Restore fix to Plugin test on Watcom compiler The fix in commit v3.4.0-rc1~127^2 (Tests: Fix Plugin test on Watcom compiler, 2015-09-03) was reverted accidentally by automated .c_str() removal. Restore it and add a comment explaining why. --- Tests/Plugin/src/example_exe.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx index 86b54f709..017fbf607 100644 --- a/Tests/Plugin/src/example_exe.cxx +++ b/Tests/Plugin/src/example_exe.cxx @@ -31,7 +31,9 @@ int main() kwsys::DynamicLoader::LibraryHandle handle = kwsys::DynamicLoader::OpenLibrary(libName.c_str()); if (!handle) { - std::cerr << "Could not open plugin \"" << libName << "\"!" << std::endl; + // Leave the .c_str() on this one. It is needed on OpenWatcom. + std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!" + << std::endl; return 1; } kwsys::DynamicLoader::SymbolPointer sym = From 0bd91ad4058c006bb67b48801e1877e8a893ef4d Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Wed, 8 Jun 2016 13:48:30 -0400 Subject: [PATCH 047/929] UseJava: Fix race condition creating java class list Modify logic to unconditionally create an empty class list response file to instead only create the empty file if no classes are being compiled. Otherwise, the response file is created via a custom command that generates the correct list. This fixes a race condition on certain systems (e.g. HFS on OS X) where the dependency for creating the "correct" list can have the "same" (due to limited precision of the filesystem) timestamp as the empty file created at configure time, resulting in an empty class list being incorrectly used to invoke `jar` (resulting in `jar` being unhappy that it was not given any input files). Although one would have some hope that this doesn't affect "real" projects, it definitely does affect the JavaExportImport unit test, causing the same to fail randomly when run on an HFS partition. --- Modules/UseJava.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 6644bd4cc..cf9c2d723 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -609,11 +609,6 @@ function(add_jar _TARGET_NAME) endif () endforeach() - # create an empty java_class_filelist - if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) - file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") - endif() - if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS) set (_JAVA_SOURCES_FILELISTS) @@ -653,6 +648,11 @@ function(add_jar _TARGET_NAME) DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) + else () + # create an empty java_class_filelist + if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") + endif() endif () # create the jar file From e9da5192e5bd0c660bfe36fe5bdab57f7b13cdcb Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 8 Jun 2016 23:35:31 +0200 Subject: [PATCH 048/929] CPack/PackageMaker: port to cmXMLWriter --- Source/CPack/cmCPackPKGGenerator.cxx | 125 +++++++++--------- Source/CPack/cmCPackPKGGenerator.h | 13 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 32 ++--- 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 3d3ef31a3..19b587a5d 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -18,6 +18,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmXMLWriter.h" #include "cmake.h" #include @@ -76,14 +77,15 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) // Create the choice outline, which provides a tree-based view of // the components in their groups. std::ostringstream choiceOut; - choiceOut << "" << std::endl; + cmXMLWriter xout(choiceOut, 1); + xout.StartElement("choices-outline"); // Emit the outline for the groups std::map::iterator groupIt; for (groupIt = this->ComponentGroups.begin(); groupIt != this->ComponentGroups.end(); ++groupIt) { if (groupIt->second.ParentGroup == 0) { - CreateChoiceOutline(groupIt->second, choiceOut); + CreateChoiceOutline(groupIt->second, xout); } } @@ -92,28 +94,32 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { if (!compIt->second.Group) { - choiceOut << "first << "Choice\">" - << std::endl; + xout.StartElement("line"); + xout.Attribute("choice", compIt->first + "Choice"); + xout.Content(""); // Avoid self-closing tag. + xout.EndElement(); } } if (!this->PostFlightComponent.Name.empty()) { - choiceOut << "" << std::endl; + xout.StartElement("line"); + xout.Attribute("choice", PostFlightComponent.Name + "Choice"); + xout.Content(""); // Avoid self-closing tag. + xout.EndElement(); } - choiceOut << "" << std::endl; + xout.EndElement(); // choices-outline> // Create the actual choices for (groupIt = this->ComponentGroups.begin(); groupIt != this->ComponentGroups.end(); ++groupIt) { - CreateChoice(groupIt->second, choiceOut); + CreateChoice(groupIt->second, xout); } for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { - CreateChoice(compIt->second, choiceOut); + CreateChoice(compIt->second, xout); } if (!this->PostFlightComponent.Name.empty()) { - CreateChoice(PostFlightComponent, choiceOut); + CreateChoice(PostFlightComponent, xout); } this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); @@ -124,40 +130,44 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) } void cmCPackPKGGenerator::CreateChoiceOutline( - const cmCPackComponentGroup& group, std::ostringstream& out) + const cmCPackComponentGroup& group, cmXMLWriter& xout) { - out << "" << std::endl; + xout.StartElement("line"); + xout.Attribute("choice", group.Name + "Choice"); std::vector::const_iterator groupIt; for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end(); ++groupIt) { - CreateChoiceOutline(**groupIt, out); + CreateChoiceOutline(**groupIt, xout); } std::vector::const_iterator compIt; for (compIt = group.Components.begin(); compIt != group.Components.end(); ++compIt) { - out << " Name << "Choice\">" - << std::endl; + xout.StartElement("line"); + xout.Attribute("choice", (*compIt)->Name + "Choice"); + xout.Content(""); // Avoid self-closing tag. + xout.EndElement(); } - out << "" << std::endl; + xout.EndElement(); } void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, - std::ostringstream& out) + cmXMLWriter& xout) { - out << "" << std::endl; + xout.EndElement(); } void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, - std::ostringstream& out) + cmXMLWriter& xout) { std::string packageId = "com."; packageId += this->GetOption("CPACK_PACKAGE_VENDOR"); @@ -166,18 +176,16 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, packageId += '.'; packageId += component.Name; - out << " visited; - AddDependencyAttributes(component, visited, out); + AddDependencyAttributes(component, visited, selected); visited.clear(); - AddReverseDependencyAttributes(component, visited, out); - out << "\""; + AddReverseDependencyAttributes(component, visited, selected); + xout.Attribute("selected", selected.str()); } - out << ">" << std::endl; - out << " " << std::endl; - out << "" << std::endl; + xout.StartElement("pkg-ref"); + xout.Attribute("id", packageId); + xout.EndElement(); // pkg-ref + xout.EndElement(); // choice // Create a description of the package associated with this // component. @@ -219,17 +228,20 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, unsigned long installedSize = component.GetInstalledSizeInKbytes(dirName.c_str()); - out << "GetOption("CPACK_PACKAGE_VERSION") << "\" " - << "installKBytes=\"" << installedSize << "\" " - << ">"; + xout.StartElement("pkg-ref"); + xout.Attribute("id", packageId); + xout.Attribute("version", this->GetOption("CPACK_PACKAGE_VERSION")); + xout.Attribute("installKBytes", installedSize); + xout.Attribute("auth", "Admin"); + xout.Attribute("onConclusion", "None"); if (component.IsDownloaded) { - out << this->GetOption("CPACK_DOWNLOAD_SITE") - << this->GetPackageName(component); + xout.Content(this->GetOption("CPACK_DOWNLOAD_SITE")); + xout.Content(this->GetPackageName(component)); } else { - out << "file:./" << relativePackageLocation; + xout.Content("file:./"); + xout.Content(relativePackageLocation); } - out << "" << std::endl; + xout.EndElement(); // pkg-ref } void cmCPackPKGGenerator::AddDependencyAttributes( @@ -244,7 +256,7 @@ void cmCPackPKGGenerator::AddDependencyAttributes( std::vector::const_iterator dependIt; for (dependIt = component.Dependencies.begin(); dependIt != component.Dependencies.end(); ++dependIt) { - out << " && choices['" << (*dependIt)->Name << "Choice'].selected"; + out << " && choices['" << (*dependIt)->Name << "Choice'].selected"; AddDependencyAttributes(**dependIt, visited, out); } } @@ -266,15 +278,6 @@ void cmCPackPKGGenerator::AddReverseDependencyAttributes( } } -std::string cmCPackPKGGenerator::EscapeForXML(std::string str) -{ - cmSystemTools::ReplaceString(str, "&", "&"); - cmSystemTools::ReplaceString(str, "<", "<"); - cmSystemTools::ReplaceString(str, ">", ">"); - cmSystemTools::ReplaceString(str, "\"", """); - return str; -} - bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, const std::string& dirName) { diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index 20ba94c7b..8d10943da 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -16,6 +16,7 @@ #include "cmCPackGenerator.h" class cmCPackComponent; +class cmXMLWriter; /** \class cmCPackPKGGenerator * \brief A generator for pkg files @@ -78,21 +79,15 @@ protected: // their components in a form that can be used by distribution // metapackages. void CreateChoiceOutline(const cmCPackComponentGroup& group, - std::ostringstream& out); + cmXMLWriter& xout); /// Create the "choice" XML element to describe a component group /// for the installer GUI. - void CreateChoice(const cmCPackComponentGroup& group, - std::ostringstream& out); + void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout); /// Create the "choice" XML element to describe a component for the /// installer GUI. - void CreateChoice(const cmCPackComponent& component, - std::ostringstream& out); - - // Escape the given string to make it usable as an XML attribute - // value. - std::string EscapeForXML(std::string str); + void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout); // The PostFlight component when creating a metapackage cmCPackComponent PostFlightComponent; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 891d0f471..ce329ca5e 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -17,6 +17,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmXMLWriter.h" #include "cmake.h" #include @@ -523,21 +524,22 @@ bool cmCPackPackageMakerGenerator::GenerateComponentPackage( std::string descriptionFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); descriptionFile += '/' + component.Name + "-Description.plist"; cmsys::ofstream out(descriptionFile.c_str()); - out << "" << std::endl - << "" << std::endl - << "" << std::endl - << "" << std::endl - << " IFPkgDescriptionTitle" << std::endl - << " " << component.DisplayName << "" << std::endl - << " IFPkgDescriptionVersion" << std::endl - << " " << this->GetOption("CPACK_PACKAGE_VERSION") - << "" << std::endl - << " IFPkgDescriptionDescription" << std::endl - << " " + this->EscapeForXML(component.Description) - << "" << std::endl - << "" << std::endl - << "" << std::endl; + cmXMLWriter xout(out); + xout.StartDocument(); + xout.Doctype("plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"" + "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""); + xout.StartElement("plist"); + xout.Attribute("version", "1.4"); + xout.StartElement("dict"); + xout.Element("key", "IFPkgDescriptionTitle"); + xout.Element("string", component.DisplayName); + xout.Element("key", "IFPkgDescriptionVersion"); + xout.Element("string", this->GetOption("CPACK_PACKAGE_VERSION")); + xout.Element("key", "IFPkgDescriptionDescription"); + xout.Element("string", component.Description); + xout.EndElement(); // dict + xout.EndElement(); // plist + xout.EndDocument(); out.close(); // Create the Info.plist file for this component From e9bfe8da04c5486335d15c68b544f25f940c9c92 Mon Sep 17 00:00:00 2001 From: Boris Fomitchev Date: Tue, 19 Apr 2016 15:13:51 -0700 Subject: [PATCH 049/929] FindCUDA: Adjust vertical whitespace --- Modules/FindCUDA.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 48bb554cc..b11105077 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -188,10 +188,8 @@ # files. # # -# # CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target # nvcc_flags object_files) -# # -- Generates the link object required by separable compilation from the given # object files. This is called automatically for CUDA_ADD_EXECUTABLE and # CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS @@ -563,7 +561,6 @@ macro(cuda_unset_include_and_libraries) unset(CUDA_npps_LIBRARY CACHE) unset(CUDA_nvcuvenc_LIBRARY CACHE) unset(CUDA_nvcuvid_LIBRARY CACHE) - unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE) endmacro() @@ -601,6 +598,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR) DOC "Toolkit location." NO_DEFAULT_PATH ) + # Now search default paths find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe @@ -614,6 +612,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR) # We need to force this back into the cache. set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE) endif() + if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) if(CUDA_FIND_REQUIRED) message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR") @@ -742,6 +741,8 @@ if(NOT CUDA_VERSION VERSION_LESS "5.5") cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static "static CUDA runtime library") mark_as_advanced(CUDA_cudart_static_LIBRARY) endif() + + if(CUDA_cudart_static_LIBRARY) # Set whether to use the static cuda runtime. option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON) @@ -955,6 +956,7 @@ set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + find_package_handle_standard_args(CUDA REQUIRED_VARS CUDA_TOOLKIT_ROOT_DIR From 7229ae728fa703390b70a9ded5606b01214c14de Mon Sep 17 00:00:00 2001 From: Boris Fomitchev Date: Tue, 19 Apr 2016 15:13:51 -0700 Subject: [PATCH 050/929] FindCUDA: Refactor Android(Tegra) support Reviewed-by: James Bigler --- Modules/FindCUDA.cmake | 132 +++++++++----- Modules/FindCUDA/select_compute_arch.cmake | 195 +++++++++++++++++++++ 2 files changed, 282 insertions(+), 45 deletions(-) create mode 100644 Modules/FindCUDA/select_compute_arch.cmake diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index b11105077..86f89d8bc 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -199,6 +199,24 @@ # specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function # instead of a macro. # +# CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures]) +# -- Selects GPU arch flags for nvcc based on target_CUDA_architectures +# target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...) +# - "Auto" detects local machine GPU compute arch at runtime. +# - "Common" and "All" cover common and entire subsets of architectures +# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX +# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal +# NUM: Any number. Only those pairs are currently accepted by NVCC though: +# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 +# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable} +# Additionally, sets ${out_variable}_readable to the resulting numeric list +# Example: +# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell) +# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS}) +# +# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA +# Note that this is a function instead of a macro. +# # CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ... # [STATIC | SHARED | MODULE] [OPTIONS ...] ) # -- This is where all the magic happens. CUDA_ADD_EXECUTABLE, @@ -562,6 +580,7 @@ macro(cuda_unset_include_and_libraries) unset(CUDA_nvcuvenc_LIBRARY CACHE) unset(CUDA_nvcuvid_LIBRARY CACHE) unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE) + unset(CUDA_GPU_DETECT_OUTPUT CACHE) endmacro() # Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed, @@ -577,21 +596,21 @@ if(NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL cuda_unset_include_and_libraries() endif() -if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}") - # No specific variables to catch. Use this kind of code before calling - # find_package(CUDA) to clean up any variables that may depend on this path. +# +# End of unset() +# - # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE) - # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE) -endif() +# +# Start looking for things +# # Search for the cuda distribution. -if(NOT CUDA_TOOLKIT_ROOT_DIR) - +if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING) # Search in the CUDA_BIN_PATH first. find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe PATHS + ENV CUDA_TOOLKIT_ROOT ENV CUDA_PATH ENV CUDA_BIN_PATH PATH_SUFFIXES bin bin64 @@ -611,6 +630,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR) string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) # We need to force this back into the cache. set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE) + set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR}) endif() if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) @@ -622,8 +642,45 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR) endif () endif () +if(CMAKE_CROSSCOMPILING) + SET (CUDA_TOOLKIT_ROOT $ENV{CUDA_TOOLKIT_ROOT}) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") + # Support for NVPACK + set (CUDA_TOOLKIT_TARGET_NAME "armv7-linux-androideabi") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") + # Support for arm cross compilation + set(CUDA_TOOLKIT_TARGET_NAME "armv7-linux-gnueabihf") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + # Support for aarch64 cross compilation + if (ANDROID_ARCH_NAME STREQUAL "arm64") + set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux-androideabi") + else() + set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux") + endif (ANDROID_ARCH_NAME STREQUAL "arm64") + endif() + + if (EXISTS "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}") + set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}" CACHE PATH "CUDA Toolkit target location.") + SET (CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT}) + mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) + endif() + + # add known CUDA targetr root path to the set of directories we search for programs, libraries and headers + set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}") + macro( cuda_find_host_program ) + find_host_program( ${ARGN} ) + endmacro() +else() + # for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR + macro( cuda_find_host_program ) + find_program( ${ARGN} ) + endmacro() + SET (CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR}) +endif() + + # CUDA_NVCC_EXECUTABLE -find_program(CUDA_NVCC_EXECUTABLE +cuda_find_host_program(CUDA_NVCC_EXECUTABLE NAMES nvcc PATHS "${CUDA_TOOLKIT_ROOT_DIR}" ENV CUDA_PATH @@ -632,7 +689,7 @@ find_program(CUDA_NVCC_EXECUTABLE NO_DEFAULT_PATH ) # Search default search paths, after we search our own set of paths. -find_program(CUDA_NVCC_EXECUTABLE nvcc) +cuda_find_host_program(CUDA_NVCC_EXECUTABLE nvcc) mark_as_advanced(CUDA_NVCC_EXECUTABLE) if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) @@ -648,33 +705,14 @@ else() string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}") endif() + # Always set this convenience variable set(CUDA_VERSION_STRING "${CUDA_VERSION}") -# Support for arm cross compilation with CUDA 5.5 -if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") - set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.") -# Support for aarch64 cross compilation with CUDA 7.0 -elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux") - set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux" CACHE PATH "Toolkit target location.") -else() - set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.") -endif() -mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) - -# Target CPU architecture -if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm") - set(_cuda_target_cpu_arch_initial "ARM") -else() - set(_cuda_target_cpu_arch_initial "") -endif() -set(CUDA_TARGET_CPU_ARCH ${_cuda_target_cpu_arch_initial} CACHE STRING "Specify the name of the class of CPU architecture for which the input files must be compiled.") -mark_as_advanced(CUDA_TARGET_CPU_ARCH) - # CUDA_TOOLKIT_INCLUDE find_path(CUDA_TOOLKIT_INCLUDE device_functions.h # Header included in toolkit - PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}" + PATHS ${CUDA_TOOLKIT_TARGET_DIR} ENV CUDA_PATH ENV CUDA_INC_PATH PATH_SUFFIXES include @@ -704,19 +742,21 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext ) # (lib/Win32) and the old path (lib). find_library(${_var} NAMES ${_names} - PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}" + PATHS "${CUDA_TOOLKIT_TARGET_DIR}" ENV CUDA_PATH ENV CUDA_LIB_PATH PATH_SUFFIXES ${_cuda_64bit_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32" DOC ${_doc} NO_DEFAULT_PATH ) - # Search default search paths, after we search our own set of paths. - find_library(${_var} - NAMES ${_names} - PATHS "/usr/lib/nvidia-current" - DOC ${_doc} - ) + if (NOT CMAKE_CROSSCOMPILING) + # Search default search paths, after we search our own set of paths. + find_library(${_var} + NAMES ${_names} + PATHS "/usr/lib/nvidia-current" + DOC ${_doc} + ) + endif() endmacro() macro(cuda_find_library_local_first _var _names _doc) @@ -737,7 +777,8 @@ if(CUDA_VERSION VERSION_EQUAL "3.0") CUDA_CUDARTEMU_LIBRARY ) endif() -if(NOT CUDA_VERSION VERSION_LESS "5.5") + +if(CUDA_USE_STATIC_CUDA_RUNTIME AND NOT CUDA_VERSION VERSION_LESS "5.5") cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static "static CUDA runtime library") mark_as_advanced(CUDA_cudart_static_LIBRARY) endif() @@ -773,12 +814,12 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) else() unset(CMAKE_THREAD_PREFER_PTHREAD) endif() - if (NOT APPLE) - # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink. - find_library(CUDA_rt_LIBRARY rt) - if (NOT CUDA_rt_LIBRARY) - message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") - endif() + endif() + if (NOT APPLE AND CUDA_VERSION VERSION_LESS "7.0") + # Before CUDA 7.0, there was librt that has things such as, clock_gettime, shm_open, and shm_unlink. + find_library(CUDA_rt_LIBRARY rt) + if (NOT CUDA_rt_LIBRARY) + message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") endif() endif() endif() @@ -988,6 +1029,7 @@ endmacro() cuda_find_helper_file(parse_cubin cmake) cuda_find_helper_file(make2cmake cmake) cuda_find_helper_file(run_nvcc cmake) +include("${CMAKE_CURRENT_LIST_DIR}/FindCUDA/select_compute_arch.cmake") ############################################################################## # Separate the OPTIONS out from the sources diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake new file mode 100644 index 000000000..d51683193 --- /dev/null +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -0,0 +1,195 @@ +# Synopsis: +# CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures]) +# -- Selects GPU arch flags for nvcc based on target_CUDA_architectures +# target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...) +# - "Auto" detects local machine GPU compute arch at runtime. +# - "Common" and "All" cover common and entire subsets of architectures +# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX +# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal +# NUM: Any number. Only those pairs are currently accepted by NVCC though: +# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 +# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable} +# Additionally, sets ${out_variable}_readable to the resulting numeric list +# Example: +# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell) +# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS}) +# +# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA +# + +# This list will be used for CUDA_ARCH_NAME = All option +set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell") + +# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default) +set(CUDA_COMMON_GPU_ARCHITECTURES "3.0" "3.5" "5.0") + +if (CUDA_VERSION VERSION_GREATER "6.5") + list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra") + list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2") +endif () + +if (CUDA_VERSION VERSION_GREATER "7.5") + list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Pascal") + list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.0" "6.1" "6.1+PTX") +else() + list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2+PTX") +endif () + + + +################################################################################################ +# A function for automatic detection of GPUs installed (if autodetection is enabled) +# Usage: +# CUDA_DETECT_INSTALLED_GPUS(OUT_VARIABLE) +# +function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) + if(NOT CUDA_GPU_DETECT_OUTPUT) + set(cufile ${PROJECT_BINARY_DIR}/detect_cuda_archs.cu) + + file(WRITE ${cufile} "" + "#include \n" + "int main()\n" + "{\n" + " int count = 0;\n" + " if (cudaSuccess != cudaGetDeviceCount(&count)) return -1;\n" + " if (count == 0) return -1;\n" + " for (int device = 0; device < count; ++device)\n" + " {\n" + " cudaDeviceProp prop;\n" + " if (cudaSuccess == cudaGetDeviceProperties(&prop, device))\n" + " std::printf(\"%d.%d \", prop.major, prop.minor);\n" + " }\n" + " return 0;\n" + "}\n") + + execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/" + RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(nvcc_res EQUAL 0) + string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}") + set(CUDA_GPU_DETECT_OUTPUT ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_gpus tool" FORCE) + endif() + endif() + + if(NOT CUDA_GPU_DETECT_OUTPUT) + message(STATUS "Automatic GPU detection failed. Building for common architectures.") + set(${OUT_VARIABLE} ${CUDA_COMMON_GPU_ARCHITECTURES} PARENT_SCOPE) + else() + set(${OUT_VARIABLE} ${CUDA_GPU_DETECT_OUTPUT} PARENT_SCOPE) + endif() +endfunction() + + +################################################################################################ +# Function for selecting GPU arch flags for nvcc based on CUDA architectures from parameter list +# Usage: +# SELECT_NVCC_ARCH_FLAGS(out_variable [list of CUDA compute archs]) +function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) + set(CUDA_ARCH_LIST "${ARGN}") + + if("X${CUDA_ARCH_LIST}" STREQUAL "X" ) + set(CUDA_ARCH_LIST "Auto") + endif() + + set(cuda_arch_bin) + set(cuda_arch_ptx) + + if("${CUDA_ARCH_LIST}" STREQUAL "All") + set(CUDA_ARCH_LIST ${CUDA_KNOWN_GPU_ARCHITECTURES}) + elseif("${CUDA_ARCH_LIST}" STREQUAL "Common") + set(CUDA_ARCH_LIST ${CUDA_COMMON_GPU_ARCHITECTURES}) + elseif("${CUDA_ARCH_LIST}" STREQUAL "Auto") + CUDA_DETECT_INSTALLED_GPUS(CUDA_ARCH_LIST) + message(STATUS "Autodetected CUDA architecture(s): ${cuda_arch_bin}") + endif() + + # Now process the list and look for names + string(REGEX REPLACE "[ \t]+" ";" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}") + list(REMOVE_DUPLICATES CUDA_ARCH_LIST) + foreach(arch_name ${CUDA_ARCH_LIST}) + set(arch_bin) + set(add_ptx FALSE) + # Check to see if we are compiling PTX + if(arch_name MATCHES "(.*)\\+PTX$") + set(add_ptx TRUE) + set(arch_name ${CMAKE_MATCH_1}) + endif() + if(arch_name MATCHES "([0-9]\\.[0-9])$") + set(arch_bin ${CMAKE_MATCH_1}) + set(arch_ptx ${arch_bin}) + else() + # Look for it in our list of known architectures + if(${arch_name} STREQUAL "Fermi") + set(arch_bin 2.0 "2.1(2.0)") + elseif(${arch_name} STREQUAL "Kepler+Tegra") + set(arch_bin 3.2) + elseif(${arch_name} STREQUAL "Kepler+Tesla") + set(arch_bin 3.7) + elseif(${arch_name} STREQUAL "Kepler") + set(arch_bin 3.0 3.5) + set(arch_ptx 3.5) + elseif(${arch_name} STREQUAL "Maxwell+Tegra") + set(arch_bin 5.3) + elseif(${arch_name} STREQUAL "Maxwell") + set(arch_bin 5.0 5.2) + set(arch_ptx 5.2) + elseif(${arch_name} STREQUAL "Pascal") + set(arch_bin 6.0 6.1) + set(arch_ptx 6.1) + else() + message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS") + endif() + endif() + if(NOT arch_bin) + message(SEND_ERROR "arch_bin wasn't set for some reason") + endif() + list(APPEND cuda_arch_bin ${arch_bin}) + if(add_ptx) + if (NOT arch_ptx) + set(arch_ptx ${arch_bin}) + endif() + list(APPEND cuda_arch_ptx ${arch_ptx}) + endif() + endforeach() + + # remove dots and convert to lists + string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}") + string(REGEX REPLACE "\\." "" cuda_arch_ptx "${cuda_arch_ptx}") + string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}") + string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}") + + if(cuda_arch_bin) + list(REMOVE_DUPLICATES cuda_arch_bin) + endif() + if(cuda_arch_ptx) + list(REMOVE_DUPLICATES cuda_arch_ptx) + endif() + + set(nvcc_flags "") + set(nvcc_archs_readable "") + + # Tell NVCC to add binaries for the specified GPUs + foreach(arch ${cuda_arch_bin}) + if(arch MATCHES "([0-9]+)\\(([0-9]+)\\)") + # User explicitly specified PTX for the concrete BIN + list(APPEND nvcc_flags -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1}) + list(APPEND nvcc_archs_readable sm_${CMAKE_MATCH_1}) + else() + # User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN + list(APPEND nvcc_flags -gencode arch=compute_${arch},code=sm_${arch}) + list(APPEND nvcc_archs_readable sm_${arch}) + endif() + endforeach() + + # Tell NVCC to add PTX intermediate code for the specified architectures + foreach(arch ${cuda_arch_ptx}) + list(APPEND nvcc_flags -gencode arch=compute_${arch},code=compute_${arch}) + list(APPEND nvcc_archs_readable compute_${arch}) + endforeach() + + string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}") + set(${out_variable} ${nvcc_flags} PARENT_SCOPE) + set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE) +endfunction() From d4b8e8135358024b6982100654a430358574efb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 9 Jun 2016 15:53:17 +0200 Subject: [PATCH 051/929] FindProtobuf: fix protobuf_generate_*() to handle proto files in subdirs. --- Modules/FindProtobuf.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 80420735c..c90a0a20a 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -144,6 +144,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) + get_filename_component(FIL_DIR ${FIL} DIRECTORY) + if(FIL_DIR) + set(FIL_WE "${FIL_DIR}/${FIL_WE}") + endif() list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") @@ -197,6 +201,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) + get_filename_component(FIL_DIR ${FIL} DIRECTORY) + if(FIL_DIR) + set(FIL_WE "${FIL_DIR}/${FIL_WE}") + endif() list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") add_custom_command( From 70d3bf85808d17dba8ec90e2975f2741383ef260 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 8 Jun 2016 11:29:35 +0200 Subject: [PATCH 052/929] cmLocalGenerator: Adopt GetFrameworkFlags method Move it from cmCommonTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 54 ++---------------------------- Source/cmCommonTargetGenerator.h | 3 -- Source/cmLocalGenerator.cxx | 48 ++++++++++++++++++++++++++ Source/cmLocalGenerator.h | 4 +++ 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index cb62bde4d..131b490d6 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -199,56 +199,6 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( } } -std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) -{ - std::string const& config = this->ConfigName; - if (!this->Makefile->IsOn("APPLE")) { - return std::string(); - } - - std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; - const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); - if (!(fwSearchFlag && *fwSearchFlag)) { - return std::string(); - } - - std::set emitted; -#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ - emitted.insert("/System/Library/Frameworks"); -#endif - std::vector includes; - - this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, - "C", config); - // check all include directories for frameworks as this - // will already have added a -F for the framework - for (std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) { - if (this->GlobalGenerator->NameResolvesToFramework(*i)) { - std::string frameworkDir = *i; - frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); - emitted.insert(frameworkDir); - } - } - - std::string flags; - if (cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(config)) { - std::vector const& frameworks = cli->GetFrameworkPaths(); - for (std::vector::const_iterator i = frameworks.begin(); - i != frameworks.end(); ++i) { - if (emitted.insert(*i).second) { - flags += fwSearchFlag; - flags += this->LocalGenerator->ConvertToOutputFormat( - *i, cmOutputConverter::SHELL); - flags += " "; - } - } - } - return flags; -} - std::string cmCommonTargetGenerator::GetFlags(const std::string& l) { ByLanguageMap::iterator i = this->FlagsByLanguage.find(l); @@ -277,7 +227,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l) this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); // Add framework directory flags. - this->LocalGenerator->AppendFlags(flags, this->GetFrameworkFlags(l)); + this->LocalGenerator->AppendFlags( + flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName, + this->GeneratorTarget)); // Add target-specific flags. this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index c9645e701..ace5351c6 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -71,9 +71,6 @@ protected: void AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source); - // Return the a string with -F flags on apple - std::string GetFrameworkFlags(std::string const& l); - virtual void AddIncludeFlags(std::string& flags, std::string const& lang) = 0; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b3694201b..9c503c2fa 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1271,6 +1271,54 @@ void cmLocalGenerator::GetTargetFlags( } } +std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target) +{ + if (!this->Makefile->IsOn("APPLE")) { + return std::string(); + } + + std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; + const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); + if (!(fwSearchFlag && *fwSearchFlag)) { + return std::string(); + } + + std::set emitted; +#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ + emitted.insert("/System/Library/Frameworks"); +#endif + std::vector includes; + + this->GetIncludeDirectories(includes, target, "C", config); + // check all include directories for frameworks as this + // will already have added a -F for the framework + for (std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) { + if (this->GlobalGenerator->NameResolvesToFramework(*i)) { + std::string frameworkDir = *i; + frameworkDir += "/../"; + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); + emitted.insert(frameworkDir); + } + } + + std::string flags; + if (cmComputeLinkInformation* cli = target->GetLinkInformation(config)) { + std::vector const& frameworks = cli->GetFrameworkPaths(); + for (std::vector::const_iterator i = frameworks.begin(); + i != frameworks.end(); ++i) { + if (emitted.insert(*i).second) { + flags += fwSearchFlag; + flags += this->ConvertToOutputFormat(*i, cmOutputConverter::SHELL); + flags += " "; + } + } + } + return flags; +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5ced64862..ac2ebce97 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -313,6 +313,10 @@ public: std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target, bool useWatcomQuote); + std::string GetFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target); + virtual void ComputeObjectFilenames( std::map& mapping, cmGeneratorTarget const* gt = 0); From d9613b962e2ed5c908850c8a083630f753dac113 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 8 Jun 2016 11:29:35 +0200 Subject: [PATCH 053/929] cmLocalGenerator: Move GetFrameworkFlags implementation to private helper --- Source/cmLocalGenerator.cxx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9c503c2fa..f543ec42a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1271,16 +1271,19 @@ void cmLocalGenerator::GetTargetFlags( } } -std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, - std::string const& config, - cmGeneratorTarget* target) +static std::string GetFrameworkFlags(const std::string& lang, + const std::string& config, + cmGeneratorTarget* target) { - if (!this->Makefile->IsOn("APPLE")) { + cmLocalGenerator* lg = target->GetLocalGenerator(); + cmMakefile* mf = lg->GetMakefile(); + + if (!mf->IsOn("APPLE")) { return std::string(); } - std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; - const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); + std::string fwSearchFlagVar = "CMAKE_" + lang + "_FRAMEWORK_SEARCH_FLAG"; + const char* fwSearchFlag = mf->GetDefinition(fwSearchFlagVar); if (!(fwSearchFlag && *fwSearchFlag)) { return std::string(); } @@ -1291,12 +1294,12 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, #endif std::vector includes; - this->GetIncludeDirectories(includes, target, "C", config); + lg->GetIncludeDirectories(includes, target, "C", config); // check all include directories for frameworks as this // will already have added a -F for the framework for (std::vector::iterator i = includes.begin(); i != includes.end(); ++i) { - if (this->GlobalGenerator->NameResolvesToFramework(*i)) { + if (lg->GetGlobalGenerator()->NameResolvesToFramework(*i)) { std::string frameworkDir = *i; frameworkDir += "/../"; frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); @@ -1311,7 +1314,7 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, i != frameworks.end(); ++i) { if (emitted.insert(*i).second) { flags += fwSearchFlag; - flags += this->ConvertToOutputFormat(*i, cmOutputConverter::SHELL); + flags += lg->ConvertToOutputFormat(*i, cmOutputConverter::SHELL); flags += " "; } } @@ -1319,6 +1322,13 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, return flags; } +std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target) +{ + return ::GetFrameworkFlags(l, config, target); +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { From 1f9b35da101ba12f5c6d8cdbe8e073fa8709709a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 10 Jun 2016 00:01:06 -0400 Subject: [PATCH 054/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a5492657d..254d9dea1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160609) +set(CMake_VERSION_PATCH 20160610) #set(CMake_VERSION_RC 1) From 853b1bb4ba176e886e3682a2475f1de1932ee890 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Jun 2016 09:23:14 -0400 Subject: [PATCH 055/929] cmLocalGenerator: Constify AppendDefines and AddCompileDefinitions --- Source/cmLocalGenerator.cxx | 7 ++++--- Source/cmLocalGenerator.h | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f543ec42a..3f957f06f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -943,7 +943,7 @@ std::string cmLocalGenerator::GetIncludeFlags( void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmGeneratorTarget const* target, const std::string& config, - const std::string& lang) + const std::string& lang) const { std::vector targetDefines; target->GetCompileDefinitions(targetDefines, config, lang); @@ -2051,7 +2051,7 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags, } void cmLocalGenerator::AppendDefines(std::set& defines, - const char* defines_list) + const char* defines_list) const { // Short-circuit if there are no definitions. if (!defines_list) { @@ -2065,7 +2065,8 @@ void cmLocalGenerator::AppendDefines(std::set& defines, } void cmLocalGenerator::AppendDefines( - std::set& defines, const std::vector& defines_vec) + std::set& defines, + const std::vector& defines_vec) const { for (std::vector::const_iterator di = defines_vec.begin(); di != defines_vec.end(); ++di) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ac2ebce97..ad77c1fcf 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -138,13 +138,15 @@ public: * Encode a list of preprocessor definitions for the compiler * command line. */ - void AppendDefines(std::set& defines, const char* defines_list); - void AppendDefines(std::set& defines, std::string defines_list) + void AppendDefines(std::set& defines, + const char* defines_list) const; + void AppendDefines(std::set& defines, + std::string defines_list) const { this->AppendDefines(defines, defines_list.c_str()); } void AppendDefines(std::set& defines, - const std::vector& defines_vec); + const std::vector& defines_vec) const; /** * Join a set of defines into a definesString with a space separator. @@ -200,7 +202,7 @@ public: void AddCompileDefinitions(std::set& defines, cmGeneratorTarget const* target, const std::string& config, - const std::string& lang); + const std::string& lang) const; std::string GetProjectName() const; From f62ed322dc0d859f595be5ddeff40904ee478f50 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 8 Jun 2016 13:23:25 +0200 Subject: [PATCH 056/929] cmLocalGenerator: Add GetTargetDefines to get all defines for a target --- Source/cmCommonTargetGenerator.cxx | 14 +++----------- Source/cmLocalGenerator.cxx | 14 ++++++++++++++ Source/cmLocalGenerator.h | 3 +++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 131b490d6..b893dd3ab 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -246,19 +246,11 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l) ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); if (i == this->DefinesByLanguage.end()) { std::set defines; - const char* lang = l.c_str(); - // Add the export symbol definition for shared library objects. - if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro); - } - - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions( - defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(), - l); + this->LocalGenerator->GetTargetDefines(this->GeneratorTarget, + this->ConfigName, l, defines); std::string definesString; - this->LocalGenerator->JoinDefines(defines, definesString, lang); + this->LocalGenerator->JoinDefines(defines, definesString, l); ByLanguageMap::value_type entry(l, definesString); i = this->DefinesByLanguage.insert(entry).first; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3f957f06f..2ccaa82fe 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1329,6 +1329,20 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, return ::GetFrameworkFlags(l, config, target); } +void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, + std::string const& config, + std::string const& lang, + std::set& defines) const +{ + // Add the export symbol definition for shared library objects. + if (const char* exportMacro = target->GetExportMacro()) { + this->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->AddCompileDefinitions(defines, target, config, lang.c_str()); +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ad77c1fcf..55b8794c9 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -314,6 +314,9 @@ public: std::string& flags, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target, bool useWatcomQuote); + void GetTargetDefines(cmGeneratorTarget const* target, + std::string const& config, std::string const& lang, + std::set& defines) const; std::string GetFrameworkFlags(std::string const& l, std::string const& config, From 7066218e792927cb6494ce73e834b8ddb3d275e6 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 09:54:07 +0200 Subject: [PATCH 057/929] cmake: Kill cmake::CacheManager and its getter This member variable is never initialized and has apparently moved to cmState. --- Source/cmake.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmake.h b/Source/cmake.h index 4958a05dc..23726a23f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -209,9 +209,6 @@ public: return this->GeneratorToolset; } - ///! get the cmCachemManager used by this invocation of cmake - cmCacheManager* GetCacheManager() { return this->CacheManager; } - const std::vector& GetSourceExtensions() const { return this->SourceFileExtensions; @@ -421,7 +418,6 @@ protected: CreateExtraGeneratorFunctionType newFunction); cmGlobalGenerator* GlobalGenerator; - cmCacheManager* CacheManager; std::map DiagLevels; std::string GeneratorPlatform; std::string GeneratorToolset; From 120899c6980fcd81aa2a0d7b733ae15332a7a133 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 09:34:14 +0200 Subject: [PATCH 058/929] cmPropertyList: Add a way to retrieve all properties --- Source/cmPropertyMap.cxx | 12 ++++++++++++ Source/cmPropertyMap.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 74e04dac3..de1281ebe 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -15,6 +15,7 @@ #include "cmSystemTools.h" #include "cmake.h" +#include #include cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) @@ -29,6 +30,17 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } +std::vector cmPropertyMap::GetPropertyList() const +{ + std::vector keyList; + for (cmPropertyMap::const_iterator i = this->begin(), e = this->end(); + i != e; ++i) { + keyList.push_back(i->first); + } + std::sort(keyList.begin(), keyList.end()); + return keyList; +} + void cmPropertyMap::SetProperty(const std::string& name, const char* value) { if (!value) { diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 4e987501b..6dc7bfbbe 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -19,6 +19,8 @@ class cmPropertyMap : public std::map public: cmProperty* GetOrCreateProperty(const std::string& name); + std::vector GetPropertyList() const; + void SetProperty(const std::string& name, const char* value); void AppendProperty(const std::string& name, const char* value, From 6eee24634bc1791a64f8146c0f79c769eb9dfb83 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 09:34:49 +0200 Subject: [PATCH 059/929] cmCacheEntry: Retrieve all properties of cache entries --- Source/cmCacheManager.cxx | 10 ++++++++++ Source/cmCacheManager.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 676e84a2a..233d9cae7 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -539,6 +539,11 @@ void cmCacheManager::CacheIterator::Next() } } +std::vector cmCacheManager::CacheIterator::GetPropertyList() const +{ + return this->GetEntry().GetPropertyList(); +} + void cmCacheManager::CacheIterator::SetValue(const char* value) { if (this->IsAtEnd()) { @@ -558,6 +563,11 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const return cmSystemTools::IsOn(this->GetEntry().Value.c_str()); } +std::vector cmCacheManager::CacheEntry::GetPropertyList() const +{ + return this->Properties.GetPropertyList(); +} + const char* cmCacheManager::CacheEntry::GetProperty( const std::string& prop) const { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index e9b80cb6f..153e9575c 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -38,6 +38,7 @@ private: std::string Value; cmState::CacheEntryType Type; cmPropertyMap Properties; + std::vector GetPropertyList() const; const char* GetProperty(const std::string&) const; void SetProperty(const std::string& property, const char* value); void AppendProperty(const std::string& property, const char* value, @@ -60,6 +61,7 @@ public: bool IsAtEnd() const; void Next(); std::string GetName() const { return this->Position->first; } + std::vector GetPropertyList() const; const char* GetProperty(const std::string&) const; bool GetPropertyAsBool(const std::string&) const; bool PropertyExists(const std::string&) const; From 63c0e92c9395083a61fe31cd89bee7e3814f10e8 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 10:10:07 +0200 Subject: [PATCH 060/929] cmState: Expose list of properties of values in the cache --- Source/cmState.cxx | 8 ++++++++ Source/cmState.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 04f07cecf..d2cfaba71 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -246,6 +246,14 @@ void cmState::SetCacheEntryBoolProperty(std::string const& key, it.SetProperty(propertyName, value); } +std::vector cmState::GetCacheEntryPropertyList( + const std::string& key) +{ + cmCacheManager::CacheIterator it = + this->CacheManager->GetCacheIterator(key.c_str()); + return it.GetPropertyList(); +} + const char* cmState::GetCacheEntryProperty(std::string const& key, std::string const& propertyName) { diff --git a/Source/cmState.h b/Source/cmState.h index 18c45b83f..935faecda 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -247,6 +247,7 @@ public: std::string const& value); void SetCacheEntryBoolProperty(std::string const& key, std::string const& propertyName, bool value); + std::vector GetCacheEntryPropertyList(std::string const& key); const char* GetCacheEntryProperty(std::string const& key, std::string const& propertyName); bool GetCacheEntryPropertyAsBool(std::string const& key, From 896ad251de49f167f4ce3cbbcf9a6cce85a16681 Mon Sep 17 00:00:00 2001 From: Daniel Scharrer Date: Fri, 10 Jun 2016 16:11:18 +0200 Subject: [PATCH 061/929] Teach find_library and find_package to search lib32 paths (#11260) Add a ``FIND_LIBRARY_USE_LIB32_PATHS`` global property analogous to the ``FIND_LIBRARY_USE_LIB64_PATHS`` property. This helps find commands on multilib systems that use ``lib32`` directories and either do not have ``lib`` symlinks or point ``lib`` to ``lib64``. --- Help/command/find_library.rst | 7 +++++++ Help/manual/cmake-properties.7.rst | 1 + Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst | 10 ++++++++++ Help/release/dev/find-lib32.rst | 7 +++++++ Modules/FindPkgConfig.cmake | 8 ++++++-- Modules/Platform/Linux.cmake | 3 ++- Modules/Platform/OpenBSD.cmake | 1 + Modules/Platform/UnixPaths.cmake | 3 ++- Source/cmFindLibraryCommand.cxx | 9 ++++----- Source/cmFindPackageCommand.cxx | 11 +++++++++++ Source/cmFindPackageCommand.h | 1 + Source/cmMakefile.cxx | 8 ++++++++ Source/cmMakefile.h | 3 +++ Tests/CMakeOnly/find_library/CMakeLists.txt | 7 +++++++ Tests/CMakeOnly/find_library/lib/32/libtest5.a | 0 Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a | 0 Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a | 0 Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a | 0 Tests/CMakeOnly/find_library/lib32/A/libtest4.a | 0 Tests/CMakeOnly/find_library/lib32/libtest4.a | 0 .../FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake | 11 ++++++++--- .../FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake | 11 ++++++++--- .../FindPkgConfig_NO_PKGCONFIG_PATH.cmake | 3 --- .../FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake | 11 ++++++++--- ...fig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake | 11 ++++++++--- .../FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake | 11 ++++++++--- .../FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder | 0 .../FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder | 0 28 files changed, 110 insertions(+), 27 deletions(-) create mode 100644 Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst create mode 100644 Help/release/dev/find-lib32.rst create mode 100644 Tests/CMakeOnly/find_library/lib/32/libtest5.a create mode 100644 Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a create mode 100644 Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a create mode 100644 Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a create mode 100644 Tests/CMakeOnly/find_library/lib32/A/libtest4.a create mode 100644 Tests/CMakeOnly/find_library/lib32/libtest4.a create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 31e6ec0f3..1eb50f77e 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -49,6 +49,13 @@ path to the framework ``/A.framework``. When a full path to a framework is used as a library, CMake will use a ``-framework A``, and a ``-F`` to link the framework to the target. +If the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global property is set +all search paths will be tested as normal, with ``32/`` appended, and +with all matches of ``lib/`` replaced with ``lib32/``. This property is +automatically set for the platforms that are known to need it if at +least one of the languages supported by the :command:`project` command +is enabled. + If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set all search paths will be tested as normal, with ``64/`` appended, and with all matches of ``lib/`` replaced with ``lib64/``. This property is diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 3403dcd86..3574b7fc5 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -24,6 +24,7 @@ Properties of Global Scope /prop_gbl/DISABLED_FEATURES /prop_gbl/ENABLED_FEATURES /prop_gbl/ENABLED_LANGUAGES + /prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS /prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS /prop_gbl/FIND_LIBRARY_USE_OPENBSD_VERSIONING /prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE diff --git a/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst new file mode 100644 index 000000000..ce18b650d --- /dev/null +++ b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst @@ -0,0 +1,10 @@ +FIND_LIBRARY_USE_LIB32_PATHS +---------------------------- + +Whether the :command:`find_library` command should automatically search +``lib32`` directories. + +``FIND_LIBRARY_USE_LIB32_PATHS`` is a boolean specifying whether the +:command:`find_library` command should automatically search the ``lib32`` +variant of directories called ``lib`` in the search path when building 32-bit +binaries. diff --git a/Help/release/dev/find-lib32.rst b/Help/release/dev/find-lib32.rst new file mode 100644 index 000000000..00818dc09 --- /dev/null +++ b/Help/release/dev/find-lib32.rst @@ -0,0 +1,7 @@ +find-lib32 +---------- + +* The :command:`find_library` and :command:`find_package` commands learned + to search in ``lib32/`` directories when the build targets a 32-bit + architecture. See the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global + property. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 644687c01..33290c422 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -316,9 +316,13 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + list(APPEND _lib_dirs "lib32/pkgconfig") + endif() get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND _lib_dirs "lib64/pkgconfig") endif() endif() diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index e40a74fab..1f8c1b4c1 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -50,8 +50,9 @@ set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_ include(Platform/UnixPaths) -# Debian has lib64 paths only for compatibility so they should not be +# Debian has lib32 and lib64 paths only for compatibility so they should not be # searched. if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) endif() diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index 7ac6c7e84..6466a0a01 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -18,6 +18,7 @@ endif() set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) # OpenBSD has no multilib +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) # OpenBSD policy requires that shared libraries be installed without diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 20ee1d111..d6c3d41f3 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -93,5 +93,6 @@ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) -# Enable use of lib64 search path variants by default. +# Enable use of lib32 and lib64 search path variants by default. +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index a4d4dbbfe..3094fcf40 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -40,11 +40,10 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn, return true; } - if (const char* abi_name = - this->Makefile->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { - std::string abi = abi_name; - if (abi.find("ELF N32") != abi.npos) { - // Convert lib to lib32. + if (this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB32_PATHS")) { + // add special 32 bit paths if this is a 32 bit compile. + if (this->Makefile->PlatformIs32Bit()) { this->AddArchitecturePaths("32"); } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7908afe95..1a44d73dc 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -43,6 +43,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->UseConfigFiles = true; this->UseFindModules = true; this->DebugMode = false; + this->UseLib32Paths = false; this->UseLib64Paths = false; this->PolicyScope = true; this->VersionMajor = 0; @@ -110,6 +111,13 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, this->LibraryArchitecture = arch; } + // Lookup whether lib32 paths should be used. + if (this->Makefile->PlatformIs32Bit() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB32_PATHS")) { + this->UseLib32Paths = true; + } + // Lookup whether lib64 paths should be used. if (this->Makefile->PlatformIs64Bit() && this->Makefile->GetState()->GetGlobalPropertyAsBool( @@ -1907,6 +1915,9 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) if (!this->LibraryArchitecture.empty()) { common.push_back("lib/" + this->LibraryArchitecture); } + if (this->UseLib32Paths) { + common.push_back("lib32"); + } if (this->UseLib64Paths) { common.push_back("lib64"); } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index eff6b8090..9019f1b04 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -148,6 +148,7 @@ private: bool NoUserRegistry; bool NoSystemRegistry; bool DebugMode; + bool UseLib32Paths; bool UseLib64Paths; bool PolicyScope; std::string LibraryArchitecture; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ca30b3d66..eaf6a7db9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2076,6 +2076,14 @@ bool cmMakefile::IsSet(const std::string& name) const return true; } +bool cmMakefile::PlatformIs32Bit() const +{ + if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) { + return atoi(sizeof_dptr) == 4; + } + return false; +} + bool cmMakefile::PlatformIs64Bit() const { if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c665b1f12..1d9ccd0a7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -437,6 +437,9 @@ public: bool IsOn(const std::string& name) const; bool IsSet(const std::string& name) const; + /** Return whether the target platform is 32-bit. */ + bool PlatformIs32Bit() const; + /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index 2d4ecaf14..995865068 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -33,16 +33,23 @@ endmacro() set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) set(CMAKE_SIZEOF_VOID_P 4) foreach(lib + lib/32/libtest5.a lib/A/lib/libtest1.a + lib/A/lib32/libtest3.a lib/A/libtest1.a lib/libtest1.a lib/libtest2.a lib/libtest3.a lib/libtest3.a + lib32/A/lib/libtest2.a + lib32/A/lib32/libtest4.a + lib32/A/libtest4.a + lib32/libtest4.a ) test_find_library_subst(${lib}) endforeach() diff --git a/Tests/CMakeOnly/find_library/lib/32/libtest5.a b/Tests/CMakeOnly/find_library/lib/32/libtest5.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a b/Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a b/Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib32/A/libtest4.a b/Tests/CMakeOnly/find_library/lib32/A/libtest4.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib32/libtest4.a b/Tests/CMakeOnly/find_library/lib32/libtest4.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake index 9d4826fa8..4a4153391 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake index d9943d4fe..b66d02f1a 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake index 89ce4c6d8..25a775d7f 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -1,6 +1,3 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS -enable_language(C) - # Prepare environment and variables set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index c90327955..bdecb8ae6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS propertie + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake index a52bcbf81..df6723597 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake index 2fabe5b43..1351b6fbf 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS and FIND_LIBRARY_USE_LIB32_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb From bd9e551c1a13f566e6ffe8cdd1262b7628ed5330 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 10 Jun 2016 18:31:30 +0200 Subject: [PATCH 062/929] PseudoMemcheck: revise style with clang-format. Rename memtester.cxx.in to memtester.cxx, run clang-format, then restore the original name. Fix the @_retval@ placeholder that was broken by clang-format. --- .../CMakeLib/PseudoMemcheck/memtester.cxx.in | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index b141942c1..9958021a9 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -4,8 +4,7 @@ #define RETVAL @_retval@ -int -main(int ac, char **av) +int main(int ac, char** av) { cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); @@ -24,31 +23,26 @@ main(int ac, char **av) #else logarg = "-log-file="; #endif - else if (exename.find("BC") != exename.npos) - { + else if (exename.find("BC") != exename.npos) { nextarg = true; logarg = "/X"; - } + } if (!logarg.empty()) { std::string logfile; for (int i = 1; i < argc; i++) { std::string arg = argv[i]; - if (arg.find(logarg) == 0) - { - if (nextarg) - { + if (arg.find(logarg) == 0) { + if (nextarg) { if (i == argc - 1) return 1; // invalid command line logfile = argv[i + 1]; - } - else - { + } else { logfile = arg.substr(logarg.length()); - } - // keep searching, it may be overridden later to provoke an error } + // keep searching, it may be overridden later to provoke an error } + } if (!logfile.empty()) cmSystemTools::Touch(logfile, true); From a16bf141bc5d393b27d13d8235d95a1b034052c2 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 10 Jun 2016 18:36:24 +0200 Subject: [PATCH 063/929] Add missing braces around statements. Apply fixits of clang-tidy's readability-braces-around-statements checker. --- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 24 +++++++++++------ Source/CPack/IFW/cmCPackIFWInstaller.cxx | 3 ++- Source/CPack/IFW/cmCPackIFWPackage.cxx | 15 +++++++---- Source/CPack/IFW/cmCPackIFWRepository.cxx | 13 ++++++--- Source/CPack/cmCPackDebGenerator.cxx | 25 ++++++++++------- Source/CTest/cmCTestBZR.cxx | 9 ++++--- Source/CTest/cmCTestHG.cxx | 3 ++- Source/CTest/cmCTestMultiProcessHandler.cxx | 12 ++++++--- Source/CTest/cmCTestP4.cxx | 3 ++- Source/CTest/cmCTestSVN.cxx | 3 ++- .../CursesDialog/cmCursesLongMessageForm.cxx | 4 +-- Source/cmCacheManager.cxx | 3 ++- Source/cmDependsC.cxx | 3 ++- Source/cmGeneratorTarget.cxx | 21 ++++++++++----- Source/cmGlobalNinjaGenerator.cxx | 27 ++++++++++++------- Source/cmLocalNinjaGenerator.cxx | 21 ++++++++++----- Source/cmMakefile.cxx | 3 ++- Source/cmMakefileLibraryTargetGenerator.cxx | 3 ++- Source/cmNinjaNormalTargetGenerator.cxx | 15 ++++++----- Source/cmNinjaTargetGenerator.cxx | 24 +++++++++++------ Source/cmNinjaUtilityTargetGenerator.cxx | 11 +++++--- Source/cmOSXBundleGenerator.cxx | 18 ++++++++----- Source/cmSystemTools.cxx | 10 ++++--- Source/cmTarget.cxx | 3 ++- .../CMakeLib/PseudoMemcheck/memtester.cxx.in | 12 +++++---- Tests/CMakeLib/run_compile_commands.cxx | 15 +++++++---- 26 files changed, 198 insertions(+), 105 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index c1ff526cf..b47d46e56 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -345,18 +345,21 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent( const std::string& projectName, const std::string& componentName) { ComponentsMap::iterator cit = Components.find(componentName); - if (cit != Components.end()) + if (cit != Components.end()) { return &(cit->second); + } cmCPackComponent* component = cmCPackGenerator::GetComponent(projectName, componentName); - if (!component) + if (!component) { return component; + } std::string name = GetComponentPackageName(component); PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) + if (pit != Packages.end()) { return component; + } cmCPackIFWPackage* package = &Packages[name]; package->Name = name; @@ -387,13 +390,15 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup( { cmCPackComponentGroup* group = cmCPackGenerator::GetComponentGroup(projectName, groupName); - if (!group) + if (!group) { return group; + } std::string name = GetGroupPackageName(group); PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) + if (pit != Packages.end()) { return group; + } cmCPackIFWPackage* package = &Packages[name]; package->Name = name; @@ -462,8 +467,9 @@ std::string cmCPackIFWGenerator::GetGroupPackageName( cmCPackComponentGroup* group) const { std::string name; - if (!group) + if (!group) { return name; + } if (cmCPackIFWPackage* package = GetGroupPackage(group)) { return package->Name; } @@ -488,8 +494,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName( cmCPackComponent* component) const { std::string name; - if (!component) + if (!component) { return name; + } if (cmCPackIFWPackage* package = GetComponentPackage(component)) { return package->Name; } @@ -534,8 +541,9 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( const std::string& repositoryName) { RepositoriesMap::iterator rit = Repositories.find(repositoryName); - if (rit != Repositories.end()) + if (rit != Repositories.end()) { return &(rit->second); + } cmCPackIFWRepository* repository = &Repositories[repositoryName]; repository->Name = repositoryName; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index dfc509bc6..74f6da671 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles() void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index ad153d1aa..c44e3897f 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -71,8 +71,9 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const { - if (Compare.Type == CompareNone) + if (Compare.Type == CompareNone) { return Name; + } std::string result = Name; @@ -128,8 +129,9 @@ bool cmCPackIFWPackage::IsVersionEqual(const char* version) std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component) { - if (!component) + if (!component) { return ""; + } const char* option = GetOption("CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_NAME"); @@ -189,8 +191,9 @@ int cmCPackIFWPackage::ConfigureFromOptions() int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) { - if (!component) + if (!component) { return 0; + } // Restore defaul configuration DefaultConfiguration(); @@ -284,8 +287,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) { - if (!group) + if (!group) { return 0; + } // Restore defaul configuration DefaultConfiguration(); @@ -474,6 +478,7 @@ void cmCPackIFWPackage::GeneratePackageFile() void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 18380054d..b8a10c64a 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -89,8 +89,9 @@ bool cmCPackIFWRepository::IsVersionEqual(const char* version) bool cmCPackIFWRepository::ConfigureFromOptions() { // Name; - if (Name.empty()) + if (Name.empty()) { return false; + } std::string prefix = "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_"; @@ -198,8 +199,9 @@ protected: patched = true; } xout.EndElement(); - if (patched) + if (patched) { return; + } if (name == "Checksum") { repository->WriteRepositoryUpdates(xout); patched = true; @@ -209,8 +211,10 @@ protected: virtual void CharacterDataHandler(const char* data, int length) { std::string content(data, data + length); - if (content == "" || content == " " || content == " " || content == "\n") + if (content == "" || content == " " || content == " " || + content == "\n") { return; + } xout.Content(content); } }; @@ -332,6 +336,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout) void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index bef0fb4ff..b659359c0 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -826,8 +826,9 @@ static int copy_ar(CF* cfp, off_t size) size_t nr, nw; char buf[8 * 1024]; - if (sz == 0) + if (sz == 0) { return 0; + } FILE* from = cfp->rFile; FILE* to = cfp->wFile; @@ -837,16 +838,20 @@ static int copy_ar(CF* cfp, off_t size) : sizeof(buf), from)) > 0) { sz -= nr; - for (size_t off = 0; off < nr; nr -= off, off += nw) - if ((nw = fwrite(buf + off, 1, nr, to)) < nr) + for (size_t off = 0; off < nr; nr -= off, off += nw) { + if ((nw = fwrite(buf + off, 1, nr, to)) < nr) { return -1; + } + } } - if (sz) + if (sz) { return -2; + } if (cfp->flags & WPAD && (size + ar_already_written) & 1 && - fwrite(&pad, 1, 1, to) != 1) + fwrite(&pad, 1, 1, to) != 1) { return -4; + } return 0; } @@ -874,11 +879,11 @@ static int put_arobj(CF* cfp, struct stat* sb) if (gid > USHRT_MAX) { gid = USHRT_MAX; } - if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) + if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) { (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size + lname, ARFMAG); - else { + } else { lname = 0; (void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size, @@ -886,12 +891,14 @@ static int put_arobj(CF* cfp, struct stat* sb) } off_t size = sb->st_size; - if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) + if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) { return -1; + } if (lname) { - if (fwrite(name, 1, lname, cfp->wFile) != lname) + if (fwrite(name, 1, lname, cfp->wFile) != lname) { return -2; + } ar_already_written = lname; } result = copy_ar(cfp, size); diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index dd53be849..92eb570f5 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -61,8 +61,9 @@ extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*, // workaround for these unknown encodings. if (name == std::string("ascii") || name == std::string("cp1252") || name == std::string("ANSI_X3.4-1968")) { - for (unsigned int i = 0; i < 256; ++i) + for (unsigned int i = 0; i < 256; ++i) { info->map[i] = latin1[i]; + } return 1; } @@ -336,8 +337,9 @@ private: void DoPath(char c0, char c1, char c2, std::string path) { - if (path.empty()) + if (path.empty()) { return; + } cmSystemTools::ConvertToUnixSlashes(path); const std::string dir = cmSystemTools::GetFilenamePath(path); @@ -441,8 +443,9 @@ private: void DoPath(char c0, char c1, char c2, std::string path) { - if (path.empty()) + if (path.empty()) { return; + } cmSystemTools::ConvertToUnixSlashes(path); if (c0 == 'C') { diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index c6cfa44bb..f1fe3774c 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -75,8 +75,9 @@ private: void DoPath(char status, std::string const& path) { - if (path.empty()) + if (path.empty()) { return; + } // See "hg help status". Note that there is no 'conflict' status. switch (status) { diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 7b384addb..ae97d3209 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -413,12 +413,14 @@ void cmCTestMultiProcessHandler::UpdateCostData() std::string line; while (std::getline(fin, line)) { - if (line == "---") + if (line == "---") { break; + } std::vector parts = cmSystemTools::SplitString(line, ' '); // Format: - if (parts.size() < 3) + if (parts.size() < 3) { break; + } std::string name = parts[0]; int prev = atoi(parts[1].c_str()); @@ -464,8 +466,9 @@ void cmCTestMultiProcessHandler::ReadCostData() fin.open(fname.c_str()); std::string line; while (std::getline(fin, line)) { - if (line == "---") + if (line == "---") { break; + } std::vector parts = cmSystemTools::SplitString(line, ' '); @@ -480,8 +483,9 @@ void cmCTestMultiProcessHandler::ReadCostData() float cost = static_cast(atof(parts[2].c_str())); int index = this->SearchByName(name); - if (index == -1) + if (index == -1) { continue; + } this->Properties[index]->PreviousRuns = prev; // When not running in parallel mode, don't use cost data diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 07f9dadc5..ede11c990 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -426,8 +426,9 @@ void cmCTestP4::LoadRevisions() ChangeLists.clear(); this->RunChild(&p4_changes[0], &out, &err); - if (ChangeLists.empty()) + if (ChangeLists.empty()) { return; + } // p4 describe -s ...@1111111,2222222 std::vector p4_describe; diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index a6885aa26..fa014111b 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -271,8 +271,9 @@ bool cmCTestSVN::UpdateImpl() bool cmCTestSVN::RunSVNCommand(std::vector const& parameters, OutputParser* out, OutputParser* err) { - if (parameters.empty()) + if (parameters.empty()) { return false; + } std::vector args; args.push_back(this->CommandLineTool.c_str()); diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 84672ae07..d03d3300d 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -54,9 +54,9 @@ void cmCursesLongMessageForm::UpdateStatusBar() size = cmCursesMainForm::MAX_WIDTH - 1; } strncpy(bar, this->Title.c_str(), size); - for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) + for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) { bar[i] = ' '; - + } int width; if (x < cmCursesMainForm::MAX_WIDTH) { width = x; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 676e84a2a..9adfdafae 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -71,8 +71,9 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, while (*realbuffer != '0' && (*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\r' || *realbuffer == '\n')) { - if (*realbuffer == '\n') + if (*realbuffer == '\n') { lineno++; + } realbuffer++; } // skip blank lines and comment lines diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index f81bf068d..57e719cc8 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -158,7 +158,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, this->HeaderLocationCache.find(current.FileName); if (headerLocationIt != this->HeaderLocationCache.end()) { fullName = headerLocationIt->second; - } else + } else { for (std::vector::const_iterator i = this->IncludePath.begin(); i != this->IncludePath.end(); ++i) { @@ -175,6 +175,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, break; } } + } } // Complain if the file cannot be found and matches the complain diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1607dd937..de02395bc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1348,8 +1348,9 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, fpath += ".app"; if (!this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) + if (!contentOnly) { fpath += "/MacOS"; + } } return fpath; } @@ -1377,8 +1378,9 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, fpath += ext; if (!this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) + if (!contentOnly) { fpath += "/MacOS"; + } } return fpath; } @@ -3336,11 +3338,13 @@ static std::string intersect(const std::set& s1, { std::string result; result = intersect(s1, s2); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s3); - if (!result.empty()) + if (!result.empty()) { return result; + } return intersect(s2, s3); } @@ -3351,14 +3355,17 @@ static std::string intersect(const std::set& s1, { std::string result; result = intersect(s1, s2); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s3); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s4); - if (!result.empty()) + if (!result.empty()) { return result; + } return intersect(s2, s3, s4); } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3abcba398..f74e83562 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -30,8 +30,9 @@ const char* cmGlobalNinjaGenerator::INDENT = " "; void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count) { - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { os << cmGlobalNinjaGenerator::INDENT; + } } void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os) @@ -43,8 +44,9 @@ void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os) void cmGlobalNinjaGenerator::WriteComment(std::ostream& os, const std::string& comment) { - if (comment.empty()) + if (comment.empty()) { return; + } std::string::size_type lpos = 0; std::string::size_type rpos; @@ -165,16 +167,18 @@ void cmGlobalNinjaGenerator::WriteBuild( if (!implicitDeps.empty()) { arguments += " |"; for (cmNinjaDeps::const_iterator i = implicitDeps.begin(); - i != implicitDeps.end(); ++i) + i != implicitDeps.end(); ++i) { arguments += " " + EncodeIdent(EncodePath(*i), os); + } } // Write order-only dependencies. if (!orderOnlyDeps.empty()) { arguments += " ||"; for (cmNinjaDeps::const_iterator i = orderOnlyDeps.begin(); - i != orderOnlyDeps.end(); ++i) + i != orderOnlyDeps.end(); ++i) { arguments += " " + EncodeIdent(EncodePath(*i), os); + } } arguments += "\n"; @@ -198,9 +202,10 @@ void cmGlobalNinjaGenerator::WriteBuild( // Write the variables bound to this build statement. std::ostringstream variable_assignments; for (cmNinjaVars::const_iterator i = variables.begin(); i != variables.end(); - ++i) + ++i) { cmGlobalNinjaGenerator::WriteVariable(variable_assignments, i->first, i->second, "", 1); + } // check if a response file rule should be used std::string buildstr = build; @@ -430,8 +435,9 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os, cmGlobalNinjaGenerator::WriteComment(os, comment); os << "default"; for (cmNinjaDeps::const_iterator i = targets.begin(); i != targets.end(); - ++i) + ++i) { os << " " << *i; + } os << "\n"; } @@ -907,15 +913,17 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, this->AppendTargetOutputs(target, outputs); // 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) + for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) { TargetAliases[*i] = 0; + } // Insert the alias into the map. If the alias was already present in the // map and referred to another target, mark it as ambiguous. std::pair newAlias = TargetAliases.insert(std::make_pair(buildAlias, target)); - if (newAlias.second && newAlias.first->second != target) + if (newAlias.second && newAlias.first->second != target) { newAlias.first->second = 0; + } } void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) @@ -926,8 +934,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) for (TargetAliasMap::const_iterator i = TargetAliases.begin(); i != TargetAliases.end(); ++i) { // Don't write ambiguous aliases. - if (!i->second) + if (!i->second) { continue; + } cmNinjaDeps deps; this->AppendTargetOutputs(i->second, deps); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6c231c3ec..6e676f1d3 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -81,8 +81,9 @@ void cmLocalNinjaGenerator::Generate() tg->Generate(); // Add the target to "all" if required. if (!this->GetGlobalNinjaGenerator()->IsExcluded( - this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) + this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) { this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t); + } delete tg; } } @@ -257,8 +258,9 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) os << "# Write statements declared in CMakeLists.txt:" << std::endl << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; - if (this->IsRootMakefile()) + if (this->IsRootMakefile()) { os << "# Which is the root file." << std::endl; + } cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; } @@ -282,9 +284,10 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps( for (std::vector::const_iterator i = deps.begin(); i != deps.end(); ++i) { std::string dep; - if (this->GetRealDependency(*i, this->GetConfigName(), dep)) + if (this->GetRealDependency(*i, this->GetConfigName(), dep)) { ninjaDeps.push_back( this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(dep)); + } } } @@ -294,12 +297,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine( // If we have no commands but we need to build a command anyway, use ":". // This happens when building a POST_BUILD value for link targets that // don't use POST_BUILD. - if (cmdLines.empty()) + if (cmdLines.empty()) { #ifdef _WIN32 return "cd ."; #else return ":"; #endif + } std::ostringstream cmd; for (std::vector::const_iterator li = cmdLines.begin(); @@ -332,8 +336,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( { if (ccg.GetNumberOfCommands() > 0) { std::string wd = ccg.GetWorkingDirectory(); - if (wd.empty()) + if (wd.empty()) { wd = this->GetCurrentBinaryDirectory(); + } std::ostringstream cdCmd; #ifdef _WIN32 @@ -361,8 +366,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps) { - if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) + if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) { return; + } cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this); @@ -391,8 +397,9 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->AppendCustomCommandDeps(ccg, ninjaDeps); for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end(); - ++i) + ++i) { this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i); + } std::vector cmdLines; this->AppendCustomCommandLines(ccg, cmdLines); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ca30b3d66..e3d66148c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3620,8 +3620,9 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, bool cmMakefile::IsAlias(const std::string& name) const { - if (this->AliasTargets.find(name) != this->AliasTargets.end()) + if (this->AliasTargets.find(name) != this->AliasTargets.end()) { return true; + } return this->GetGlobalGenerator()->IsAlias(name); } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 0998eb811..438f90f3d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -329,8 +329,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( buildEcho += " shared library "; break; case cmState::MODULE_LIBRARY: - if (this->GeneratorTarget->IsCFBundleOnApple()) + if (this->GeneratorTarget->IsCFBundleOnApple()) { buildEcho += " CFBundle"; + } buildEcho += " shared module "; break; default: diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index fdce542cc..5225e3ff0 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -41,15 +41,16 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator( , TargetLinkLanguage("") { this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName()); - if (target->GetType() == cmState::EXECUTABLE) + if (target->GetType() == cmState::EXECUTABLE) { this->GetGeneratorTarget()->GetExecutableNames( this->TargetNameOut, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, GetLocalGenerator()->GetConfigName()); - else + } else { this->GetGeneratorTarget()->GetLibraryNames( this->TargetNameOut, this->TargetNameSO, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, GetLocalGenerator()->GetConfigName()); + } if (target->GetType() != cmState::OBJECT_LIBRARY) { // on Windows the output dir is already needed at compile time @@ -125,10 +126,11 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const case cmState::SHARED_LIBRARY: return "shared library"; case cmState::MODULE_LIBRARY: - if (this->GetGeneratorTarget()->IsCFBundleOnApple()) + if (this->GetGeneratorTarget()->IsCFBundleOnApple()) { return "CFBundle shared module"; - else + } else { return "shared module"; + } case cmState::EXECUTABLE: return "executable"; default: @@ -271,7 +273,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); - if (targetType == cmState::EXECUTABLE) + if (targetType == cmState::EXECUTABLE) { this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_EXECUTABLE", cmakeCommand + " -E cmake_symlink_executable" @@ -284,7 +286,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) /*rspcontent*/ "", /*restat*/ "", /*generator*/ false); - else + } else { this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_LIBRARY", cmakeCommand + " -E cmake_symlink_library" @@ -297,6 +299,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) /*rspcontent*/ "", /*restat*/ "", /*generator*/ false); + } } } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b0f0d9b47..05a0a6392 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -46,8 +46,9 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) // (i.e. top-level) directory. CMake creates copies of these targets // in every directory, which we don't need. if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(), - target->GetLocalGenerator()->GetSourceDirectory()) == 0) + target->GetLocalGenerator()->GetSourceDirectory()) == 0) { return new cmNinjaUtilityTargetGenerator(target); + } // else fallthrough } @@ -132,8 +133,9 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, includes, this->GeneratorTarget, language, language == "RC", // full include paths for RC needed by cmcldeps false, this->GetConfigName()); - if (this->GetGlobalGenerator()->IsGCCOnWindows()) + if (this->GetGlobalGenerator()->IsGCCOnWindows()) { std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/'); + } this->LocalGenerator->AppendFlags(languageFlags, includeFlags); } @@ -170,13 +172,15 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const { // Static libraries never depend on other targets for linking. if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) + this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) { return cmNinjaDeps(); + } cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(this->GetConfigName()); - if (!cli) + if (!cli) { return cmNinjaDeps(); + } const std::vector& deps = cli->GetDepends(); cmNinjaDeps result(deps.size()); @@ -218,8 +222,9 @@ std::string cmNinjaTargetGenerator::GetObjectFilePath( cmSourceFile const* source) const { std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); - if (!path.empty()) + if (!path.empty()) { path += "/"; + } std::string const& objectName = this->GeneratorTarget->GetObjectName(source); path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); path += "/"; @@ -237,8 +242,9 @@ std::string cmNinjaTargetGenerator::GetTargetFilePath( const std::string& name) const { std::string path = this->GetTargetOutputDir(); - if (path.empty() || path == ".") + if (path.empty() || path == ".") { return name; + } path += "/"; path += name; return path; @@ -420,8 +426,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) } for (std::vector::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) + i != compileCmds.end(); ++i) { this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); + } std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(compileCmds); @@ -653,8 +660,9 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( cmSystemTools::ExpandListArgument(compileCmd, compileCmds); for (std::vector::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) + i != compileCmds.end(); ++i) { this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); + } std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(compileCmds); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index f7a7f38c8..c54964671 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -57,8 +57,9 @@ void cmNinjaUtilityTargetGenerator::Generate() std::vector const& ccByproducts = ccg.GetByproducts(); std::transform(ccByproducts.begin(), ccByproducts.end(), std::back_inserter(util_outputs), MapToNinjaPath()); - if (ci->GetUsesTerminal()) + if (ci->GetUsesTerminal()) { uses_terminal = true; + } } } @@ -99,10 +100,11 @@ void cmNinjaUtilityTargetGenerator::Generate() const char* echoStr = this->GetGeneratorTarget()->GetProperty("EchoString"); std::string desc; - if (echoStr) + if (echoStr) { desc = echoStr; - else + } else { desc = "Running utility command for " + this->GetTargetName(); + } // TODO: fix problematic global targets. For now, search and replace the // makefile vars. @@ -122,8 +124,9 @@ void cmNinjaUtilityTargetGenerator::Generate() .c_str()); cmSystemTools::ReplaceString(command, "$(ARGS)", ""); - if (command.find('$') != std::string::npos) + if (command.find('$') != std::string::npos) { return; + } for (cmNinjaDeps::const_iterator oi = util_outputs.begin(), oe = util_outputs.end(); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index f62ba40cc..c19cae0d0 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -25,8 +25,9 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target, , ConfigName(configName) , MacContentFolders(0) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } } bool cmOSXBundleGenerator::MustSkip() @@ -37,8 +38,9 @@ bool cmOSXBundleGenerator::MustSkip() void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, std::string& outpath) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } // Compute bundle directory names. std::string out = outpath; @@ -64,8 +66,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, const std::string& outpath) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } assert(this->MacContentFolders); @@ -92,8 +95,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, plist.c_str()); // Generate Versions directory only for MacOSX frameworks - if (this->Makefile->PlatformIsAppleIos()) + if (this->Makefile->PlatformIsAppleIos()) { return; + } // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to // drive rules to create these files at build time. @@ -162,8 +166,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, const std::string& root) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } // Compute bundle directory names. std::string out = root; @@ -186,8 +191,9 @@ void cmOSXBundleGenerator::GenerateMacOSXContentStatements( std::vector const& sources, MacOSXContentGeneratorType* generator) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } for (std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 10c68d193..26cbfb6bf 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -228,14 +228,16 @@ std::string cmSystemTools::HelpFileName(std::string name) std::string cmSystemTools::TrimWhitespace(const std::string& s) { std::string::const_iterator start = s.begin(); - while (start != s.end() && cm_isspace(*start)) + while (start != s.end() && cm_isspace(*start)) { ++start; - if (start == s.end()) + } + if (start == s.end()) { return ""; - + } std::string::const_iterator stop = s.end() - 1; - while (cm_isspace(*stop)) + while (cm_isspace(*stop)) { --stop; + } return std::string(start, stop + 1); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index da2a64993..55da611f8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -287,8 +287,9 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( { std::map::const_iterator i = this->UtilityBacktraces.find(u); - if (i == this->UtilityBacktraces.end()) + if (i == this->UtilityBacktraces.end()) { return 0; + } return &i->second; } diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index 9958021a9..e2cdec89a 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -15,15 +15,15 @@ int main(int ac, char** av) std::string logarg; bool nextarg = false; - if (exename.find("valgrind") != exename.npos) + if (exename.find("valgrind") != exename.npos) { logarg = "--log-file="; - else if (exename.find("purify") != exename.npos) + } else if (exename.find("purify") != exename.npos) { #ifdef _WIN32 logarg = "/SAVETEXTDATA="; #else logarg = "-log-file="; #endif - else if (exename.find("BC") != exename.npos) { + } else if (exename.find("BC") != exename.npos) { nextarg = true; logarg = "/X"; } @@ -34,8 +34,9 @@ int main(int ac, char** av) std::string arg = argv[i]; if (arg.find(logarg) == 0) { if (nextarg) { - if (i == argc - 1) + if (i == argc - 1) { return 1; // invalid command line + } logfile = argv[i + 1]; } else { logfile = arg.substr(logarg.length()); @@ -44,8 +45,9 @@ int main(int ac, char** av) } } - if (!logfile.empty()) + if (!logfile.empty()) { cmSystemTools::Touch(logfile, true); + } } return RETVAL; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 1cfd3815a..b811c7fd5 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -46,10 +46,12 @@ private: void ParseTranslationUnit() { this->Command = CommandType(); - if (!Expect('{')) + if (!Expect('{')) { return; - if (Expect('}')) + } + if (Expect('}')) { return; + } do { ParseString(); std::string name = this->String; @@ -64,8 +66,9 @@ private: void ParseString() { this->String = ""; - if (!Expect('"')) + if (!Expect('"')) { return; + } while (!Expect('"')) { Expect('\\'); this->String.append(1, C); @@ -84,8 +87,9 @@ private: void ExpectOrDie(char c, const std::string& message) { - if (!Expect(c)) + if (!Expect(c)) { ErrorExit(std::string("'") + c + "' expected " + message + "."); + } } void NextNonWhitespace() @@ -98,8 +102,9 @@ private: void Next() { this->C = char(Input->get()); - if (this->Input->bad()) + if (this->Input->bad()) { ErrorExit("Unexpected end of file."); + } } void ErrorExit(const std::string& message) From d6e99fa8345f07a72308b8b33f4a31aa7fe9a0fd Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 11 Jun 2016 00:01:07 -0400 Subject: [PATCH 064/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 254d9dea1..a27d5e15d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160610) +set(CMake_VERSION_PATCH 20160611) #set(CMake_VERSION_RC 1) From 757b0ff5dd08445ebac4f7ea50dd143a67f2e966 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 11 Jun 2016 09:49:00 +0200 Subject: [PATCH 065/929] Add missing braces around statements in header files --- Source/cmGlobalGeneratorFactory.h | 3 ++- Source/cmMakefile.h | 6 ++++-- Source/cmStandardIncludes.h | 12 ++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 640497ab8..7d4fe2ce8 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -51,8 +51,9 @@ public: virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, cmake* cm) const { - if (name != T::GetActualName()) + if (name != T::GetActualName()) { return 0; + } return new T(cm); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c665b1f12..a07836230 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -643,8 +643,9 @@ public: void AddInstallGenerator(cmInstallGenerator* g) { - if (g) + if (g) { this->InstallGenerators.push_back(g); + } } std::vector& GetInstallGenerators() { @@ -653,8 +654,9 @@ public: void AddTestGenerator(cmTestGenerator* g) { - if (g) + if (g) { this->TestGenerators.push_back(g); + } } const std::vector& GetTestGenerators() const { diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 6669e5c12..d3bf301c3 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -75,17 +75,21 @@ struct cmDocumentationEntry cmDocumentationEntry() {} cmDocumentationEntry(const char* doc[2]) { - if (doc[0]) + if (doc[0]) { this->Name = doc[0]; - if (doc[1]) + } + if (doc[1]) { this->Brief = doc[1]; + } } cmDocumentationEntry(const char* n, const char* b) { - if (n) + if (n) { this->Name = n; - if (b) + } + if (b) { this->Brief = b; + } } }; From acf0c0f4446e6d3cee8b00a7ebc39d5d8040e42d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 12 Jun 2016 00:01:09 -0400 Subject: [PATCH 066/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a27d5e15d..65e4a53d5 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160611) +set(CMake_VERSION_PATCH 20160612) #set(CMake_VERSION_RC 1) From 0a4af0735f2aeec74a723dd6af31db585f1b664e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Jun 2016 18:38:33 +0200 Subject: [PATCH 067/929] cmake: Issue message independent of cmMakefile definition The makefile is only used when called by the cmMessageCommand, so inline the use of it there. It otherwise creates an undesirable dependency on cmMakefile for issuing messages in the cmake instance, a violation of the Interface Segregation Principle. https://en.wikipedia.org/wiki/Interface_segregation_principle This also makes it more explicit that the variable definitions only affect the message() command. If an AUTHOR_WARNING is issued for any other reason, it is not affected. To affect that, it is necessary to set the cache variable instead of the regular variable. This is an unfortunate interface quirk, but one which can't be fixed easily now. --- Source/cmMessageCommand.cxx | 11 ++-- Source/cmake.cxx | 58 +++++-------------- Source/cmake.h | 8 +-- Tests/RunCMake/message/RunCMakeTest.cmake | 2 + .../message-internal-warning-stderr.txt | 13 +++++ .../message/message-internal-warning.cmake | 5 ++ .../nomessage-internal-warning-stderr.txt | 0 .../message/nomessage-internal-warning.cmake | 5 ++ 8 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 Tests/RunCMake/message/message-internal-warning-stderr.txt create mode 100644 Tests/RunCMake/message/message-internal-warning.cmake create mode 100644 Tests/RunCMake/message/nomessage-internal-warning-stderr.txt create mode 100644 Tests/RunCMake/message/nomessage-internal-warning.cmake diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f4458a7da..dab90c914 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -24,7 +24,6 @@ bool cmMessageCommand::InitialPass(std::vector const& args, cmake::MessageType type = cmake::MESSAGE; bool status = false; bool fatal = false; - cmake* cm = this->Makefile->GetCMakeInstance(); if (*i == "SEND_ERROR") { type = cmake::FATAL_ERROR; ++i; @@ -36,10 +35,11 @@ bool cmMessageCommand::InitialPass(std::vector const& args, type = cmake::WARNING; ++i; } else if (*i == "AUTHOR_WARNING") { - if (cm->GetDevWarningsAsErrors(this->Makefile)) { + if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && + !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) { fatal = true; type = cmake::AUTHOR_ERROR; - } else if (!cm->GetSuppressDevWarnings(this->Makefile)) { + } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { type = cmake::AUTHOR_WARNING; } else { return true; @@ -49,10 +49,11 @@ bool cmMessageCommand::InitialPass(std::vector const& args, status = true; ++i; } else if (*i == "DEPRECATION") { - if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) { + if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) { fatal = true; type = cmake::DEPRECATION_ERROR; - } else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) { + } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") || + this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) { type = cmake::DEPRECATION_WARNING; } else { return true; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ecbdc61a8..98ac518f6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2447,19 +2447,11 @@ void cmake::RunCheckForUnusedVariables() #endif } -bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) const +bool cmake::GetSuppressDevWarnings() const { - /* - * The suppression CMake variable may be set in the CMake configuration file - * itself, so we have to check what its set to in the makefile if we can. - */ - if (mf) { - return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - return cmSystemTools::IsOn(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetSuppressDevWarnings(bool b) @@ -2481,20 +2473,11 @@ void cmake::SetSuppressDevWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) const +bool cmake::GetSuppressDeprecatedWarnings() const { - /* - * The suppression CMake variable may be set in the CMake configuration file - * itself, so we have to check what its set to in the makefile if we can. - */ - if (mf) { - return (mf->IsSet("CMAKE_WARN_DEPRECATED") && - !mf->IsOn("CMAKE_WARN_DEPRECATED")); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetSuppressDeprecatedWarnings(bool b) @@ -2516,16 +2499,11 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDevWarningsAsErrors() const { - if (mf) { - return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && - !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetDevWarningsAsErrors(bool b) @@ -2547,15 +2525,11 @@ void cmake::SetDevWarningsAsErrors(bool b) cmState::INTERNAL); } -bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDeprecatedWarningsAsErrors() const { - if (mf) { - return mf->IsOn("CMAKE_ERROR_DEPRECATED"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - return cmSystemTools::IsOn(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetDeprecatedWarningsAsErrors(bool b) diff --git a/Source/cmake.h b/Source/cmake.h index 4958a05dc..aa1ff2caf 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -339,7 +339,7 @@ public: * Returns false, by default, if developer warnings should be shown, true * otherwise. */ - bool GetSuppressDevWarnings(cmMakefile const* mf = NULL) const; + bool GetSuppressDevWarnings() const; /* * Set the state of the suppression of developer (author) warnings. */ @@ -350,7 +350,7 @@ public: * Returns false, by default, if deprecated warnings should be shown, true * otherwise. */ - bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL) const; + bool GetSuppressDeprecatedWarnings() const; /* * Set the state of the suppression of deprecated warnings. */ @@ -361,7 +361,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL) const; + bool GetDevWarningsAsErrors() const; /** * Set the state of treating developer (author) warnings as errors. */ @@ -372,7 +372,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL) const; + bool GetDeprecatedWarningsAsErrors() const; /** * Set the state of treating developer (author) warnings as errors. */ diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 94896930a..2346c8675 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(defaultmessage) run_cmake(nomessage) +run_cmake(message-internal-warning) +run_cmake(nomessage-internal-warning) run_cmake(warnmessage) # message command sets fatal occurred flag, so check each type of error diff --git a/Tests/RunCMake/message/message-internal-warning-stderr.txt b/Tests/RunCMake/message/message-internal-warning-stderr.txt new file mode 100644 index 000000000..25946e9b2 --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\) in message-internal-warning.cmake: + A logical block opening on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:4 \(macro\) + + closes on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:5 \(endmacro\) + + with mis-matching arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/message/message-internal-warning.cmake b/Tests/RunCMake/message/message-internal-warning.cmake new file mode 100644 index 000000000..33993c7ff --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) + +macro(mymacro) +endmacro(notmymacro) diff --git a/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt b/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/message/nomessage-internal-warning.cmake b/Tests/RunCMake/message/nomessage-internal-warning.cmake new file mode 100644 index 000000000..3ec2e28d7 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON CACHE BOOL "") + +macro(mymacro) +endmacro(notmymacro) From 096c7754b3b7edd2e69f79b81b06539e5c9314f3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Jun 2016 09:58:21 +0200 Subject: [PATCH 068/929] cmLocalGenerator: Store Backtrace for the directory Don't rely on cmMakefile to provide that. Use it to issue messages. --- Source/cmLocalGenerator.cxx | 3 ++- Source/cmLocalGenerator.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f543ec42a..759e06cd5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -45,6 +45,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) : cmOutputConverter(makefile->GetStateSnapshot()) , StateSnapshot(makefile->GetStateSnapshot()) + , DirectoryBacktrace(makefile->GetBacktrace()) { this->GlobalGenerator = gg; @@ -68,7 +69,7 @@ cmLocalGenerator::~cmLocalGenerator() void cmLocalGenerator::IssueMessage(cmake::MessageType t, std::string const& text) const { - this->Makefile->IssueMessage(t, text); + this->GetCMakeInstance()->IssueMessage(t, text, this->DirectoryBacktrace); } void cmLocalGenerator::ComputeObjectMaxPath() diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ac2ebce97..8e5563caa 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -368,6 +368,7 @@ protected: cmMakefile* Makefile; cmState::Snapshot StateSnapshot; + cmListFileBacktrace DirectoryBacktrace; cmGlobalGenerator* GlobalGenerator; std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; From 946d1e50dc80bfb593ad7b6d4bded279fa17ced9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:27 +0100 Subject: [PATCH 069/929] cmMakefile: Avoid IssueMessage after configure is finished --- Source/cmMakefile.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ca30b3d66..c57fa7f8b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -546,7 +546,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::WARN: // Warn because the user did not provide a mimimum required // version. - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, + msg.str(), this->Backtrace); case cmPolicies::OLD: // OLD behavior is to use policy version 2.4 set in // cmListFileCache. @@ -555,7 +556,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // NEW behavior is to issue an error. - this->IssueMessage(cmake::FATAL_ERROR, msg.str()); + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str(), + this->Backtrace); cmSystemTools::SetFatalErrorOccured(); return; } @@ -651,12 +653,13 @@ void cmMakefile::ConfigureFinalPass() const char* oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); if (oldValue && cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { - this->IssueMessage( + this->GetCMakeInstance()->IssueMessage( cmake::FATAL_ERROR, "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " "than 2.4. This version of CMake only supports backwards compatibility " "with CMake 2.4 or later. For compatibility with older versions please " - "use any CMake 2.8.x release or lower."); + "use any CMake 2.8.x release or lower.", + this->Backtrace); } } @@ -2048,7 +2051,8 @@ void cmMakefile::ExpandVariablesCMP0019() << "The following variable evaluations were encountered:\n" << w.str(); /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, m.str(), + this->Backtrace); } } From df8c3130d6e31558469cd1f0daa63e65cec79af1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:27 +0100 Subject: [PATCH 070/929] cmGlobalGenerator: Don't use cmMakefile::IssueMessage after configure --- Source/cmGlobalGenerator.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fc34b8b21..aef3f44b3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2188,9 +2188,10 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) // Install bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES"); if (this->InstallTargetEnabled && skipInstallRules) { - mf->IssueMessage(cmake::WARNING, - "CMAKE_SKIP_INSTALL_RULES was enabled even though " - "installation rules have been specified"); + this->CMakeInstance->IssueMessage( + cmake::WARNING, "CMAKE_SKIP_INSTALL_RULES was enabled even though " + "installation rules have been specified", + mf->GetBacktrace()); } else if (this->InstallTargetEnabled && !skipInstallRules) { if (!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') { std::set* componentsSet = &this->InstallComponents; From ea5324cd4b570ea757a6da96a7bc85538943e008 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:27 +0100 Subject: [PATCH 071/929] cmMakefile: Port messages for compile features to cmake --- Source/cmMakefile.cxx | 38 +++++++++++++++++++++++++++++--------- Source/cmMakefile.h | 7 ++++--- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c57fa7f8b..fe3194073 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3997,14 +3997,20 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, << this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID") << "\"\nversion " << this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << "."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + if (error) { + *error = e.str(); + } else { + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Backtrace); + } return false; } target->AppendProperty("COMPILE_FEATURES", feature.c_str()); - return lang == "C" ? this->AddRequiredTargetCFeature(target, feature) - : this->AddRequiredTargetCxxFeature(target, feature); + return lang == "C" + ? this->AddRequiredTargetCFeature(target, feature, error) + : this->AddRequiredTargetCxxFeature(target, feature, error); } bool cmMakefile::CompileFeatureKnown(cmTarget const* target, @@ -4040,7 +4046,8 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target, if (error) { *error = e.str(); } else { - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Backtrace); } return false; } @@ -4065,7 +4072,8 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang, if (error) { *error = e.str(); } else { - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Backtrace); } return 0; } @@ -4252,7 +4260,8 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, } bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, - const std::string& feature) const + const std::string& feature, + std::string* error) const { bool needCxx98 = false; bool needCxx11 = false; @@ -4268,7 +4277,12 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, std::ostringstream e; e << "The CXX_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCxxStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + if (error) { + *error = e.str(); + } else { + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Backtrace); + } return false; } } @@ -4333,7 +4347,8 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature, } bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, - const std::string& feature) const + const std::string& feature, + std::string* error) const { bool needC90 = false; bool needC99 = false; @@ -4348,7 +4363,12 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, std::ostringstream e; e << "The C_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + if (error) { + *error = e.str(); + } else { + this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Backtrace); + } return false; } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c665b1f12..4fc197dd6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -928,11 +928,12 @@ private: std::vector QtUiFilesWithOptions; - bool AddRequiredTargetCFeature(cmTarget* target, - const std::string& feature) const; + bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature, + std::string* error = 0) const; bool AddRequiredTargetCxxFeature(cmTarget* target, - const std::string& feature) const; + const std::string& feature, + std::string* error = 0) const; void CheckNeededCLanguage(const std::string& feature, bool& needC90, bool& needC99, bool& needC11) const; From 54c65d5fb22c3cc53ecd707687c2f25b1643726b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Jun 2016 22:06:01 +0200 Subject: [PATCH 072/929] cmake: Extract DisplayMessage API. --- Source/cmake.cxx | 6 ++++++ Source/cmake.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ecbdc61a8..657091b42 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2310,6 +2310,12 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, return; } + this->DisplayMessage(t, text, backtrace); +} + +void cmake::DisplayMessage(cmake::MessageType t, std::string const& text, + cmListFileBacktrace const& backtrace) const +{ std::ostringstream msg; if (!printMessagePreamble(t, msg)) { return; diff --git a/Source/cmake.h b/Source/cmake.h index 4958a05dc..1d63ede80 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -384,6 +384,9 @@ public: cmListFileBacktrace const& backtrace = cmListFileBacktrace(), bool force = false) const; + void DisplayMessage(cmake::MessageType t, std::string const& text, + cmListFileBacktrace const& backtrace) const; + ///! run the --build option int Build(const std::string& dir, const std::string& target, const std::string& config, From 23f87e8157770c56d3aa568f3d1318f9b9070364 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Jun 2016 09:57:47 +0200 Subject: [PATCH 073/929] cmake: Remove force from IssueMessage API The force parameter is ugly and makes the method harder to reason about (issues the message ... but maybe it doesn't ... but then again you can force it). It is a violation of https://en.wikipedia.org/wiki/Interface_segregation_principle and is the kind of thing described in a recent blog here: http://code.joejag.com/2016/anti-if-the-missing-patterns.html "Any time you see this you actually have two methods bundled into one. That boolean represents an opportunity to name a concept in your code." --- Source/cmMakefile.cxx | 6 +++--- Source/cmMakefile.h | 3 +-- Source/cmMessageCommand.cxx | 5 +++-- Source/cmake.cxx | 16 +++++++--------- Source/cmake.h | 3 +-- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ca30b3d66..00ff5ac8c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -105,8 +105,8 @@ cmMakefile::~cmMakefile() cmDeleteAll(this->EvaluationFiles); } -void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text, - bool force) const +void cmMakefile::IssueMessage(cmake::MessageType t, + std::string const& text) const { // Collect context information. if (!this->ExecutionStatusStack.empty()) { @@ -114,7 +114,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text, this->ExecutionStatusStack.back()->SetNestedError(true); } } - this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace(), force); + this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c665b1f12..719c7648f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -715,8 +715,7 @@ public: cmMakefile* Makefile; }; - void IssueMessage(cmake::MessageType t, std::string const& text, - bool force = false) const; + void IssueMessage(cmake::MessageType t, std::string const& text) const; /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f4458a7da..689e3fa8d 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -63,8 +63,9 @@ bool cmMessageCommand::InitialPass(std::vector const& args, std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); if (type != cmake::MESSAGE) { - // we've overriden the message type, above, so force IssueMessage to use it - this->Makefile->IssueMessage(type, message, true); + // we've overriden the message type, above, so display it directly + cmake* cm = this->Makefile->GetCMakeInstance(); + cm->DisplayMessage(type, message, this->Makefile->GetBacktrace()); } else { if (status) { this->Makefile->DisplayStatus(message.c_str(), -1); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 657091b42..594eebf29 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2294,16 +2294,14 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) } void cmake::IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace, - bool force) const + cmListFileBacktrace const& backtrace) const { - if (!force) { - // override the message type, if needed, for warnings and errors - cmake::MessageType override = this->ConvertMessageType(t); - if (override != t) { - t = override; - force = true; - } + bool force = false; + // override the message type, if needed, for warnings and errors + cmake::MessageType override = this->ConvertMessageType(t); + if (override != t) { + t = override; + force = true; } if (!force && !this->IsMessageTypeVisible(t)) { diff --git a/Source/cmake.h b/Source/cmake.h index 1d63ede80..523c576d3 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -381,8 +381,7 @@ public: /** Display a message to the user. */ void IssueMessage( cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace = cmListFileBacktrace(), - bool force = false) const; + cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; void DisplayMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace) const; From 06ee543c00971cd6d52a41da146fdbc9317fd5f7 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 13 Jun 2016 00:01:05 -0400 Subject: [PATCH 074/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65e4a53d5..26702f892 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160612) +set(CMake_VERSION_PATCH 20160613) #set(CMake_VERSION_RC 1) From 42fe7d215092dd1251a9ec298ca83a6ad9e59b86 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 13 Jun 2016 09:55:17 -0400 Subject: [PATCH 075/929] Help: clarify PARENT_SCOPE behavior Fixes #15093. --- Help/command/set.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Help/command/set.rst b/Help/command/set.rst index d04b88004..b24ebefeb 100644 --- a/Help/command/set.rst +++ b/Help/command/set.rst @@ -25,7 +25,9 @@ If the ``PARENT_SCOPE`` option is given the variable will be set in the scope above the current scope. Each new directory or function creates a new scope. This command will set the value of a variable into the parent directory or calling function (whichever is applicable -to the case at hand). +to the case at hand). The previous state of the variable's value stays the +same in the current scope (e.g., if it was undefined before, it is still +undefined and if it had a value, it is still that value). Set Cache Entry ^^^^^^^^^^^^^^^ From ebf18df58083c90d4ba06ab896dfad8df9fe6ade Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 13 Jun 2016 11:09:05 -0400 Subject: [PATCH 076/929] cmFindPackageCommand: use iterators to loop over configurations --- Source/cmFindPackageCommand.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7908afe95..4ab7a7239 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -670,10 +670,10 @@ bool cmFindPackageCommand::HandlePackageMode() << " requested version \"" << this->Version << "\".\n" << "The following configuration files were considered but not " "accepted:\n"; - for (std::vector::size_type i = 0; - i < this->ConsideredConfigs.size(); i++) { - e << " " << this->ConsideredConfigs[i].filename - << ", version: " << this->ConsideredConfigs[i].version << "\n"; + for (std::vector::const_iterator i = + this->ConsideredConfigs.begin(); + i != this->ConsideredConfigs.end(); ++i) { + e << " " << i->filename << ", version: " << i->version << "\n"; } } else { std::string requestedVersionString; @@ -766,12 +766,13 @@ bool cmFindPackageCommand::HandlePackageMode() std::string consideredVersions; const char* sep = ""; - for (std::vector::size_type i = 0; - i < this->ConsideredConfigs.size(); i++) { + for (std::vector::const_iterator i = + this->ConsideredConfigs.begin(); + i != this->ConsideredConfigs.end(); ++i) { consideredConfigFiles += sep; consideredVersions += sep; - consideredConfigFiles += this->ConsideredConfigs[i].filename; - consideredVersions += this->ConsideredConfigs[i].version; + consideredConfigFiles += i->filename; + consideredVersions += i->version; sep = ";"; } From 919db25c3b54f0303a19abb4a9e4f16056a3c1b6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 13 Jun 2016 11:10:59 -0400 Subject: [PATCH 077/929] cmFindPackageCommand: remove duplicate paths from error message Fixes #15252. --- Source/cmFindPackageCommand.cxx | 4 +++- Source/cmFindPackageCommand.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 4ab7a7239..1945c44c8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -664,6 +664,8 @@ bool cmFindPackageCommand::HandlePackageMode() // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. else if (!this->ConsideredConfigs.empty()) { + std::vector::const_iterator duplicate_end = + cmRemoveDuplicates(this->ConsideredConfigs); e << "Could not find a configuration file for package \"" << this->Name << "\" that " << (this->VersionExact ? "exactly matches" : "is compatible with") @@ -672,7 +674,7 @@ bool cmFindPackageCommand::HandlePackageMode() "accepted:\n"; for (std::vector::const_iterator i = this->ConsideredConfigs.begin(); - i != this->ConsideredConfigs.end(); ++i) { + i != duplicate_end; ++i) { e << " " << i->filename << ", version: " << i->version << "\n"; } } else { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index eff6b8090..00db22b3f 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -159,6 +159,21 @@ private: { std::string filename; std::string version; + + bool operator<(ConfigFileInfo const& rhs) const + { + return this->filename < rhs.filename; + } + + bool operator==(ConfigFileInfo const& rhs) const + { + return this->filename == rhs.filename; + } + + bool operator!=(ConfigFileInfo const& rhs) const + { + return !(*this == rhs); + } }; std::vector ConsideredConfigs; }; From 0a9094cd1017057d3c5141fdacdc6a89fb14acfc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Jun 2016 09:58:15 +0200 Subject: [PATCH 078/929] Parser: Issue file open error messages through dedicated API --- Source/cmListFileCache.cxx | 15 +++++++++------ Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt | 6 +----- Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt | 6 +----- Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt | 6 +----- Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt | 6 +----- 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 036a2b116..4df542f6b 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -23,6 +23,7 @@ struct cmListFileParser { cmListFileParser(cmListFile* lf, cmMakefile* mf, const char* filename); ~cmListFileParser(); + void IssueFileOpenError(std::string const& text) const; bool ParseFile(); bool ParseFunction(const char* name, long line); bool AddArgument(cmListFileLexer_Token* token, @@ -54,23 +55,25 @@ cmListFileParser::~cmListFileParser() cmListFileLexer_Delete(this->Lexer); } +void cmListFileParser::IssueFileOpenError(const std::string& text) const +{ + this->Makefile->IssueMessage(cmake::FATAL_ERROR, text); +} + bool cmListFileParser::ParseFile() { // Open the file. cmListFileLexer_BOM bom; if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) { - cmSystemTools::Error("cmListFileCache: error can not open file ", - this->FileName); + this->IssueFileOpenError("cmListFileCache: error can not open file."); return false; } // Verify the Byte-Order-Mark, if any. if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) { cmListFileLexer_SetFileName(this->Lexer, 0, 0); - std::ostringstream m; - m << "File\n " << this->FileName << "\n" - << "starts with a Byte-Order-Mark that is not UTF-8."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); + this->IssueFileOpenError( + "File starts with a Byte-Order-Mark that is not UTF-8."); return false; } diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt index a845ffb1d..f0b678362 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt @@ -1,8 +1,4 @@ CMake Error in BOM-UTF-16-BE.cmake: - File - - .*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake - - starts with a Byte-Order-Mark that is not UTF-8. + File starts with a Byte-Order-Mark that is not UTF-8. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt index cc4244b8f..bcc9c3869 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt @@ -1,8 +1,4 @@ CMake Error in BOM-UTF-16-LE.cmake: - File - - .*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake - - starts with a Byte-Order-Mark that is not UTF-8. + File starts with a Byte-Order-Mark that is not UTF-8. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt index 5f851bfa8..7bd74c99b 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt @@ -1,8 +1,4 @@ CMake Error in BOM-UTF-32-BE.cmake: - File - - .*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake - - starts with a Byte-Order-Mark that is not UTF-8. + File starts with a Byte-Order-Mark that is not UTF-8. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt index d8fafd0ea..678013fbd 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt @@ -1,8 +1,4 @@ CMake Error in BOM-UTF-32-LE.cmake: - File - - .*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake - - starts with a Byte-Order-Mark that is not UTF-8. + File starts with a Byte-Order-Mark that is not UTF-8. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) From 905e738ffeb1ec1b5d1a376b99e300a8787f7255 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:26 +0100 Subject: [PATCH 079/929] Parser: Out-of-line conditional code to cmMakefile Simplify parser API. --- Source/cmListFileCache.cxx | 72 +--------------------------------- Source/cmListFileCache.h | 2 +- Source/cmMakefile.cxx | 79 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 76 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 4df542f6b..44604186d 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -118,7 +118,7 @@ bool cmListFileParser::ParseFile() return true; } -bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf) +bool cmListFile::ParseFile(const char* filename, cmMakefile* mf) { if (!cmSystemTools::FileExists(filename) || cmSystemTools::FileIsDirectory(filename)) { @@ -132,76 +132,6 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf) parseError = !parser.ParseFile(); } - // do we need a cmake_policy(VERSION call? - if (topLevel) { - bool hasVersion = false; - // search for the right policy command - for (std::vector::iterator i = this->Functions.begin(); - i != this->Functions.end(); ++i) { - if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") { - hasVersion = true; - break; - } - } - // if no policy command is found this is an error if they use any - // non advanced functions or a lot of functions - if (!hasVersion) { - bool isProblem = true; - if (this->Functions.size() < 30) { - // the list of simple commands DO NOT ADD TO THIS LIST!!!!! - // these commands must have backwards compatibility forever and - // and that is a lot longer than your tiny mind can comprehend mortal - std::set allowedCommands; - allowedCommands.insert("project"); - allowedCommands.insert("set"); - allowedCommands.insert("if"); - allowedCommands.insert("endif"); - allowedCommands.insert("else"); - allowedCommands.insert("elseif"); - allowedCommands.insert("add_executable"); - allowedCommands.insert("add_library"); - allowedCommands.insert("target_link_libraries"); - allowedCommands.insert("option"); - allowedCommands.insert("message"); - isProblem = false; - for (std::vector::iterator i = - this->Functions.begin(); - i != this->Functions.end(); ++i) { - std::string name = cmSystemTools::LowerCase(i->Name); - if (allowedCommands.find(name) == allowedCommands.end()) { - isProblem = true; - break; - } - } - } - - if (isProblem) { - // Tell the top level cmMakefile to diagnose - // this violation of CMP0000. - mf->SetCheckCMP0000(true); - - // Implicitly set the version for the user. - mf->SetPolicyVersion("2.4"); - } - } - bool hasProject = false; - // search for a project command - for (std::vector::iterator i = this->Functions.begin(); - i != this->Functions.end(); ++i) { - if (cmSystemTools::LowerCase(i->Name) == "project") { - hasProject = true; - break; - } - } - // if no project command is found, add one - if (!hasProject) { - cmListFileFunction project; - project.Name = "PROJECT"; - cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); - project.Arguments.push_back(prj); - this->Functions.insert(this->Functions.begin(), project); - } - } return !parseError; } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index d72c36045..f3e6f7008 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -158,7 +158,7 @@ private: struct cmListFile { - bool ParseFile(const char* path, bool topLevel, cmMakefile* mf); + bool ParseFile(const char* path, cmMakefile* mf); std::vector Functions; }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c9192fdeb..95ca0e2b8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -426,7 +426,7 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) IncludeScope incScope(this, filenametoread, noPolicyScope); cmListFile listFile; - if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { + if (!listFile.ParseFile(filenametoread.c_str(), this)) { return false; } @@ -475,7 +475,7 @@ bool cmMakefile::ReadListFile(const char* filename) ListFileScope scope(this, filenametoread); cmListFile listFile; - if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { + if (!listFile.ParseFile(filenametoread.c_str(), this)) { return false; } @@ -1423,10 +1423,81 @@ void cmMakefile::Configure() this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); cmListFile listFile; - if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), - this)) { + if (!listFile.ParseFile(currentStart.c_str(), this)) { return; } + if (this->IsRootMakefile()) { + bool hasVersion = false; + // search for the right policy command + for (std::vector::iterator i = + listFile.Functions.begin(); + i != listFile.Functions.end(); ++i) { + if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") { + hasVersion = true; + break; + } + } + // if no policy command is found this is an error if they use any + // non advanced functions or a lot of functions + if (!hasVersion) { + bool isProblem = true; + if (listFile.Functions.size() < 30) { + // the list of simple commands DO NOT ADD TO THIS LIST!!!!! + // these commands must have backwards compatibility forever and + // and that is a lot longer than your tiny mind can comprehend mortal + std::set allowedCommands; + allowedCommands.insert("project"); + allowedCommands.insert("set"); + allowedCommands.insert("if"); + allowedCommands.insert("endif"); + allowedCommands.insert("else"); + allowedCommands.insert("elseif"); + allowedCommands.insert("add_executable"); + allowedCommands.insert("add_library"); + allowedCommands.insert("target_link_libraries"); + allowedCommands.insert("option"); + allowedCommands.insert("message"); + isProblem = false; + for (std::vector::iterator i = + listFile.Functions.begin(); + i != listFile.Functions.end(); ++i) { + std::string name = cmSystemTools::LowerCase(i->Name); + if (allowedCommands.find(name) == allowedCommands.end()) { + isProblem = true; + break; + } + } + } + + if (isProblem) { + // Tell the top level cmMakefile to diagnose + // this violation of CMP0000. + this->SetCheckCMP0000(true); + + // Implicitly set the version for the user. + this->SetPolicyVersion("2.4"); + } + } + bool hasProject = false; + // search for a project command + for (std::vector::iterator i = + listFile.Functions.begin(); + i != listFile.Functions.end(); ++i) { + if (cmSystemTools::LowerCase(i->Name) == "project") { + hasProject = true; + break; + } + } + // if no project command is found, add one + if (!hasProject) { + cmListFileFunction project; + project.Name = "PROJECT"; + cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); + project.Arguments.push_back(prj); + listFile.Functions.insert(listFile.Functions.begin(), project); + } + } + this->ReadListFile(listFile, currentStart); if (cmSystemTools::GetFatalErrorOccured()) { scope.Quiet(); From 262ce91e8ac3c6fc9b09605e652028db7229b9b8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:28 +0100 Subject: [PATCH 080/929] cmMakefile: Extract invoke result variables Make it more clear what is happening here. --- Source/cmMakefile.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c9192fdeb..bfcd7dbc0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -254,9 +254,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, this->PrintCommandTrace(lff); } // Try invoking the command. - if (!pcmd->InvokeInitialPass(lff.Arguments, status) || - status.GetNestedError()) { - if (!status.GetNestedError()) { + bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); + bool hadNestedError = status.GetNestedError(); + if (!invokeSucceeded || hadNestedError) { + if (!hadNestedError) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); } From 5bbcf758a1a0c52836d313156788a10a232f1f9f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:29 +0100 Subject: [PATCH 081/929] cmIfCommand: Don't rely on NestedError logic to issue messages --- Source/cmIfCommand.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 45395d1ea..cb5ba76b1 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -185,12 +185,12 @@ bool cmIfCommand::InvokeInitialPass( conditionEvaluator.IsTrue(expandedArguments, errorString, status); if (!errorString.empty()) { - std::string err = cmIfCommandError(expandedArguments); + std::string err = "if " + cmIfCommandError(expandedArguments); err += errorString; if (status == cmake::FATAL_ERROR) { - this->SetError(err); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, err); cmSystemTools::SetFatalErrorOccured(); - return false; + return true; } else { this->Makefile->IssueMessage(status, err); } From c3819acad22c1bc0f763f7222648e8cade777ca6 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 12 Jun 2016 22:15:08 +0200 Subject: [PATCH 082/929] cmConfigure.h: Establish as 'include first' file At the moment, cmStandardIncludes.h needs to be included before any standard includes because it disables some warnings that are caused by the standard library of some compilers. Move this responsibility to the cmConfigure.h file. Also add include guards to cmConfigure.h to make sure the file can be included multiple times. --- Source/cmConfigure.cmake.h.in | 17 +++++++++++++++++ Source/cmStandardIncludes.h | 12 ------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 11ff00bd5..938b10ed4 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -9,6 +9,21 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ +#ifndef cmConfigure_h +#define cmConfigure_h + +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4786) +#pragma warning(disable : 4503) +#endif + +#ifdef __ICL +#pragma warning(disable : 985) +#pragma warning(disable : 1572) /* floating-point equality test */ +#endif + #cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER @@ -17,3 +32,5 @@ #cmakedefine CMake_HAVE_CXX11_UNORDERED_MAP #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" + +#endif diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index d3bf301c3..5ff221db2 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -18,18 +18,6 @@ #include -#include - -#ifdef _MSC_VER -#pragma warning(disable : 4786) -#pragma warning(disable : 4503) -#endif - -#ifdef __ICL -#pragma warning(disable : 985) -#pragma warning(disable : 1572) /* floating-point equality test */ -#endif - // Provide fixed-size integer types. #include From 535ec2bf1a57375221259ed1041c6d8d35c79b91 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 12 Jun 2016 22:38:18 +0200 Subject: [PATCH 083/929] cmDocumentationEntry: Extract from cmStandardIncludes --- Source/cmDocumentationEntry.h | 45 +++++++++++++++++++++++++++++++++++ Source/cmStandardIncludes.h | 26 +------------------- 2 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 Source/cmDocumentationEntry.h diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h new file mode 100644 index 000000000..f50839ea5 --- /dev/null +++ b/Source/cmDocumentationEntry.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmDocumentationEntry_h +#define cmDocumentationEntry_h + +#include // IWYU pragma: keep + +#include + +/** Standard documentation entry for cmDocumentation's formatting. */ +struct cmDocumentationEntry +{ + std::string Name; + std::string Brief; + cmDocumentationEntry() {} + cmDocumentationEntry(const char* doc[2]) + { + if (doc[0]) { + this->Name = doc[0]; + } + if (doc[1]) { + this->Brief = doc[1]; + } + } + cmDocumentationEntry(const char* n, const char* b) + { + if (n) { + this->Name = n; + } + if (b) { + this->Brief = b; + } + } +}; + +#endif diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 5ff221db2..82652f117 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -55,31 +55,7 @@ typedef unsigned short mode_t; /* Poison this operator to avoid common mistakes. */ extern void operator<<(std::ostream&, const std::ostringstream&); -/** Standard documentation entry for cmDocumentation's formatting. */ -struct cmDocumentationEntry -{ - std::string Name; - std::string Brief; - cmDocumentationEntry() {} - cmDocumentationEntry(const char* doc[2]) - { - if (doc[0]) { - this->Name = doc[0]; - } - if (doc[1]) { - this->Brief = doc[1]; - } - } - cmDocumentationEntry(const char* n, const char* b) - { - if (n) { - this->Name = n; - } - if (b) { - this->Brief = b; - } - } -}; +#include "cmDocumentationEntry.h" /** Data structure to represent a single command line. */ class cmCustomCommandLine : public std::vector From 33f74dc5247328cc5b3d6239c65e869bcc35cd80 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 14 Jun 2016 00:01:10 -0400 Subject: [PATCH 084/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 26702f892..fe41ca692 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160613) +set(CMake_VERSION_PATCH 20160614) #set(CMake_VERSION_RC 1) From 90d114ed8c724ca49fa02444dd59d06fd9806f3b Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Mon, 13 Jun 2016 09:39:15 -0400 Subject: [PATCH 085/929] FindCUDA: Use the correct runtime in REQUIRED_VARS check When enabling the CUDA static runtime, the current module always uses the shared runtime in the REQUIRED_VARS check. This change should select the correct runtime to be checked for as required based on the CUDA_USE_STATIC_CUDA_RUNTIME option. Fixes #16096 --- Modules/FindCUDA.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 86f89d8bc..81fc7a856 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -787,8 +787,10 @@ endif() if(CUDA_cudart_static_LIBRARY) # Set whether to use the static cuda runtime. option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON) + set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY) else() option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" OFF) + set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY) endif() if(CUDA_USE_STATIC_CUDA_RUNTIME) @@ -1003,7 +1005,7 @@ find_package_handle_standard_args(CUDA CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS - CUDA_CUDART_LIBRARY + ${CUDA_CUDART_LIBRARY_VAR} VERSION_VAR CUDA_VERSION ) From eb79fa726090410dbfceb64e29604320cc65d92f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 13 Jun 2016 23:04:16 +0200 Subject: [PATCH 086/929] Access std::ios_base with std::ios Just because it is shorter. --- Source/CPack/cmCPackDragNDropGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 4 ++-- Source/cmMakefile.cxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index f4379c13d..640e43767 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -235,7 +235,7 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target, return false; } else { // Seek to desired size - 1 byte - fout.seekp(size - 1, std::ios_base::beg); + fout.seekp(size - 1, std::ios::beg); char byte = 0; // Write one byte to ensure file grows fout.write(&byte, 1); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f74e83562..3aec63049 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -513,8 +513,8 @@ void cmGlobalNinjaGenerator::Generate() this->WriteBuiltinTargets(*this->BuildFileStream); if (cmSystemTools::GetErrorOccuredFlag()) { - this->RulesFileStream->setstate(std::ios_base::failbit); - this->BuildFileStream->setstate(std::ios_base::failbit); + this->RulesFileStream->setstate(std::ios::failbit); + this->BuildFileStream->setstate(std::ios::failbit); } this->CloseCompileCommandsStream(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c9192fdeb..b03bac71d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3387,7 +3387,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, } } else { std::string newLineCharacters; - std::ios_base::openmode omode = std::ios_base::out | std::ios_base::trunc; + std::ios::openmode omode = std::ios::out | std::ios::trunc; if (newLine.IsValid()) { newLineCharacters = newLine.GetCharacters(); omode |= std::ios::binary; From ab8b77dd33e9a13551af402b2cf7ee3aaa5486b8 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 13 Jun 2016 22:56:48 +0200 Subject: [PATCH 087/929] Remove redundant arguments from fstream constructors Don't pass the default value of the openmode parameter explicitly. --- Source/cmDependsFortran.cxx | 4 ++-- Source/cmDocumentation.cxx | 2 +- Source/cmFileCommand.cxx | 4 ++-- Source/cmGeneratedFileStream.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmake.cxx | 2 +- Tests/AliasTarget/commandgenerator.cpp | 3 +-- Tests/AliasTarget/targetgenerator.cpp | 3 +-- 8 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index a20fb9819..bbda68883 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -633,8 +633,8 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, cmsys::ifstream finModFile(modFile, std::ios::in | std::ios::binary); cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary); #else - cmsys::ifstream finModFile(modFile, std::ios::in); - cmsys::ifstream finStampFile(stampFile, std::ios::in); + cmsys::ifstream finModFile(modFile); + cmsys::ifstream finStampFile(stampFile); #endif if (!finModFile || !finStampFile) { // At least one of the files does not exist. The modules differ. diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 68a84887f..413dacd62 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -140,7 +140,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) cmsys::ofstream* fout = 0; std::ostream* s = &os; if (!i->Filename.empty()) { - fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out); + fout = new cmsys::ofstream(i->Filename.c_str()); if (fout) { s = fout; } else { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4e72f3613..6abc23858 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -257,7 +257,7 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) fileName.c_str(), std::ios::in | (hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in)); #else - cmsys::ifstream file(fileName.c_str(), std::ios::in); + cmsys::ifstream file(fileName.c_str()); #endif if (!file) { @@ -526,7 +526,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) #if defined(_WIN32) || defined(__CYGWIN__) cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); #else - cmsys::ifstream fin(fileName.c_str(), std::ios::in); + cmsys::ifstream fin(fileName.c_str()); #endif if (!fin) { std::ostringstream e; diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index dee174b7f..c35a1bcd0 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -56,7 +56,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, this->Stream::open(this->TempName.c_str(), std::ios::out | std::ios::binary); } else { - this->Stream::open(this->TempName.c_str(), std::ios::out); + this->Stream::open(this->TempName.c_str()); } // Check if the file opened. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index aef3f44b3..536c5d286 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2571,7 +2571,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, #if defined(_WIN32) || defined(__CYGWIN__) cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary); #else - cmsys::ifstream fin(pfile.c_str(), std::ios::in); + cmsys::ifstream fin(pfile.c_str()); #endif if (!fin) { return; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e404fa318..db0072a47 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2094,7 +2094,7 @@ static bool cmakeCheckStampFile(const char* stampName) #if defined(_WIN32) || defined(__CYGWIN__) cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary); #else - cmsys::ifstream fin(stampDepends.c_str(), std::ios::in); + cmsys::ifstream fin(stampDepends.c_str()); #endif if (!fin) { // The stamp dependencies file cannot be read. Just assume the diff --git a/Tests/AliasTarget/commandgenerator.cpp b/Tests/AliasTarget/commandgenerator.cpp index aaab014f9..c4d80a19f 100644 --- a/Tests/AliasTarget/commandgenerator.cpp +++ b/Tests/AliasTarget/commandgenerator.cpp @@ -5,8 +5,7 @@ int main(int argc, char** argv) { - std::fstream fout; - fout.open("commandoutput.h", std::ios::out); + std::ofstream fout("commandoutput.h"); if (!fout) return 1; fout << "#define COMMANDOUTPUT_DEFINE\n"; diff --git a/Tests/AliasTarget/targetgenerator.cpp b/Tests/AliasTarget/targetgenerator.cpp index b3e6ee22c..4de479230 100644 --- a/Tests/AliasTarget/targetgenerator.cpp +++ b/Tests/AliasTarget/targetgenerator.cpp @@ -3,8 +3,7 @@ int main(int argc, char** argv) { - std::fstream fout; - fout.open("targetoutput.h", std::ios::out); + std::ofstream fout("targetoutput.h"); if (!fout) return 1; fout << "#define TARGETOUTPUT_DEFINE\n"; From 24ab29b882548d9eceeb20d3ecbc5b9cc918bb7c Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Tue, 14 Jun 2016 22:37:36 +0200 Subject: [PATCH 088/929] Prefer istringstream and ostringstream over stringstream. Use istringsream for parsing, ostringstream for generation. --- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 2 +- Source/CPack/IFW/cmCPackIFWPackage.cxx | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 12 ++-- Source/CPack/WiX/cmWIXAccessControlList.cxx | 2 +- .../WiX/cmWIXDirectoriesSourceWriter.cxx | 2 +- Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 2 +- Source/CPack/WiX/cmWIXPatchParser.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCLocaleEnvironmentScope.cxx | 4 +- .../cmCMakeHostSystemInformationCommand.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmQtAutoGeneratorInitializer.cxx | 6 +- Source/cmQtAutoGenerators.cxx | 58 +++++++++---------- Source/cmTimestamp.cxx | 2 +- Source/cmcldeps.cxx | 2 +- 17 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index b47d46e56..accba083d 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -567,7 +567,7 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout) { - std::stringstream comment; + std::ostringstream comment; comment << "Generated by CPack " << CMake_VERSION << " IFW generator " << "for QtIFW "; if (IsVersionLess("2.0")) { diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c44e3897f..405d66844 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -422,7 +422,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Write dependencies if (!compDepSet.empty()) { - std::stringstream dependencies; + std::ostringstream dependencies; std::set::iterator it = compDepSet.begin(); dependencies << it->NameWithCompare(); ++it; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 8777296e5..b5b364d26 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -90,7 +90,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, return false; } - std::stringstream command; + std::ostringstream command; command << QuotePath(executable); command << " -nologo"; command << " -arch " << GetArchitecture(); @@ -115,7 +115,7 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) return false; } - std::stringstream command; + std::ostringstream command; command << QuotePath(executable); command << " -nologo"; command << " -out " << QuotePath(packageFileNames.at(0)); @@ -254,7 +254,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() std::set usedBaseNames; - std::stringstream objectFiles; + std::ostringstream objectFiles; for (size_t i = 0; i < this->WixSources.size(); ++i) { std::string const& sourceFilename = this->WixSources[i]; @@ -265,7 +265,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() std::string uniqueBaseName = baseName; while (usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) { - std::stringstream tmp; + std::ostringstream tmp; tmp << baseName << ++counter; uniqueBaseName = tmp.str(); } @@ -403,7 +403,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, std::string const& name, std::string const& value) { - std::stringstream tmp; + std::ostringstream tmp; tmp << name << "=\"" << value << '"'; source.AddProcessingInstruction( @@ -1019,7 +1019,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) idPrefix = "H"; } - std::stringstream result; + std::ostringstream result; result << idPrefix << "_" << identifier; size_t ambiguityCount = ++IdAmbiguityCounter[identifier]; diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index 043cdffb0..bbbd92d97 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -127,7 +127,7 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry, std::string const& name) { if (!this->IsBooleanAttribute(name)) { - std::stringstream message; + std::ostringstream message; message << "Unknown boolean attribute '" << name << "'"; this->ReportError(entry, message.str()); } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 60ecae6ab..de6405959 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -69,7 +69,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory( if (i == installRoot.size() - 1) { AddAttribute("Id", "INSTALL_ROOT"); } else { - std::stringstream tmp; + std::ostringstream tmp; tmp << "INSTALL_PREFIX_" << i; AddAttribute("Id", tmp.str()); } diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 1341fa53d..9a143cc04 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -31,7 +31,7 @@ void cmWIXFilesSourceWriter::EmitShortcut(std::string const& id, std::string const& shortcutPrefix, size_t shortcutIndex) { - std::stringstream shortcutId; + std::ostringstream shortcutId; shortcutId << shortcutPrefix << id; if (shortcutIndex > 0) { diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index b750dcf35..449a70bde 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -88,7 +88,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes) if (key == "Id") { if (Fragments.find(value) != Fragments.end()) { - std::stringstream tmp; + std::ostringstream tmp; tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value; ReportValidationError(tmp.str()); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 96a22d9c6..c991a23f4 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1677,7 +1677,7 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml, xml.Attribute(measurementfile.match(3).c_str(), measurementfile.match(4)); xml.Attribute("encoding", "base64"); - std::stringstream ostr; + std::ostringstream ostr; for (size_t cc = 0; cc < rlen; cc++) { ostr << encoded_buffer[cc]; if (cc % 60 == 0 && cc) { diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx index ee9acdefb..a19dbaeef 100644 --- a/Source/cmCLocaleEnvironmentScope.cxx +++ b/Source/cmCLocaleEnvironmentScope.cxx @@ -45,7 +45,7 @@ void cmCLocaleEnvironmentScope::SetEnv(std::string const& key, if (value.empty()) { cmSystemTools::UnsetEnv(key.c_str()); } else { - std::stringstream tmp; + std::ostringstream tmp; tmp << key << "=" << value; cmSystemTools::PutEnv(tmp.str()); } @@ -55,7 +55,7 @@ cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope() { for (backup_map_t::const_iterator i = this->EnvironmentBackup.begin(); i != this->EnvironmentBackup.end(); ++i) { - std::stringstream tmp; + std::ostringstream tmp; tmp << i->first << "=" << i->second; cmSystemTools::PutEnv(tmp.str()); } diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index fbec6fd91..fdbd5e79e 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -84,7 +84,7 @@ bool cmCMakeHostSystemInformationCommand::GetValue( std::string cmCMakeHostSystemInformationCommand::ValueToString( size_t value) const { - std::stringstream tmp; + std::ostringstream tmp; tmp << value; return tmp.str(); } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index bc217afb9..f964b9726 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -311,7 +311,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "false"); // set project specific environment - std::stringstream environment; + std::ostringstream environment; environment << "VERBOSE=1|CMAKE_NO_VERBOSE=1|"; // verbose Makefile output // set vsvars32.bat environment available at CMake time, // but not necessarily when eclipse is open @@ -341,7 +341,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all"); // set error parsers - std::stringstream errorOutputParser; + std::ostringstream errorOutputParser; if (compilerId == "MSVC") { errorOutputParser << "org.eclipse.cdt.core.VCErrorParser;"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index de02395bc..5f4b07469 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1527,7 +1527,7 @@ public: if (item.find("::") != std::string::npos) { bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; - std::stringstream e; + std::ostringstream e; switch (this->Target->GetLocalGenerator()->GetPolicyStatus( cmPolicies::CMP0028)) { case cmPolicies::WARN: { @@ -1628,7 +1628,7 @@ public: if (this->Preferred.empty()) { return ""; } else if (this->Preferred.size() > 1) { - std::stringstream e; + std::ostringstream e; e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" << " (" << this->Preference << "):\n"; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e68bac265..d56bb053b 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -623,7 +623,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule( std::string darwin_major_version_s = mf->GetSafeDefinition("DARWIN_MAJOR_VERSION"); - std::stringstream ss(darwin_major_version_s); + std::istringstream ss(darwin_major_version_s); int darwin_major_version; ss >> darwin_major_version; if (!ss.fail() && darwin_major_version <= 9 && diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index dd19760f6..98851d629 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -464,7 +464,7 @@ static std::string cmQtAutoGeneratorsStripCR(std::string const& line) static std::string ReadAll(const std::string& filename) { cmsys::ifstream file(filename.c_str()); - std::stringstream stream; + std::ostringstream stream; stream << file.rdbuf(); file.close(); return stream.str(); @@ -508,7 +508,7 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, bool result = cmSystemTools::RunSingleCommand( command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE); if (!result || retVal) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() << " failed:\n" << rccStdOut << "\n" @@ -538,7 +538,7 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, std::string::size_type pos = eline.find(searchString); if (pos == std::string::npos) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: Rcc lists unparsable output " << eline << std::endl; std::cerr << err.str(); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index dc44f3e6a..6a6d72f47 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -432,7 +432,7 @@ void cmQtAutoGenerators::Init() static std::string ReadAll(const std::string& filename) { cmsys::ifstream file(filename.c_str()); - std::stringstream stream; + std::ostringstream stream; stream << file.rdbuf(); file.close(); return stream.str(); @@ -477,7 +477,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) skipUic ? skippedUis : includedUis; const std::string& absFilename = *it; if (this->Verbose) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: Checking " << absFilename << std::endl; this->LogInfo(err.str()); } @@ -499,7 +499,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) uicSkipped.end()) { const std::string& absFilename = *it; if (this->Verbose) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: Checking " << absFilename << std::endl; this->LogInfo(err.str()); } @@ -527,19 +527,19 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) } if (this->RunMocFailed) { - std::stringstream err; + std::ostringstream err; err << "moc failed..." << std::endl; this->LogError(err.str()); return false; } if (this->RunUicFailed) { - std::stringstream err; + std::ostringstream err; err << "uic failed..." << std::endl; this->LogError(err.str()); return false; } if (this->RunRccFailed) { - std::stringstream err; + std::ostringstream err; err << "rcc failed..." << std::endl; this->LogError(err.str()); return false; @@ -560,7 +560,7 @@ void cmQtAutoGenerators::ParseCppFile( const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; this->LogError(err.str()); @@ -620,7 +620,7 @@ void cmQtAutoGenerators::ParseCppFile( ownMocHeaderFile = headerToMoc; } } else { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " << "includes the moc file \"" << currentMoc << "\", " << "but could not find header \"" << basename << '{' @@ -644,7 +644,7 @@ void cmQtAutoGenerators::ParseCppFile( // this is for KDE4 compatibility: fileToMoc = headerToMoc; if (!requiresMoc && basename == scannedFileBasename) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": The file " "includes the moc file \"" @@ -656,7 +656,7 @@ void cmQtAutoGenerators::ParseCppFile( << std::endl; this->LogError(err.str()); } else { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": The file " "includes the moc file \"" @@ -670,7 +670,7 @@ void cmQtAutoGenerators::ParseCppFile( this->LogError(err.str()); } } else { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " "includes the moc file \"" @@ -699,7 +699,7 @@ void cmQtAutoGenerators::ParseCppFile( if (!dotMocIncluded && requiresMoc) { if (mocUnderscoreIncluded) { // this is for KDE4 compatibility: - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": The file " << "contains a " << macroName << " macro, but does not " "include " @@ -717,7 +717,7 @@ void cmQtAutoGenerators::ParseCppFile( includedMocs.erase(ownMocHeaderFile); } else { // otherwise always error out since it will not compile: - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " << "contains a " << macroName << " macro, but does not " "include " @@ -742,7 +742,7 @@ void cmQtAutoGenerators::StrictParseCppFile( const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; this->LogError(err.str()); @@ -791,7 +791,7 @@ void cmQtAutoGenerators::StrictParseCppFile( if (!headerToMoc.empty()) { includedMocs[headerToMoc] = currentMoc; } else { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << " The file " << "includes the moc file \"" << currentMoc << "\", " << "but could not find header \"" << basename << '{' @@ -807,7 +807,7 @@ void cmQtAutoGenerators::StrictParseCppFile( } } else { if (basename != scannedFileBasename) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " "includes the moc file \"" @@ -835,7 +835,7 @@ void cmQtAutoGenerators::StrictParseCppFile( std::string macroName; if (!dotMocIncluded && requiresMocing(contentsString, macroName)) { // otherwise always error out since it will not compile: - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " << absFilename << ": The file " << "contains a " << macroName << " macro, but does not include " << "\"" << scannedFileBasename << ".moc\" !\n" @@ -854,7 +854,7 @@ void cmQtAutoGenerators::ParseForUic( } const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; this->LogError(err.str()); @@ -942,7 +942,7 @@ void cmQtAutoGenerators::ParseHeaders( if (!this->MocExecutable.empty() && includedMocs.find(headerName) == includedMocs.end()) { if (this->Verbose) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: Checking " << headerName << std::endl; this->LogInfo(err.str()); } @@ -972,7 +972,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( std::map mergedMocs(includedMocs); mergedMocs.insert(notIncludedMocs.begin(), notIncludedMocs.end()); if (this->NameCollisionTest(mergedMocs, collisions)) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: " "The same moc file will be generated " "from different sources." @@ -1013,7 +1013,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( // compose _automoc.cpp content std::string automocSource; { - std::stringstream outStream; + std::ostringstream outStream; outStream << "/* This file is autogenerated, do not edit*/\n"; if (notIncludedMocs.empty()) { outStream << "enum some_compilers { need_more_than_nothing };\n"; @@ -1035,7 +1035,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( if (oldContents == automocSource) { // nothing changed: don't touch the _automoc.cpp file if (this->Verbose) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date" << std::endl; this->LogInfo(err.str()); @@ -1106,7 +1106,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n" << output << std::endl; this->LogError(err.str()); @@ -1147,7 +1147,7 @@ bool cmQtAutoGenerators::GenerateUiFiles( { std::multimap collisions; if (this->NameCollisionTest(testMap, collisions)) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: The same ui_NAME.h file will be generated " "from different sources." << std::endl @@ -1223,7 +1223,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::stringstream err; + std::ostringstream err; err << "AUTOUIC: error: process for " << uiOutputFile << " needed by\n \"" << realName << "\"\nfailed:\n" << output << std::endl; @@ -1275,7 +1275,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles() { std::multimap collisions; if (this->NameCollisionTest(qrcGenMap, collisions)) { - std::stringstream err; + std::ostringstream err; err << "AUTOGEN: error: The same qrc_NAME.cpp file" " will be generated from different sources." << std::endl @@ -1344,7 +1344,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::stringstream err; + std::ostringstream err; err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n" << output << std::endl; this->LogError(err.str()); @@ -1435,7 +1435,7 @@ void cmQtAutoGenerators::NameCollisionLog( { typedef std::multimap::const_iterator Iter; - std::stringstream err; + std::ostringstream err; // Add message err << message; // Append collision list @@ -1457,7 +1457,7 @@ void cmQtAutoGenerators::LogError(const std::string& message) void cmQtAutoGenerators::LogCommand(const std::vector& command) { - std::stringstream sbuf; + std::ostringstream sbuf; for (std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { if (cmdIt != command.begin()) { diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index c624d0f93..2a70ed04c 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -152,7 +152,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, return std::string(); } - std::stringstream ss; + std::ostringstream ss; ss << static_cast(difftime(timeT, unixEpoch)); return ss.str(); } diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 8b0cede99..44f71f1cc 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -213,7 +213,7 @@ static int process(const std::string& srcfilename, const std::string& dfile, dir.c_str(), cmSystemTools::OUTPUT_NONE); // process the include directives and output everything else - std::stringstream ss(output); + std::istringstream ss(output); std::string line; std::vector includes; bool isFirstLine = true; // cl prints always first the source filename From ed5fa48d50ea0605b47598ff5b1d765548e8d638 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Tue, 14 Jun 2016 23:26:16 +0200 Subject: [PATCH 089/929] cmXMLWriter: use ifstream from KWSys --- Source/cmXMLWriter.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index 98c26801c..e2dce93d3 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -14,7 +14,7 @@ #include "cmXMLSafe.h" #include -#include +#include cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level) : Output(output) @@ -107,7 +107,7 @@ void cmXMLWriter::ProcessingInstruction(const char* target, const char* data) void cmXMLWriter::FragmentFile(const char* fname) { this->CloseStartElement(); - std::ifstream fin(fname, std::ios::in | std::ios::binary); + cmsys::ifstream fin(fname, std::ios::in | std::ios::binary); this->Output << fin.rdbuf(); } From 909d51bece7d343f32a8f59351aad5c396101a2c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 15 Jun 2016 00:01:06 -0400 Subject: [PATCH 090/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fe41ca692..da12fe0f2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160614) +set(CMake_VERSION_PATCH 20160615) #set(CMake_VERSION_RC 1) From 82ecc2a3a872a8db82ab1a8a5d2c35882b4a9757 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Wed, 15 Jun 2016 15:35:06 +0100 Subject: [PATCH 091/929] FindIce: Add versions 3.6.1 and 3.6.2 --- Modules/FindIce.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 3fa6cab4d..c7840e44e 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -141,6 +141,8 @@ function(_Ice_FIND) set(ice_versions 3 3.6 + 3.6.2 + 3.6.1 3.6.0 3.5 3.5.1 From d645b03e9c97856436b9fcd517b2c33b8aa3302c Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 15 Jun 2016 23:41:46 +0200 Subject: [PATCH 092/929] cmOutputConverter: implement Shell__GetArgument using ostringstream This removes the need to calculate the resulting string length beforehand. --- Source/cmOutputConverter.cxx | 214 ++++++----------------------------- Source/cmOutputConverter.h | 17 +-- 2 files changed, 39 insertions(+), 192 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 8e80bd01c..da43a119b 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -15,6 +15,7 @@ #include "cmake.h" #include +#include #include /* isalpha */ #include /* strlen */ @@ -328,19 +329,9 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str, flags |= Shell_Flag_NMake; } - // Compute the buffer size needed. - int size = (this->GetState()->UseWindowsShell() - ? Shell_GetArgumentSizeForWindows(str.c_str(), flags) - : Shell_GetArgumentSizeForUnix(str.c_str(), flags)); - - // Compute the shell argument itself. - std::vector arg(size); - if (this->GetState()->UseWindowsShell()) { - Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); - } else { - Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); - } - return std::string(&arg[0]); + return this->GetState()->UseWindowsShell() + ? Shell_GetArgumentForWindows(str.c_str(), flags) + : Shell_GetArgumentForUnix(str.c_str(), flags); } std::string cmOutputConverter::EscapeForCMake(const std::string& str) @@ -369,18 +360,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str) std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) { - char local_buffer[1024]; - char* buffer = local_buffer; - int size = Shell_GetArgumentSizeForWindows(arg, shell_flags); - if (size > 1024) { - buffer = new char[size]; - } - Shell_GetArgumentForWindows(arg, buffer, shell_flags); - std::string result(buffer); - if (buffer != local_buffer) { - delete[] buffer; - } - return result; + return Shell_GetArgumentForWindows(arg, shell_flags); } cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( @@ -586,12 +566,10 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix, return 0; } -int cmOutputConverter::Shell__GetArgumentSize(const char* in, int isUnix, - int flags) +std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, + int flags) { - /* Start with the length of the original argument, plus one for - either a terminating null or a separating space. */ - int size = (int)strlen(in) + 1; + std::ostringstream out; /* String iterator. */ const char* c; @@ -599,116 +577,17 @@ int cmOutputConverter::Shell__GetArgumentSize(const char* in, int isUnix, /* Keep track of how many backslashes have been encountered in a row. */ int windows_backslashes = 0; - /* Scan the string for characters that require escaping or quoting. */ - for (c = in; *c; ++c) { - /* Look for $(MAKEVAR) syntax if requested. */ - if (flags & Shell_Flag_AllowMakeVariables) { - /* Skip over the make variable references if any are present. */ - c = Shell__SkipMakeVariables(c); - - /* Stop if we have reached the end of the string. */ - if (!*c) { - break; - } - } - - /* Check whether this character needs escaping for the shell. */ - if (isUnix) { - /* On Unix a few special characters need escaping even inside a - quoted argument. */ - if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') { - /* This character needs a backslash to escape it. */ - ++size; - } - } else if (flags & Shell_Flag_EchoWindows) { - /* On Windows the built-in command shell echo never needs escaping. */ - } else { - /* On Windows only backslashes and double-quotes need escaping. */ - if (*c == '\\') { - /* Found a backslash. It may need to be escaped later. */ - ++windows_backslashes; - } else if (*c == '"') { - /* Found a double-quote. We need to escape it and all - immediately preceding backslashes. */ - size += windows_backslashes + 1; - windows_backslashes = 0; - } else { - /* Found another character. This eliminates the possibility - that any immediately preceding backslashes will be - escaped. */ - windows_backslashes = 0; - } - } - - /* Check whether this character needs escaping for a make tool. */ - if (*c == '$') { - if (flags & Shell_Flag_Make) { - /* In Makefiles a dollar is written $$ so we need one extra - character. */ - ++size; - } else if (flags & Shell_Flag_VSIDE) { - /* In a VS IDE a dollar is written "$" so we need two extra - characters. */ - size += 2; - } - } else if (*c == '#') { - if ((flags & Shell_Flag_Make) && (flags & Shell_Flag_WatcomWMake)) { - /* In Watcom WMake makefiles a pound is written $# so we need - one extra character. */ - ++size; - } - } else if (*c == '%') { - if ((flags & Shell_Flag_VSIDE) || - ((flags & Shell_Flag_Make) && - ((flags & Shell_Flag_MinGWMake) || (flags & Shell_Flag_NMake)))) { - /* In the VS IDE, NMake, or MinGW make a percent is written %% - so we need one extra characters. */ - size += 1; - } - } else if (*c == ';') { - if (flags & Shell_Flag_VSIDE) { - /* In a VS IDE a semicolon is written ";" so we need two extra - characters. */ - size += 2; - } - } - } - - /* Check whether the argument needs surrounding quotes. */ - if (Shell__ArgumentNeedsQuotes(in, isUnix, flags)) { - /* Surrounding quotes are needed. Allocate space for them. */ - if ((flags & Shell_Flag_WatcomQuote) && (isUnix)) { - size += 2; - } - size += 2; - - /* We must escape all ending backslashes when quoting on windows. */ - size += windows_backslashes; - } - - return size; -} - -char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, - int isUnix, int flags) -{ - /* String iterator. */ - const char* c; - - /* Keep track of how many backslashes have been encountered in a row. */ - int windows_backslashes = 0; - /* Whether the argument must be quoted. */ int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags); if (needQuotes) { /* Add the opening quote for this argument. */ if (flags & Shell_Flag_WatcomQuote) { if (isUnix) { - *out++ = '"'; + out << '"'; } - *out++ = '\''; + out << '\''; } else { - *out++ = '"'; + out << '"'; } } @@ -720,7 +599,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, if (skip != c) { /* Copy to the end of the make variable references. */ while (c != skip) { - *out++ = *c++; + out << *c++; } /* The make variable reference eliminates any escaping needed @@ -740,7 +619,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, quoted argument. */ if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') { /* This character needs a backslash to escape it. */ - *out++ = '\\'; + out << '\\'; } } else if (flags & Shell_Flag_EchoWindows) { /* On Windows the built-in command shell echo never needs escaping. */ @@ -754,11 +633,11 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, backslashes. */ while (windows_backslashes > 0) { --windows_backslashes; - *out++ = '\\'; + out << '\\'; } /* Add the backslash to escape the double-quote. */ - *out++ = '\\'; + out << '\\'; } else { /* We encountered a normal character. This eliminates any escaping needed for preceding backslashes. */ @@ -771,8 +650,7 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, if (flags & Shell_Flag_Make) { /* In Makefiles a dollar is written $$. The make tool will replace it with just $ before passing it to the shell. */ - *out++ = '$'; - *out++ = '$'; + out << "$$"; } else if (flags & Shell_Flag_VSIDE) { /* In a VS IDE a dollar is written "$". If this is written in an un-quoted argument it starts a quoted segment, inserts @@ -780,34 +658,30 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, argument it ends quoting, inserts the $ and restarts quoting. Either way the $ is isolated from surrounding text to avoid looking like a variable reference. */ - *out++ = '"'; - *out++ = '$'; - *out++ = '"'; + out << "\"$\""; } else { /* Otherwise a dollar is written just $. */ - *out++ = '$'; + out << '$'; } } else if (*c == '#') { if ((flags & Shell_Flag_Make) && (flags & Shell_Flag_WatcomWMake)) { /* In Watcom WMake makefiles a pound is written $#. The make tool will replace it with just # before passing it to the shell. */ - *out++ = '$'; - *out++ = '#'; + out << "$#"; } else { /* Otherwise a pound is written just #. */ - *out++ = '#'; + out << '#'; } } else if (*c == '%') { if ((flags & Shell_Flag_VSIDE) || ((flags & Shell_Flag_Make) && ((flags & Shell_Flag_MinGWMake) || (flags & Shell_Flag_NMake)))) { /* In the VS IDE, NMake, or MinGW make a percent is written %%. */ - *out++ = '%'; - *out++ = '%'; + out << "%%"; } else { /* Otherwise a percent is written just %. */ - *out++ = '%'; + out << '%'; } } else if (*c == ';') { if (flags & Shell_Flag_VSIDE) { @@ -816,16 +690,14 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, inserts the ; and ends the segment. If it is written in a quoted argument it ends quoting, inserts the ; and restarts quoting. Either way the ; is isolated. */ - *out++ = '"'; - *out++ = ';'; - *out++ = '"'; + out << "\";\""; } else { /* Otherwise a semicolon is written just ;. */ - *out++ = ';'; + out << ';'; } } else { /* Store this character. */ - *out++ = *c; + out << *c; } } @@ -833,45 +705,31 @@ char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, /* Add enough backslashes to escape any trailing ones. */ while (windows_backslashes > 0) { --windows_backslashes; - *out++ = '\\'; + out << '\\'; } /* Add the closing quote for this argument. */ if (flags & Shell_Flag_WatcomQuote) { - *out++ = '\''; + out << '\''; if (isUnix) { - *out++ = '"'; + out << '"'; } } else { - *out++ = '"'; + out << '"'; } } - /* Store a terminating null without incrementing. */ - *out = 0; - - return out; + return out.str(); } -char* cmOutputConverter::Shell_GetArgumentForWindows(const char* in, char* out, - int flags) +std::string cmOutputConverter::Shell_GetArgumentForWindows(const char* in, + int flags) { - return Shell__GetArgument(in, out, 0, flags); + return Shell__GetArgument(in, 0, flags); } -char* cmOutputConverter::Shell_GetArgumentForUnix(const char* in, char* out, - int flags) +std::string cmOutputConverter::Shell_GetArgumentForUnix(const char* in, + int flags) { - return Shell__GetArgument(in, out, 1, flags); -} - -int cmOutputConverter::Shell_GetArgumentSizeForWindows(const char* in, - int flags) -{ - return Shell__GetArgumentSize(in, 0, flags); -} - -int cmOutputConverter::Shell_GetArgumentSizeForUnix(const char* in, int flags) -{ - return Shell__GetArgumentSize(in, 1, flags); + return Shell__GetArgument(in, 1, flags); } diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 75d6326fe..f138d0e89 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -126,17 +126,8 @@ public: * modify the generated quoting and escape sequences to work under * alternative environments. */ - static char* Shell_GetArgumentForWindows(const char* in, char* out, - int flags); - static char* Shell_GetArgumentForUnix(const char* in, char* out, int flags); - - /** - * Compute the size of the buffer required to store the output from - * Shell_GetArgumentForWindows or Shell_GetArgumentForUnix. The flags - * passed must be identical between the two calls. - */ - static int Shell_GetArgumentSizeForWindows(const char* in, int flags); - static int Shell_GetArgumentSizeForUnix(const char* in, int flags); + static std::string Shell_GetArgumentForWindows(const char* in, int flags); + static std::string Shell_GetArgumentForUnix(const char* in, int flags); std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false, @@ -182,9 +173,7 @@ private: static int Shell__CharIsMakeVariableName(char c); static const char* Shell__SkipMakeVariables(const char* c); static int Shell__ArgumentNeedsQuotes(const char* in, int isUnix, int flags); - static int Shell__GetArgumentSize(const char* in, int isUnix, int flags); - static char* Shell__GetArgument(const char* in, char* out, int isUnix, - int flags); + static std::string Shell__GetArgument(const char* in, int isUnix, int flags); private: cmState::Snapshot StateSnapshot; From 83ae79442c8bc16cca72977e0671845efe191696 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 16 Jun 2016 00:01:06 -0400 Subject: [PATCH 093/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index da12fe0f2..3c49d03b6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160615) +set(CMake_VERSION_PATCH 20160616) #set(CMake_VERSION_RC 1) From 86bcdbcde52988fe32e017700d2d0f759a2c2570 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 16 Jun 2016 11:21:15 +0100 Subject: [PATCH 094/929] FindIce: Support finding both release and debug libraries Search for both release and debug library variants, and use SelectLibraryConfigurations to choose the appropriate library. Also add both release and debug libraries to the imported targets. --- Modules/FindIce.cmake | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 3fa6cab4d..4bd6d3ca8 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -360,12 +360,20 @@ function(_Ice_FIND) foreach(component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_cache "Ice_${component_upcase}_LIBRARY") + set(component_cache_release "${component_cache}_RELEASE") + set(component_cache_debug "${component_cache}_DEBUG") set(component_found "${component_upcase}_FOUND") - find_library("${component_cache}" "${component}" + find_library("${component_cache_release}" "${component}" HINTS ${ice_roots} PATH_SUFFIXES ${ice_library_suffixes} - DOC "Ice ${component} library") - mark_as_advanced("${component_cache}") + DOC "Ice ${component} library (release)") + find_library("${component_cache_debug}" "${component}d" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_library_suffixes} + DOC "Ice ${component} library (debug)") + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(Ice_${component_upcase}) + mark_as_advanced("${component_cache_release}" "${component_cache_debug}") if(${component_cache}) set("${component_found}" ON) list(APPEND Ice_LIBRARY "${${component_cache}}") @@ -438,6 +446,8 @@ if(Ice_FOUND) foreach(_Ice_component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${_Ice_component}" _Ice_component_upcase) set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") + set(_Ice_component_cache_release "Ice_${_Ice_component_upcase}_LIBRARY_RELEASE") + set(_Ice_component_cache_debug "Ice_${_Ice_component_upcase}_LIBRARY_DEBUG") set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") set(_Ice_component_found "${_Ice_component_upcase}_FOUND") set(_Ice_imported_target "Ice::${_Ice_component}") @@ -445,9 +455,29 @@ if(Ice_FOUND) set("${_Ice_component_lib}" "${${_Ice_component_cache}}") if(NOT TARGET ${_Ice_imported_target}) add_library(${_Ice_imported_target} UNKNOWN IMPORTED) - set_target_properties(${_Ice_imported_target} PROPERTIES - IMPORTED_LOCATION "${${_Ice_component_cache}}" - INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}") + if() + set_target_properties(${_Ice_imported_target} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}") + endif() + if(EXISTS "${${_Ice_component_cache}}") + set_target_properties(${_Ice_imported_target} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${${_Ice_component_cache}}") + endif() + if(EXISTS "${${_Ice_component_cache_debug}}") + set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(${_Ice_imported_target} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${${_Ice_component_cache_debug}}") + endif() + if(EXISTS "${${_Ice_component_cache_release}}") + set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(${_Ice_imported_target} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${${_Ice_component_cache_release}}") + endif() endif() endif() unset(_Ice_component_upcase) From e4eb88e21dab2f887b2a974ed89358f398418499 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 12 Jun 2016 22:43:23 +0200 Subject: [PATCH 095/929] cmCustomCommandLines: Extract from cmStandardIncludes.h --- Source/cmCustomCommandLines.h | 38 +++++++++++++++++++++++++++++++++++ Source/cmStandardIncludes.h | 19 +----------------- 2 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 Source/cmCustomCommandLines.h diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h new file mode 100644 index 000000000..c67550eae --- /dev/null +++ b/Source/cmCustomCommandLines.h @@ -0,0 +1,38 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCustomCommandLines_h +#define cmCustomCommandLines_h + +#include // IWYU pragma: keep + +#include +#include + +/** Data structure to represent a single command line. */ +class cmCustomCommandLine : public std::vector +{ +public: + typedef std::vector Superclass; + typedef Superclass::iterator iterator; + typedef Superclass::const_iterator const_iterator; +}; + +/** Data structure to represent a list of command lines. */ +class cmCustomCommandLines : public std::vector +{ +public: + typedef std::vector Superclass; + typedef Superclass::iterator iterator; + typedef Superclass::const_iterator const_iterator; +}; + +#endif diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 82652f117..6a34fb666 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -55,26 +55,9 @@ typedef unsigned short mode_t; /* Poison this operator to avoid common mistakes. */ extern void operator<<(std::ostream&, const std::ostringstream&); +#include "cmCustomCommandLines.h" #include "cmDocumentationEntry.h" -/** Data structure to represent a single command line. */ -class cmCustomCommandLine : public std::vector -{ -public: - typedef std::vector Superclass; - typedef Superclass::iterator iterator; - typedef Superclass::const_iterator const_iterator; -}; - -/** Data structure to represent a list of command lines. */ -class cmCustomCommandLines : public std::vector -{ -public: - typedef std::vector Superclass; - typedef Superclass::iterator iterator; - typedef Superclass::const_iterator const_iterator; -}; - // All subclasses of cmCommand or cmCTestGenericHandler should // invoke this macro. #define cmTypeMacro(thisClass, superclass) \ From ffdc0a8e2877605f0c7f786ec0a2536db4a71f34 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 12 Jun 2016 22:46:03 +0200 Subject: [PATCH 096/929] cmTypeMacro: Extract from cmStandardIncludes.h --- Source/cmStandardIncludes.h | 23 +---------------------- Source/cmTypeMacro.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 Source/cmTypeMacro.h diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 6a34fb666..047eded9e 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -57,28 +57,7 @@ extern void operator<<(std::ostream&, const std::ostringstream&); #include "cmCustomCommandLines.h" #include "cmDocumentationEntry.h" - -// All subclasses of cmCommand or cmCTestGenericHandler should -// invoke this macro. -#define cmTypeMacro(thisClass, superclass) \ - virtual const char* GetNameOfClass() { return #thisClass; } \ - typedef superclass Superclass; \ - static bool IsTypeOf(const char* type) \ - { \ - if (!strcmp(#thisClass, type)) { \ - return true; \ - } \ - return Superclass::IsTypeOf(type); \ - } \ - virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \ - static thisClass* SafeDownCast(cmObject* c) \ - { \ - if (c && c->IsA(#thisClass)) { \ - return static_cast(c); \ - } \ - return 0; \ - } \ - class cmTypeMacro_UseTrailingSemicolon +#include "cmTypeMacro.h" enum cmTargetLinkLibraryType { diff --git a/Source/cmTypeMacro.h b/Source/cmTypeMacro.h new file mode 100644 index 000000000..5c534c353 --- /dev/null +++ b/Source/cmTypeMacro.h @@ -0,0 +1,37 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmTypeMacro_h +#define cmTypeMacro_h + +// All subclasses of cmCommand or cmCTestGenericHandler should +// invoke this macro. +#define cmTypeMacro(thisClass, superclass) \ + virtual const char* GetNameOfClass() { return #thisClass; } \ + typedef superclass Superclass; \ + static bool IsTypeOf(const char* type) \ + { \ + if (!strcmp(#thisClass, type)) { \ + return true; \ + } \ + return Superclass::IsTypeOf(type); \ + } \ + virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \ + static thisClass* SafeDownCast(cmObject* c) \ + { \ + if (c && c->IsA(#thisClass)) { \ + return static_cast(c); \ + } \ + return 0; \ + } \ + class cmTypeMacro_UseTrailingSemicolon + +#endif From 1c2c629769e1bca0cee9e25293c88bfa060e692b Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 12 Jun 2016 22:49:18 +0200 Subject: [PATCH 097/929] cmTargetLinkLibraryType: Extract from cmStandardIncludes.h --- Source/cmStandardIncludes.h | 8 +------- Source/cmTargetLinkLibraryType.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 Source/cmTargetLinkLibraryType.h diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 047eded9e..606978ef5 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -57,13 +57,7 @@ extern void operator<<(std::ostream&, const std::ostringstream&); #include "cmCustomCommandLines.h" #include "cmDocumentationEntry.h" +#include "cmTargetLinkLibraryType.h" #include "cmTypeMacro.h" -enum cmTargetLinkLibraryType -{ - GENERAL_LibraryType, - DEBUG_LibraryType, - OPTIMIZED_LibraryType -}; - #endif diff --git a/Source/cmTargetLinkLibraryType.h b/Source/cmTargetLinkLibraryType.h new file mode 100644 index 000000000..71ac9e759 --- /dev/null +++ b/Source/cmTargetLinkLibraryType.h @@ -0,0 +1,22 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmTargetLinkLibraryType_h +#define cmTargetLinkLibraryType_h + +enum cmTargetLinkLibraryType +{ + GENERAL_LibraryType, + DEBUG_LibraryType, + OPTIMIZED_LibraryType +}; + +#endif From afd6cc6b923af63faebe9ccbad3a8ccd950e1782 Mon Sep 17 00:00:00 2001 From: Enrico Bedau Date: Thu, 16 Jun 2016 08:39:07 +0200 Subject: [PATCH 098/929] CodeBlocks: Show generated files in non-utility targets Since 2.6.3 the UTILITY target may have source files. A defect was filed that these files are now visible in the source tree. A fix later removed all generated files from the source tree, regardless of the target type. You can't even include them by using the SOURCES option. This fix adds generated files again, except for the UTILITY target which cluttered the source tree. Fixes #14272. --- Source/cmExtraCodeBlocksGenerator.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 8c656b98b..28d1d48ac 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -376,8 +376,10 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector::const_iterator si = sources.begin(); si != sources.end(); si++) { - // don't add source files which have the GENERATED property set: - if ((*si)->GetPropertyAsBool("GENERATED")) { + // don't add source files from UTILITY target which have the + // GENERATED property set: + if (gt->GetType() == cmState::UTILITY && + (*si)->GetPropertyAsBool("GENERATED")) { continue; } From d4283ca18b75a218642b8d446ba52be08e135852 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 17 Jun 2016 00:01:07 -0400 Subject: [PATCH 099/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3c49d03b6..7e8a46a7f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160616) +set(CMake_VERSION_PATCH 20160617) #set(CMake_VERSION_RC 1) From 025edea019fa95581045ad6b83e7556a83d15f69 Mon Sep 17 00:00:00 2001 From: James Touton Date: Fri, 3 Jun 2016 16:38:52 -0700 Subject: [PATCH 100/929] Xcode: Add const qualifiers --- Source/cmXCodeObject.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index d2f7cb712..1502c2785 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -59,11 +59,11 @@ public: static const char* PBXTypeNames[]; virtual ~cmXCodeObject(); cmXCodeObject(PBXType ptype, Type type); - Type GetType() { return this->TypeValue; } - PBXType GetIsA() { return this->IsA; } + Type GetType() const { return this->TypeValue; } + PBXType GetIsA() const { return this->IsA; } void SetString(const std::string& s); - const std::string& GetString() { return this->String; } + const std::string& GetString() const { return this->String; } void AddAttribute(const std::string& name, cmXCodeObject* value) { @@ -73,7 +73,7 @@ public: void SetObject(cmXCodeObject* value) { this->Object = value; } cmXCodeObject* GetObject() { return this->Object; } void AddObject(cmXCodeObject* value) { this->List.push_back(value); } - bool HasObject(cmXCodeObject* o) + bool HasObject(cmXCodeObject* o) const { return !(std::find(this->List.begin(), this->List.end(), o) == this->List.end()); @@ -94,23 +94,25 @@ public: virtual void PrintComment(std::ostream&) {} static void PrintList(std::vector const&, std::ostream& out); - const std::string& GetId() { return this->Id; } + const std::string& GetId() const { return this->Id; } void SetId(const std::string& id) { this->Id = id; } - cmGeneratorTarget* GetTarget() { return this->Target; } + cmGeneratorTarget* GetTarget() const { return this->Target; } void SetTarget(cmGeneratorTarget* t) { this->Target = t; } - const std::string& GetComment() { return this->Comment; } - bool HasComment() { return (!this->Comment.empty()); } - cmXCodeObject* GetObject(const char* name) + const std::string& GetComment() const { return this->Comment; } + bool HasComment() const { return (!this->Comment.empty()); } + cmXCodeObject* GetObject(const char* name) const { - if (this->ObjectAttributes.count(name)) { - return this->ObjectAttributes[name]; + std::map::const_iterator i = + this->ObjectAttributes.find(name); + if (i != this->ObjectAttributes.end()) { + return i->second; } return 0; } // search the attribute list for an object of the specified type - cmXCodeObject* GetObject(cmXCodeObject::PBXType t) + cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const { - for (std::vector::iterator i = this->List.begin(); + for (std::vector::const_iterator i = this->List.begin(); i != this->List.end(); ++i) { cmXCodeObject* o = *i; if (o->IsA == t) { @@ -126,7 +128,7 @@ public: { this->DependLibraries[configName].push_back(l); } - std::map const& GetDependLibraries() + std::map const& GetDependLibraries() const { return this->DependLibraries; } @@ -134,11 +136,14 @@ public: { this->DependTargets[configName].push_back(tName); } - std::map const& GetDependTargets() + std::map const& GetDependTargets() const { return this->DependTargets; } - std::vector const& GetObjectList() { return this->List; } + std::vector const& GetObjectList() const + { + return this->List; + } void SetComment(const std::string& c) { this->Comment = c; } static void PrintString(std::ostream& os, std::string String); From 82ebbf683e201af7b9bb493a221804992abf5a4a Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 12 Jun 2016 21:39:16 +0200 Subject: [PATCH 101/929] Xcode: Add function to conditionally add Xcode Attributes --- Source/cmXCodeObject.cxx | 16 ++++++++++++++++ Source/cmXCodeObject.h | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 3d3134339..fabf097ad 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -83,6 +83,22 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type) } } +bool cmXCodeObject::IsEmpty() const +{ + switch (this->TypeValue) { + case OBJECT_LIST: + return this->List.empty(); + case STRING: + return this->String.empty(); + case ATTRIBUTE_GROUP: + return this->ObjectAttributes.empty(); + case OBJECT_REF: + case OBJECT: + return this->Object == 0; + } + return true; // unreachable, but quiets warnings +} + void cmXCodeObject::Indent(int level, std::ostream& out) { while (level) { diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 1502c2785..ed917aff4 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -62,6 +62,8 @@ public: Type GetType() const { return this->TypeValue; } PBXType GetIsA() const { return this->IsA; } + bool IsEmpty() const; + void SetString(const std::string& s); const std::string& GetString() const { return this->String; } @@ -70,6 +72,13 @@ public: this->ObjectAttributes[name] = value; } + void AddAttributeIfNotEmpty(const std::string& name, cmXCodeObject* value) + { + if (value && !value->IsEmpty()) { + AddAttribute(name, value); + } + } + void SetObject(cmXCodeObject* value) { this->Object = value; } cmXCodeObject* GetObject() { return this->Object; } void AddObject(cmXCodeObject* value) { this->List.push_back(value); } From ef494edf766d622f87b82e601bf6ef7405bf29d0 Mon Sep 17 00:00:00 2001 From: James Touton Date: Fri, 3 Jun 2016 18:32:38 -0700 Subject: [PATCH 102/929] Xcode: Don't emit empty settings blocks. --- Source/cmGlobalXCodeGenerator.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4d778ee17..b43901849 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -689,7 +689,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject(); cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags)); + settings->AddAttributeIfNotEmpty("COMPILER_FLAGS", + this->CreateString(flags)); // Is this a resource file in this target? Add it to the resources group... // @@ -698,23 +699,23 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( gtgt->GetTargetSourceFileFlags(sf); bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource; + cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); + // Is this a "private" or "public" framework header file? // Set the ATTRIBUTES attribute appropriately... // if (gtgt->IsFrameworkOnApple()) { if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) { - cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); attrs->AddObject(this->CreateString("Private")); - settings->AddAttribute("ATTRIBUTES", attrs); isResource = true; } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) { - cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); attrs->AddObject(this->CreateString("Public")); - settings->AddAttribute("ATTRIBUTES", attrs); isResource = true; } } + settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs); + // Add the fileRef to the top level Resources group/folder if it is not // already there. // @@ -723,7 +724,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( this->ResourcesGroupChildren->AddObject(fileRef); } - buildFile->AddAttribute("settings", settings); + buildFile->AddAttributeIfNotEmpty("settings", settings); return buildFile; } From 811f6c825271320259ed0ccdbe3c2d577ccbdcd4 Mon Sep 17 00:00:00 2001 From: James Touton Date: Fri, 3 Jun 2016 18:51:18 -0700 Subject: [PATCH 103/929] Xcode: Add XCODE_FILE_ATTRIBUTES source file property This adds values to the ATTRIBUTES list in PBXBuildFile settings. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst | 11 +++++++++++ Source/cmGlobalXCodeGenerator.cxx | 14 ++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 3403dcd86..1c64d6363 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -344,6 +344,7 @@ Properties on Source Files /prop_sf/VS_XAML_TYPE /prop_sf/WRAP_EXCLUDE /prop_sf/XCODE_EXPLICIT_FILE_TYPE + /prop_sf/XCODE_FILE_ATTRIBUTES /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE .. _`Cache Entry Properties`: diff --git a/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst new file mode 100644 index 000000000..39e69665a --- /dev/null +++ b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst @@ -0,0 +1,11 @@ +XCODE_FILE_ATTRIBUTES +--------------------- + +Add values to the Xcode ``ATTRIBUTES`` setting on its reference to a +source file. Among other things, this can be used to set the role on +a mig file:: + + set_source_files_properties(defs.mig + PROPERTIES + XCODE_FILE_ATTRIBUTES "Client;Server" + ) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b43901849..8eefb196b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -714,6 +714,20 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( } } + // Add user-specified file attributes. + const char* extraFileAttributes = sf->GetProperty("XCODE_FILE_ATTRIBUTES"); + if (extraFileAttributes) { + // Expand the list of attributes. + std::vector attributes; + cmSystemTools::ExpandListArgument(extraFileAttributes, attributes); + + // Store the attributes. + for (std::vector::const_iterator ai = attributes.begin(); + ai != attributes.end(); ++ai) { + attrs->AddObject(this->CreateString(*ai)); + } + } + settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs); // Add the fileRef to the top level Resources group/folder if it is not From 27eb657d110123ee22b87fad1df7ebf64ecb47ba Mon Sep 17 00:00:00 2001 From: James Touton Date: Fri, 3 Jun 2016 18:27:39 -0700 Subject: [PATCH 104/929] Xcode: Add support for mig files --- Source/cmGlobalXCodeGenerator.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8eefb196b..d30830a46 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -787,6 +787,8 @@ std::string GetSourcecodeValueFromFileExtension(const std::string& _ext, sourcecode += ".asm"; } else if (ext == "metal") { sourcecode += ".metal"; + } else if (ext == "mig") { + sourcecode += ".mig"; } // else // { From 8be00e443ff4ad6795ddd90d0f6d6873623aa1b3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Jun 2016 10:53:59 -0400 Subject: [PATCH 105/929] Help: Add release note about XCODE_FILE_ATTRIBUTES source file property --- Help/release/dev/xcode-file-attributes.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/xcode-file-attributes.rst diff --git a/Help/release/dev/xcode-file-attributes.rst b/Help/release/dev/xcode-file-attributes.rst new file mode 100644 index 000000000..35824fa6c --- /dev/null +++ b/Help/release/dev/xcode-file-attributes.rst @@ -0,0 +1,6 @@ +xcode-file-attributes +--------------------- + +* A :prop_sf:`XCODE_FILE_ATTRIBUTES` source file property was + added to tell the :generator:`Xcode` generator to generate + custom content in the Xcode project attributes for the file. From 96242f8022fa4bc718ef36cda43f5dfe6236c066 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 2 Jun 2016 18:08:30 -0400 Subject: [PATCH 106/929] Add options to run `ldd -u -r` as a "link-what-you-use" tool Create a LINK_WHAT_YOU_USE target property and corresponding CMAKE_LINK_WHAT_YOU_USE variable to enable this behavior. Extend link commands by running `ldd -u -r` to detect shared libraries that are linked but not needed. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/LINK_WHAT_YOU_USE.rst | 15 ++++++++ Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst | 6 ++++ .../cmMakefileExecutableTargetGenerator.cxx | 12 +++++++ Source/cmMakefileLibraryTargetGenerator.cxx | 13 +++++++ Source/cmNinjaNormalTargetGenerator.cxx | 24 +++++++++++-- Source/cmTarget.cxx | 1 + Source/cmcmd.cxx | 35 ++++++++++++++++--- Tests/RunCMake/CMakeLists.txt | 8 +++++ .../LinkWhatYouUse/C-Build-stdout.txt | 2 ++ .../LinkWhatYouUse/C-launch-Build-stdout.txt | 2 ++ Tests/RunCMake/LinkWhatYouUse/C-launch.cmake | 3 ++ Tests/RunCMake/LinkWhatYouUse/C.cmake | 4 +++ Tests/RunCMake/LinkWhatYouUse/CMakeLists.txt | 3 ++ .../LinkWhatYouUse/CXX-Build-stdout.txt | 2 ++ .../CXX-launch-Build-stdout.txt | 2 ++ .../RunCMake/LinkWhatYouUse/CXX-launch.cmake | 3 ++ Tests/RunCMake/LinkWhatYouUse/CXX.cmake | 4 +++ .../LinkWhatYouUse/RunCMakeTest.cmake | 21 +++++++++++ Tests/RunCMake/LinkWhatYouUse/main.c | 4 +++ Tests/RunCMake/LinkWhatYouUse/main.cxx | 4 +++ 22 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 Help/prop_tgt/LINK_WHAT_YOU_USE.rst create mode 100644 Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst create mode 100644 Tests/RunCMake/LinkWhatYouUse/C-Build-stdout.txt create mode 100644 Tests/RunCMake/LinkWhatYouUse/C-launch-Build-stdout.txt create mode 100644 Tests/RunCMake/LinkWhatYouUse/C-launch.cmake create mode 100644 Tests/RunCMake/LinkWhatYouUse/C.cmake create mode 100644 Tests/RunCMake/LinkWhatYouUse/CMakeLists.txt create mode 100644 Tests/RunCMake/LinkWhatYouUse/CXX-Build-stdout.txt create mode 100644 Tests/RunCMake/LinkWhatYouUse/CXX-launch-Build-stdout.txt create mode 100644 Tests/RunCMake/LinkWhatYouUse/CXX-launch.cmake create mode 100644 Tests/RunCMake/LinkWhatYouUse/CXX.cmake create mode 100644 Tests/RunCMake/LinkWhatYouUse/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/LinkWhatYouUse/main.c create mode 100644 Tests/RunCMake/LinkWhatYouUse/main.cxx diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 3403dcd86..6a7560ac5 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -217,6 +217,7 @@ Properties on Targets /prop_tgt/LINK_LIBRARIES /prop_tgt/LINK_SEARCH_END_STATIC /prop_tgt/LINK_SEARCH_START_STATIC + /prop_tgt/LINK_WHAT_YOU_USE /prop_tgt/LOCATION_CONFIG /prop_tgt/LOCATION /prop_tgt/MACOSX_BUNDLE_INFO_PLIST diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 85b8eae71..36d00dc7d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -275,6 +275,7 @@ Variables that Control the Build /variable/CMAKE_LINK_INTERFACE_LIBRARIES /variable/CMAKE_LINK_LIBRARY_FILE_FLAG /variable/CMAKE_LINK_LIBRARY_FLAG + /variable/CMAKE_LINK_WHAT_YOU_USE /variable/CMAKE_MACOSX_BUNDLE /variable/CMAKE_MACOSX_RPATH /variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG diff --git a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst new file mode 100644 index 000000000..32d6edb07 --- /dev/null +++ b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst @@ -0,0 +1,15 @@ +LINK_WHAT_YOU_USE +--------------------------- + +This is a boolean option that when set to ``TRUE`` will automatically run +``ldd -r -u`` on the target after it is linked. In addition, the linker flag +``-Wl,--no-as-needed`` will be passed to the target with the link command so +that all libraries specified on the command line will be linked into the +target. This will result in the link producing a list of libraries that +provide no symbols used by this target but are being linked to it. +This is only applicable to executable and shared library targets and +will only work when ld and ldd accept the flags used. + +This property is initialized by the value of +the :variable:`CMAKE_LINK_WHAT_YOU_USE` variable if it is set +when a target is created. diff --git a/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst b/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst new file mode 100644 index 000000000..90c4d3ff2 --- /dev/null +++ b/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst @@ -0,0 +1,6 @@ +CMAKE_LINK_WHAT_YOU_USE +--------------------------------- + +Default value for :prop_tgt:`LINK_WHAT_YOU_USE` target property. +This variable is used to initialize the property on each target as it is +created. diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 9d422578b..ba4c6e6b5 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -187,6 +187,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->LocalGenerator->AppendFlags( linkFlags, this->Makefile->GetDefinition(export_flag_var)); } + if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) { + this->LocalGenerator->AppendFlags(linkFlags, " -Wl,--no-as-needed"); + } // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); @@ -356,6 +359,15 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.LinkFlags = linkFlags.c_str(); vars.Manifests = manifests.c_str(); + if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) { + std::string cmakeCommand = + this->Convert(cmSystemTools::GetCMakeCommand(), cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += targetOutPathReal; + real_link_commands.push_back(cmakeCommand); + } + // Expand placeholders in the commands. this->LocalGenerator->TargetImplib = targetOutPathImport; for (std::vector::iterator i = real_link_commands.begin(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 128291d29..6666c3676 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -163,6 +163,9 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); this->AddModuleDefinitionFlag(extraFlags); + if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) { + this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed"); + } this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } @@ -682,6 +685,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Get the set of commands. std::string linkRule = this->GetLinkRule(linkRuleVar); cmSystemTools::ExpandListArgument(linkRule, real_link_commands); + if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE") && + (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY)) { + std::string cmakeCommand = + this->Convert(cmSystemTools::GetCMakeCommand(), + cmLocalGenerator::NONE, cmLocalGenerator::SHELL); + cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += targetOutPathReal; + real_link_commands.push_back(cmakeCommand); + } // Expand placeholders. for (std::vector::iterator i = real_link_commands.begin(); @@ -728,6 +740,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); } + // Add the post-build rules when building but not when relinking. if (!relink) { this->LocalGenerator->AppendCustomCommands( diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3e915450e..7c18414b6 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -295,6 +295,22 @@ std::vector cmNinjaNormalTargetGenerator::ComputeLinkCmd() const char* linkCmd = mf->GetDefinition(linkCmdVar); if (linkCmd) { cmSystemTools::ExpandListArgument(linkCmd, linkCmds); + if (this->GetGeneratorTarget()->GetProperty("LINK_WHAT_YOU_USE")) { + std::string cmakeCommand = + this->GetLocalGenerator()->ConvertToOutputFormat( + cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); + cmakeCommand += " -E __run_iwyu --lwyu="; + cmGeneratorTarget& gt = *this->GetGeneratorTarget(); + const std::string cfgName = this->GetConfigName(); + std::string targetOutput = ConvertToNinjaPath(gt.GetFullPath(cfgName)); + std::string targetOutputReal = + this->ConvertToNinjaPath(gt.GetFullPath(cfgName, + /*implib=*/false, + /*realpath=*/true)); + cmakeCommand += targetOutputReal; + cmakeCommand += " || true"; + linkCmds.push_back(cmakeCommand); + } return linkCmds; } } @@ -467,6 +483,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() vars["MANIFESTS"] = this->GetManifests(); vars["LINK_PATH"] = frameworkPath + linkPath; + std::string lwyuFlags; + if (genTarget.GetProperty("LINK_WHAT_YOU_USE")) { + lwyuFlags = " -Wl,--no-as-needed"; + } // Compute architecture specific link flags. Yes, these go into a different // variable for executables, probably due to a mistake made when duplicating @@ -474,16 +494,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (targetType == cmState::EXECUTABLE) { std::string t = vars["FLAGS"]; localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName); + t += lwyuFlags; vars["FLAGS"] = t; } else { std::string t = vars["ARCH_FLAGS"]; localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName); vars["ARCH_FLAGS"] = t; t = ""; + t += lwyuFlags; localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName); vars["LANGUAGE_COMPILE_FLAGS"] = t; } - if (this->GetGeneratorTarget()->HasSOName(cfgName)) { vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME"] = this->TargetNameSO; @@ -607,7 +628,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() vars["POST_BUILD"] = ":"; symlinkVars["POST_BUILD"] = postBuildCmdLine; } - cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator(); int commandLineLengthLimit = -1; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f435a1d7a..8327af2e5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -139,6 +139,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) 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); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 535dead22..161256e25 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -271,6 +271,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::string iwyu; std::string tidy; std::string sourceFile; + std::string lwyu; for (std::string::size_type cc = 2; cc < args.size(); cc++) { std::string const& arg = args[cc]; if (arg == "--") { @@ -281,6 +282,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) tidy = arg.substr(7); } else if (doing_options && cmHasLiteralPrefix(arg, "--source=")) { sourceFile = arg.substr(9); + } else if (doing_options && cmHasLiteralPrefix(arg, "--lwyu=")) { + lwyu = arg.substr(7); } else if (doing_options) { std::cerr << "__run_iwyu given unknown argument: " << arg << "\n"; return 1; @@ -288,7 +291,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) orig_cmd.push_back(arg); } } - if (tidy.empty() && iwyu.empty()) { + if (tidy.empty() && iwyu.empty() && lwyu.empty()) { std::cerr << "__run_iwyu missing --tidy= or --iwyu=\n"; return 1; } @@ -296,7 +299,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::cerr << "__run_iwyu --tidy= requires --source=\n"; return 1; } - if (orig_cmd.empty()) { + if (orig_cmd.empty() && lwyu.empty()) { std::cerr << "__run_iwyu missing compile command after --\n"; return 1; } @@ -345,13 +348,37 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::cerr << "Error running '" << tidy_cmd[0] << "'\n"; return 1; } - // Output the stdout from clang-tidy to stderr std::cerr << stdOut; } + if (!lwyu.empty()) { + // Construct the ldd -r -u (link what you use lwyu) command line + // ldd -u -r lwuy target + std::vector lwyu_cmd; + lwyu_cmd.push_back("ldd"); + lwyu_cmd.push_back("-u"); + lwyu_cmd.push_back("-r"); + lwyu_cmd.push_back(lwyu); + // 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, + cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << lwyu_cmd[0] << "'\n"; + return 1; + } + + // Output the stdout from ldd -r -u to stderr + // Warn if lwyu reported anything. + if (stdOut.find("Unused direct dependencies:") != stdOut.npos) { + std::cerr << "Warning: " << stdOut; + } + } + ret = 0; // Now run the real compiler command and return its result value. - if (!cmSystemTools::RunSingleCommand( + if (lwyu.empty() && + !cmSystemTools::RunSingleCommand( orig_cmd, 0, 0, &ret, 0, cmSystemTools::OUTPUT_PASSTHROUGH)) { std::cerr << "Error running '" << orig_cmd[0] << "'\n"; return 1; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d16e5e7c6..b6d1c3857 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -307,6 +307,14 @@ if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]" endif() if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + if(UNIX AND NOT CYGWIN) + execute_process(COMMAND ldd --help + OUTPUT_VARIABLE LDD_HELP) + if("${LDD_HELP}" MATCHES + "(-r, --function-relocs.*process data and function relocations.*-u, --unused.*print unused direct dependencies)") + add_RunCMake_test(LinkWhatYouUse) + endif() + endif() add_executable(pseudo_tidy pseudo_tidy.c) add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$) diff --git a/Tests/RunCMake/LinkWhatYouUse/C-Build-stdout.txt b/Tests/RunCMake/LinkWhatYouUse/C-Build-stdout.txt new file mode 100644 index 000000000..95eafadb0 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/C-Build-stdout.txt @@ -0,0 +1,2 @@ +.*Warning: Unused direct dependencies.* +.*libm.* diff --git a/Tests/RunCMake/LinkWhatYouUse/C-launch-Build-stdout.txt b/Tests/RunCMake/LinkWhatYouUse/C-launch-Build-stdout.txt new file mode 100644 index 000000000..95eafadb0 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/C-launch-Build-stdout.txt @@ -0,0 +1,2 @@ +.*Warning: Unused direct dependencies.* +.*libm.* diff --git a/Tests/RunCMake/LinkWhatYouUse/C-launch.cmake b/Tests/RunCMake/LinkWhatYouUse/C-launch.cmake new file mode 100644 index 000000000..e66ca203e --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/LinkWhatYouUse/C.cmake b/Tests/RunCMake/LinkWhatYouUse/C.cmake new file mode 100644 index 000000000..4c3f42828 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/C.cmake @@ -0,0 +1,4 @@ +enable_language(C) +set(CMAKE_LINK_WHAT_YOU_USE TRUE) +add_executable(main main.c) +target_link_libraries(main m) diff --git a/Tests/RunCMake/LinkWhatYouUse/CMakeLists.txt b/Tests/RunCMake/LinkWhatYouUse/CMakeLists.txt new file mode 100644 index 000000000..18dfd2686 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/LinkWhatYouUse/CXX-Build-stdout.txt b/Tests/RunCMake/LinkWhatYouUse/CXX-Build-stdout.txt new file mode 100644 index 000000000..95eafadb0 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/CXX-Build-stdout.txt @@ -0,0 +1,2 @@ +.*Warning: Unused direct dependencies.* +.*libm.* diff --git a/Tests/RunCMake/LinkWhatYouUse/CXX-launch-Build-stdout.txt b/Tests/RunCMake/LinkWhatYouUse/CXX-launch-Build-stdout.txt new file mode 100644 index 000000000..95eafadb0 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/CXX-launch-Build-stdout.txt @@ -0,0 +1,2 @@ +.*Warning: Unused direct dependencies.* +.*libm.* diff --git a/Tests/RunCMake/LinkWhatYouUse/CXX-launch.cmake b/Tests/RunCMake/LinkWhatYouUse/CXX-launch.cmake new file mode 100644 index 000000000..3002c9d68 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/LinkWhatYouUse/CXX.cmake b/Tests/RunCMake/LinkWhatYouUse/CXX.cmake new file mode 100644 index 000000000..95558327e --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/CXX.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +set(CMAKE_LINK_WHAT_YOU_USE TRUE) +add_executable(main main.cxx) +target_link_libraries(main m) diff --git a/Tests/RunCMake/LinkWhatYouUse/RunCMakeTest.cmake b/Tests/RunCMake/LinkWhatYouUse/RunCMakeTest.cmake new file mode 100644 index 000000000..897f56817 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + + +function(run_lwyu lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_lwyu(CXX) +run_lwyu(C) +if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_lwyu(C-launch) + run_lwyu(CXX-launch) +endif() diff --git a/Tests/RunCMake/LinkWhatYouUse/main.c b/Tests/RunCMake/LinkWhatYouUse/main.c new file mode 100644 index 000000000..8488f4e58 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LinkWhatYouUse/main.cxx b/Tests/RunCMake/LinkWhatYouUse/main.cxx new file mode 100644 index 000000000..f8b643afb --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/main.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} From a0902efaa747d567fdd35729c8f0dac7b4fbee6d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Jun 2016 10:59:56 -0400 Subject: [PATCH 107/929] Help: Add notes for topic 'link_what_you_use' --- Help/release/dev/link_what_you_use.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/link_what_you_use.rst diff --git a/Help/release/dev/link_what_you_use.rst b/Help/release/dev/link_what_you_use.rst new file mode 100644 index 000000000..8d1e59871 --- /dev/null +++ b/Help/release/dev/link_what_you_use.rst @@ -0,0 +1,7 @@ +link_what_you_use +----------------- + +* A :prop_tgt:`LINK_WHAT_YOU_USE` target property and supporting + :variable:`CMAKE_LINK_WHAT_YOU_USE` variable were introduced + to detect (on UNIX) shared libraries that are linked but not + needed by running ``ldd -r -u``. From e63151ff543bb665fea255713e2e643e64527517 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Tue, 14 Jun 2016 02:27:58 +0700 Subject: [PATCH 108/929] cmake: Add an option to control what files needs to be traced Even in relatively small projects using `--trace` (and `--trace-expand`) may produce a lot of output. When developing a custom module usually one is interested in output of only a few particular modules. Add a `--trace-source=` option to enable tracing only a subset of source files. The final output would be only from requested modules, ignoring anything else not matched to given filename(s). --- Help/manual/cmake.1.rst | 5 ++++ Help/release/dev/cmake-trace-source.rst | 4 ++++ Source/cmMakefile.cxx | 24 ++++++++++++++++++- Source/cmake.cxx | 5 ++++ Source/cmake.h | 10 ++++++++ Source/cmakemain.cxx | 2 ++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 ++++ .../CommandLine/trace-only-this-file.cmake | 1 + .../CommandLine/trace-source-stderr.txt | 1 + Tests/RunCMake/CommandLine/trace-source.cmake | 3 +++ 10 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/cmake-trace-source.rst create mode 100644 Tests/RunCMake/CommandLine/trace-only-this-file.cmake create mode 100644 Tests/RunCMake/CommandLine/trace-source-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/trace-source.cmake diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 65153af41..8f7c33685 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -108,6 +108,11 @@ Options Like ``--trace``, but with variables expanded. +``--trace-source=`` + Put cmake in trace mode, but output only lines of a specified file. + + Multiple options are allowed. + ``--warn-uninitialized`` Warn about uninitialized values. diff --git a/Help/release/dev/cmake-trace-source.rst b/Help/release/dev/cmake-trace-source.rst new file mode 100644 index 000000000..9b17f6cec --- /dev/null +++ b/Help/release/dev/cmake-trace-source.rst @@ -0,0 +1,4 @@ +cmake-trace-source +------------------ + +* The :manual:`cmake(1)` command learned a ``--trace-source=`` option. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 57120707f..e8c1576b7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -175,8 +176,29 @@ cmListFileContext cmMakefile::GetExecutionContext() const void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const { + // Check if current file in the list of requested to trace... + std::vector const& trace_only_this_files = + this->GetCMakeInstance()->GetTraceSources(); + std::string const& full_path = this->GetExecutionFilePath(); + std::string const& only_filename = cmSystemTools::GetFilenameName(full_path); + bool trace = trace_only_this_files.empty(); + if (!trace) { + for (std::vector::const_iterator i = + trace_only_this_files.begin(); + !trace && i != trace_only_this_files.end(); ++i) { + std::string::size_type const pos = full_path.rfind(*i); + trace = (pos != std::string::npos) && + ((pos + i->size()) == full_path.size()) && + (only_filename == cmSystemTools::GetFilenameName(*i)); + } + // Do nothing if current file wasn't requested for trace... + if (!trace) { + return; + } + } + std::ostringstream msg; - msg << this->GetExecutionFilePath() << "(" << lff.Line << "): "; + msg << full_path << "(" << lff.Line << "): "; msg << lff.Name << "("; bool expand = this->GetCMakeInstance()->GetTraceExpand(); std::string temp; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index db0072a47..654100bf8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -589,6 +589,11 @@ void cmake::SetArgs(const std::vector& args, std::cout << "Running with expanded trace output on.\n"; this->SetTrace(true); this->SetTraceExpand(true); + } else if (arg.find("--trace-source=", 0) == 0) { + std::string file = arg.substr(strlen("--trace-source=")); + cmSystemTools::ConvertToUnixSlashes(file); + this->AddTraceSource(file); + this->SetTrace(true); } else if (arg.find("--trace", 0) == 0) { std::cout << "Running with trace output on.\n"; this->SetTrace(true); diff --git a/Source/cmake.h b/Source/cmake.h index c5d7cbbbd..9ac69354b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -307,6 +307,14 @@ public: void SetTrace(bool b) { this->Trace = b; } bool GetTraceExpand() { return this->TraceExpand; } void SetTraceExpand(bool b) { this->TraceExpand = b; } + void AddTraceSource(std::string const& file) + { + this->TraceOnlyThisSources.push_back(file); + } + std::vector const& GetTraceSources() const + { + return this->TraceOnlyThisSources; + } bool GetWarnUninitialized() { return this->WarnUninitialized; } void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; } bool GetWarnUnused() { return this->WarnUnused; } @@ -481,6 +489,8 @@ private: cmState* State; cmState::Snapshot CurrentSnapshot; + std::vector TraceOnlyThisSources; + void UpdateConversionPathTable(); // Print a list of valid generators to stderr. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 056671a83..495aae54f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -73,6 +73,8 @@ static const char* cmDocumentationOptions[][2] = { { "--debug-output", "Put cmake in a debug mode." }, { "--trace", "Put cmake in trace mode." }, { "--trace-expand", "Put cmake in trace mode with variable expansion." }, + { "--trace-source=", + "Trace only this CMake file/module. Multiple options allowed." }, { "--warn-uninitialized", "Warn about uninitialized values." }, { "--warn-unused-vars", "Warn about unused variables." }, { "--no-warn-unused-cli", "Don't warn about command line options." }, diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f449f1d0e..077a19d41 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -264,6 +264,10 @@ set(RunCMake_TEST_OPTIONS --trace-expand) run_cmake(trace-expand) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS --trace-source=trace-only-this-file.cmake) +run_cmake(trace-source) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(debug-trycompile) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CommandLine/trace-only-this-file.cmake b/Tests/RunCMake/CommandLine/trace-only-this-file.cmake new file mode 100644 index 000000000..145027153 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-only-this-file.cmake @@ -0,0 +1 @@ +message(STATUS "trace particular file test passed") diff --git a/Tests/RunCMake/CommandLine/trace-source-stderr.txt b/Tests/RunCMake/CommandLine/trace-source-stderr.txt new file mode 100644 index 000000000..dc90c659a --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-source-stderr.txt @@ -0,0 +1 @@ +^.*/trace-only-this-file.cmake\(1\): message\(STATUS trace particular file test passed \)$ diff --git a/Tests/RunCMake/CommandLine/trace-source.cmake b/Tests/RunCMake/CommandLine/trace-source.cmake new file mode 100644 index 000000000..5ac2d9def --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-source.cmake @@ -0,0 +1,3 @@ +message(STATUS "before include()") +include("trace-only-this-file.cmake") +message(STATUS "after include()") From b213a7f6ab0d4aa18e7b704bf1cf4994fae77254 Mon Sep 17 00:00:00 2001 From: Stuart Mentzer Date: Sun, 12 Jun 2016 13:52:36 -0400 Subject: [PATCH 109/929] FindFreetype: Find release and debug libraries separately --- Modules/FindFreetype.cmake | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index dc6336ddf..e38e5ed39 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -87,15 +87,28 @@ find_path( freetype2 ) -find_library(FREETYPE_LIBRARY - NAMES - freetype - libfreetype - freetype219 - ${FREETYPE_FIND_ARGS} - PATH_SUFFIXES - lib -) +if(NOT FREETYPE_LIBRARY) + find_library(FREETYPE_LIBRARY_RELEASE + NAMES + freetype + libfreetype + freetype219 + ${FREETYPE_FIND_ARGS} + PATH_SUFFIXES + lib + ) + find_library(FREETYPE_LIBRARY_DEBUG + NAMES + freetyped + libfreetyped + freetype219d + ${FREETYPE_FIND_ARGS} + PATH_SUFFIXES + lib + ) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(FREETYPE) +endif() unset(FREETYPE_FIND_ARGS) @@ -147,7 +160,6 @@ find_package_handle_standard_args( ) mark_as_advanced( - FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build ) From 0392f72bef5f1394c2dba3740f2a701fe1a98f0d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Jun 2016 10:54:20 -0400 Subject: [PATCH 110/929] Refactor Makefile/Ninja tool working directory storage Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator and add an access method. --- Source/cmCommonTargetGenerator.cxx | 12 ++++++------ Source/cmCommonTargetGenerator.h | 4 +--- Source/cmLocalCommonGenerator.cxx | 5 +++-- Source/cmLocalCommonGenerator.h | 10 +++++++++- Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index b893dd3ab..1cc04eab1 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -19,10 +19,8 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" -cmCommonTargetGenerator::cmCommonTargetGenerator( - cmOutputConverter::RelativeRoot wd, cmGeneratorTarget* gt) - : WorkingDirectory(wd) - , GeneratorTarget(gt) +cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) + : GeneratorTarget(gt) , Makefile(gt->Makefile) , LocalGenerator(static_cast(gt->LocalGenerator)) , GlobalGenerator(static_cast( @@ -140,7 +138,8 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) std::string mod_dir = this->GetFortranModuleDirectory(); if (!mod_dir.empty()) { mod_dir = - this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); + this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(), + cmOutputConverter::SHELL); } else { mod_dir = this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); @@ -308,7 +307,8 @@ std::string cmCommonTargetGenerator::GetManifests() for (std::vector::iterator mi = manifest_srcs.begin(); mi != manifest_srcs.end(); ++mi) { manifests.push_back(this->Convert( - (*mi)->GetFullPath(), this->WorkingDirectory, cmOutputConverter::SHELL)); + (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(), + cmOutputConverter::SHELL)); } return cmJoin(manifests, " "); diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index ace5351c6..c35d22a34 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -28,8 +28,7 @@ class cmSourceFile; class cmCommonTargetGenerator { public: - cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd, - cmGeneratorTarget* gt); + cmCommonTargetGenerator(cmGeneratorTarget* gt); virtual ~cmCommonTargetGenerator(); std::string const& GetConfigName() const; @@ -45,7 +44,6 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - cmOutputConverter::RelativeRoot WorkingDirectory; cmGeneratorTarget* GeneratorTarget; cmMakefile* Makefile; cmLocalCommonGenerator* LocalGenerator; diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 3ebd128f7..6cfeb1006 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -13,9 +13,10 @@ #include "cmMakefile.h" -cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmMakefile* mf) +cmLocalCommonGenerator::cmLocalCommonGenerator( + cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd) : cmLocalGenerator(gg, mf) + , WorkingDirectory(wd) { } diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index d282054ae..10380dba7 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -22,12 +22,20 @@ class cmCommonTargetGenerator; class cmLocalCommonGenerator : public cmLocalGenerator { public: - cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf); + cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, + cmOutputConverter::RelativeRoot wd); ~cmLocalCommonGenerator(); std::string const& GetConfigName() { return this->ConfigName; } + cmOutputConverter::RelativeRoot GetWorkingDirectory() const + { + return this->WorkingDirectory; + } + protected: + cmOutputConverter::RelativeRoot WorkingDirectory; + void SetConfigName(); std::string ConfigName; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6e676f1d3..0f488a6a8 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -25,7 +25,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4b5af8b87..460f0e202 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -84,7 +84,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT) { this->MakefileVariableSize = 0; this->ColorMakefile = false; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3086bb106..daf05d3e4 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -32,7 +32,7 @@ #include cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target) + : cmCommonTargetGenerator(target) , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 05a0a6392..b413c33d5 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,7 +58,7 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target) + : cmCommonTargetGenerator(target) , MacOSXContentGenerator(0) , OSXBundleGenerator(0) , MacContentFolders() From 49f10f0d24420f7d96c5153ba64a16b3f43c4736 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 16:58:36 +0200 Subject: [PATCH 111/929] cmGeneratorTarget: Adopt Fortran module directory generation Move code to create/get the fortran module directory from the cmCommonTargetGenerator to cmGeneratorTarget. Rename the ComputeFortranModuleDirectory method to CreateFortranModuleDirectory as this method *creates* the directory if it is missing. --- Source/cmCommonTargetGenerator.cxx | 40 +--------------------------- Source/cmCommonTargetGenerator.h | 6 ----- Source/cmGeneratorTarget.cxx | 35 ++++++++++++++++++++++++ Source/cmGeneratorTarget.h | 6 +++++ Source/cmMakefileTargetGenerator.cxx | 2 +- 5 files changed, 43 insertions(+), 46 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 1cc04eab1..eb1216ed8 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -27,7 +27,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) gt->LocalGenerator->GetGlobalGenerator())) , ConfigName(LocalGenerator->GetConfigName()) , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) - , FortranModuleDirectoryComputed(false) { } @@ -89,43 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->LocalGenerator->AppendFlags(flags, flag); } -std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const -{ - std::string mod_dir; - const char* target_mod_dir = - this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY"); - const char* moddir_flag = - this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); - if (target_mod_dir && moddir_flag) { - // Compute the full path to the module directory. - if (cmSystemTools::FileIsFullPath(target_mod_dir)) { - // Already a full path. - mod_dir = target_mod_dir; - } else { - // Interpret relative to the current output directory. - mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory(); - mod_dir += "/"; - mod_dir += target_mod_dir; - } - - // Make sure the module output directory exists. - cmSystemTools::MakeDirectory(mod_dir); - } - return mod_dir; -} - -std::string cmCommonTargetGenerator::GetFortranModuleDirectory() -{ - // Compute the module directory. - if (!this->FortranModuleDirectoryComputed) { - this->FortranModuleDirectoryComputed = true; - this->FortranModuleDirectory = this->ComputeFortranModuleDirectory(); - } - - // Return the computed directory. - return this->FortranModuleDirectory; -} - void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) { // Enable module output if necessary. @@ -135,7 +97,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) } // Add a module output directory flag if necessary. - std::string mod_dir = this->GetFortranModuleDirectory(); + std::string mod_dir = this->GeneratorTarget->GetFortranModuleDirectory(); if (!mod_dir.empty()) { mod_dir = this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(), diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index c35d22a34..dc4974c4a 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -53,12 +53,6 @@ protected: // The windows module definition source file (.def), if any. cmSourceFile const* ModuleDefinitionFile; - // Target-wide Fortran module output directory. - bool FortranModuleDirectoryComputed; - std::string FortranModuleDirectory; - std::string GetFortranModuleDirectory(); - virtual std::string ComputeFortranModuleDirectory() const; - // Compute target-specific Fortran language flags. void AddFortranFlags(std::string& flags); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5f4b07469..15b44a6e5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -258,6 +258,7 @@ void CreatePropertyGeneratorExpressions( cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) : Target(t) + , FortranModuleDirectoryCreated(false) , SourceFileFlagsConstructed(false) , PolicyWarnedCMP0022(false) , DebugIncludesDone(false) @@ -3842,6 +3843,40 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major, } } +std::string cmGeneratorTarget::GetFortranModuleDirectory() const +{ + if (!this->FortranModuleDirectoryCreated) { + this->FortranModuleDirectory = true; + this->FortranModuleDirectory = this->CreateFortranModuleDirectory(); + } + + return this->FortranModuleDirectory; +} + +std::string cmGeneratorTarget::CreateFortranModuleDirectory() const +{ + static std::string mod_dir; + const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY"); + const char* moddir_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); + if (target_mod_dir && moddir_flag) { + // Compute the full path to the module directory. + if (cmSystemTools::FileIsFullPath(target_mod_dir)) { + // Already a full path. + mod_dir = target_mod_dir; + } else { + // Interpret relative to the current output directory. + mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory(); + mod_dir += "/"; + mod_dir += target_mod_dir; + } + + // Make sure the module output directory exists. + cmSystemTools::MakeDirectory(mod_dir); + } + return mod_dir; +} + std::string cmGeneratorTarget::GetFrameworkVersion() const { assert(this->GetType() != cmState::INTERFACE_LIBRARY); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 63208bc70..2ee9bef4d 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -526,7 +526,13 @@ public: void GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; + std::string GetFortranModuleDirectory() const; + private: + std::string CreateFortranModuleDirectory() const; + mutable bool FortranModuleDirectoryCreated; + mutable std::string FortranModuleDirectory; + friend class cmTargetTraceDependencies; struct SourceEntry { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index daf05d3e4..8b341a1ac 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -962,7 +962,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "\n" << "# Fortran module output directory.\n" << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" - << this->GetFortranModuleDirectory() << "\")\n"; + << this->GeneratorTarget->GetFortranModuleDirectory() << "\")\n"; /* clang-format on */ // and now write the rule to use it From 5467e7945d46f5f8540a6e11933c9b6b584036a2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Jun 2016 11:14:18 -0400 Subject: [PATCH 112/929] cmLocalGenerator: Add method to get Fortran-specific compiler flags Add a cmLocalGenerator::GetTargetFortranFlags virtual method to get generator-specific generation of Fortran-specific flags. Implement it in cmLocalCommonGenerator by moving the implementation from cmCommonTargetGenerator::AddFortranFlags. This will allow it to be used without having a target generator available. Inspired-by: Tobias Hunger --- Source/cmCommonTargetGenerator.cxx | 49 ++---------------------------- Source/cmCommonTargetGenerator.h | 3 -- Source/cmLocalCommonGenerator.cxx | 47 ++++++++++++++++++++++++++++ Source/cmLocalCommonGenerator.h | 3 ++ Source/cmLocalGenerator.cxx | 7 +++++ Source/cmLocalGenerator.h | 2 ++ 6 files changed, 62 insertions(+), 49 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index eb1216ed8..aa7f5c097 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -88,51 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->LocalGenerator->AppendFlags(flags, flag); } -void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) -{ - // Enable module output if necessary. - if (const char* modout_flag = - this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) { - this->LocalGenerator->AppendFlags(flags, modout_flag); - } - - // Add a module output directory flag if necessary. - std::string mod_dir = this->GeneratorTarget->GetFortranModuleDirectory(); - if (!mod_dir.empty()) { - mod_dir = - this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(), - cmOutputConverter::SHELL); - } else { - mod_dir = - this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); - } - if (!mod_dir.empty()) { - const char* moddir_flag = - this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); - std::string modflag = moddir_flag; - modflag += mod_dir; - this->LocalGenerator->AppendFlags(flags, modflag); - } - - // If there is a separate module path flag then duplicate the - // include path with it. This compiler does not search the include - // path for modules. - if (const char* modpath_flag = - this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { - std::vector includes; - const std::string& config = this->ConfigName; - this->LocalGenerator->GetIncludeDirectories( - includes, this->GeneratorTarget, "C", config); - for (std::vector::const_iterator idi = includes.begin(); - idi != includes.end(); ++idi) { - std::string flg = modpath_flag; - flg += - this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL); - this->LocalGenerator->AppendFlags(flags, flg); - } - } -} - void cmCommonTargetGenerator::AppendFortranFormatFlags( std::string& flags, cmSourceFile const& source) { @@ -175,7 +130,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l) // Fortran-specific flags computed for this target. if (l == "Fortran") { - this->AddFortranFlags(flags); + this->LocalGenerator->AppendFlags( + flags, this->LocalGenerator->GetTargetFortranFlags( + this->GeneratorTarget, this->ConfigName)); } this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index dc4974c4a..0bafde9fe 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -53,9 +53,6 @@ protected: // The windows module definition source file (.def), if any. cmSourceFile const* ModuleDefinitionFile; - // Compute target-specific Fortran language flags. - void AddFortranFlags(std::string& flags); - std::string Convert( std::string const& source, cmOutputConverter::RelativeRoot relative, cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED); diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 6cfeb1006..5502296dc 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -35,3 +35,50 @@ void cmLocalCommonGenerator::SetConfigName() this->ConfigName = ""; } } + +std::string cmLocalCommonGenerator::GetTargetFortranFlags( + cmGeneratorTarget const* target, std::string const& config) +{ + std::string flags; + + // Enable module output if necessary. + if (const char* modout_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) { + this->AppendFlags(flags, modout_flag); + } + + // Add a module output directory flag if necessary. + std::string mod_dir = target->GetFortranModuleDirectory(); + if (!mod_dir.empty()) { + mod_dir = + this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); + } else { + mod_dir = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if (!mod_dir.empty()) { + const char* moddir_flag = + this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); + std::string modflag = moddir_flag; + modflag += mod_dir; + this->AppendFlags(flags, modflag); + } + + // If there is a separate module path flag then duplicate the + // include path with it. This compiler does not search the include + // path for modules. + if (const char* modpath_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { + std::vector includes; + this->GetIncludeDirectories(includes, target, "C", config); + for (std::vector::const_iterator idi = includes.begin(); + idi != includes.end(); ++idi) { + std::string flg = modpath_flag; + flg += + this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL); + this->AppendFlags(flags, flg); + } + } + + return flags; +} diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 10380dba7..fd17ae380 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -33,6 +33,9 @@ public: return this->WorkingDirectory; } + std::string GetTargetFortranFlags(cmGeneratorTarget const* target, + std::string const& config); + protected: cmOutputConverter::RelativeRoot WorkingDirectory; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2f50b7f4c..a0263e4f3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1344,6 +1344,13 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, this->AddCompileDefinitions(defines, target, config, lang.c_str()); } +std::string cmLocalGenerator::GetTargetFortranFlags(cmGeneratorTarget const*, + std::string const&) +{ + // Implemented by specific generators that override this. + return std::string(); +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index af561f687..d04a723c1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -321,6 +321,8 @@ public: std::string GetFrameworkFlags(std::string const& l, std::string const& config, cmGeneratorTarget* target); + virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target, + std::string const& config); virtual void ComputeObjectFilenames( std::map& mapping, From 3c488ce89955d00785bb4637c87b960da6c55ec8 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 18:04:58 +0200 Subject: [PATCH 113/929] cmLocalGenerator: Adopt target compile flag generation Factor the flag generation out of cmCommonTargetGenerator::GetFlags into a new cmLocalGenerator::GetTargetCompileFlags method. This will allow it to be used without a target generator available. --- Source/cmCommonTargetGenerator.cxx | 33 ++---------------------------- Source/cmLocalGenerator.cxx | 27 ++++++++++++++++++++++++ Source/cmLocalGenerator.h | 3 +++ 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index aa7f5c097..101093d7f 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -120,38 +120,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l) ByLanguageMap::iterator i = this->FlagsByLanguage.find(l); if (i == this->FlagsByLanguage.end()) { std::string flags; - const char* lang = l.c_str(); - // Add language feature flags. - this->AddFeatureFlags(flags, lang); - - this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, - lang, this->ConfigName); - - // Fortran-specific flags computed for this target. - if (l == "Fortran") { - this->LocalGenerator->AppendFlags( - flags, this->LocalGenerator->GetTargetFortranFlags( - this->GeneratorTarget, this->ConfigName)); - } - - this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, - this->ConfigName); - - this->LocalGenerator->AddVisibilityPresetFlags( - flags, this->GeneratorTarget, lang); - - // Append old-style preprocessor definition flags. - this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); - - // Add framework directory flags. - this->LocalGenerator->AppendFlags( - flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName, - this->GeneratorTarget)); - - // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, - this->ConfigName); + this->LocalGenerator->GetTargetCompileFlags(this->GeneratorTarget, + this->ConfigName, l, flags); ByLanguageMap::value_type entry(l, flags); i = this->FlagsByLanguage.insert(entry).first; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a0263e4f3..e2e7aa159 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1272,6 +1272,33 @@ void cmLocalGenerator::GetTargetFlags( } } +void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, + std::string const& config, + std::string const& lang, + std::string& flags) +{ + cmMakefile* mf = this->GetMakefile(); + + // Add language-specific flags. + this->AddLanguageFlags(flags, lang, config); + + if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } + + this->AddArchitectureFlags(flags, target, lang, config); + + if (lang == "Fortran") { + this->AppendFlags(flags, this->GetTargetFortranFlags(target, config)); + } + + this->AddCMP0018Flags(flags, target, lang, config); + this->AddVisibilityPresetFlags(flags, target, lang); + this->AppendFlags(flags, mf->GetDefineFlags()); + this->AppendFlags(flags, this->GetFrameworkFlags(lang, config, target)); + this->AddCompileOptions(flags, target, lang, config); +} + static std::string GetFrameworkFlags(const std::string& lang, const std::string& config, cmGeneratorTarget* target) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d04a723c1..66fbe01c9 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -317,6 +317,9 @@ public: void GetTargetDefines(cmGeneratorTarget const* target, std::string const& config, std::string const& lang, std::set& defines) const; + void GetTargetCompileFlags(cmGeneratorTarget* target, + std::string const& config, + std::string const& lang, std::string& flags); std::string GetFrameworkFlags(std::string const& l, std::string const& config, From 802b36fb62c7dc9a471bdb630536c82491e9cd0e Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 18:09:13 +0200 Subject: [PATCH 114/929] cmExtraSublimeTextGenerator: Use GetTargetCompileFlags Replace some custom code with equivalent code from the framework. This also fixes some fixmes left in the custom code. --- Source/cmExtraSublimeTextGenerator.cxx | 27 +++----------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 9b3ea0b68..2b9f64fef 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -314,27 +314,14 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt) { std::string flags; - - cmMakefile* makefile = lg->GetMakefile(); std::string language = source->GetLanguage(); if (language.empty()) { language = "C"; } - const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - // Add language-specific flags. - lg->AddLanguageFlags(flags, language, config); + std::string const& config = + lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - lg->AddArchitectureFlags(flags, gtgt, language, config); - - // TODO: Fortran support. - // // Fortran-specific flags computed for this target. - // if(*l == "Fortran") - // { - // this->AddFortranFlags(flags); - // } - - // Add shared-library flags if needed. - lg->AddCMP0018Flags(flags, gtgt, language, config); + lg->GetTargetCompileFlags(gtgt, config, language, flags); // Add include directory flags. { @@ -345,17 +332,9 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( lg->AppendFlags(flags, includeFlags); } - // Append old-style preprocessor definition flags. - lg->AppendFlags(flags, makefile->GetDefineFlags()); - - // Add target-specific flags. - lg->AddCompileOptions(flags, gtgt, language, config); - // Add source file specific flags. lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); - // TODO: Handle Apple frameworks. - return flags; } From 9ad10c8feb9ffd0adf0840379eedbae4df49ffd7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Jun 2016 15:02:54 -0400 Subject: [PATCH 115/929] cmake-gui: Reference LGPLv3 when redistributing Qt Download http://www.gnu.org/licenses/lgpl.txt and place it as Licenses/LGPLv3.txt in our source tree. When building cmake-gui, use option CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL to enable notification in the "About" dialog of how the distribution of Qt is licensed. Install the license file as ${CMAKE_ROOT}/Licenses/LGPLv3.txt so that the dialog can display a path to it. --- CMakeCPack.cmake | 4 +- CMakeLists.txt | 10 ++ Licenses/LGPLv3.txt | 165 ++++++++++++++++++++++++ Source/QtDialog/CMakeLists.txt | 6 +- Source/QtDialog/CMakeSetupDialog.cxx | 9 +- Utilities/Release/linux32_release.cmake | 2 +- Utilities/Release/linux64_release.cmake | 2 +- Utilities/Release/osx_release.cmake | 2 +- Utilities/Release/win32_release.cmake | 2 +- Utilities/Release/win64_release.cmake | 2 +- 10 files changed, 190 insertions(+), 14 deletions(-) create mode 100644 Licenses/LGPLv3.txt diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 72fc97c8d..8879cb987 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -108,9 +108,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_COMPONENTS_GROUPING IGNORE) ") else() - if(BUILD_QtDialog AND CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) + if(BUILD_QtDialog AND USE_LGPL) set(_CPACK_IFW_ADDITIONAL_LICENSES - "\"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\"") + "\"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\"") endif() endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 787f3193a..5336208d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,16 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) endif() +if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) + if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL MATCHES "^3|2\\.1$") + set(USE_LGPL "${CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL}") + else() + set(USE_LGPL "2.1") + endif() +else() + set(USE_LGPL "") +endif() + if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # Disallow architecture-specific try_run. It may not run on the host. macro(TRY_RUN) diff --git a/Licenses/LGPLv3.txt b/Licenses/LGPLv3.txt new file mode 100644 index 000000000..65c5ca88a --- /dev/null +++ b/Licenses/LGPLv3.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index a906f4a6f..68c65ac0f 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -150,12 +150,12 @@ if(APPLE) MACOSX_PACKAGE_LOCATION Resources) endif() -if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) - install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt +if(USE_LGPL) + install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt DESTINATION ${CMAKE_DATA_DIR}/Licenses ${COMPONENT}) set_property(SOURCE CMakeSetupDialog.cxx - PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) + PROPERTY COMPILE_DEFINITIONS USE_LGPL="${USE_LGPL}") endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 712611d41..fda3e5865 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -830,17 +830,18 @@ void CMakeSetupDialog::doAbout() "\n" "CMake GUI maintained by csimsoft,\n" "built using Qt %2 (qt-project.org).\n" -#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL +#ifdef USE_LGPL "\n" "The Qt Toolkit is Copyright (C) Digia Plc and/or its subsidiary(-ies).\n" - "Qt is licensed under terms of the GNU LGPLv2.1, available at:\n" + "Qt is licensed under terms of the GNU LGPLv" USE_LGPL ", available at:\n" " \"%3\"" #endif ); msg = msg.arg(cmVersion::GetCMakeVersion()); msg = msg.arg(qVersion()); -#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL - std::string lgpl = cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv2.1.txt"; +#ifdef USE_LGPL + std::string lgpl = + cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv" USE_LGPL ".txt"; msg = msg.arg(lgpl.c_str()); #endif diff --git a/Utilities/Release/linux32_release.cmake b/Utilities/Release/linux32_release.cmake index 6d096d197..4ef513ebc 100644 --- a/Utilities/Release/linux32_release.cmake +++ b/Utilities/Release/linux32_release.cmake @@ -17,7 +17,7 @@ OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2h/include OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2h/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=2.1 CMake_INSTALL_DEPENDENCIES:BOOL=ON QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake ") diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index cfe370bdb..7511c8ab7 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -17,7 +17,7 @@ OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2h/include OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2h/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-x86_64 BUILD_QtDialog:BOOL:=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=2.1 CMake_INSTALL_DEPENDENCIES:BOOL=ON QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.8.6/bin/qmake ") diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index 17f7df6eb..35705eda1 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -18,7 +18,7 @@ CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 BUILD_QtDialog:BOOL=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON CMAKE_SKIP_RPATH:BOOL=TRUE CMake_NO_C_STANDARD:BOOL=TRUE diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index ba83b2633..38924411a 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -15,7 +15,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Ninja BUILD_QtDialog:BOOL:=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,5.01 ") diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 8e207b562..923cc964c 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -16,7 +16,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Ninja BUILD_QtDialog:BOOL:=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,5.02 ") From 2e351f892e8eeaec2ecfe3b8a047c340a8718f10 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 18 Jun 2016 00:01:07 -0400 Subject: [PATCH 116/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7e8a46a7f..ac145cf01 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160617) +set(CMake_VERSION_PATCH 20160618) #set(CMake_VERSION_RC 1) From e36e5a2680f34c64773944b152e5337f8951a644 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sat, 18 Jun 2016 22:59:40 +0200 Subject: [PATCH 117/929] Xcode: Properly handle BUNDLE_EXTENSION --- Source/cmGlobalXCodeGenerator.cxx | 5 +++++ Tests/CFBundleTest/CMakeLists.txt | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d30830a46..e82cb16cd 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1801,6 +1801,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, extraLinkOptions += " "; extraLinkOptions += createFlags; } + const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION"); + if (ext) { + buildSettings->AddAttribute("WRAPPER_EXTENSION", + this->CreateString(ext)); + } std::string plist = this->ComputeInfoPListLocation(gtgt); // Xcode will create the final version of Info.plist at build time, // so let it replace the cfbundle name. This avoids creating diff --git a/Tests/CFBundleTest/CMakeLists.txt b/Tests/CFBundleTest/CMakeLists.txt index 5cda527d8..0fe6bb771 100644 --- a/Tests/CFBundleTest/CMakeLists.txt +++ b/Tests/CFBundleTest/CMakeLists.txt @@ -50,7 +50,6 @@ set_source_files_properties( set_target_properties(CFBundleTest PROPERTIES BUNDLE 1 BUNDLE_EXTENSION plugin - XCODE_ATTRIBUTE_WRAPPER_EXTENSION plugin #sets the extension to .plugin XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/Info.plist MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist From d6378091361623a9018925b9cfb2708f6a0183f4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 19 Jun 2016 00:01:06 -0400 Subject: [PATCH 118/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ac145cf01..520fdeb81 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160618) +set(CMake_VERSION_PATCH 20160619) #set(CMake_VERSION_RC 1) From f4c35c3dc2cd7204fc680d39a5c2f186f0badd6a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 20 Jun 2016 00:01:06 -0400 Subject: [PATCH 119/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 520fdeb81..f2faea262 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160619) +set(CMake_VERSION_PATCH 20160620) #set(CMake_VERSION_RC 1) From 5cc34162ad5d0ca174b44d37bcc32b7f4aa00a33 Mon Sep 17 00:00:00 2001 From: Wu Zhao Date: Mon, 20 Jun 2016 14:51:37 +0800 Subject: [PATCH 120/929] AIX: Add support for Clang compiler The platform information module for GNU on AIX can be reused for Clang on AIX because clang accepts almost all of the same options. --- Help/release/dev/aix-clang.rst | 4 ++++ Modules/Platform/AIX-Clang-C.cmake | 1 + Modules/Platform/AIX-Clang-CXX.cmake | 1 + 3 files changed, 6 insertions(+) create mode 100644 Help/release/dev/aix-clang.rst create mode 100644 Modules/Platform/AIX-Clang-C.cmake create mode 100644 Modules/Platform/AIX-Clang-CXX.cmake diff --git a/Help/release/dev/aix-clang.rst b/Help/release/dev/aix-clang.rst new file mode 100644 index 000000000..2ff53bfa4 --- /dev/null +++ b/Help/release/dev/aix-clang.rst @@ -0,0 +1,4 @@ +aix-clang +--------- + +* The Clang compiler is now supported on AIX. diff --git a/Modules/Platform/AIX-Clang-C.cmake b/Modules/Platform/AIX-Clang-C.cmake new file mode 100644 index 000000000..0e8a1c075 --- /dev/null +++ b/Modules/Platform/AIX-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/AIX-GNU-C) diff --git a/Modules/Platform/AIX-Clang-CXX.cmake b/Modules/Platform/AIX-Clang-CXX.cmake new file mode 100644 index 000000000..6b9110e31 --- /dev/null +++ b/Modules/Platform/AIX-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/AIX-GNU-CXX) From c9fca42fd1e14536d68bd600fc4c394d2630f7f5 Mon Sep 17 00:00:00 2001 From: Andreas Weis Date: Sun, 19 Jun 2016 12:44:29 +0200 Subject: [PATCH 121/929] FindBoost: Make imported targets fall back to `Release` FindBoost only detects Debug and Release configurations. All other configurations will fall back to the configuration listed as the first entry in `IMPORTED_CONFIGURATIONS`. Switch the order so that `Release` is listed first, as this is a better fallback than `Debug` for the `RelWithDebInfo` and `MinSizeRel` configurations. See issue #16091. --- Modules/FindBoost.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 6bf640195..2560459bd 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1734,13 +1734,6 @@ if(Boost_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") endif() - if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") - set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(Boost::${COMPONENT} PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" - IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") - endif() if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) @@ -1748,6 +1741,13 @@ if(Boost_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) From ed05f11dd27d668791887f32e2c7be00753cfdb5 Mon Sep 17 00:00:00 2001 From: Gilles Khouzam Date: Fri, 17 Jun 2016 14:24:21 -0700 Subject: [PATCH 122/929] VS: Add a VS_TOOL_OVERRIDE source file property This property allow to specify a specific Visual Studio tool for a source file overriding the default tool behavior. For example, a `.resw` file being processed as a `PriResource` file. This has the advantage of being able to teach CMake to process new file types without code modifications. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_sf/VS_TOOL_OVERRIDE.rst | 5 + Help/release/dev/vs-tool-override.rst | 5 + Source/cmVisualStudio10TargetGenerator.cxx | 5 + Tests/VSWinStorePhone/CMakeLists.txt | 6 +- .../Direct3DApp1/Strings/en-US/Resources.resw | 123 ++++++++++++++++++ 6 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 Help/prop_sf/VS_TOOL_OVERRIDE.rst create mode 100644 Help/release/dev/vs-tool-override.rst create mode 100644 Tests/VSWinStorePhone/Direct3DApp1/Strings/en-US/Resources.resw diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f08251894..c21c3d880 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -343,6 +343,7 @@ Properties on Source Files /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL /prop_sf/VS_SHADER_TYPE + /prop_sf/VS_TOOL_OVERRIDE.rst /prop_sf/VS_XAML_TYPE /prop_sf/WRAP_EXCLUDE /prop_sf/XCODE_EXPLICIT_FILE_TYPE diff --git a/Help/prop_sf/VS_TOOL_OVERRIDE.rst b/Help/prop_sf/VS_TOOL_OVERRIDE.rst new file mode 100644 index 000000000..8bdc5ca50 --- /dev/null +++ b/Help/prop_sf/VS_TOOL_OVERRIDE.rst @@ -0,0 +1,5 @@ +VS_TOOL_OVERRIDE +---------------- + +Override the default Visual Studio tool that will be applied to the source file +with a new tool not based on the extension of the file. diff --git a/Help/release/dev/vs-tool-override.rst b/Help/release/dev/vs-tool-override.rst new file mode 100644 index 000000000..e1177c8d6 --- /dev/null +++ b/Help/release/dev/vs-tool-override.rst @@ -0,0 +1,5 @@ +vs-tool-override +---------------- + +* A :prop_sf:`VS_TOOL_OVERRIDE` source file property was created to tell + :ref:`Visual Studio Generators` what tool to use for a source file. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 3b1cddb62..ed84befdf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1203,6 +1203,11 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } } + const char* toolOverride = sf->GetProperty("VS_TOOL_OVERRIDE"); + if (toolOverride && *toolOverride) { + tool = toolOverride; + } + std::string deployContent; std::string deployLocation; if (this->GlobalGenerator->TargetsWindowsPhone() || diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index ae8275551..6b026fc70 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -98,13 +98,17 @@ elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") ) endif() +set(STRING_FILES + Direct3DApp1/Strings/en-US/Resources.resw) + set(RESOURCE_FILES - ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES} + ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES} ${STRING_FILES} Direct3DApp1/Direct3DApp1_TemporaryKey.pfx) set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets") +set_property(SOURCE ${STRING_FILES} PROPERTY VS_TOOL_OVERRIDE "PRIResource") set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $) set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $,$,$>) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Strings/en-US/Resources.resw b/Tests/VSWinStorePhone/Direct3DApp1/Strings/en-US/Resources.resw new file mode 100644 index 000000000..8c2c8ae4f --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Strings/en-US/Resources.resw @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Test String + + From fe27879c6b37d09084a740de843a54d39727c0f0 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 16 Jun 2016 23:51:36 +0200 Subject: [PATCH 123/929] cmDependsJavaParserHelper: fix dangling pointer The cmDependsJavaParserHelper tries to implement a "deep copy" in the assignment operator of the internal class CurrentClass. To do that, it uses std::copy and std::back_inserter. The copy constructor is implemented in terms of the assignment operator but it does not initialize the member NestedClasses, a pointer to vector. This pointer is dereferenced in the assignment operator. Change the pointer to a value and rely on the compiler generated special functions. --- Source/cmDependsJavaParserHelper.cxx | 39 ++++++++++++---------------- Source/cmDependsJavaParserHelper.h | 17 +++--------- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index bd3ee4d53..238e7a149 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper() } void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting( - std::vector* files, const char* prefix, const char* sep) + std::vector* files, const char* prefix, const char* sep) const { std::string rname = ""; if (prefix) { @@ -44,8 +44,8 @@ void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting( } rname += this->Name; files->push_back(rname); - std::vector::iterator it; - for (it = this->NestedClasses->begin(); it != this->NestedClasses->end(); + std::vector::const_iterator it; + for (it = this->NestedClasses.begin(); it != this->NestedClasses.end(); ++it) { it->AddFileNamesForPrinting(files, rname.c_str(), sep); } @@ -191,25 +191,19 @@ void cmDependsJavaParserHelper::StartClass(const char* cls) void cmDependsJavaParserHelper::EndClass() { - CurrentClass* parent = 0; - CurrentClass* current = 0; - if (!this->ClassStack.empty()) { - current = &(*(this->ClassStack.end() - 1)); - if (this->ClassStack.size() > 1) { - parent = &(*(this->ClassStack.end() - 2)); - } - } - if (current == 0) { + if (this->ClassStack.empty()) { std::cerr << "Error when parsing. Current class is null" << std::endl; abort(); } - if (parent == 0) { + if (this->ClassStack.size() <= 1) { std::cerr << "Error when parsing. Parent class is null" << std::endl; abort(); } + CurrentClass& current = this->ClassStack.back(); + CurrentClass& parent = this->ClassStack[this->ClassStack.size() - 2]; this->CurrentDepth--; - parent->NestedClasses->push_back(*current); - this->ClassStack.erase(this->ClassStack.end() - 1, this->ClassStack.end()); + parent.NestedClasses.push_back(current); + this->ClassStack.pop_back(); } void cmDependsJavaParserHelper::PrintClasses() @@ -228,10 +222,10 @@ void cmDependsJavaParserHelper::PrintClasses() std::vector cmDependsJavaParserHelper::GetFilesProduced() { std::vector files; - CurrentClass* toplevel = &(*(this->ClassStack.begin())); - std::vector::iterator it; - for (it = toplevel->NestedClasses->begin(); - it != toplevel->NestedClasses->end(); ++it) { + CurrentClass const& toplevel = this->ClassStack.front(); + std::vector::const_iterator it; + for (it = toplevel.NestedClasses.begin(); it != toplevel.NestedClasses.end(); + ++it) { it->AddFileNamesForPrinting(&files, 0, "$"); } return files; @@ -309,11 +303,10 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen) if (buf[0] == '\n') { this->CurrentLine++; } - return (1); - } else { - buf[0] = '\n'; - return (0); + return 1; } + buf[0] = '\n'; + return 0; } void cmDependsJavaParserHelper::Error(const char* str) { diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index a13d023b8..6ff024563 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -48,7 +48,7 @@ public: // For yacc void AddClassFound(const char* sclass); - void PrepareElement(ParserType* opt); + void PrepareElement(ParserType* me); void DeallocateParserType(char** pt); void CheckEmpty(int line, int cnt, ParserType* pt); void StartClass(const char* cls); @@ -69,20 +69,9 @@ private: { public: std::string Name; - std::vector* NestedClasses; - CurrentClass() { this->NestedClasses = new std::vector; } - ~CurrentClass() { delete this->NestedClasses; } - CurrentClass& operator=(CurrentClass const& c) - { - this->NestedClasses->clear(); - this->Name = c.Name; - std::copy(c.NestedClasses->begin(), c.NestedClasses->end(), - std::back_inserter(*this->NestedClasses)); - return *this; - } - CurrentClass(CurrentClass const& c) { (*this) = c; } + std::vector NestedClasses; void AddFileNamesForPrinting(std::vector* files, - const char* prefix, const char* sep); + const char* prefix, const char* sep) const; }; std::string CurrentPackage; std::string::size_type InputBufferPos; From 92c67b9f01292741428eae12878aad52bf23b002 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 20 Jun 2016 20:00:32 +0300 Subject: [PATCH 124/929] FindLua: Prefix private APIs with `_lua_` --- Modules/FindLua.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index 4e00a9211..eddd94b73 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -51,32 +51,32 @@ unset(_lua_include_subdirs) unset(_lua_library_names) # this is a function only to have all the variables inside go away automatically -function(set_lua_version_vars) +function(_lua_set_version_vars) set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) if (Lua_FIND_VERSION_EXACT) if (Lua_FIND_VERSION_COUNT GREATER 1) - set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) + set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) endif () elseif (Lua_FIND_VERSION) # once there is a different major version supported this should become a loop if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) if (Lua_FIND_VERSION_COUNT EQUAL 1) - set(lua_append_versions ${LUA_VERSIONS5}) + set(_lua_append_versions ${LUA_VERSIONS5}) else () foreach (subver IN LISTS LUA_VERSIONS5) if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) - list(APPEND lua_append_versions ${subver}) + list(APPEND _lua_append_versions ${subver}) endif () endforeach () endif () endif () else () # once there is a different major version supported this should become a loop - set(lua_append_versions ${LUA_VERSIONS5}) + set(_lua_append_versions ${LUA_VERSIONS5}) endif () - foreach (ver IN LISTS lua_append_versions) + foreach (ver IN LISTS _lua_append_versions) string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") list(APPEND _lua_include_subdirs include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} @@ -93,9 +93,9 @@ function(set_lua_version_vars) set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) -endfunction(set_lua_version_vars) +endfunction(_lua_set_version_vars) -set_lua_version_vars() +_lua_set_version_vars() find_path(LUA_INCLUDE_DIR lua.h HINTS From 281c707b65dee100f09b4782a3d7e60bc8d29db8 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 20 Jun 2016 20:01:32 +0300 Subject: [PATCH 125/929] FindLua: Factor out a helper function for version extraction --- Modules/FindLua.cmake | 53 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index eddd94b73..6a9d5b58b 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -95,6 +95,34 @@ function(_lua_set_version_vars) set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) endfunction(_lua_set_version_vars) +function(_lua_check_header_version _hdr_file) + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${_hdr_file}" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) + set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) + set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) + set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) +endfunction(_lua_check_header_version) + _lua_set_version_vars() find_path(LUA_INCLUDE_DIR lua.h @@ -138,29 +166,8 @@ if (LUA_LIBRARY) endif () if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - # At least 5.[012] have different ways to express the version - # so all of them need to be tested. Lua 5.2 defines LUA_VERSION - # and LUA_RELEASE as joined by the C preprocessor, so avoid those. - file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings - REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") - - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") - if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") - set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") - else () - string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - endif () - string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") - endif () - - unset(lua_version_strings) -endif() + _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") +endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if From 3532cbce18f4021507a0fd8d23d0930aa09ae8e1 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 20 Jun 2016 19:45:59 +0300 Subject: [PATCH 126/929] FindLua: Check header file against suitable versions --- Modules/FindLua.cmake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index 6a9d5b58b..4af3bbf45 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -49,6 +49,7 @@ unset(_lua_include_subdirs) unset(_lua_library_names) +unset(_lua_append_versions) # this is a function only to have all the variables inside go away automatically function(_lua_set_version_vars) @@ -93,6 +94,7 @@ function(_lua_set_version_vars) set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) + set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) endfunction(_lua_set_version_vars) function(_lua_check_header_version _hdr_file) @@ -116,11 +118,15 @@ function(_lua_check_header_version _hdr_file) string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") endif () - - set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) - set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) - set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) - set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) + foreach (ver IN LISTS _lua_append_versions) + if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") + set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) + set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) + set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) + set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) + return() + endif () + endforeach () endfunction(_lua_check_header_version) _lua_set_version_vars() @@ -138,6 +144,7 @@ find_path(LUA_INCLUDE_DIR lua.h /opt ) unset(_lua_include_subdirs) +unset(_lua_append_versions) find_library(LUA_LIBRARY NAMES ${_lua_library_names} lua From eecd307e24a35b68d7ed4fa2f085c283d3e34461 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 20 Jun 2016 19:53:45 +0300 Subject: [PATCH 127/929] FindLua: Iterate through all include subdirs to find a suitable header Fixes #15756. --- Modules/FindLua.cmake | 45 ++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index 4af3bbf45..f105f3d94 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -77,6 +77,8 @@ function(_lua_set_version_vars) set(_lua_append_versions ${LUA_VERSIONS5}) endif () + list(APPEND _lua_include_subdirs "include/lua" "include") + foreach (ver IN LISTS _lua_append_versions) string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") list(APPEND _lua_include_subdirs @@ -131,18 +133,33 @@ endfunction(_lua_check_header_version) _lua_set_version_vars() -find_path(LUA_INCLUDE_DIR lua.h - HINTS - ENV LUA_DIR - PATH_SUFFIXES ${_lua_include_subdirs} include/lua include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) +if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") +endif () + +if (NOT LUA_VERSION_STRING) + foreach (subdir IN LISTS _lua_include_subdirs) + unset(LUA_INCLUDE_PREFIX CACHE) + find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h + HINTS + ENV LUA_DIR + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + ) + if (LUA_INCLUDE_PREFIX) + _lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h") + if (LUA_VERSION_STRING) + set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}") + break() + endif () + endif () + endforeach () +endif () unset(_lua_include_subdirs) unset(_lua_append_versions) @@ -172,10 +189,6 @@ if (LUA_LIBRARY) endif () endif () -if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") -endif () - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE From 6087b9e439fd74e82730657a104b7d991eb08d72 Mon Sep 17 00:00:00 2001 From: FARBOS Arnaud Date: Wed, 15 Jun 2016 16:50:08 +0200 Subject: [PATCH 128/929] FindGLEW: Search for debug and release configurations separately --- Modules/FindGLEW.cmake | 43 +++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index f42182fca..74132894e 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -35,20 +35,45 @@ # License text for the above reference.) find_path(GLEW_INCLUDE_DIR GL/glew.h) -find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) -set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) -set(GLEW_LIBRARIES ${GLEW_LIBRARY}) +if(NOT GLEW_LIBRARY) + find_library(GLEW_LIBRARY_RELEASE NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) + find_library(GLEW_LIBRARY_DEBUG NAMES GLEWd glew32d glewd PATH_SUFFIXES lib64) + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(GLEW) +endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) -if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) - add_library(GLEW::GLEW UNKNOWN IMPORTED) - set_target_properties(GLEW::GLEW PROPERTIES - IMPORTED_LOCATION "${GLEW_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") +if(GLEW_FOUND) + set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) + + if(NOT GLEW_LIBRARIES) + set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + endif() + + if (NOT TARGET GLEW::GLEW) + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") + + if(GLEW_LIBRARY_RELEASE) + set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_LIBRARY_RELEASE}") + endif() + + if(GLEW_LIBRARY_DEBUG) + set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_LIBRARY_DEBUG}") + endif() + + if(NOT GLEW_LIBRARY_RELEASE AND NOT GLEW_LIBRARY_DEBUG) + set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_LOCATION "${GLEW_LIBRARY}") + endif() + endif() endif() -mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) +mark_as_advanced(GLEW_INCLUDE_DIR) From 6509ad29f6efab56ce2dd3669ca0fbf798adbee2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 20 Jun 2016 15:45:25 -0400 Subject: [PATCH 129/929] CTest: Properly set buildname if only C langage is enabled Fixes #14068 --- Modules/CTest.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index a27eb4b8e..ce725c520 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -224,16 +224,16 @@ if(BUILD_TESTING) set(BUILD_NAME_SYSTEM_NAME "Win32") endif() if(UNIX OR BORLAND) - get_filename_component(DART_CXX_NAME - "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT}) + get_filename_component(DART_COMPILER_NAME + "${DART_COMPILER}" ${DART_NAME_COMPONENT}) else() - get_filename_component(DART_CXX_NAME + get_filename_component(DART_COMPILER_NAME "${CMAKE_MAKE_PROGRAM}" ${DART_NAME_COMPONENT}) endif() - if(DART_CXX_NAME MATCHES "devenv") - GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME) + if(DART_COMPILER_NAME MATCHES "devenv") + GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_COMPILER_NAME) endif() - set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") + set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_COMPILER_NAME}") endif() # the build command From c23f89bc7651609865164c95ce3655ebd369c11e Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 22:11:20 +0200 Subject: [PATCH 130/929] cmOutputConverter::Convert: make precondition explicit --- Source/cmOutputConverter.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index da43a119b..a23478b4b 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -161,9 +161,11 @@ std::string cmOutputConverter::Convert(RelativeRoot remote, OutputFormat output, bool optional) const { - const char* remotePath = this->GetRelativeRootPath(remote); - // The relative root must have a path (i.e. not FULL or NONE) + assert(remote != FULL); + assert(remote != NONE); + + const char* remotePath = this->GetRelativeRootPath(remote); assert(remotePath != 0); if (!local.empty() && !optional) { From cde127b08441b23f7210bfe987812f8d253e960b Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 22:12:21 +0200 Subject: [PATCH 131/929] cmOutputConverter::Convert: invert condition Make the control flow of the 'optional' argument more explicit. --- Source/cmOutputConverter.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index a23478b4b..a45e37b3b 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -168,14 +168,14 @@ std::string cmOutputConverter::Convert(RelativeRoot remote, const char* remotePath = this->GetRelativeRootPath(remote); assert(remotePath != 0); - if (!local.empty() && !optional) { - std::vector components; - cmSystemTools::SplitPath(local, components); - std::string result = this->ConvertToRelativePath(components, remotePath); - return this->ConvertToOutputFormat(result, output); + if (local.empty() || optional) { + return this->ConvertToOutputFormat(remotePath, output); } - return this->ConvertToOutputFormat(remotePath, output); + std::vector components; + cmSystemTools::SplitPath(local, components); + std::string result = this->ConvertToRelativePath(components, remotePath); + return this->ConvertToOutputFormat(result, output); } static bool cmOutputConverterNotAbove(const char* a, const char* b) From b86007e385fc0f4cc45149b68cafebad749bf6e8 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 22:31:57 +0200 Subject: [PATCH 132/929] cmOutputConverter: remove 'optional' argument Remove the 'optional' paramenter from the second overload of the Convert function. This parameter is used from one single location. Inline the codepath for which the argument is true to the callsite. --- Source/cmOutputConverter.cxx | 17 ++++++++++++----- Source/cmOutputConverter.h | 3 +-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index a45e37b3b..8f1e3af23 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -61,11 +61,19 @@ std::string cmOutputConverter::ConvertToOutputForExisting( std::string cmOutputConverter::ConvertToOutputForExisting( RelativeRoot remote, const std::string& local, OutputFormat format) const { + static_cast(local); + + // The relative root must have a path (i.e. not FULL or NONE) + assert(remote != FULL); + assert(remote != NONE); + + const char* remotePath = this->GetRelativeRootPath(remote); + assert(remotePath != 0); + // Perform standard conversion. - std::string result = this->Convert(remote, local, format, true); + std::string result = this->ConvertToOutputFormat(remotePath, format); // Consider short-path. - const char* remotePath = this->GetRelativeRootPath(remote); return this->ConvertToOutputForExistingCommon(remotePath, result, format); } @@ -158,8 +166,7 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell( std::string cmOutputConverter::Convert(RelativeRoot remote, const std::string& local, - OutputFormat output, - bool optional) const + OutputFormat output) const { // The relative root must have a path (i.e. not FULL or NONE) assert(remote != FULL); @@ -168,7 +175,7 @@ std::string cmOutputConverter::Convert(RelativeRoot remote, const char* remotePath = this->GetRelativeRootPath(remote); assert(remotePath != 0); - if (local.empty() || optional) { + if (local.empty()) { return this->ConvertToOutputFormat(remotePath, output); } diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index f138d0e89..f66157240 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -58,8 +58,7 @@ public: std::string Convert(const std::string& remote, RelativeRoot local, OutputFormat output = UNCHANGED) const; std::string Convert(RelativeRoot remote, const std::string& local, - OutputFormat output = UNCHANGED, - bool optional = false) const; + OutputFormat output = UNCHANGED) const; std::string ConvertDirectorySeparatorsForShell( const std::string& source) const; From 191fc3a0f373d262e2f2e5a2ccb07979e227d683 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 23:03:28 +0200 Subject: [PATCH 133/929] cmOutputConverter: remove unused 'local' argument --- Source/cmLocalGenerator.cxx | 6 +++--- Source/cmLocalUnixMakefileGenerator3.cxx | 7 +++---- Source/cmOutputConverter.cxx | 8 ++------ Source/cmOutputConverter.h | 2 -- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e2e7aa159..0de9895b5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -832,8 +832,8 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, std::string cmLocalGenerator::ConvertToIncludeReference( std::string const& path, OutputFormat format, bool forceFullPaths) { - return this->ConvertToOutputForExisting( - path, forceFullPaths ? FULL : START_OUTPUT, format); + static_cast(forceFullPaths); + return this->ConvertToOutputForExisting(path, format); } std::string cmLocalGenerator::GetIncludeFlags( @@ -1503,7 +1503,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, for (std::vector::const_iterator libDir = libDirs.begin(); libDir != libDirs.end(); ++libDir) { std::string libpath = - this->ConvertToOutputForExisting(*libDir, START_OUTPUT, shellFormat); + this->ConvertToOutputForExisting(*libDir, shellFormat); linkPath += " " + libPathFlag; linkPath += libpath; linkPath += libPathTerminator; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 460f0e202..0478a3aa3 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2068,19 +2068,18 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand( // back because the shell keeps the working directory between // commands. std::string cmd = cd_cmd; - cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); + cmd += this->ConvertToOutputForExisting(tgtDir); commands.insert(commands.begin(), cmd); // Change back to the starting directory. cmd = cd_cmd; - cmd += this->ConvertToOutputForExisting(relRetDir, tgtDir); + cmd += this->ConvertToOutputForExisting(relRetDir); commands.push_back(cmd); } else { // On UNIX we must construct a single shell command to change // directory and build because make resets the directory between // each command. - std::string outputForExisting = - this->ConvertToOutputForExisting(tgtDir, relRetDir); + std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir); std::string prefix = cd_cmd + outputForExisting + " && "; std::transform(commands.begin(), commands.end(), commands.begin(), std::bind1st(std::plus(), prefix)); diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 8f1e3af23..e66158e68 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -47,10 +47,8 @@ std::string cmOutputConverter::ConvertToOutputForExistingCommon( } std::string cmOutputConverter::ConvertToOutputForExisting( - const std::string& remote, RelativeRoot local, OutputFormat format) const + const std::string& remote, OutputFormat format) const { - static_cast(local); - // Perform standard conversion. std::string result = this->ConvertToOutputFormat(remote, format); @@ -59,10 +57,8 @@ std::string cmOutputConverter::ConvertToOutputForExisting( } std::string cmOutputConverter::ConvertToOutputForExisting( - RelativeRoot remote, const std::string& local, OutputFormat format) const + RelativeRoot remote, OutputFormat format) const { - static_cast(local); - // The relative root must have a path (i.e. not FULL or NONE) assert(remote != FULL); assert(remote != NONE); diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index f66157240..3d7d49318 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -69,13 +69,11 @@ public: ///! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const std::string& remote, - RelativeRoot local = START_OUTPUT, OutputFormat format = SHELL) const; /** For existing path identified by RelativeRoot convert to output path and short path if spaces. */ std::string ConvertToOutputForExisting(RelativeRoot remote, - const std::string& local = "", OutputFormat format = SHELL) const; void SetLinkScriptShell(bool linkScriptShell); From bdaadbdc2b6f7cb9eea1392043f225da85f51b5b Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 23:11:05 +0200 Subject: [PATCH 134/929] cmOutputConverter: collapse ConvertToOutputForExisting functions --- Source/cmOutputConverter.cxx | 24 ++++++------------------ Source/cmOutputConverter.h | 4 ---- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index e66158e68..03d8376b0 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -27,10 +27,12 @@ cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) assert(this->StateSnapshot.IsValid()); } -std::string cmOutputConverter::ConvertToOutputForExistingCommon( - const std::string& remote, std::string const& result, - OutputFormat format) const +std::string cmOutputConverter::ConvertToOutputForExisting( + const std::string& remote, OutputFormat format) const { + // Perform standard conversion. + std::string result = this->ConvertToOutputFormat(remote, format); + // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a // space. @@ -46,16 +48,6 @@ std::string cmOutputConverter::ConvertToOutputForExistingCommon( return result; } -std::string cmOutputConverter::ConvertToOutputForExisting( - const std::string& remote, OutputFormat format) const -{ - // Perform standard conversion. - std::string result = this->ConvertToOutputFormat(remote, format); - - // Consider short-path. - return this->ConvertToOutputForExistingCommon(remote, result, format); -} - std::string cmOutputConverter::ConvertToOutputForExisting( RelativeRoot remote, OutputFormat format) const { @@ -66,11 +58,7 @@ std::string cmOutputConverter::ConvertToOutputForExisting( const char* remotePath = this->GetRelativeRootPath(remote); assert(remotePath != 0); - // Perform standard conversion. - std::string result = this->ConvertToOutputFormat(remotePath, format); - - // Consider short-path. - return this->ConvertToOutputForExistingCommon(remotePath, result, format); + return this->ConvertToOutputForExisting(remotePath, format); } const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 3d7d49318..23f2e6268 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -159,10 +159,6 @@ public: private: cmState* GetState() const; - std::string ConvertToOutputForExistingCommon(const std::string& remote, - std::string const& result, - OutputFormat format) const; - static int Shell__CharIsWhitespace(char c); static int Shell__CharNeedsQuotesOnUnix(char c); static int Shell__CharNeedsQuotesOnWindows(char c); From 8ddbd4c2806f3064f734377b48ec77131f6836dc Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 20 Jun 2016 23:18:59 +0200 Subject: [PATCH 135/929] cmOutputConverter: remove unnecessary conversion --- Source/cmOutputConverter.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 03d8376b0..b92c074da 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -30,13 +30,11 @@ cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) std::string cmOutputConverter::ConvertToOutputForExisting( const std::string& remote, OutputFormat format) const { - // Perform standard conversion. - std::string result = this->ConvertToOutputFormat(remote, format); - // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a // space. - if (this->GetState()->UseWindowsShell() && result.find(' ') != result.npos && + if (this->GetState()->UseWindowsShell() && + remote.find(' ') != std::string::npos && cmSystemTools::FileExists(remote.c_str())) { std::string tmp; if (cmSystemTools::GetShortPath(remote, tmp)) { @@ -44,8 +42,8 @@ std::string cmOutputConverter::ConvertToOutputForExisting( } } - // Otherwise, leave it unchanged. - return result; + // Otherwise, perform standard conversion. + return this->ConvertToOutputFormat(remote, format); } std::string cmOutputConverter::ConvertToOutputForExisting( From 76c186b72fc233d96643c078b00756dfaa69fa66 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 21 Jun 2016 00:01:11 -0400 Subject: [PATCH 136/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f2faea262..98d87b14b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160620) +set(CMake_VERSION_PATCH 20160621) #set(CMake_VERSION_RC 1) From 867b73e27554d9a6a0c33e76af4a06901504816f Mon Sep 17 00:00:00 2001 From: Laurent Tarrisse Date: Mon, 20 Jun 2016 20:35:55 +0200 Subject: [PATCH 137/929] GetPrerequisites: Optimize on Windows by filtering `objdump` output Extend the optimization from commit v3.4.0-rc1~264^2 (GetPrerequisites: Optionally filter "objdump" output for speed, 2015-07-29) to work on Windows by using `findstr` in place of `grep`. --- Modules/GetPrerequisites.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 375349fda..19810404f 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -747,7 +747,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_fallback "") set(gp_regex_cmp_count 1) # objdump generaates copious output so we create a grep filter to pre-filter results - find_program(gp_grep_cmd grep) + if(WIN32) + find_program(gp_grep_cmd findstr) + else() + find_program(gp_grep_cmd grep) + endif() if(gp_grep_cmd) set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ") endif() From 4bb83514147fef6f96635a1e7940ddf568fde228 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Jun 2016 08:56:56 -0400 Subject: [PATCH 138/929] FindZLIB: Do not mark unused variable as advanced We no longer define the ZLIB_LIBRARY cache entry, so we should not mark it as advanced either. We only use this variable when someone else defines it in order to remain compatible with older versions of this module, but we never create the entry ourselves anymore. --- Modules/FindZLIB.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index a57f45008..0b36d6f71 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -96,7 +96,7 @@ endif() unset(ZLIB_NAMES) unset(ZLIB_NAMES_DEBUG) -mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) +mark_as_advanced(ZLIB_INCLUDE_DIR) if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") From 41925efe760a2e84e85b52f513668c9c46ed2744 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Jun 2016 13:37:06 -0400 Subject: [PATCH 139/929] cmGeneratorTarget: Fix Fortran module directory regression Refactoring in commit 49f10f0d (cmGeneratorTarget: Adopt Fortran module directory generation, 2016-06-10) accidentally made a local variable declared `static` causing results to be re-used incorrectly. --- Source/cmGeneratorTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 15b44a6e5..9a025d911 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3855,7 +3855,7 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory() const std::string cmGeneratorTarget::CreateFortranModuleDirectory() const { - static std::string mod_dir; + std::string mod_dir; const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY"); const char* moddir_flag = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); From de943c31280367a1219d5050298fd4be4dd7f3f7 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 22 Jun 2016 00:01:10 -0400 Subject: [PATCH 140/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 98d87b14b..fc9a5e73a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160621) +set(CMake_VERSION_PATCH 20160622) #set(CMake_VERSION_RC 1) From 35a6cac2d3bf550edf5306e6270a80fc848deeb8 Mon Sep 17 00:00:00 2001 From: Gilles Khouzam Date: Fri, 17 Jun 2016 14:18:39 -0700 Subject: [PATCH 141/929] VS: Add VS_SDK_REFERENCES target property to reference external SDKs Allow one to specify external SDK references such as `Microsoft.AdMediatorWindows81, Version=1.0`. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/VS_SDK_REFERENCES.rst | 7 +++++++ Help/release/dev/vs-sdk-refs.rst | 5 +++++ Source/cmVisualStudio10TargetGenerator.cxx | 22 +++++++++++++++++++++- Tests/VSWinStorePhone/CMakeLists.txt | 3 +++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Help/prop_tgt/VS_SDK_REFERENCES.rst create mode 100644 Help/release/dev/vs-sdk-refs.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f08251894..bdd8c1b5f 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -276,6 +276,7 @@ Properties on Targets /prop_tgt/VS_SCC_LOCALPATH /prop_tgt/VS_SCC_PROJECTNAME /prop_tgt/VS_SCC_PROVIDER + /prop_tgt/VS_SDK_REFERENCES /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION /prop_tgt/VS_WINRT_COMPONENT /prop_tgt/VS_WINRT_EXTENSIONS diff --git a/Help/prop_tgt/VS_SDK_REFERENCES.rst b/Help/prop_tgt/VS_SDK_REFERENCES.rst new file mode 100644 index 000000000..769a0d1d5 --- /dev/null +++ b/Help/prop_tgt/VS_SDK_REFERENCES.rst @@ -0,0 +1,7 @@ +VS_SDK_REFERENCES +----------------- + +Visual Studio project SDK references. +Specify a :ref:`;-list ` of SDK references +to be added to a generated Visual Studio project, e.g. +``Microsoft.AdMediatorWindows81, Version=1.0``. diff --git a/Help/release/dev/vs-sdk-refs.rst b/Help/release/dev/vs-sdk-refs.rst new file mode 100644 index 000000000..55232e36d --- /dev/null +++ b/Help/release/dev/vs-sdk-refs.rst @@ -0,0 +1,5 @@ +vs-sdk-refs +----------- + +* A :prop_tgt:`VS_SDK_REFERENCES` target property was added to tell + :ref:`Visual Studio Generators` to reference the named SDKs. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 3b1cddb62..6ab32bf90 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2643,6 +2643,20 @@ void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( void cmVisualStudio10TargetGenerator::WriteSDKReferences() { + std::vector sdkReferences; + bool hasWrittenItemGroup = false; + if (const char* vsSDKReferences = + this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) { + cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences); + this->WriteString("\n", 1); + hasWrittenItemGroup = true; + for (std::vector::iterator ri = sdkReferences.begin(); + ri != sdkReferences.end(); ++ri) { + this->WriteString("BuildFileStream) << cmVS10EscapeXML(*ri) << "\"/>\n"; + } + } + // This only applies to Windows 10 apps if (this->GlobalGenerator->TargetsWindowsStore() && cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) { @@ -2655,7 +2669,10 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() if (desktopExtensionsVersion || mobileExtensionsVersion || iotExtensionsVersion) { - this->WriteString("\n", 1); + if (!hasWrittenItemGroup) { + this->WriteString("\n", 1); + hasWrittenItemGroup = true; + } if (desktopExtensionsVersion) { this->WriteSingleSDKReference("WindowsDesktop", desktopExtensionsVersion); @@ -2667,6 +2684,9 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() if (iotExtensionsVersion) { this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion); } + } + + if (hasWrittenItemGroup) { this->WriteString("\n", 1); } } diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index ae8275551..14d532a5b 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -134,6 +134,9 @@ if("${SHORT_VERSION}" STREQUAL "10.0") set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + + # Add a reference to an SDK + set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.UniversalCRT.Debug, Version=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") endif() From 46f49c918af040b92a63171388206adbb9a8b8bc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 23 Jun 2016 00:01:15 -0400 Subject: [PATCH 142/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fc9a5e73a..6e32ab0b9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160622) +set(CMake_VERSION_PATCH 20160623) #set(CMake_VERSION_RC 1) From 8b3ffbe4afd689488fe02eec6c3363761025c5fd Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 22 Jun 2016 21:38:08 +0200 Subject: [PATCH 143/929] GetPrerequisites: fix typo in comment --- Modules/GetPrerequisites.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 19810404f..631220bf0 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -746,7 +746,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 1) - # objdump generaates copious output so we create a grep filter to pre-filter results + # objdump generates copious output so we create a grep filter to pre-filter results if(WIN32) find_program(gp_grep_cmd findstr) else() From 8bbd5db4c160927cf5e9a2eb2f45fe36a2c2d799 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Thu, 23 Jun 2016 17:01:29 +0200 Subject: [PATCH 144/929] Ninja: Make bundle resources a dependency of their target Fixes #13816. --- Source/cmNinjaTargetGenerator.cxx | 8 ++++++-- Source/cmNinjaTargetGenerator.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b413c33d5..954c73e0d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -487,6 +487,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget, orderOnlyDeps); + // Add order-only dependencies on other files associated with the target. + orderOnlyDeps.insert(orderOnlyDeps.end(), this->ExtraFiles.begin(), + this->ExtraFiles.end()); + // Add order-only dependencies on custom command outputs. for (std::vector::const_iterator cci = this->CustomCommands.begin(); @@ -717,8 +721,8 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, output); - // Add as a dependency of all target so that it gets called. - this->Generator->GetGlobalGenerator()->AddDependencyToAll(output); + // Add as a dependency to the target so that it gets called. + this->Generator->ExtraFiles.push_back(output); } void cmNinjaTargetGenerator::addPoolNinjaVariable( diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 414aa09c4..44346c1b0 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -156,6 +156,7 @@ private: /// List of object files for this target. cmNinjaDeps Objects; std::vector CustomCommands; + cmNinjaDeps ExtraFiles; }; #endif // ! cmNinjaTargetGenerator_h From f05657de9d1ae7247a527186830d37702ec30de4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 24 Jun 2016 00:01:08 -0400 Subject: [PATCH 145/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6e32ab0b9..40f8e114e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160623) +set(CMake_VERSION_PATCH 20160624) #set(CMake_VERSION_RC 1) From 3a0449439f03981865b8d43815ac9b6292574a47 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 25 Jun 2016 00:01:05 -0400 Subject: [PATCH 146/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 40f8e114e..a1d1eb3e7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160624) +set(CMake_VERSION_PATCH 20160625) #set(CMake_VERSION_RC 1) From aff1e77f480f72b1a517ae9b7d54e56b30fab4b3 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Sat, 25 Jun 2016 13:37:44 +0200 Subject: [PATCH 147/929] CMakeIOSInstallCombined: do not merge content of OUTPUT and ERROR variables --- Modules/CMakeIOSInstallCombined.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index 1256f563e..d70001106 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -237,17 +237,20 @@ function(ios_install_combined target destination) endif() set(cmd xcrun -f lipo) + + # Do not merge OUTPUT_VARIABLE and ERROR_VARIABLE since latter may contain + # some diagnostic information even for the successful run. execute_process( COMMAND ${cmd} RESULT_VARIABLE result OUTPUT_VARIABLE output - ERROR_VARIABLE output + ERROR_VARIABLE error_output OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) if(NOT result EQUAL 0) message( - FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}\nOutput(error):\n${error_output}" ) endif() set(_lipo_path ${output}) From 11c3a8dc11eae4305409afbb8d7fa66ee31d41de Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Sat, 25 Jun 2016 13:48:31 +0200 Subject: [PATCH 148/929] CMakeIOSInstallCombined: add some sanity checks --- Modules/CMakeIOSInstallCombined.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index d70001106..234322c20 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -254,6 +254,13 @@ function(ios_install_combined target destination) ) endif() set(_lipo_path ${output}) + list(LENGTH _lipo_path len) + if(NOT len EQUAL 1) + message(FATAL_ERROR "Unexpected xcrun output: ${_lipo_path}") + endif() + if(NOT EXISTS "${_lipo_path}") + message(FATAL_ERROR "File not found: ${_lipo_path}") + endif() set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}") set(CURRENT_TARGET "${target}") From c68cf9e4d111fa7c92973acec92d71ce6d187ff9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 26 Jun 2016 00:01:05 -0400 Subject: [PATCH 149/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a1d1eb3e7..733ba9262 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160625) +set(CMake_VERSION_PATCH 20160626) #set(CMake_VERSION_RC 1) From 2ca76a6651dd16586334067f6a41524a4015adc9 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 26 Jun 2016 22:00:00 +0200 Subject: [PATCH 150/929] Validate target name in ALIASED_TARGET property getter --- Source/cmGetPropertyCommand.cxx | 11 +++++------ Source/cmGetTargetPropertyCommand.cxx | 24 ++++++++++-------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 06f750446..67b0e9da7 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -248,15 +248,14 @@ bool cmGetPropertyCommand::HandleTargetMode() return false; } - if (this->PropertyName == "ALIASED_TARGET") { - if (this->Makefile->IsAlias(this->Name)) { - if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { + if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { + if (this->PropertyName == "ALIASED_TARGET") { + if (this->Makefile->IsAlias(this->Name)) { return this->StoreResult(target->GetName().c_str()); + } else { + return this->StoreResult((this->Variable + "-NOTFOUND").c_str()); } } - return this->StoreResult((this->Variable + "-NOTFOUND").c_str()); - } - if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { return this->StoreResult( target->GetProperty(this->PropertyName, this->Makefile)); } else { diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index dded9f751..073cf32e5 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -24,22 +24,18 @@ bool cmGetTargetPropertyCommand::InitialPass( std::string prop; bool prop_exists = false; - if (args[2] == "ALIASED_TARGET") { - if (this->Makefile->IsAlias(targetName)) { - if (cmTarget* target = this->Makefile->FindTargetToUse(targetName)) { - prop = target->GetName(); + if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { + if (args[2] == "ALIASED_TARGET") { + if (this->Makefile->IsAlias(targetName)) { + prop = tgt->GetName(); + prop_exists = true; + } + } else if (!args[2].empty()) { + const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile); + if (prop_cstr) { + prop = prop_cstr; prop_exists = true; } - } - } else if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { - cmTarget& target = *tgt; - const char* prop_cstr = 0; - if (!args[2].empty()) { - prop_cstr = target.GetProperty(args[2], this->Makefile); - } - if (prop_cstr) { - prop = prop_cstr; - prop_exists = true; } } else { bool issueMessage = false; From 99c873c835172d4aec14766a4cc8f606c06ecda7 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 27 Jun 2016 00:01:04 -0400 Subject: [PATCH 151/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 733ba9262..478c6bcbc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160626) +set(CMake_VERSION_PATCH 20160627) #set(CMake_VERSION_RC 1) From ea5477e43de4660343897e4669bc5809dc4ddabe Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:16:15 +0200 Subject: [PATCH 152/929] Make C++ feature checks extensible Turn the feature check for cxx11_unordered_map into a function such that we can use it for other features as well. Drop the 11 suffix, as we may want to check features from other standards. --- CMakeLists.txt | 2 +- Source/Checks/cm_cxx11_unordered_map.cmake | 25 ------------- Source/Checks/cm_cxx_features.cmake | 36 +++++++++++++++++++ ...dered_map.cpp => cm_cxx_unordered_map.cxx} | 0 Source/cmConfigure.cmake.h.in | 2 +- Source/cmDefinitions.h | 4 +-- Source/cmFileTimeComparison.cxx | 6 ++-- Source/cmGlobalGenerator.h | 4 +-- Source/cmMakefile.h | 6 ++-- Source/cmTarget.h | 4 +-- 10 files changed, 50 insertions(+), 39 deletions(-) delete mode 100644 Source/Checks/cm_cxx11_unordered_map.cmake create mode 100644 Source/Checks/cm_cxx_features.cmake rename Source/Checks/{cm_cxx11_unordered_map.cpp => cm_cxx_unordered_map.cxx} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5336208d0..ae5990ebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) endif() endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) - include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx11_unordered_map.cmake) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake) endif() # option to set the internal encoding of CMake to UTF-8 diff --git a/Source/Checks/cm_cxx11_unordered_map.cmake b/Source/Checks/cm_cxx11_unordered_map.cmake deleted file mode 100644 index 80fe391bc..000000000 --- a/Source/Checks/cm_cxx11_unordered_map.cmake +++ /dev/null @@ -1,25 +0,0 @@ - -if(CMAKE_CXX_STANDARD AND NOT DEFINED CMake_HAVE_CXX11_UNORDERED_MAP) - message(STATUS "Checking if compiler supports C++11 unordered_map") - try_compile(CMake_HAVE_CXX11_UNORDERED_MAP - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/cm_cxx11_unordered_map.cpp - CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - OUTPUT_VARIABLE OUTPUT - ) - if(CMake_HAVE_CXX11_UNORDERED_MAP) - message(STATUS "Checking if compiler supports C++11 unordered_map - yes") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if compiler supports C++11 unordered_map passed with the following output:\n" - "${OUTPUT}\n" - "\n" - ) - else() - message(STATUS "Checking if compiler supports C++11 unordered_map - no") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if compiler supports C++11 unordered_map failed with the following output:\n" - "${OUTPUT}\n" - "\n" - ) - endif() -endif() diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake new file mode 100644 index 000000000..b0ecc4cd2 --- /dev/null +++ b/Source/Checks/cm_cxx_features.cmake @@ -0,0 +1,36 @@ + +function(cm_check_cxx_feature name) + string(TOUPPER ${name} FEATURE) + if(NOT DEFINED CMake_HAVE_CXX_${FEATURE}) + message(STATUS "Checking if compiler supports C++ ${name}") + try_compile(CMake_HAVE_CXX_${FEATURE} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx + CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + OUTPUT_VARIABLE OUTPUT + ) + # If using the feature causes warnings, treat it as broken/unavailable. + if(OUTPUT MATCHES "warning") + set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE) + endif() + if(CMake_HAVE_CXX_${FEATURE}) + message(STATUS "Checking if compiler supports C++ ${name} - yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if compiler supports C++ ${name} passed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + else() + message(STATUS "Checking if compiler supports C++ ${name} - no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler supports C++ ${name} failed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + endif() + endif() +endfunction() + +if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(unordered_map) +endif() diff --git a/Source/Checks/cm_cxx11_unordered_map.cpp b/Source/Checks/cm_cxx_unordered_map.cxx similarity index 100% rename from Source/Checks/cm_cxx11_unordered_map.cpp rename to Source/Checks/cm_cxx_unordered_map.cxx diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 938b10ed4..4c5ad2ada 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,7 +29,7 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 -#cmakedefine CMake_HAVE_CXX11_UNORDERED_MAP +#cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 7be0098eb..8f1813c98 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -17,7 +17,7 @@ #include "cmLinkedTree.h" #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include "cmsys/hash_map.hxx" @@ -92,7 +92,7 @@ private: static Def NoDef; #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map MapType; #else typedef cmsys::hash_map MapType; diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 7efe1943e..9d6350528 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -13,7 +13,7 @@ // Use a hash table to avoid duplicate file time checks from disk. #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -47,13 +47,13 @@ private: { public: size_t operator()(const std::string& s) const { return h(s.c_str()); } -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP std::hash h; #else cmsys::hash h; #endif }; -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map #else #include @@ -433,7 +433,7 @@ protected: private: #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map TargetMap; typedef std::unordered_map GeneratorTargetMap; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1680c6aaf..c68cd1c87 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -31,7 +31,7 @@ #include #include #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -796,7 +796,7 @@ protected: // libraries, classes, and executables mutable cmTargets Targets; #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map TargetMap; #else typedef cmsys::hash_map TargetMap; @@ -915,7 +915,7 @@ private: // A map for fast output to input look up. #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map OutputToSourceMap; #else typedef cmsys::hash_map OutputToSourceMap; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f91e5c68d..9e095c2de 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -21,7 +21,7 @@ #include #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -331,7 +331,7 @@ private: }; #ifdef CMAKE_BUILD_WITH_CMAKE -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map cmTargets; #else typedef cmsys::hash_map cmTargets; From 09aa2c94186081267753dedb50acb102717a6577 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:29:47 +0200 Subject: [PATCH 153/929] Use where available --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_unordered_set.cxx | 7 +++++++ Source/cmConfigure.cmake.h.in | 1 + Source/cmGeneratorTarget.cxx | 5 ++++- Source/cmTarget.cxx | 6 +++++- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Source/Checks/cm_cxx_unordered_set.cxx diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index b0ecc4cd2..e550e641a 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -33,4 +33,5 @@ endfunction() if(CMAKE_CXX_STANDARD) cm_check_cxx_feature(unordered_map) + cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_unordered_set.cxx b/Source/Checks/cm_cxx_unordered_set.cxx new file mode 100644 index 000000000..de4bb7765 --- /dev/null +++ b/Source/Checks/cm_cxx_unordered_set.cxx @@ -0,0 +1,7 @@ +#include +int main() +{ + std::unordered_set set; + set.insert(0); + return 0; +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 4c5ad2ada..a723942ba 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -30,6 +30,7 @@ #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP +#cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9a025d911..3668c8297 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -27,7 +27,10 @@ #include "assert.h" #include -#if defined(CMAKE_BUILD_WITH_CMAKE) +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #define UNORDERED_SET cmsys::hash_set #else diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 43860802c..5e5ed2b29 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -27,7 +27,11 @@ #include #include #include // required for atof -#if defined(CMAKE_BUILD_WITH_CMAKE) + +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #define UNORDERED_SET cmsys::hash_set #else From 5286110d6f106e03ee6c5bdeea48d62674656c9f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:37:10 +0200 Subject: [PATCH 154/929] cxx features: add check for override --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_override.cxx | 20 ++++++++++++++++++++ Source/cmConfigure.cmake.h.in | 7 +++++++ bootstrap | 1 + 4 files changed, 29 insertions(+) create mode 100644 Source/Checks/cm_cxx_override.cxx diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index e550e641a..18dbaf8a1 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,7 @@ function(cm_check_cxx_feature name) endfunction() if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(override) cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx new file mode 100644 index 000000000..9395a0a23 --- /dev/null +++ b/Source/Checks/cm_cxx_override.cxx @@ -0,0 +1,20 @@ +struct Foo +{ + virtual int test() const = 0; +}; + +struct Bar : Foo +{ + int test() const override { return 0; } +}; + +int test(Foo const& foo) +{ + return foo.test(); +} + +int main() +{ + Bar const bar; + return test(bar); +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index a723942ba..a8d4f58c6 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,9 +29,16 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 +#cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" +#ifdef CMake_HAVE_CXX_OVERRIDE +#define CM_OVERRIDE override +#else +#define CM_OVERRIDE +#endif + #endif diff --git a/bootstrap b/bootstrap index 27cf9d861..a9f340226 100755 --- a/bootstrap +++ b/bootstrap @@ -1272,6 +1272,7 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" +cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE" # Regenerate configured headers for h in Configure VersionConfig; do From 7647f6afa46b6b5020cc1d93b3f75d3358a28f8a Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 01:02:39 +0200 Subject: [PATCH 155/929] Add CM_OVERRIDE to some functions Run clang-tidy's modernize-use-override checker. This checker must have issues in version 3.8. It has way too little matches. And it adds override to destructors. Revert the changes on the destructors and change override to CM_OVERRIDE. --- Source/CPack/IFW/cmCPackIFWRepository.cxx | 6 +- Source/CTest/cmCTestBZR.cxx | 22 ++-- Source/CTest/cmCTestCVS.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 6 +- Source/CTest/cmCTestHG.cxx | 14 +-- Source/CTest/cmCTestMemCheckHandler.cxx | 4 +- Source/CTest/cmCTestP4.cxx | 10 +- Source/CTest/cmCTestSVN.cxx | 18 +-- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestSubmitHandler.cxx | 6 +- Source/CTest/cmCTestTestHandler.cxx | 32 +++--- Source/CTest/cmParseCoberturaCoverage.cxx | 6 +- Source/CTest/cmParseJacocoCoverage.cxx | 4 +- Source/cmELF.cxx | 10 +- Source/cmGeneratorExpressionNode.cxx | 130 ++++++++++++---------- Source/cmOrderDirectories.cxx | 8 +- 16 files changed, 146 insertions(+), 138 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index b8a10c64a..e4fa569b1 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -177,7 +177,7 @@ public: bool patched; protected: - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { xout.StartElement(name); StartFragment(atts); @@ -192,7 +192,7 @@ protected: } } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "Updates" && !patched) { repository->WriteRepositoryUpdates(xout); @@ -208,7 +208,7 @@ protected: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { std::string content(data, data + length); if (content == "" || content == " " || content == " " || diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 92eb570f5..5b3f6128a 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -101,7 +101,7 @@ private: bool CheckOutFound; cmsys::RegularExpression RegexCheckOut; cmsys::RegularExpression RegexParent; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexCheckOut.find(this->Line)) { this->BZR->URL = this->RegexCheckOut.match(1); @@ -126,7 +126,7 @@ public: private: std::string& Rev; cmsys::RegularExpression RegexRevno; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexRevno.find(this->Line)) { this->Rev = this->RegexRevno.match(1); @@ -185,7 +185,7 @@ public: } ~LogParser() { this->CleanupParser(); } - virtual int InitializeParser() + int InitializeParser() CM_OVERRIDE { int res = cmXMLParser::InitializeParser(); if (res) { @@ -207,14 +207,14 @@ private: cmsys::RegularExpression EmailRegex; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char**) + void StartElement(const std::string& name, const char**) CM_OVERRIDE { this->CData.clear(); if (name == "log") { @@ -239,12 +239,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); @@ -274,7 +274,7 @@ private: this->CData.clear(); } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n"; } @@ -294,7 +294,7 @@ private: cmCTestBZR* BZR; cmsys::RegularExpression RegexUpdate; - virtual bool ProcessChunk(const char* first, int length) + bool ProcessChunk(const char* first, int length) CM_OVERRIDE { bool last_is_new_line = (*first == '\r' || *first == '\n'); @@ -325,7 +325,7 @@ private: return true; } - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -431,7 +431,7 @@ public: private: cmCTestBZR* BZR; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 5ddafbb9c..df1968504 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -53,7 +53,7 @@ private: cmsys::RegularExpression RegexFileRemoved1; cmsys::RegularExpression RegexFileRemoved2; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexFileUpdated.find(this->Line)) { this->DoFile(PathUpdated, this->RegexFileUpdated.match(2)); @@ -140,7 +140,7 @@ private: SectionType Section; Revision Rev; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line == ("=======================================" "======================================")) { diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 8b392f29e..36a781e9e 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -52,7 +52,7 @@ public: private: std::string& Line1; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { // Only the first line is of interest. this->Line1 = this->Line; @@ -355,7 +355,7 @@ protected: this->Changes.clear(); } - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line[0] == ':') { this->DiffField = DiffFieldChange; @@ -513,7 +513,7 @@ private: person.TimeZone = strtol(c, (char**)&c, 10); } - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line.empty()) { if (this->Section == SectionBody && this->LineEnd == '\0') { diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index f1fe3774c..9589e057e 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -41,7 +41,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -65,7 +65,7 @@ private: cmCTestHG* HG; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], this->RegexStatus.match(2)); @@ -182,14 +182,14 @@ private: Change CurChange; std::vector CData; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CData.clear(); if (name == "logentry") { @@ -201,12 +201,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); @@ -261,7 +261,7 @@ private: return output; } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->HG->Log << "Error parsing hg log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5f70f66df..6f1a2c495 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -61,7 +61,7 @@ public: this->CTest = c; this->SetErrorCallback(xmlReportError, (void*)c); } - void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { if (name == "MemoryLeak" || name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); @@ -78,7 +78,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const std::string&) {} + void EndElement(const std::string&) CM_OVERRIDE {} const char* GetAttribute(const char* name, const char** atts) { diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index ede11c990..072da29f7 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -45,7 +45,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -69,7 +69,7 @@ private: cmsys::RegularExpression RegexIdentify; cmCTestP4* P4; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { P4->ChangeLists.push_back(this->RegexIdentify.match(1)); @@ -92,7 +92,7 @@ private: cmsys::RegularExpression RegexUser; cmCTestP4* P4; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUser.find(this->Line)) { User NewUser; @@ -135,7 +135,7 @@ private: std::string CurrentPath; cmsys::RegularExpression RegexDiff; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (!this->Line.empty() && this->Line[0] == '=' && this->RegexDiff.find(this->Line)) { @@ -225,7 +225,7 @@ private: SectionType Section; Revision Rev; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line.empty()) { this->NextSection(); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index fa014111b..074bd3df7 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -62,7 +62,7 @@ private: cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexRev.find(this->Line)) { this->Rev = this->RegexRev.match(1); @@ -206,7 +206,7 @@ private: cmCTestSVN* SVN; cmsys::RegularExpression RegexUpdate; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -323,14 +323,14 @@ private: Change CurChange; std::vector CData; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CData.clear(); if (name == "logentry") { @@ -348,12 +348,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); @@ -372,7 +372,7 @@ private: this->CData.clear(); } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->SVN->Log << "Error parsing svn log xml: " << msg << "\n"; } @@ -441,7 +441,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], @@ -506,7 +506,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexExternal; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexExternal.find(this->Line)) { this->DoPath(this->RegexExternal.match(1)); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 6389a9db3..028cfdd20 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -60,8 +60,8 @@ class cmCTestScriptFunctionBlocker : public cmFunctionBlocker public: cmCTestScriptFunctionBlocker() {} virtual ~cmCTestScriptFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&); + bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); // virtual void ScopeEnded(cmMakefile &mf); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 69f2ac5b0..85e243f5c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -69,7 +69,7 @@ private: return val; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CurrentValue.clear(); if (name == "cdash") { @@ -77,12 +77,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CurrentValue.insert(this->CurrentValue.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c991a23f4..3ee9c5f97 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -42,7 +42,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSubdirCommand* c = new cmCTestSubdirCommand; c->TestHandler = this->TestHandler; @@ -53,13 +53,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus&); + bool InitialPass(std::vector const& args, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "subdirs"; } + std::string GetName() const CM_OVERRIDE { return "subdirs"; } cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -123,7 +123,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand; c->TestHandler = this->TestHandler; @@ -134,13 +134,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus&); + bool InitialPass(std::vector const& args, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_subdirectory"; } + std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; } cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -197,7 +197,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestAddTestCommand* c = new cmCTestAddTestCommand; c->TestHandler = this->TestHandler; @@ -208,13 +208,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, - cmExecutionStatus&); + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_test"; } + std::string GetName() const CM_OVERRIDE { return "add_test"; } cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -237,7 +237,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand; c->TestHandler = this->TestHandler; @@ -248,13 +248,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, - cmExecutionStatus&); + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_tests_properties"; } + std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; } cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 3bdae179c..f1c37edcb 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -23,7 +23,7 @@ public: virtual ~XMLParser() {} protected: - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "source") { this->InSource = false; @@ -34,7 +34,7 @@ protected: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { std::string tmp; tmp.insert(0, data, length); @@ -46,7 +46,7 @@ protected: } } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { std::string FoundSource; std::string finalpath = ""; diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index e456f39f9..27ccf5832 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,9 +23,9 @@ public: virtual ~XMLParser() {} protected: - virtual void EndElement(const std::string&) {} + void EndElement(const std::string&) CM_OVERRIDE {} - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { if (name == "package") { this->PackageName = atts[1]; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index c7f8a2d62..16294ea46 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -241,20 +241,20 @@ public: ByteOrderType order); // Return the number of sections as specified by the ELF header. - virtual unsigned int GetNumberOfSections() const + unsigned int GetNumberOfSections() const CM_OVERRIDE { return static_cast(this->ELFHeader.e_shnum); } // Get the file position and size of a dynamic section entry. - virtual unsigned int GetDynamicEntryCount(); - virtual unsigned long GetDynamicEntryPosition(int j); + unsigned int GetDynamicEntryCount() CM_OVERRIDE; + unsigned long GetDynamicEntryPosition(int j) CM_OVERRIDE; // Lookup a string from the dynamic section with the given tag. - virtual StringEntry const* GetDynamicSectionString(unsigned int tag); + StringEntry const* GetDynamicSectionString(unsigned int tag) CM_OVERRIDE; // Print information about the ELF file. - virtual void PrintInfo(std::ostream& os) const + void PrintInfo(std::ostream& os) const CM_OVERRIDE { os << "ELF " << Types::GetName(); if (this->ByteOrder == ByteOrderMSB) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index e750551b2..599ea8d3a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -42,14 +42,14 @@ static const struct ZeroNode : public cmGeneratorExpressionNode { ZeroNode() {} - virtual bool GeneratesContent() const { return false; } + bool GeneratesContent() const CM_OVERRIDE { return false; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return std::string(); } @@ -59,12 +59,12 @@ static const struct OneNode : public cmGeneratorExpressionNode { OneNode() {} - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return parameters.front(); } @@ -113,7 +113,7 @@ static const struct NotNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (*parameters.begin() != "0" && *parameters.begin() != "1") { reportError( @@ -129,12 +129,12 @@ static const struct BoolNode : public cmGeneratorExpressionNode { BoolNode() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; } @@ -144,12 +144,12 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode { StrEqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return *parameters.begin() == parameters[1] ? "1" : "0"; } @@ -159,12 +159,12 @@ static const struct EqualNode : public cmGeneratorExpressionNode { EqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { char* pEnd; @@ -236,12 +236,12 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::LowerCase(parameters.front()); } @@ -251,12 +251,12 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode { UpperCaseNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::UpperCase(parameters.front()); } @@ -266,12 +266,12 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::MakeCidentifier(parameters.front()); } @@ -281,12 +281,12 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode { Angle_RNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ">"; } @@ -296,12 +296,12 @@ static const struct CommaNode : public cmGeneratorExpressionNode { CommaNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ","; } @@ -311,12 +311,12 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode { SemicolonNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ";"; } @@ -326,7 +326,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { CompilerIdNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector& parameters, cmGeneratorExpressionContext* context, @@ -381,6 +381,7 @@ static const struct CCompilerIdNode : public CompilerIdNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -402,6 +403,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -419,7 +421,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode { CompilerVersionNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector& parameters, cmGeneratorExpressionContext* context, @@ -460,6 +462,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -481,6 +484,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -498,12 +502,12 @@ struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { const char* platformId = context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME"); @@ -526,12 +530,12 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode { VersionGreaterNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, parameters.front().c_str(), @@ -545,12 +549,12 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode { VersionLessNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, parameters.front().c_str(), @@ -564,12 +568,12 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode { VersionEqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, parameters.front().c_str(), @@ -583,10 +587,10 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode { LinkOnlyNode() {} - std::string Evaluate(const std::vector& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker* dagChecker) const + std::string Evaluate( + const std::vector& parameters, cmGeneratorExpressionContext*, + const GeneratorExpressionContent*, + cmGeneratorExpressionDAGChecker* dagChecker) const CM_OVERRIDE { if (!dagChecker->GetTransitivePropertiesOnly()) { return parameters.front(); @@ -599,12 +603,12 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode { ConfigurationNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext* context, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { context->HadContextSensitiveCondition = true; return context->Config; @@ -615,12 +619,12 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (parameters.empty()) { return configurationNode.Evaluate(parameters, context, content, 0); @@ -673,14 +677,14 @@ static const struct JoinNode : public cmGeneratorExpressionNode { JoinNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { std::vector list; cmSystemTools::ExpandListArgument(parameters.front(), list); @@ -692,12 +696,13 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode { CompileLanguageNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (context->Language.empty()) { reportError( @@ -795,12 +800,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode TargetPropertyNode() {} // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagCheckerParent) const + CM_OVERRIDE { if (parameters.size() != 1 && parameters.size() != 2) { reportError( @@ -1087,20 +1093,20 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode { TargetNameNode() {} - virtual bool GeneratesContent() const { return true; } + bool GeneratesContent() const CM_OVERRIDE { return true; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool RequiresLiteralInput() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return parameters.front(); } - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } } targetNameNode; @@ -1111,7 +1117,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!context->EvaluateForBuildsystem) { std::ostringstream e; @@ -1179,12 +1185,13 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { CompileFeaturesNode() {} - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { cmGeneratorTarget const* target = context->HeadTarget; if (!target) { @@ -1306,12 +1313,12 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode { TargetPolicyNode() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -1365,13 +1372,13 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode { InstallPrefixNode() {} - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } + bool GeneratesContent() const CM_OVERRIDE { return true; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { reportError(context, content->GetOriginalExpression(), "INSTALL_PREFIX is a marker for install(EXPORT) only. It " @@ -1529,12 +1536,13 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { // Lookup the referenced target. std::string name = *parameters.begin(); @@ -1606,7 +1614,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!cmSystemTools::FileIsFullPath(parameters.front())) { reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 00606c796..20f224610 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -157,7 +157,7 @@ public: } } - virtual void Report(std::ostream& e) + void Report(std::ostream& e) CM_OVERRIDE { e << "runtime library ["; if (this->SOName.empty()) { @@ -168,7 +168,7 @@ public: e << "]"; } - virtual bool FindConflict(std::string const& dir); + bool FindConflict(std::string const& dir) CM_OVERRIDE; private: // The soname of the shared library if it is known. @@ -212,12 +212,12 @@ public: { } - virtual void Report(std::ostream& e) + void Report(std::ostream& e) CM_OVERRIDE { e << "link library [" << this->FileName << "]"; } - virtual bool FindConflict(std::string const& dir); + bool FindConflict(std::string const& dir) CM_OVERRIDE; }; bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) From 9e2d6f0c4d19e1ae1652071ea783ad577ea93e28 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 27 Jun 2016 22:46:25 +0200 Subject: [PATCH 156/929] CM_OVERRIDE: mark destructor overridden in the feature test. This is important for two reasons: 1. A compiler might warn about a class that has a virtual member function but no virtual destructor. We don't want to treat the feature as incomplete in this case. 2. MSVC10 supports the override identifier except on destructors. In this case, the feature really is incomplete and we want to detect it as such. --- Source/Checks/cm_cxx_override.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx index 9395a0a23..e1969684d 100644 --- a/Source/Checks/cm_cxx_override.cxx +++ b/Source/Checks/cm_cxx_override.cxx @@ -1,10 +1,12 @@ struct Foo { + virtual ~Foo() {} virtual int test() const = 0; }; struct Bar : Foo { + ~Bar() override {} int test() const override { return 0; } }; From a7a92390964ea5aa7021f71ee69fcc71c4229516 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 27 Jun 2016 21:25:27 +0200 Subject: [PATCH 157/929] mark functions with CM_OVERRIDE --- Source/CPack/IFW/cmCPackIFWGenerator.h | 29 +++---- Source/CPack/cmCPack7zGenerator.h | 4 +- Source/CPack/cmCPackArchiveGenerator.h | 10 +-- Source/CPack/cmCPackDebGenerator.h | 14 ++-- Source/CPack/cmCPackGenerator.h | 2 +- Source/CPack/cmCPackGeneratorFactory.h | 2 +- Source/CPack/cmCPackLog.h | 2 +- Source/CPack/cmCPackNSISGenerator.h | 17 +++-- Source/CPack/cmCPackRPMGenerator.h | 14 ++-- Source/CPack/cmCPackSTGZGenerator.h | 10 +-- Source/CPack/cmCPackTGZGenerator.h | 4 +- Source/CPack/cmCPackTXZGenerator.h | 4 +- Source/CPack/cmCPackTarBZip2Generator.h | 4 +- Source/CPack/cmCPackTarCompressGenerator.h | 4 +- Source/CPack/cmCPackZIPGenerator.h | 4 +- Source/CTest/cmCTestBZR.cxx | 2 +- Source/CTest/cmCTestBZR.h | 12 +-- Source/CTest/cmCTestBatchTestHandler.h | 4 +- Source/CTest/cmCTestBuildAndTestHandler.h | 10 +-- Source/CTest/cmCTestBuildCommand.h | 12 +-- Source/CTest/cmCTestBuildHandler.h | 6 +- Source/CTest/cmCTestCVS.h | 6 +- Source/CTest/cmCTestConfigureCommand.h | 6 +- Source/CTest/cmCTestConfigureHandler.h | 4 +- Source/CTest/cmCTestCoverageCommand.h | 10 +-- Source/CTest/cmCTestCoverageHandler.h | 6 +- .../cmCTestEmptyBinaryDirectoryCommand.h | 8 +- Source/CTest/cmCTestGIT.h | 12 +-- Source/CTest/cmCTestGenericHandler.h | 2 +- Source/CTest/cmCTestGlobalVC.h | 4 +- Source/CTest/cmCTestHG.cxx | 2 +- Source/CTest/cmCTestHG.h | 12 +-- Source/CTest/cmCTestHandlerCommand.h | 4 +- Source/CTest/cmCTestMemCheckCommand.h | 6 +- Source/CTest/cmCTestMemCheckHandler.h | 13 ++-- Source/CTest/cmCTestP4.h | 12 +-- Source/CTest/cmCTestReadCustomFilesCommand.h | 8 +- Source/CTest/cmCTestRunScriptCommand.h | 8 +- Source/CTest/cmCTestSVN.cxx | 2 +- Source/CTest/cmCTestSVN.h | 16 ++-- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestScriptHandler.h | 6 +- Source/CTest/cmCTestSleepCommand.h | 8 +- Source/CTest/cmCTestStartCommand.h | 8 +- Source/CTest/cmCTestSubmitCommand.h | 14 ++-- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/CTest/cmCTestSubmitHandler.h | 6 +- Source/CTest/cmCTestTestCommand.h | 6 +- Source/CTest/cmCTestTestHandler.h | 6 +- Source/CTest/cmCTestUpdateCommand.h | 6 +- Source/CTest/cmCTestUpdateHandler.h | 4 +- Source/CTest/cmCTestUploadCommand.h | 10 +-- Source/CTest/cmCTestUploadHandler.h | 6 +- Source/CTest/cmParseCacheCoverage.h | 2 +- Source/CTest/cmParseCoberturaCoverage.cxx | 2 +- Source/CTest/cmParseGTMCoverage.h | 2 +- Source/CTest/cmParseJacocoCoverage.cxx | 2 +- Source/CursesDialog/cmCursesBoolWidget.h | 2 +- Source/CursesDialog/cmCursesDummyWidget.h | 2 +- Source/CursesDialog/cmCursesLabelWidget.h | 4 +- Source/CursesDialog/cmCursesLongMessageForm.h | 8 +- Source/CursesDialog/cmCursesMainForm.h | 10 +-- Source/CursesDialog/cmCursesOptionsWidget.h | 2 +- Source/CursesDialog/cmCursesPathWidget.h | 6 +- Source/CursesDialog/cmCursesStringWidget.h | 6 +- Source/cmAddCompileOptionsCommand.h | 8 +- Source/cmAddCustomCommandCommand.h | 8 +- Source/cmAddCustomTargetCommand.h | 8 +- Source/cmAddDefinitionsCommand.h | 8 +- Source/cmAddDependenciesCommand.h | 8 +- Source/cmAddExecutableCommand.h | 8 +- Source/cmAddLibraryCommand.h | 8 +- Source/cmAddSubDirectoryCommand.h | 8 +- Source/cmAddTestCommand.h | 8 +- Source/cmAuxSourceDirectoryCommand.h | 8 +- Source/cmBreakCommand.h | 10 +-- Source/cmBuildCommand.h | 8 +- Source/cmBuildNameCommand.h | 10 +-- Source/cmCMakeHostSystemInformationCommand.h | 10 +-- Source/cmCMakeMinimumRequired.h | 10 +-- Source/cmCMakePolicyCommand.h | 10 +-- Source/cmCPackPropertiesGenerator.h | 5 +- Source/cmCommand.h | 2 +- Source/cmCommandArgumentsHelper.h | 16 ++-- Source/cmConfigureFileCommand.h | 10 +-- Source/cmContinueCommand.h | 10 +-- Source/cmCreateTestSourceList.h | 8 +- Source/cmCryptoHash.h | 8 +- Source/cmDefinePropertyCommand.h | 8 +- Source/cmDependsC.h | 9 +-- Source/cmDependsFortran.h | 13 ++-- Source/cmDependsJava.h | 13 ++-- Source/cmElseCommand.h | 10 +-- Source/cmElseIfCommand.h | 10 +-- Source/cmEnableLanguageCommand.h | 8 +- Source/cmEnableTestingCommand.h | 8 +- Source/cmEndForEachCommand.h | 13 ++-- Source/cmEndFunctionCommand.h | 13 ++-- Source/cmEndIfCommand.h | 10 +-- Source/cmEndMacroCommand.h | 13 ++-- Source/cmEndWhileCommand.h | 13 ++-- Source/cmExecProgramCommand.h | 10 +-- Source/cmExecuteProcessCommand.h | 10 +-- Source/cmExportBuildFileGenerator.h | 16 ++-- Source/cmExportCommand.h | 8 +- Source/cmExportInstallFileGenerator.h | 18 ++--- Source/cmExportLibraryDependenciesCommand.h | 18 +++-- Source/cmExportTryCompileFileGenerator.h | 14 ++-- Source/cmExtraCodeBlocksGenerator.h | 8 +- Source/cmExtraCodeLiteGenerator.h | 8 +- Source/cmExtraEclipseCDT4Generator.h | 12 +-- Source/cmExtraKateGenerator.h | 8 +- Source/cmExtraSublimeTextGenerator.h | 8 +- Source/cmFLTKWrapUICommand.h | 12 +-- Source/cmFileCommand.cxx | 18 ++--- Source/cmFileCommand.h | 10 +-- Source/cmFindCommon.h | 2 +- Source/cmFindFileCommand.h | 4 +- Source/cmFindLibraryCommand.h | 10 +-- Source/cmFindPackageCommand.cxx | 26 +++---- Source/cmFindPackageCommand.h | 10 +-- Source/cmFindPathCommand.h | 10 +-- Source/cmFindProgramCommand.h | 10 +-- Source/cmForEachCommand.h | 18 ++--- Source/cmFunctionCommand.cxx | 17 +++-- Source/cmFunctionCommand.h | 18 ++--- Source/cmGeneratedFileStream.h | 2 +- Source/cmGeneratorExpressionEvaluator.h | 16 ++-- Source/cmGetCMakePropertyCommand.h | 10 +-- Source/cmGetDirectoryPropertyCommand.h | 10 +-- Source/cmGetFilenameComponentCommand.h | 10 +-- Source/cmGetPropertyCommand.h | 10 +-- Source/cmGetSourceFilePropertyCommand.h | 11 ++- Source/cmGetTargetPropertyCommand.h | 8 +- Source/cmGetTestPropertyCommand.h | 8 +- Source/cmGlobalCommonGenerator.h | 2 +- Source/cmGlobalGeneratorFactory.h | 10 +-- Source/cmGlobalKdevelopGenerator.h | 8 +- Source/cmGlobalNinjaGenerator.h | 57 +++++++------- Source/cmGlobalUnixMakefileGenerator3.h | 76 ++++++++++++------- Source/cmGlobalWatcomWMakeGenerator.h | 10 +-- Source/cmIfCommand.h | 21 ++--- Source/cmIncludeCommand.h | 10 +-- Source/cmIncludeDirectoryCommand.h | 8 +- Source/cmIncludeExternalMSProjectCommand.h | 14 +++- Source/cmIncludeRegularExpressionCommand.h | 14 +++- Source/cmInstallCommand.h | 8 +- Source/cmInstallDirectoryGenerator.h | 12 +-- Source/cmInstallExportGenerator.h | 12 +-- Source/cmInstallFilesCommand.h | 12 +-- Source/cmInstallFilesGenerator.h | 12 +-- Source/cmInstallGenerator.h | 4 +- Source/cmInstallProgramsCommand.h | 12 +-- Source/cmInstallScriptGenerator.h | 4 +- Source/cmInstallTargetGenerator.h | 11 ++- Source/cmInstallTargetsCommand.h | 8 +- Source/cmLinkDirectoriesCommand.h | 8 +- Source/cmLinkLibrariesCommand.h | 8 +- Source/cmListCommand.h | 10 +-- Source/cmLoadCacheCommand.h | 8 +- Source/cmLoadCommandCommand.cxx | 14 ++-- Source/cmLoadCommandCommand.h | 8 +- Source/cmLocalCommonGenerator.h | 4 +- Source/cmLocalNinjaGenerator.h | 22 +++--- Source/cmLocalUnixMakefileGenerator3.h | 25 +++--- Source/cmMacroCommand.cxx | 17 +++-- Source/cmMacroCommand.h | 18 ++--- Source/cmMakeDirectoryCommand.h | 10 +-- Source/cmMakefileExecutableTargetGenerator.h | 4 +- Source/cmMakefileLibraryTargetGenerator.h | 4 +- Source/cmMakefileTargetGenerator.h | 8 +- Source/cmMakefileUtilityTargetGenerator.h | 4 +- Source/cmMarkAsAdvancedCommand.h | 10 +-- Source/cmMathCommand.h | 10 +-- Source/cmMessageCommand.h | 10 +-- Source/cmNinjaNormalTargetGenerator.h | 4 +- Source/cmNinjaTargetGenerator.h | 8 +- Source/cmNinjaUtilityTargetGenerator.h | 4 +- Source/cmOptionCommand.h | 10 +-- Source/cmOutputRequiredFilesCommand.h | 8 +- Source/cmParseArgumentsCommand.h | 10 +-- Source/cmProcessTools.h | 4 +- Source/cmProjectCommand.h | 8 +- Source/cmQTWrapCPPCommand.h | 8 +- Source/cmQTWrapUICommand.h | 8 +- Source/cmRemoveCommand.h | 10 +-- Source/cmRemoveDefinitionsCommand.h | 8 +- Source/cmReturnCommand.h | 10 +-- Source/cmSeparateArgumentsCommand.h | 10 +-- Source/cmSetCommand.h | 10 +-- Source/cmSetDirectoryPropertiesCommand.h | 16 ++-- Source/cmSetPropertyCommand.h | 10 +-- Source/cmSetSourceFilesPropertiesCommand.h | 14 +++- Source/cmSetTargetPropertiesCommand.h | 8 +- Source/cmSetTestsPropertiesCommand.h | 8 +- Source/cmSiteNameCommand.h | 10 +-- Source/cmSourceGroupCommand.h | 8 +- Source/cmStringCommand.h | 10 +-- Source/cmSubdirCommand.h | 8 +- Source/cmSubdirDependsCommand.h | 8 +- Source/cmTargetCompileDefinitionsCommand.h | 26 ++++--- Source/cmTargetCompileFeaturesCommand.h | 20 ++--- Source/cmTargetCompileOptionsCommand.h | 20 ++--- Source/cmTargetIncludeDirectoriesCommand.h | 32 ++++---- Source/cmTargetLinkLibrariesCommand.h | 8 +- Source/cmTargetSourcesCommand.h | 20 ++--- Source/cmTestGenerator.h | 18 +++-- Source/cmTryCompileCommand.h | 8 +- Source/cmTryRunCommand.h | 8 +- Source/cmUnsetCommand.h | 10 +-- Source/cmUseMangledMesaCommand.h | 10 +-- Source/cmUtilitySourceCommand.h | 8 +- Source/cmVariableRequiresCommand.h | 8 +- Source/cmVariableWatchCommand.h | 14 ++-- Source/cmWhileCommand.h | 21 ++--- Source/cmWriteFileCommand.h | 10 +-- 216 files changed, 1124 insertions(+), 1033 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 2b35749d5..12f2ca65a 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -46,7 +46,7 @@ public: /** * Destruct IFW generator */ - virtual ~cmCPackIFWGenerator(); + ~cmCPackIFWGenerator() CM_OVERRIDE; /** * Compare \a version with QtIFW framework version @@ -70,18 +70,18 @@ protected: * @brief Initialize generator * @return 0 on failure */ - virtual int InitializeInternal(); - virtual int PackageFiles(); - virtual const char* GetPackagingInstallPrefix(); + int InitializeInternal() CM_OVERRIDE; + int PackageFiles() CM_OVERRIDE; + const char* GetPackagingInstallPrefix() CM_OVERRIDE; /** * @brief Extension of binary installer * @return Executable suffix or value from default implementation */ - virtual const char* GetOutputExtension(); + const char* GetOutputExtension() CM_OVERRIDE; - virtual std::string GetComponentInstallDirNameSuffix( - const std::string& componentName); + std::string GetComponentInstallDirNameSuffix( + const std::string& componentName) CM_OVERRIDE; /** * @brief Get Component @@ -92,8 +92,8 @@ protected: * * @return Pointer to component */ - virtual cmCPackComponent* GetComponent(const std::string& projectName, - const std::string& componentName); + cmCPackComponent* GetComponent(const std::string& projectName, + const std::string& componentName) CM_OVERRIDE; /** * @brief Get group of component @@ -104,12 +104,13 @@ protected: * * @return Pointer to component group */ - virtual cmCPackComponentGroup* GetComponentGroup( - const std::string& projectName, const std::string& groupName); + cmCPackComponentGroup* GetComponentGroup( + const std::string& projectName, const std::string& groupName) CM_OVERRIDE; - enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const; - virtual bool SupportsAbsoluteDestination() const; - virtual bool SupportsComponentInstallation() const; + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const + CM_OVERRIDE; + bool SupportsAbsoluteDestination() const CM_OVERRIDE; + bool SupportsComponentInstallation() const CM_OVERRIDE; protected: // Methods diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index f5a323f1e..ddbcc3446 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -27,10 +27,10 @@ public: * Construct generator */ cmCPack7zGenerator(); - virtual ~cmCPack7zGenerator(); + ~cmCPack7zGenerator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".7z"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".7z"; } }; #endif diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 9eb38b19d..a018ebd54 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -32,14 +32,14 @@ public: * Construct generator */ cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format); - virtual ~cmCPackArchiveGenerator(); + ~cmCPackArchiveGenerator() CM_OVERRIDE; // Used to add a header to the archive virtual int GenerateHeader(std::ostream* os); // component support - virtual bool SupportsComponentInstallation() const; + bool SupportsComponentInstallation() const CM_OVERRIDE; protected: - virtual int InitializeInternal(); + int InitializeInternal() CM_OVERRIDE; /** * Add the files belonging to the specified component * to the provided (already opened) archive. @@ -55,7 +55,7 @@ protected: * method will call either PackageComponents or * PackageComponentsAllInOne. */ - int PackageFiles(); + int PackageFiles() CM_OVERRIDE; /** * The method used to package files when component * install is used. This will create one @@ -67,7 +67,7 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(); - virtual const char* GetOutputExtension() = 0; + const char* GetOutputExtension() CM_OVERRIDE = 0; cmArchiveWrite::Compress Compress; std::string ArchiveFormat; }; diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index ff34ca571..bcdc509ba 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -28,7 +28,7 @@ public: * Construct generator */ cmCPackDebGenerator(); - virtual ~cmCPackDebGenerator(); + ~cmCPackDebGenerator() CM_OVERRIDE; static bool CanGenerate() { @@ -45,7 +45,7 @@ public: } protected: - virtual int InitializeInternal(); + int InitializeInternal() CM_OVERRIDE; /** * This method factors out the work done in component packaging case. */ @@ -62,11 +62,11 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(const std::string& compInstDirName); - virtual int PackageFiles(); - virtual const char* GetOutputExtension() { return ".deb"; } - virtual bool SupportsComponentInstallation() const; - virtual std::string GetComponentInstallDirNameSuffix( - const std::string& componentName); + int PackageFiles() CM_OVERRIDE; + const char* GetOutputExtension() CM_OVERRIDE { return ".deb"; } + bool SupportsComponentInstallation() const CM_OVERRIDE; + std::string GetComponentInstallDirNameSuffix( + const std::string& componentName) CM_OVERRIDE; private: int createDeb(); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index ce9371589..6313a0e28 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -101,7 +101,7 @@ public: * Construct generator */ cmCPackGenerator(); - virtual ~cmCPackGenerator(); + ~cmCPackGenerator() CM_OVERRIDE; //! Set and get the options void SetOption(const std::string& op, const char* value); diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index a55ec6ece..f0ed57a55 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -28,7 +28,7 @@ public: cmTypeMacro(cmCPackGeneratorFactory, cmObject); cmCPackGeneratorFactory(); - ~cmCPackGeneratorFactory(); + ~cmCPackGeneratorFactory() CM_OVERRIDE; //! Get the generator cmCPackGenerator* NewGenerator(const std::string& name); diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 41871cca0..77f0f0bc1 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -42,7 +42,7 @@ public: cmTypeMacro(cmCPackLog, cmObject); cmCPackLog(); - ~cmCPackLog(); + ~cmCPackLog() CM_OVERRIDE; enum __log_tags { diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index ae3ccca6e..4923cf0da 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -36,21 +36,22 @@ public: * Construct generator */ cmCPackNSISGenerator(bool nsis64 = false); - virtual ~cmCPackNSISGenerator(); + ~cmCPackNSISGenerator() CM_OVERRIDE; protected: - virtual int InitializeInternal(); + int InitializeInternal() CM_OVERRIDE; void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr); - int PackageFiles(); - virtual const char* GetOutputExtension() { return ".exe"; } - virtual const char* GetOutputPostfix() { return "win32"; } + int PackageFiles() CM_OVERRIDE; + const char* GetOutputExtension() CM_OVERRIDE { return ".exe"; } + const char* GetOutputPostfix() CM_OVERRIDE { return "win32"; } bool GetListOfSubdirectories(const char* dir, std::vector& dirs); - enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const; - virtual bool SupportsAbsoluteDestination() const; - virtual bool SupportsComponentInstallation() const; + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const + CM_OVERRIDE; + bool SupportsAbsoluteDestination() const CM_OVERRIDE; + bool SupportsComponentInstallation() const CM_OVERRIDE; /// Produce a string that contains the NSIS code to describe a /// particular component. Any added macros will be emitted via diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index b39f2c2fc..4baef08ab 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -32,7 +32,7 @@ public: * Construct generator */ cmCPackRPMGenerator(); - virtual ~cmCPackRPMGenerator(); + ~cmCPackRPMGenerator() CM_OVERRIDE; static bool CanGenerate() { @@ -49,8 +49,8 @@ public: } protected: - virtual int InitializeInternal(); - virtual int PackageFiles(); + int InitializeInternal() CM_OVERRIDE; + int PackageFiles() CM_OVERRIDE; /** * This method factors out the work done in component packaging case. */ @@ -67,10 +67,10 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(const std::string& compInstDirName); - virtual const char* GetOutputExtension() { return ".rpm"; } - virtual bool SupportsComponentInstallation() const; - virtual std::string GetComponentInstallDirNameSuffix( - const std::string& componentName); + const char* GetOutputExtension() CM_OVERRIDE { return ".rpm"; } + bool SupportsComponentInstallation() const CM_OVERRIDE; + std::string GetComponentInstallDirNameSuffix( + const std::string& componentName) CM_OVERRIDE; void AddGeneratedPackageNames(); }; diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 08152b5b2..94cc8aa79 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -28,13 +28,13 @@ public: * Construct generator */ cmCPackSTGZGenerator(); - virtual ~cmCPackSTGZGenerator(); + ~cmCPackSTGZGenerator() CM_OVERRIDE; protected: - int PackageFiles(); - virtual int InitializeInternal(); - int GenerateHeader(std::ostream* os); - virtual const char* GetOutputExtension() { return ".sh"; } + int PackageFiles() CM_OVERRIDE; + int InitializeInternal() CM_OVERRIDE; + int GenerateHeader(std::ostream* os) CM_OVERRIDE; + const char* GetOutputExtension() CM_OVERRIDE { return ".sh"; } }; #endif diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index 408422b40..cb7620c58 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -27,10 +27,10 @@ public: * Construct generator */ cmCPackTGZGenerator(); - virtual ~cmCPackTGZGenerator(); + ~cmCPackTGZGenerator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".tar.gz"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".tar.gz"; } }; #endif diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index 05052a160..87c92ef61 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -27,10 +27,10 @@ public: * Construct generator */ cmCPackTXZGenerator(); - virtual ~cmCPackTXZGenerator(); + ~cmCPackTXZGenerator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".tar.xz"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".tar.xz"; } }; #endif diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 403319736..6fec88284 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -26,10 +26,10 @@ public: * Construct generator */ cmCPackTarBZip2Generator(); - virtual ~cmCPackTarBZip2Generator(); + ~cmCPackTarBZip2Generator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".tar.bz2"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".tar.bz2"; } }; #endif diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 7ff9a0ade..02926a207 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -26,10 +26,10 @@ public: * Construct generator */ cmCPackTarCompressGenerator(); - virtual ~cmCPackTarCompressGenerator(); + ~cmCPackTarCompressGenerator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".tar.Z"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".tar.Z"; } }; #endif diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 70e1a5fa8..1130826da 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -27,10 +27,10 @@ public: * Construct generator */ cmCPackZIPGenerator(); - virtual ~cmCPackZIPGenerator(); + ~cmCPackZIPGenerator() CM_OVERRIDE; protected: - virtual const char* GetOutputExtension() { return ".zip"; } + const char* GetOutputExtension() CM_OVERRIDE { return ".zip"; } }; #endif diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 5b3f6128a..17d4eefa3 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -183,7 +183,7 @@ public: { this->InitializeParser(); } - ~LogParser() { this->CleanupParser(); } + ~LogParser() CM_OVERRIDE { this->CleanupParser(); } int InitializeParser() CM_OVERRIDE { diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h index 4f44136fd..0f05d3881 100644 --- a/Source/CTest/cmCTestBZR.h +++ b/Source/CTest/cmCTestBZR.h @@ -24,20 +24,20 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestBZR(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestBZR(); + ~cmCTestBZR() CM_OVERRIDE; private: // Implement cmCTestVC internal API. - virtual void NoteOldRevision(); - virtual void NoteNewRevision(); - virtual bool UpdateImpl(); + void NoteOldRevision() CM_OVERRIDE; + void NoteNewRevision() CM_OVERRIDE; + bool UpdateImpl() CM_OVERRIDE; // URL of repository directory checked out in the working tree. std::string URL; std::string LoadInfo(); - void LoadModifications(); - void LoadRevisions(); + void LoadModifications() CM_OVERRIDE; + void LoadRevisions() CM_OVERRIDE; // Parsing helper classes. class InfoParser; diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h index ed60ea3c9..17cc23469 100644 --- a/Source/CTest/cmCTestBatchTestHandler.h +++ b/Source/CTest/cmCTestBatchTestHandler.h @@ -28,8 +28,8 @@ class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler { public: - ~cmCTestBatchTestHandler(); - virtual void RunTests(); + ~cmCTestBatchTestHandler() CM_OVERRIDE; + void RunTests() CM_OVERRIDE; protected: void WriteBatchScript(); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index d0443aeee..2aa90a436 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -30,12 +30,12 @@ public: /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; //! Set all the build and test arguments - virtual int ProcessCommandLineArguments( - const std::string& currentArg, size_t& idx, - const std::vector& allArgs); + int ProcessCommandLineArguments(const std::string& currentArg, size_t& idx, + const std::vector& allArgs) + CM_OVERRIDE; /* * Get the output variable @@ -44,7 +44,7 @@ public: cmCTestBuildAndTestHandler(); - virtual void Initialize(); + void Initialize() CM_OVERRIDE; protected: ///! Run CMake and build a test and then run it as a single test. diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index f420c2f4c..92ae216ae 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -26,12 +26,12 @@ class cmCTestBuildCommand : public cmCTestHandlerCommand { public: cmCTestBuildCommand(); - ~cmCTestBuildCommand(); + ~cmCTestBuildCommand() CM_OVERRIDE; /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestBuildCommand* ni = new cmCTestBuildCommand; ni->CTest = this->CTest; @@ -42,10 +42,10 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_build"; } + std::string GetName() const CM_OVERRIDE { return "ctest_build"; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; cmTypeMacro(cmCTestBuildCommand, cmCTestHandlerCommand); @@ -65,7 +65,7 @@ protected: ctb_LAST }; - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; }; #endif diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index 48a37b783..8cc5f01df 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -36,16 +36,16 @@ public: /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; cmCTestBuildHandler(); - void PopulateCustomVectors(cmMakefile* mf); + void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; /** * Initialize handler */ - virtual void Initialize(); + void Initialize() CM_OVERRIDE; int GetTotalErrors() { return this->TotalErrors; } int GetTotalWarnings() { return this->TotalWarnings; } diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index 62fe01b8f..4d5e6a9c8 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -24,12 +24,12 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestCVS(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestCVS(); + ~cmCTestCVS() CM_OVERRIDE; private: // Implement cmCTestVC internal API. - virtual bool UpdateImpl(); - virtual bool WriteXMLUpdates(cmXMLWriter& xml); + bool UpdateImpl() CM_OVERRIDE; + bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE; // Update status for files in each directory. class Directory : public std::map diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 9ff3d4ad9..a97f9f055 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestConfigureCommand* ni = new cmCTestConfigureCommand; ni->CTest = this->CTest; @@ -38,12 +38,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_configure"; } + std::string GetName() const CM_OVERRIDE { return "ctest_configure"; } cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand); protected: - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; enum { diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index 4c1a96b02..a7de939fb 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -29,11 +29,11 @@ public: /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; cmCTestConfigureHandler(); - void Initialize(); + void Initialize() CM_OVERRIDE; }; #endif diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index f60ffd5e0..ffd5fec77 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestCoverageCommand* ni = new cmCTestCoverageCommand; ni->CTest = this->CTest; @@ -38,15 +38,15 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_coverage"; } + std::string GetName() const CM_OVERRIDE { return "ctest_coverage"; } cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand); protected: - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; - virtual bool CheckArgumentKeyword(std::string const& arg); - virtual bool CheckArgumentValue(std::string const& arg); + bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; enum { diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 177321844..60fea48b9 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -45,16 +45,16 @@ public: /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; cmCTestCoverageHandler(); - virtual void Initialize(); + void Initialize() CM_OVERRIDE; /** * This method is called when reading CTest custom file */ - void PopulateCustomVectors(cmMakefile* mf); + void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; /** Report coverage only for sources with these labels. */ void SetLabelFilter(std::set const& labels); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index e904d192b..acacbcbb7 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestEmptyBinaryDirectoryCommand* ni = new cmCTestEmptyBinaryDirectoryCommand; @@ -41,13 +41,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return "ctest_empty_binary_directory"; } diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index 685cc3190..85298cb15 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -24,15 +24,15 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestGIT(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestGIT(); + ~cmCTestGIT() CM_OVERRIDE; private: unsigned int CurrentGitVersion; unsigned int GetGitVersion(); std::string GetWorkingRevision(); - virtual void NoteOldRevision(); - virtual void NoteNewRevision(); - virtual bool UpdateImpl(); + void NoteOldRevision() CM_OVERRIDE; + void NoteNewRevision() CM_OVERRIDE; + bool UpdateImpl() CM_OVERRIDE; std::string FindGitDir(); std::string FindTopDir(); @@ -41,8 +41,8 @@ private: bool UpdateByCustom(std::string const& custom); bool UpdateInternal(); - void LoadRevisions(); - void LoadModifications(); + void LoadRevisions() CM_OVERRIDE; + void LoadModifications() CM_OVERRIDE; // "public" needed by older Sun compilers public: diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index ad349aca5..9949c3aa8 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -74,7 +74,7 @@ public: * Construct handler */ cmCTestGenericHandler(); - virtual ~cmCTestGenericHandler(); + ~cmCTestGenericHandler() CM_OVERRIDE; typedef std::map t_StringToString; diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index 9a5357fd1..7ea344086 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -26,11 +26,11 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestGlobalVC(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestGlobalVC(); + ~cmCTestGlobalVC() CM_OVERRIDE; protected: // Implement cmCTestVC internal API. - virtual bool WriteXMLUpdates(cmXMLWriter& xml); + bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE; /** Represent a vcs-reported action for one path in a revision. */ struct Change diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 9589e057e..298804b59 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -171,7 +171,7 @@ public: { this->InitializeParser(); } - ~LogParser() { this->CleanupParser(); } + ~LogParser() CM_OVERRIDE { this->CleanupParser(); } private: cmCTestHG* HG; diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h index 8cc8c7a2f..c4ce08c3b 100644 --- a/Source/CTest/cmCTestHG.h +++ b/Source/CTest/cmCTestHG.h @@ -24,16 +24,16 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestHG(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestHG(); + ~cmCTestHG() CM_OVERRIDE; private: std::string GetWorkingRevision(); - virtual void NoteOldRevision(); - virtual void NoteNewRevision(); - virtual bool UpdateImpl(); + void NoteOldRevision() CM_OVERRIDE; + void NoteNewRevision() CM_OVERRIDE; + bool UpdateImpl() CM_OVERRIDE; - void LoadRevisions(); - void LoadModifications(); + void LoadRevisions() CM_OVERRIDE; + void LoadModifications() CM_OVERRIDE; // Parsing helper classes. class IdentifyParser; diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 7248832ed..0468bbc2b 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -30,8 +30,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 245892c96..2ba33ae56 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestMemCheckCommand* ni = new cmCTestMemCheckCommand; ni->CTest = this->CTest; @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_memcheck"; } + std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; } cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand); protected: - cmCTestGenericHandler* InitializeActualHandler(); + cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE; }; #endif diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 8f0cc473f..a005d54a3 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -33,16 +33,17 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler public: cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler); - void PopulateCustomVectors(cmMakefile* mf); + void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; cmCTestMemCheckHandler(); - void Initialize(); + void Initialize() CM_OVERRIDE; protected: - virtual int PreProcessHandler(); - virtual int PostProcessHandler(); - virtual void GenerateTestCommand(std::vector& args, int test); + int PreProcessHandler() CM_OVERRIDE; + int PostProcessHandler() CM_OVERRIDE; + void GenerateTestCommand(std::vector& args, + int test) CM_OVERRIDE; private: enum @@ -125,7 +126,7 @@ private: /** * Generate the Dart compatible output */ - void GenerateDartOutput(cmXMLWriter& xml); + void GenerateDartOutput(cmXMLWriter& xml) CM_OVERRIDE; std::vector CustomPreMemCheck; std::vector CustomPostMemCheck; diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index 917751e7d..84e4f96e2 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -27,7 +27,7 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestP4(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestP4(); + ~cmCTestP4() CM_OVERRIDE; private: std::vector ChangeLists; @@ -54,13 +54,13 @@ private: void SetP4Options(std::vector& options); std::string GetWorkingRevision(); - virtual void NoteOldRevision(); - virtual void NoteNewRevision(); - virtual bool UpdateImpl(); + void NoteOldRevision() CM_OVERRIDE; + void NoteNewRevision() CM_OVERRIDE; + bool UpdateImpl() CM_OVERRIDE; bool UpdateCustom(const std::string& custom); - void LoadRevisions(); - void LoadModifications(); + void LoadRevisions() CM_OVERRIDE; + void LoadModifications() CM_OVERRIDE; // Parsing helper classes. class IdentifyParser; diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 713fc6635..6cce7c863 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand; ni->CTest = this->CTest; @@ -39,13 +39,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_read_custom_files"; } + std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; } cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand); }; diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index c5035166c..9ea0999bb 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand; ni->CTest = this->CTest; @@ -40,13 +40,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_run_script"; } + std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; } cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand); }; diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 074bd3df7..e4b6e255c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -311,7 +311,7 @@ public: { this->InitializeParser(); } - ~LogParser() { this->CleanupParser(); } + ~LogParser() CM_OVERRIDE { this->CleanupParser(); } private: cmCTestSVN* SVN; cmCTestSVN::SVNInfo& SVNRepo; diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index e596bdc93..4f3eb88ef 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -26,14 +26,14 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestSVN(cmCTest* ctest, std::ostream& log); - virtual ~cmCTestSVN(); + ~cmCTestSVN() CM_OVERRIDE; private: // Implement cmCTestVC internal API. - virtual void CleanupImpl(); - virtual void NoteOldRevision(); - virtual void NoteNewRevision(); - virtual bool UpdateImpl(); + void CleanupImpl() CM_OVERRIDE; + void NoteOldRevision() CM_OVERRIDE; + void NoteNewRevision() CM_OVERRIDE; + bool UpdateImpl() CM_OVERRIDE; bool RunSVNCommand(std::vector const& parameters, OutputParser* out, OutputParser* err); @@ -78,8 +78,8 @@ private: std::string LoadInfo(SVNInfo& svninfo); void LoadExternals(); - void LoadModifications(); - void LoadRevisions(); + void LoadModifications() CM_OVERRIDE; + void LoadRevisions() CM_OVERRIDE; void LoadRevisions(SVNInfo& svninfo); void GuessBase(SVNInfo& svninfo, std::vector const& changes); @@ -87,7 +87,7 @@ private: void DoRevisionSVN(Revision const& revision, std::vector const& changes); - void WriteXMLGlobal(cmXMLWriter& xml); + void WriteXMLGlobal(cmXMLWriter& xml) CM_OVERRIDE; // Parsing helper classes. class InfoParser; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 028cfdd20..44b6b934b 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -59,7 +59,7 @@ class cmCTestScriptFunctionBlocker : public cmFunctionBlocker { public: cmCTestScriptFunctionBlocker() {} - virtual ~cmCTestScriptFunctionBlocker() {} + ~cmCTestScriptFunctionBlocker() CM_OVERRIDE {} bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&) CM_OVERRIDE; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index e09e040aa..4403030f5 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -71,7 +71,7 @@ public: /** * Run a dashboard using a specified confiuration script */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; /* * Run a script @@ -104,9 +104,9 @@ public: double GetRemainingTimeAllowed(); cmCTestScriptHandler(); - ~cmCTestScriptHandler(); + ~cmCTestScriptHandler() CM_OVERRIDE; - void Initialize(); + void Initialize() CM_OVERRIDE; void CreateCMake(); cmake* GetCMake() { return this->CMake; } diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index ff7f1467a..7981fa293 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSleepCommand* ni = new cmCTestSleepCommand; ni->CTest = this->CTest; @@ -40,13 +40,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_sleep"; } + std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; } cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); }; diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 2aa628159..e3f8f8b4c 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestStartCommand* ni = new cmCTestStartCommand; ni->CTest = this->CTest; @@ -41,8 +41,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * Will this invocation of ctest_start create a new TAG file? @@ -57,7 +57,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_start"; } + std::string GetName() const CM_OVERRIDE { return "ctest_start"; } cmTypeMacro(cmCTestStartCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 6323d8cdc..7c3d6cd64 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -38,7 +38,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSubmitCommand* ni = new cmCTestSubmitCommand; ni->CTest = this->CTest; @@ -46,21 +46,21 @@ public: return ni; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_submit"; } + std::string GetName() const CM_OVERRIDE { return "ctest_submit"; } cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand); protected: - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; - virtual bool CheckArgumentKeyword(std::string const& arg); - virtual bool CheckArgumentValue(std::string const& arg); + bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; enum { diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 85e243f5c..3aacde09f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -41,7 +41,7 @@ class cmCTestSubmitHandler::ResponseParser : public cmXMLParser { public: ResponseParser() { this->Status = STATUS_OK; } - ~ResponseParser() {} + ~ResponseParser() CM_OVERRIDE {} public: enum StatusType diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 87fa14203..c2c9a8536 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -26,14 +26,14 @@ public: cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler); cmCTestSubmitHandler(); - ~cmCTestSubmitHandler() { this->LogFile = 0; } + ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = 0; } /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; - void Initialize(); + void Initialize() CM_OVERRIDE; /** Specify a set of parts (by name) to submit. */ void SelectParts(std::set const& parts); diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 212213e79..f652971a4 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestTestCommand* ni = new cmCTestTestCommand; ni->CTest = this->CTest; @@ -38,13 +38,13 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_test"; } + std::string GetName() const CM_OVERRIDE { return "ctest_test"; } cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand); protected: virtual cmCTestGenericHandler* InitializeActualHandler(); - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; enum { diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 4b74ce0f6..a085a82e7 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -36,7 +36,7 @@ public: /** * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; /** * When both -R and -I are used should te resulting test list be the @@ -54,7 +54,7 @@ public: /** * This method is called when reading CTest custom file */ - void PopulateCustomVectors(cmMakefile* mf); + void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; ///! Control the use of the regular expresisons, call these methods to turn /// them on @@ -90,7 +90,7 @@ public: */ bool SetTestsProperties(const std::vector& args); - void Initialize(); + void Initialize() CM_OVERRIDE; // NOTE: This struct is Saved/Restored // in cmCTestTestHandler, if you add to this class diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index e80719360..6b5bbab90 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestUpdateCommand* ni = new cmCTestUpdateCommand; ni->CTest = this->CTest; @@ -38,12 +38,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_update"; } + std::string GetName() const CM_OVERRIDE { return "ctest_update"; } cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand); protected: - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; }; #endif diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index d44e61906..6733c8c14 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -29,7 +29,7 @@ public: /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; cmCTestUpdateHandler(); @@ -48,7 +48,7 @@ public: /** * Initialize handler */ - virtual void Initialize(); + void Initialize() CM_OVERRIDE; private: // Some structures needed for update diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 551be2be1..923995dcd 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -30,7 +30,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestUploadCommand* ni = new cmCTestUploadCommand; ni->CTest = this->CTest; @@ -41,15 +41,15 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "ctest_upload"; } + std::string GetName() const CM_OVERRIDE { return "ctest_upload"; } cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand); protected: - cmCTestGenericHandler* InitializeHandler(); + cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; - virtual bool CheckArgumentKeyword(std::string const& arg); - virtual bool CheckArgumentValue(std::string const& arg); + bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; enum { diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h index 23ed35a25..8b824d630 100644 --- a/Source/CTest/cmCTestUploadHandler.h +++ b/Source/CTest/cmCTestUploadHandler.h @@ -26,14 +26,14 @@ public: cmTypeMacro(cmCTestUploadHandler, cmCTestGenericHandler); cmCTestUploadHandler(); - ~cmCTestUploadHandler() {} + ~cmCTestUploadHandler() CM_OVERRIDE {} /* * The main entry point for this class */ - int ProcessHandler(); + int ProcessHandler() CM_OVERRIDE; - void Initialize(); + void Initialize() CM_OVERRIDE; /** Specify a set of files to submit. */ void SetFiles(cmCTest::SetOfStrings const& files); diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h index bd331d0c4..65b1d10a6 100644 --- a/Source/CTest/cmParseCacheCoverage.h +++ b/Source/CTest/cmParseCacheCoverage.h @@ -28,7 +28,7 @@ public: protected: // implement virtual from parent - bool LoadCoverageData(const char* dir); + bool LoadCoverageData(const char* dir) CM_OVERRIDE; // remove files with no coverage void RemoveUnCoveredFiles(); // Read a single mcov file diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index f1c37edcb..1a3fe3c40 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -20,7 +20,7 @@ public: this->CurFileName = ""; } - virtual ~XMLParser() {} + ~XMLParser() CM_OVERRIDE {} protected: void EndElement(const std::string& name) CM_OVERRIDE diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h index bc2f2ec18..4188689ed 100644 --- a/Source/CTest/cmParseGTMCoverage.h +++ b/Source/CTest/cmParseGTMCoverage.h @@ -28,7 +28,7 @@ public: protected: // implement virtual from parent - bool LoadCoverageData(const char* dir); + bool LoadCoverageData(const char* dir) CM_OVERRIDE; // Read a single mcov file bool ReadMCovFile(const char* f); // find out what line in a mumps file (filepath) the given entry point diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 27ccf5832..93258121a 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -20,7 +20,7 @@ public: this->PackageName = ""; } - virtual ~XMLParser() {} + ~XMLParser() CM_OVERRIDE {} protected: void EndElement(const std::string&) CM_OVERRIDE {} diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index 49be45a2b..d2899eeab 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -25,7 +25,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; // Description: // Set/Get the value (on/off). diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index 9a3df2917..e6ca91eda 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -25,7 +25,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; protected: cmCursesDummyWidget(const cmCursesDummyWidget& from); diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index c31a58cac..ff645aff2 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -21,13 +21,13 @@ class cmCursesLabelWidget : public cmCursesWidget public: cmCursesLabelWidget(int width, int height, int left, int top, const std::string& name); - virtual ~cmCursesLabelWidget(); + ~cmCursesLabelWidget() CM_OVERRIDE; // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled - virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; protected: cmCursesLabelWidget(const cmCursesLabelWidget& from); diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 73ccfc4d3..a12ed2f7b 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -23,16 +23,16 @@ class cmCursesLongMessageForm : public cmCursesForm public: cmCursesLongMessageForm(std::vector const& messages, const char* title); - virtual ~cmCursesLongMessageForm(); + ~cmCursesLongMessageForm() CM_OVERRIDE; // Description: // Handle user input. - virtual void HandleInput(); + void HandleInput() CM_OVERRIDE; // Description: // Display form. Use a window of size width x height, starting // at top, left. - virtual void Render(int left, int top, int width, int height); + void Render(int left, int top, int width, int height) CM_OVERRIDE; // Description: // This method should normally called only by the form. @@ -42,7 +42,7 @@ public: // Description: // This method should normally called only by the form. // The only exception is during a resize. - virtual void UpdateStatusBar(); + void UpdateStatusBar() CM_OVERRIDE; protected: cmCursesLongMessageForm(const cmCursesLongMessageForm& from); diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 9aa0f6775..a8e99b6ba 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -30,7 +30,7 @@ class cmCursesMainForm : public cmCursesForm { public: cmCursesMainForm(std::vector const& args, int initwidth); - virtual ~cmCursesMainForm(); + ~cmCursesMainForm() CM_OVERRIDE; /** * Set the widgets which represent the cache entries. @@ -40,13 +40,13 @@ public: /** * Handle user input. */ - virtual void HandleInput(); + void HandleInput() CM_OVERRIDE; /** * Display form. Use a window of size width x height, starting * at top, left. */ - virtual void Render(int left, int top, int width, int height); + void Render(int left, int top, int width, int height) CM_OVERRIDE; /** * Returns true if an entry with the given key is in the @@ -67,7 +67,7 @@ public: * exception is during a resize. The optional argument specifies the * string to be displayed in the status bar. */ - virtual void UpdateStatusBar() { this->UpdateStatusBar(0); } + void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(0); } virtual void UpdateStatusBar(const char* message); /** @@ -83,7 +83,7 @@ public: * During a CMake run, an error handle should add errors * to be displayed afterwards. */ - virtual void AddError(const char* message, const char* title); + void AddError(const char* message, const char* title) CM_OVERRIDE; /** * Used to do a configure. If argument is specified, it does only the check diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index a17f2d51a..f88b6bc65 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -25,7 +25,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; void SetOption(const std::string&); void AddOption(std::string const&); void NextOption(); diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h index 18d298aa4..cd26df636 100644 --- a/Source/CursesDialog/cmCursesPathWidget.h +++ b/Source/CursesDialog/cmCursesPathWidget.h @@ -23,9 +23,9 @@ public: * This method is called when different keys are pressed. The * subclass can have a special implementation handler for this. */ - virtual void OnTab(cmCursesMainForm* fm, WINDOW* w); - virtual void OnReturn(cmCursesMainForm* fm, WINDOW* w); - virtual void OnType(int& key, cmCursesMainForm* fm, WINDOW* w); + void OnTab(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + void OnReturn(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; protected: cmCursesPathWidget(const cmCursesPathWidget& from); diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index fc1b2ba4f..c8ca4821f 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -32,14 +32,14 @@ public: * when this widget has focus. Returns true if the input was * handled. */ - virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; /** * Set/Get the string. */ void SetString(const std::string& value); const char* GetString(); - virtual const char* GetValue(); + const char* GetValue() CM_OVERRIDE; /** * Set/Get InEdit flag. Can be used to tell the widget to leave @@ -61,7 +61,7 @@ public: * in the toolbar and return true. Otherwise, return false * and the parent widget will print. */ - virtual bool PrintKeys(); + bool PrintKeys() CM_OVERRIDE; protected: cmCursesStringWidget(const cmCursesStringWidget& from); diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index 5c073c86c..dba1acdff 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -20,19 +20,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddCompileOptionsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddCompileOptionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_compile_options"; } + std::string GetName() const CM_OVERRIDE { return "add_compile_options"; } cmTypeMacro(cmAddCompileOptionsCommand, cmCommand); }; diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index ccbd50c84..1164d4616 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddCustomCommandCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomCommandCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_custom_command"; } + std::string GetName() const CM_OVERRIDE { return "add_custom_command"; } cmTypeMacro(cmAddCustomCommandCommand, cmCommand); diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 9c376c008..120d4d475 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddCustomTargetCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomTargetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_custom_target"; } + std::string GetName() const CM_OVERRIDE { return "add_custom_target"; } cmTypeMacro(cmAddCustomTargetCommand, cmCommand); }; diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index 959ed6431..b30001cdb 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddDefinitionsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddDefinitionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_definitions"; } + std::string GetName() const CM_OVERRIDE { return "add_definitions"; } cmTypeMacro(cmAddDefinitionsCommand, cmCommand); }; diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 202d0723f..c059ff2b1 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddDependenciesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddDependenciesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_dependencies"; } + std::string GetName() const CM_OVERRIDE { return "add_dependencies"; } cmTypeMacro(cmAddDependenciesCommand, cmCommand); }; diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 1e3181f8b..133f5bf54 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddExecutableCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddExecutableCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_executable"; } + std::string GetName() const CM_OVERRIDE { return "add_executable"; } cmTypeMacro(cmAddExecutableCommand, cmCommand); }; diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 0f0f7688c..20f1bc9df 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddLibraryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddLibraryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_library"; } + std::string GetName() const CM_OVERRIDE { return "add_library"; } cmTypeMacro(cmAddLibraryCommand, cmCommand); }; diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index 786c8b034..ec1d2c81d 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddSubDirectoryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddSubDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_subdirectory"; } + std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; } cmTypeMacro(cmAddSubDirectoryCommand, cmCommand); }; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 295fb78a0..abff0c28d 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAddTestCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAddTestCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_test"; } + std::string GetName() const CM_OVERRIDE { return "add_test"; } cmTypeMacro(cmAddTestCommand, cmCommand); diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index b5943f5fb..6301cb2da 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -29,19 +29,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmAuxSourceDirectoryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmAuxSourceDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "aux_source_directory"; } + std::string GetName() const CM_OVERRIDE { return "aux_source_directory"; } cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand); }; diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 270d3e63a..3b585e226 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmBreakCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmBreakCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "break"; } + std::string GetName() const CM_OVERRIDE { return "break"; } cmTypeMacro(cmBreakCommand, cmCommand); }; diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 6cbf3ca10..552e5ff43 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmBuildCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmBuildCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The primary command signature with optional, KEYWORD-based args. @@ -47,7 +47,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "build_command"; } + std::string GetName() const CM_OVERRIDE { return "build_command"; } cmTypeMacro(cmBuildCommand, cmCommand); diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 43c24b023..4a1641bd1 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -18,11 +18,11 @@ class cmBuildNameCommand : public cmCommand { public: cmTypeMacro(cmBuildNameCommand, cmCommand); - virtual cmCommand* Clone() { return new cmBuildNameCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "build_name"; } - virtual bool IsScriptable() const { return true; } + cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "build_name"; } + bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index 6981ea98b..8e6f0f5a4 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { return new cmCMakeHostSystemInformationCommand; } @@ -37,18 +37,18 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return "cmake_host_system_information"; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index fc73e871a..4231eb422 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmCMakeMinimumRequired; } + cmCommand* Clone() CM_OVERRIDE { return new cmCMakeMinimumRequired; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "cmake_minimum_required"; } + std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; } cmTypeMacro(cmCMakeMinimumRequired, cmCommand); diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index dbb91d50e..fd4ab0a71 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -26,24 +26,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmCMakePolicyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmCMakePolicyCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "cmake_policy"; } + std::string GetName() const CM_OVERRIDE { return "cmake_policy"; } cmTypeMacro(cmCMakePolicyCommand, cmCommand); diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 4372b8711..4d092f6c4 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -29,9 +29,8 @@ public: std::vector const& configurations); protected: - virtual void GenerateScriptForConfig(std::ostream& os, - const std::string& config, - Indent const& indent); + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent const& indent) CM_OVERRIDE; cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 01572938f..be90a469e 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -45,7 +45,7 @@ public: /** * Need virtual destructor to destroy real command type. */ - virtual ~cmCommand() {} + ~cmCommand() CM_OVERRIDE {} /** * Specify the makefile. diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index c2a6f928e..27fef1f70 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -108,8 +108,8 @@ private: unsigned int DataStart; const char* Ignore; cmCAStringVector(); - virtual bool DoConsume(const std::string& arg, unsigned int index); - virtual void DoReset(); + bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; + void DoReset() CM_OVERRIDE; }; /** cmCAString is to be used for arguments which consist of one value, @@ -126,8 +126,8 @@ public: private: std::string String; unsigned int DataStart; - virtual bool DoConsume(const std::string& arg, unsigned int index); - virtual void DoReset(); + bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; + void DoReset() CM_OVERRIDE; cmCAString(); }; @@ -143,8 +143,8 @@ public: bool IsEnabled() const { return this->Enabled; } private: bool Enabled; - virtual bool DoConsume(const std::string& arg, unsigned int index); - virtual void DoReset(); + bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; + void DoReset() CM_OVERRIDE; cmCAEnabler(); }; @@ -160,8 +160,8 @@ public: bool IsEnabled() const { return this->Enabled; } private: bool Enabled; - virtual bool DoConsume(const std::string& arg, unsigned int index); - virtual void DoReset(); + bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; + void DoReset() CM_OVERRIDE; cmCADisabler(); }; diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 79f00bce7..1da65c8f3 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -19,24 +19,24 @@ class cmConfigureFileCommand : public cmCommand public: cmTypeMacro(cmConfigureFileCommand, cmCommand); - virtual cmCommand* Clone() { return new cmConfigureFileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmConfigureFileCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "configure_file"; } + std::string GetName() const CM_OVERRIDE { return "configure_file"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } private: int ConfigureFile(); diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h index 63ae59d36..6fa9af298 100644 --- a/Source/cmContinueCommand.h +++ b/Source/cmContinueCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmContinueCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmContinueCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "continue"; } + std::string GetName() const CM_OVERRIDE { return "continue"; } cmTypeMacro(cmContinueCommand, cmCommand); }; diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index cfaca2ea9..2025ecd52 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmCreateTestSourceList; } + cmCommand* Clone() CM_OVERRIDE { return new cmCreateTestSourceList; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "create_test_sourcelist"; } + std::string GetName() const CM_OVERRIDE { return "create_test_sourcelist"; } cmTypeMacro(cmCreateTestSourceList, cmCommand); }; diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index a0c5eab66..85adf6967 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -36,12 +36,12 @@ class cmCryptoHashMD5 : public cmCryptoHash public: cmCryptoHashMD5(); - ~cmCryptoHashMD5(); + ~cmCryptoHashMD5() CM_OVERRIDE; protected: - virtual void Initialize(); - virtual void Append(unsigned char const* buf, int sz); - virtual std::string Finalize(); + void Initialize() CM_OVERRIDE; + void Append(unsigned char const* buf, int sz) CM_OVERRIDE; + std::string Finalize() CM_OVERRIDE; }; #define cmCryptoHash_SHA_CLASS_DECL(SHA) \ diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 4248bbe31..9cc19c48e 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -17,19 +17,19 @@ class cmDefinePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmDefinePropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmDefinePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "define_property"; } + std::string GetName() const CM_OVERRIDE { return "define_property"; } cmTypeMacro(cmDefinePropertyCommand, cmCommand); diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index e830aa873..bde07b745 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -31,14 +31,13 @@ public: const std::map* validDeps); /** Virtual destructor to cleanup subclasses properly. */ - virtual ~cmDependsC(); + ~cmDependsC() CM_OVERRIDE; protected: // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const std::set& sources, - const std::string& obj, - std::ostream& makeDepends, - std::ostream& internalDepends); + bool WriteDependencies(const std::set& sources, + const std::string& obj, std::ostream& makeDepends, + std::ostream& internalDepends) CM_OVERRIDE; // Method to scan a single file. void Scan(std::istream& is, const char* directory, diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 5ff0b6c58..f4385ebb9 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -34,7 +34,7 @@ public: cmDependsFortran(cmLocalGenerator* lg); /** Virtual destructor to cleanup subclasses properly. */ - virtual ~cmDependsFortran(); + ~cmDependsFortran() CM_OVERRIDE; /** Callback from build system after a .mod file has been generated by a Fortran90 compiler to copy the .mod file to the @@ -48,8 +48,8 @@ public: protected: // Finalize the dependency information for the target. - virtual bool Finalize(std::ostream& makeDepends, - std::ostream& internalDepends); + bool Finalize(std::ostream& makeDepends, + std::ostream& internalDepends) CM_OVERRIDE; // Find all the modules required by the target. void LocateModules(); @@ -59,10 +59,9 @@ protected: bool FindModule(std::string const& name, std::string& module); // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const std::set& sources, - const std::string& file, - std::ostream& makeDepends, - std::ostream& internalDepends); + bool WriteDependencies(const std::set& sources, + const std::string& file, std::ostream& makeDepends, + std::ostream& internalDepends) CM_OVERRIDE; // Actually write the depenencies to the streams. bool WriteDependenciesReal(const char* obj, cmFortranSourceInfo const& info, diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 44723fa63..5bb3039d0 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -25,17 +25,16 @@ public: cmDependsJava(); /** Virtual destructor to cleanup subclasses properly. */ - virtual ~cmDependsJava(); + ~cmDependsJava() CM_OVERRIDE; protected: // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const std::set& sources, - const std::string& file, - std::ostream& makeDepends, - std::ostream& internalDepends); - virtual bool CheckDependencies( + bool WriteDependencies(const std::set& sources, + const std::string& file, std::ostream& makeDepends, + std::ostream& internalDepends) CM_OVERRIDE; + bool CheckDependencies( std::istream& internalDepends, const char* internalDependsFileName, - std::map& validDeps); + std::map& validDeps) CM_OVERRIDE; private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index 815825e24..9acf4d88d 100644 --- a/Source/cmElseCommand.h +++ b/Source/cmElseCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmElseCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmElseCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "else"; } + std::string GetName() const CM_OVERRIDE { return "else"; } cmTypeMacro(cmElseCommand, cmCommand); }; diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index d0ffa5d93..19c188570 100644 --- a/Source/cmElseIfCommand.h +++ b/Source/cmElseIfCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmElseIfCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmElseIfCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "elseif"; } + std::string GetName() const CM_OVERRIDE { return "elseif"; } cmTypeMacro(cmElseIfCommand, cmCommand); }; diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 657e4e5e1..31b609568 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -28,19 +28,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEnableLanguageCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEnableLanguageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "enable_language"; } + std::string GetName() const CM_OVERRIDE { return "enable_language"; } cmTypeMacro(cmEnableLanguageCommand, cmCommand); }; diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index a518f185d..8c8ffbf1d 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -33,19 +33,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEnableTestingCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEnableTestingCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, - cmExecutionStatus&); + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "enable_testing"; } + std::string GetName() const CM_OVERRIDE { return "enable_testing"; } cmTypeMacro(cmEnableTestingCommand, cmCommand); }; diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index ebc794f3b..b2c47b21d 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -25,20 +25,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEndForEachCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; } /** * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&); + bool InvokeInitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -46,12 +47,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "endforeach"; } + std::string GetName() const CM_OVERRIDE { return "endforeach"; } cmTypeMacro(cmEndForEachCommand, cmCommand); }; diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index b69dec028..856fdc568 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -25,20 +25,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEndFunctionCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; } /** * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&); + bool InvokeInitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -46,12 +47,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "endfunction"; } + std::string GetName() const CM_OVERRIDE { return "endfunction"; } cmTypeMacro(cmEndFunctionCommand, cmCommand); }; diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 457dfd3dc..13cf6f663 100644 --- a/Source/cmEndIfCommand.h +++ b/Source/cmEndIfCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEndIfCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEndIfCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "endif"; } + std::string GetName() const CM_OVERRIDE { return "endif"; } cmTypeMacro(cmEndIfCommand, cmCommand); }; diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index 615e8dc6c..e176eafa6 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -25,20 +25,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEndMacroCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; } /** * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&); + bool InvokeInitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -46,12 +47,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "endmacro"; } + std::string GetName() const CM_OVERRIDE { return "endmacro"; } cmTypeMacro(cmEndMacroCommand, cmCommand); }; diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 5eda7af6e..6b725140c 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -25,20 +25,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmEndWhileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; } /** * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InvokeInitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -46,12 +47,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "endwhile"; } + std::string GetName() const CM_OVERRIDE { return "endwhile"; } cmTypeMacro(cmEndWhileCommand, cmCommand); }; diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index e6e76d21a..ef87aacdd 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -27,24 +27,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmExecProgramCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmExecProgramCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "exec_program"; } + std::string GetName() const CM_OVERRIDE { return "exec_program"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmExecProgramCommand, cmCommand); diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index a89e7059a..61687efc8 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -26,24 +26,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmExecuteProcessCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmExecuteProcessCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "execute_process"; } + std::string GetName() const CM_OVERRIDE { return "execute_process"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmExecuteProcessCommand, cmCommand); }; diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index be3c70a2e..417e8c928 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -50,14 +50,14 @@ public: protected: // Implement virtual methods from the superclass. - virtual bool GenerateMainFile(std::ostream& os); - virtual void GenerateImportTargetsConfig( + bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; + void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, - std::vector& missingTargets); - virtual void HandleMissingTarget(std::string& link_libs, - std::vector& missingTargets, - cmGeneratorTarget* depender, - cmGeneratorTarget* dependee); + std::vector& missingTargets) CM_OVERRIDE; + void HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee) CM_OVERRIDE; void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, @@ -70,7 +70,7 @@ protected: ImportPropertyMap& properties); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config); + const std::string& config) CM_OVERRIDE; std::vector FindNamespaces(cmGlobalGenerator* gg, const std::string& name); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index a71393aaa..0a149af51 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -30,19 +30,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmExportCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmExportCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "export"; } + std::string GetName() const CM_OVERRIDE { return "export"; } cmTypeMacro(cmExportCommand, cmCommand); diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 723b6e5ff..68960dbe0 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -52,16 +52,16 @@ public: protected: // Implement virtual methods from the superclass. - virtual bool GenerateMainFile(std::ostream& os); - virtual void GenerateImportTargetsConfig( + bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; + void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, - std::vector& missingTargets); - virtual void HandleMissingTarget(std::string& link_libs, - std::vector& missingTargets, - cmGeneratorTarget* depender, - cmGeneratorTarget* dependee); + std::vector& missingTargets) CM_OVERRIDE; + void HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee) CM_OVERRIDE; - virtual void ReplaceInstallPrefix(std::string& input); + void ReplaceInstallPrefix(std::string& input) CM_OVERRIDE; void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, @@ -82,7 +82,7 @@ protected: std::set& importedLocations); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config); + const std::string& config) CM_OVERRIDE; cmInstallExportGenerator* IEGen; diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 3fb35650b..4b3dc92ae 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -18,13 +18,19 @@ class cmExportLibraryDependenciesCommand : public cmCommand { public: cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand); - virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "export_library_dependencies"; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmExportLibraryDependenciesCommand; + } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE + { + return "export_library_dependencies"; + } - virtual void FinalPass(); - virtual bool HasFinalPass() const { return true; } + void FinalPass() CM_OVERRIDE; + bool HasFinalPass() const CM_OVERRIDE { return true; } private: std::string Filename; diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 26f4db14a..1d13711da 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -28,15 +28,15 @@ public: void SetConfig(const std::string& config) { this->Config = config; } protected: // Implement virtual methods from the superclass. - virtual bool GenerateMainFile(std::ostream& os); + bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; - virtual void GenerateImportTargetsConfig(std::ostream&, const std::string&, - std::string const&, - std::vector&) + void GenerateImportTargetsConfig(std::ostream&, const std::string&, + std::string const&, + std::vector&) CM_OVERRIDE { } - virtual void HandleMissingTarget(std::string&, std::vector&, - cmGeneratorTarget*, cmGeneratorTarget*) + void HandleMissingTarget(std::string&, std::vector&, + cmGeneratorTarget*, cmGeneratorTarget*) CM_OVERRIDE { } @@ -45,7 +45,7 @@ protected: std::set& emitted); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config); + const std::string& config) CM_OVERRIDE; private: std::string FindTargets(const std::string& prop, diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index fe4f513eb..31ea50020 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -28,7 +28,7 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator public: cmExtraCodeBlocksGenerator(); - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmExtraCodeBlocksGenerator::GetActualName(); } @@ -38,10 +38,10 @@ public: return new cmExtraCodeBlocksGenerator; } /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; private: struct CbpUnit diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 01ff31f90..f2ee85c98 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -36,7 +36,7 @@ protected: public: cmExtraCodeLiteGenerator(); - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmExtraCodeLiteGenerator::GetActualName(); } @@ -46,10 +46,10 @@ public: return new cmExtraCodeLiteGenerator; } /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; void CreateProjectFile(const std::vector& lgs); void CreateNewProjectFile(const std::vector& lgs, diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 0cef0717b..ff6e4b65f 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -40,19 +40,19 @@ public: return new cmExtraEclipseCDT4Generator; } - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmExtraEclipseCDT4Generator::GetActualName(); } static std::string GetActualName() { return "Eclipse CDT4"; } - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; - virtual void EnableLanguage(std::vector const& languages, - cmMakefile*, bool optional); + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; + void EnableLanguage(std::vector const& languages, cmMakefile*, + bool optional) CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; private: // create .project file in the source tree diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 71e88a906..410d55210 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -26,7 +26,7 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator public: cmExtraKateGenerator(); - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmExtraKateGenerator::GetActualName(); } @@ -36,10 +36,10 @@ public: return new cmExtraKateGenerator; } /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; private: void CreateKateProjectFile(const cmLocalGenerator* lg) const; diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 6efec7a76..26dd13841 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -30,7 +30,7 @@ public: typedef std::map > MapSourceFileFlags; cmExtraSublimeTextGenerator(); - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmExtraSublimeTextGenerator::GetActualName(); } @@ -40,10 +40,10 @@ public: return new cmExtraSublimeTextGenerator; } /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; private: void CreateProjectFile(const std::vector& lgs); diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index 2e6005161..72b468ed6 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -28,14 +28,14 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFLTKWrapUICommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFLTKWrapUICommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This is called at the end after all the information @@ -43,13 +43,13 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - virtual void FinalPass(); - virtual bool HasFinalPass() const { return true; } + void FinalPass() CM_OVERRIDE; + bool HasFinalPass() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "fltk_wrap_ui"; } + std::string GetName() const CM_OVERRIDE { return "fltk_wrap_ui"; } private: /** diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6abc23858..c1fca517c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1615,7 +1615,7 @@ struct cmFileInstaller : public cmFileCopier this->Manifest = this->Makefile->GetSafeDefinition("CMAKE_INSTALL_MANIFEST_FILES"); } - ~cmFileInstaller() + ~cmFileInstaller() CM_OVERRIDE { // Save the updated install manifest. this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES", @@ -1640,12 +1640,12 @@ protected: this->Manifest += file.substr(this->DestDirLength); } - virtual std::string const& ToName(std::string const& fromName) + std::string const& ToName(std::string const& fromName) CM_OVERRIDE { return this->Rename.empty() ? fromName : this->Rename; } - virtual void ReportCopy(const char* toFile, Type type, bool copy) + void ReportCopy(const char* toFile, Type type, bool copy) CM_OVERRIDE { if (!this->MessageNever && (copy || !this->MessageLazy)) { std::string message = (copy ? "Installing: " : "Up-to-date: "); @@ -1657,11 +1657,11 @@ protected: this->ManifestAppend(toFile); } } - virtual bool ReportMissing(const char* fromFile) + bool ReportMissing(const char* fromFile) CM_OVERRIDE { return (this->Optional || this->cmFileCopier::ReportMissing(fromFile)); } - virtual bool Install(const char* fromFile, const char* toFile) + bool Install(const char* fromFile, const char* toFile) CM_OVERRIDE { // Support installing from empty source to make a directory. if (this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { @@ -1670,16 +1670,16 @@ protected: return this->cmFileCopier::Install(fromFile, toFile); } - virtual bool Parse(std::vector const& args); + bool Parse(std::vector const& args) CM_OVERRIDE; enum { DoingType = DoingLast1, DoingRename, DoingLast2 }; - virtual bool CheckKeyword(std::string const& arg); - virtual bool CheckValue(std::string const& arg); - virtual void DefaultFilePermissions() + bool CheckKeyword(std::string const& arg) CM_OVERRIDE; + bool CheckValue(std::string const& arg) CM_OVERRIDE; + void DefaultFilePermissions() CM_OVERRIDE { this->cmFileCopier::DefaultFilePermissions(); // Add execute permissions based on the target type. diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 84bb4564e..9121d3c66 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -26,24 +26,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "file"; } + std::string GetName() const CM_OVERRIDE { return "file"; } cmTypeMacro(cmFileCommand, cmCommand); diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index ebec88405..0f8d82635 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -27,7 +27,7 @@ class cmFindCommon : public cmCommand { public: cmFindCommon(); - ~cmFindCommon(); + ~cmFindCommon() CM_OVERRIDE; cmTypeMacro(cmFindCommon, cmCommand); protected: diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 74b01f1e3..68bd5b993 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -29,8 +29,8 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFindFileCommand; } - virtual std::string GetName() const { return "find_file"; } + cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; } + std::string GetName() const CM_OVERRIDE { return "find_file"; } cmTypeMacro(cmFindFileCommand, cmFindPathCommand); }; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index a08e15124..813decd50 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -28,24 +28,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFindLibraryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFindLibraryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "find_library"; } + std::string GetName() const CM_OVERRIDE { return "find_library"; } cmTypeMacro(cmFindLibraryCommand, cmFindBase); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index d074b055f..c133fcfc6 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1566,7 +1566,7 @@ public: } private: - bool Visit(std::string const& fullPath) + bool Visit(std::string const& fullPath) CM_OVERRIDE { if (this->UseSuffixes) { return this->FPC->SearchDirectory(fullPath); @@ -1616,12 +1616,12 @@ public: private: std::string String; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { std::string fullPath = parent + this->String; return this->Consider(fullPath, lister); } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorFixed(*this)); @@ -1645,7 +1645,7 @@ public: private: std::vector const& Vector; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { for (std::vector::const_iterator i = this->Vector.begin(); i != this->Vector.end(); ++i) { @@ -1655,7 +1655,7 @@ private: } return false; } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorEnumerate(*this)); @@ -1679,7 +1679,7 @@ public: private: std::vector const& Names; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { // Construct a list of matches. std::vector matches; @@ -1706,7 +1706,7 @@ private: } return false; } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorProject(*this)); @@ -1734,7 +1734,7 @@ public: private: std::vector const& Names; std::string Extension; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { // Construct a list of matches. std::vector matches; @@ -1763,7 +1763,7 @@ private: } return false; } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorMacProject(*this)); @@ -1788,7 +1788,7 @@ public: private: std::string String; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { // Look for matching files. std::vector matches; @@ -1807,7 +1807,7 @@ private: } return false; } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorCaseInsensitive(*this)); @@ -1831,7 +1831,7 @@ public: private: std::string Pattern; - virtual bool Search(std::string const& parent, cmFileList& lister) + bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE { // Glob the set of matching files. std::string expr = parent; @@ -1853,7 +1853,7 @@ private: } return false; } - virtual cmsys::auto_ptr Clone() const + cmsys::auto_ptr Clone() const CM_OVERRIDE { cmsys::auto_ptr g( new cmFileListGeneratorGlob(*this)); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 2d14be2b0..087107ee9 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -29,24 +29,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFindPackageCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFindPackageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "find_package"; } + std::string GetName() const CM_OVERRIDE { return "find_package"; } cmTypeMacro(cmFindPackageCommand, cmFindCommon); diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index e14626a78..52ce3b0d0 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -28,24 +28,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFindPathCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFindPathCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "find_path"; } + std::string GetName() const CM_OVERRIDE { return "find_path"; } cmTypeMacro(cmFindPathCommand, cmFindBase); bool IncludeFileInPath; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 3f2ac0ed4..1953f5901 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -29,24 +29,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFindProgramCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFindProgramCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "find_program"; } + std::string GetName() const CM_OVERRIDE { return "find_program"; } cmTypeMacro(cmFindProgramCommand, cmFindBase); diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 60956aaf7..887e6e918 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -21,10 +21,10 @@ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: cmForEachFunctionBlocker(cmMakefile* mf); - ~cmForEachFunctionBlocker(); - virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&); - virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf); + ~cmForEachFunctionBlocker() CM_OVERRIDE; + bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; std::vector Args; std::vector Functions; @@ -41,24 +41,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmForEachCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmForEachCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "foreach"; } + std::string GetName() const CM_OVERRIDE { return "foreach"; } cmTypeMacro(cmForEachCommand, cmCommand); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index de9887e50..40c54dbdc 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -20,7 +20,7 @@ public: cmFunctionHelperCommand() {} ///! clean up any memory allocated by the function - ~cmFunctionHelperCommand() {} + ~cmFunctionHelperCommand() CM_OVERRIDE {} /** * This is used to avoid including this command @@ -28,12 +28,12 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() const { return false; } + bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; } /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmFunctionHelperCommand* newC = new cmFunctionHelperCommand; // we must copy when we clone @@ -47,16 +47,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InvokeInitialPass(const std::vector& args, - cmExecutionStatus&); + bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus&) CM_OVERRIDE; - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -64,7 +65,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return this->Args[0]; } + std::string GetName() const CM_OVERRIDE { return this->Args[0]; } cmTypeMacro(cmFunctionHelperCommand, cmCommand); diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 08f7f0fed..2c7a88473 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -20,10 +20,10 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: cmFunctionFunctionBlocker() { this->Depth = 0; } - virtual ~cmFunctionFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, - cmExecutionStatus&); - virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf); + ~cmFunctionFunctionBlocker() CM_OVERRIDE {} + bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; + bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE; std::vector Args; std::vector Functions; @@ -37,24 +37,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmFunctionCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmFunctionCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "function"; } + std::string GetName() const CM_OVERRIDE { return "function"; } cmTypeMacro(cmFunctionCommand, cmCommand); }; diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index a2de5bc73..3480c5bca 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -99,7 +99,7 @@ public: * file was successfully written before allowing the original to be * replaced. */ - ~cmGeneratedFileStream(); + ~cmGeneratedFileStream() CM_OVERRIDE; /** * Open an output file by name. This should be used only with a diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 7ca62c5b6..58e732b92 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -52,12 +52,15 @@ struct TextContent : public cmGeneratorExpressionEvaluator } std::string Evaluate(cmGeneratorExpressionContext*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return std::string(this->Content, this->Length); } - Type GetType() const { return cmGeneratorExpressionEvaluator::Text; } + Type GetType() const CM_OVERRIDE + { + return cmGeneratorExpressionEvaluator::Text; + } void Extend(size_t length) { this->Length += length; } @@ -82,14 +85,17 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator this->ParamChildren = parameters; } - Type GetType() const { return cmGeneratorExpressionEvaluator::Generator; } + Type GetType() const CM_OVERRIDE + { + return cmGeneratorExpressionEvaluator::Generator; + } std::string Evaluate(cmGeneratorExpressionContext* context, - cmGeneratorExpressionDAGChecker*) const; + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE; std::string GetOriginalExpression() const; - ~GeneratorExpressionContent(); + ~GeneratorExpressionContent() CM_OVERRIDE; private: std::string EvaluateParameters(const cmGeneratorExpressionNode* node, diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index fd247e839..7df9cc1e2 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -17,24 +17,24 @@ class cmGetCMakePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmGetCMakePropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetCMakePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_cmake_property"; } + std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; } cmTypeMacro(cmGetCMakePropertyCommand, cmCommand); }; diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 97394ec46..1be9aa4da 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -17,24 +17,24 @@ class cmGetDirectoryPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmGetDirectoryPropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetDirectoryPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_directory_property"; } + std::string GetName() const CM_OVERRIDE { return "get_directory_property"; } cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index a114b3d7f..d8609fedb 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -26,24 +26,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmGetFilenameComponentCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetFilenameComponentCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_filename_component"; } + std::string GetName() const CM_OVERRIDE { return "get_filename_component"; } cmTypeMacro(cmGetFilenameComponentCommand, cmCommand); }; diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index aeed01d00..558226b63 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -19,24 +19,24 @@ class cmGetPropertyCommand : public cmCommand public: cmGetPropertyCommand(); - virtual cmCommand* Clone() { return new cmGetPropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_property"; } + std::string GetName() const CM_OVERRIDE { return "get_property"; } cmTypeMacro(cmGetPropertyCommand, cmCommand); diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 06f582f7e..2d2477c06 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -17,19 +17,22 @@ class cmGetSourceFilePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmGetSourceFilePropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetSourceFilePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_source_file_property"; } + std::string GetName() const CM_OVERRIDE + { + return "get_source_file_property"; + } cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand); }; diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 9a1e18e2e..3e0fe3633 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -17,19 +17,19 @@ class cmGetTargetPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmGetTargetPropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetTargetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_target_property"; } + std::string GetName() const CM_OVERRIDE { return "get_target_property"; } cmTypeMacro(cmGetTargetPropertyCommand, cmCommand); }; diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index fc281c42a..e419c9848 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -17,19 +17,19 @@ class cmGetTestPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmGetTestPropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmGetTestPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "get_test_property"; } + std::string GetName() const CM_OVERRIDE { return "get_test_property"; } cmTypeMacro(cmGetTestPropertyCommand, cmCommand); }; diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h index 7bb0e55a0..a48ff4f38 100644 --- a/Source/cmGlobalCommonGenerator.h +++ b/Source/cmGlobalCommonGenerator.h @@ -21,7 +21,7 @@ class cmGlobalCommonGenerator : public cmGlobalGenerator { public: cmGlobalCommonGenerator(cmake* cm); - ~cmGlobalCommonGenerator(); + ~cmGlobalCommonGenerator() CM_OVERRIDE; }; #endif diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 7d4fe2ce8..40678da0a 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -48,8 +48,8 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory { public: /** Create a GlobalGenerator */ - virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const + cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const CM_OVERRIDE { if (name != T::GetActualName()) { return 0; @@ -58,19 +58,19 @@ public: } /** Get the documentation entry for this factory */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const + void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE { T::GetDocumentation(entry); } /** Get the names of the current registered generators */ - virtual void GetGenerators(std::vector& names) const + void GetGenerators(std::vector& names) const CM_OVERRIDE { names.push_back(T::GetActualName()); } /** Determine whether or not this generator supports toolsets */ - virtual bool SupportsToolset() const { return T::SupportsToolset(); } + bool SupportsToolset() const CM_OVERRIDE { return T::SupportsToolset(); } }; #endif diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h index 315e38e0c..c61cafbed 100644 --- a/Source/cmGlobalKdevelopGenerator.h +++ b/Source/cmGlobalKdevelopGenerator.h @@ -33,7 +33,7 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator public: cmGlobalKdevelopGenerator(); - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmGlobalKdevelopGenerator::GetActualName(); } @@ -43,10 +43,10 @@ public: return new cmGlobalKdevelopGenerator; } /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const; + void GetDocumentation(cmDocumentationEntry& entry, + const std::string& fullName) const CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; private: /*** Create the foo.kdevelop.filelist file, return false if it doesn't diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 6d9bfe835..ea51fbf6d 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -161,11 +161,11 @@ public: return new cmGlobalGeneratorSimpleFactory(); } - virtual ~cmGlobalNinjaGenerator() {} + ~cmGlobalNinjaGenerator() CM_OVERRIDE {} - virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); + cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE; - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmGlobalNinjaGenerator::GetActualName(); } @@ -174,39 +174,44 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); - virtual void EnableLanguage(std::vector const& languages, - cmMakefile* mf, bool optional); + void EnableLanguage(std::vector const& languages, + cmMakefile* mf, bool optional) CM_OVERRIDE; - virtual void GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, - const std::string& projectName, const std::string& projectDir, - const std::string& targetName, const std::string& config, bool fast, - bool verbose, - std::vector const& makeOptions = std::vector()); + void GenerateBuildCommand(std::vector& makeCommand, + const std::string& makeProgram, + const std::string& projectName, + const std::string& projectDir, + const std::string& targetName, + const std::string& config, bool fast, bool verbose, + std::vector const& makeOptions = + std::vector()) CM_OVERRIDE; // Setup target names - virtual const char* GetAllTargetName() const { return "all"; } - virtual const char* GetInstallTargetName() const { return "install"; } - virtual const char* GetInstallLocalTargetName() const + const char* GetAllTargetName() const CM_OVERRIDE { return "all"; } + const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; } + const char* GetInstallLocalTargetName() const CM_OVERRIDE { return "install/local"; } - virtual const char* GetInstallStripTargetName() const + const char* GetInstallStripTargetName() const CM_OVERRIDE { return "install/strip"; } - virtual const char* GetTestTargetName() const { return "test"; } - virtual const char* GetPackageTargetName() const { return "package"; } - virtual const char* GetPackageSourceTargetName() const + const char* GetTestTargetName() const CM_OVERRIDE { return "test"; } + const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; } + const char* GetPackageSourceTargetName() const CM_OVERRIDE { return "package_source"; } - virtual const char* GetEditCacheTargetName() const { return "edit_cache"; } - virtual const char* GetRebuildCacheTargetName() const + const char* GetEditCacheTargetName() const CM_OVERRIDE + { + return "edit_cache"; + } + const char* GetRebuildCacheTargetName() const CM_OVERRIDE { return "rebuild_cache"; } - virtual const char* GetCleanTargetName() const { return "clean"; } + const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; } cmGeneratedFileStream* GetBuildFileStream() const { @@ -307,7 +312,7 @@ public: void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target); - virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3 static std::string RequiredNinjaVersion() { return "1.3"; } @@ -319,13 +324,13 @@ public: void StripNinjaOutputPathPrefixAsSuffix(std::string& path); protected: - virtual void Generate(); + void Generate() CM_OVERRIDE; - virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; } + bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; } private: - virtual std::string GetEditCacheCommand() const; - virtual void FindMakeProgram(cmMakefile* mf); + std::string GetEditCacheCommand() const CM_OVERRIDE; + void FindMakeProgram(cmMakefile* mf) CM_OVERRIDE; void OpenBuildFileStream(); void CloseBuildFileStream(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index f951b2a8f..98969ff96 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -63,7 +63,7 @@ public: } ///! Get the name for the generator. - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmGlobalUnixMakefileGenerator3::GetActualName(); } @@ -78,23 +78,23 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); + cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE; /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vector const& languages, - cmMakefile*, bool optional); + void EnableLanguage(std::vector const& languages, cmMakefile*, + bool optional) CM_OVERRIDE; - virtual void Configure(); + void Configure() CM_OVERRIDE; /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and * requests that they Generate. */ - virtual void Generate(); + void Generate() CM_OVERRIDE; void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream, std::vector&); @@ -116,12 +116,14 @@ public: std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; } // change the build command for speed - virtual void GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, - const std::string& projectName, const std::string& projectDir, - const std::string& targetName, const std::string& config, bool fast, - bool verbose, - std::vector const& makeOptions = std::vector()); + void GenerateBuildCommand(std::vector& makeCommand, + const std::string& makeProgram, + const std::string& projectName, + const std::string& projectDir, + const std::string& targetName, + const std::string& config, bool fast, bool verbose, + std::vector const& makeOptions = + std::vector()) CM_OVERRIDE; /** Record per-target progress information. */ void RecordTargetProgress(cmMakefileTargetGenerator* tg); @@ -136,7 +138,7 @@ public: /** Does the make tool tolerate .DELETE_ON_ERROR? */ virtual bool AllowDeleteOnError() const { return true; } - virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; std::string IncludeDirective; bool DefineWindowsNULL; @@ -163,19 +165,37 @@ protected: bool NeedRequiresStep(cmGeneratorTarget const*); // Target name hooks for superclass. - const char* GetAllTargetName() const { return "all"; } - const char* GetInstallTargetName() const { return "install"; } - const char* GetInstallLocalTargetName() const { return "install/local"; } - const char* GetInstallStripTargetName() const { return "install/strip"; } - const char* GetPreinstallTargetName() const { return "preinstall"; } - const char* GetTestTargetName() const { return "test"; } - const char* GetPackageTargetName() const { return "package"; } - const char* GetPackageSourceTargetName() const { return "package_source"; } - const char* GetEditCacheTargetName() const { return "edit_cache"; } - const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; } - const char* GetCleanTargetName() const { return "clean"; } + const char* GetAllTargetName() const CM_OVERRIDE { return "all"; } + const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; } + const char* GetInstallLocalTargetName() const CM_OVERRIDE + { + return "install/local"; + } + const char* GetInstallStripTargetName() const CM_OVERRIDE + { + return "install/strip"; + } + const char* GetPreinstallTargetName() const CM_OVERRIDE + { + return "preinstall"; + } + const char* GetTestTargetName() const CM_OVERRIDE { return "test"; } + const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; } + const char* GetPackageSourceTargetName() const CM_OVERRIDE + { + return "package_source"; + } + const char* GetEditCacheTargetName() const CM_OVERRIDE + { + return "edit_cache"; + } + const char* GetRebuildCacheTargetName() const CM_OVERRIDE + { + return "rebuild_cache"; + } + const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; } - virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; } + bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; } // Some make programs (Borland) do not keep a rule if there are no // dependencies or commands. This is a problem for creating rules @@ -214,13 +234,13 @@ protected: cmGeneratedFileStream* CommandDatabase; private: - virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; } - virtual std::string GetEditCacheCommand() const; + const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; } + std::string GetEditCacheCommand() const CM_OVERRIDE; std::map, cmState::Snapshot::StrictWeakOrder> DirectoryTargetsMap; - virtual void InitializeProgressMarks(); + void InitializeProgressMarks() CM_OVERRIDE; }; #endif diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 39549071b..bc0d786ae 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -28,7 +28,7 @@ public: return new cmGlobalGeneratorSimpleFactory(); } ///! Get the name for the generator. - virtual std::string GetName() const + std::string GetName() const CM_OVERRIDE { return cmGlobalWatcomWMakeGenerator::GetActualName(); } @@ -41,11 +41,11 @@ public: * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vector const& languages, - cmMakefile*, bool optional); + void EnableLanguage(std::vector const& languages, cmMakefile*, + bool optional) CM_OVERRIDE; - virtual bool AllowNotParallel() const { return false; } - virtual bool AllowDeleteOnError() const { return false; } + bool AllowNotParallel() const CM_OVERRIDE { return false; } + bool AllowDeleteOnError() const CM_OVERRIDE { return false; } }; #endif diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 54200df84..f1f979d11 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -24,10 +24,10 @@ public: this->HasRun = false; this->ScopeDepth = 0; } - virtual ~cmIfFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&); - virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf); + ~cmIfFunctionBlocker() CM_OVERRIDE {} + bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; std::vector Args; std::vector Functions; @@ -43,20 +43,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmIfCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmIfCommand; } /** * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ - virtual bool InvokeInitialPass(const std::vector& args, - cmExecutionStatus&); + bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -64,12 +65,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "if"; } + std::string GetName() const CM_OVERRIDE { return "if"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } // Filter the given variable definition based on policy CMP0054. static const char* GetDefinitionIfUnquoted( diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index e319dbd20..365a8304d 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -26,24 +26,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmIncludeCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmIncludeCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "include"; } + std::string GetName() const CM_OVERRIDE { return "include"; } cmTypeMacro(cmIncludeCommand, cmCommand); }; diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 952294b25..25be70993 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmIncludeDirectoryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmIncludeDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "include_directories"; } + std::string GetName() const CM_OVERRIDE { return "include_directories"; } cmTypeMacro(cmIncludeDirectoryCommand, cmCommand); diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 999eb9ef7..8cda7b9fc 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -27,19 +27,25 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmIncludeExternalMSProjectCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmIncludeExternalMSProjectCommand; + } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "include_external_msproject"; } + std::string GetName() const CM_OVERRIDE + { + return "include_external_msproject"; + } cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); }; diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 1071a7a9d..52fdff0e2 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -26,19 +26,25 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmIncludeRegularExpressionCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmIncludeRegularExpressionCommand; + } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "include_regular_expression"; } + std::string GetName() const CM_OVERRIDE + { + return "include_regular_expression"; + } cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand); }; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 93aca4567..3718ad5f9 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmInstallCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmInstallCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "install"; } + std::string GetName() const CM_OVERRIDE { return "install"; } cmTypeMacro(cmInstallCommand, cmCommand); diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 10d7c9576..93becf4dc 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -27,17 +27,17 @@ public: const char* component, MessageLevel message, bool exclude_from_all, const char* literal_args, bool optional = false); - virtual ~cmInstallDirectoryGenerator(); + ~cmInstallDirectoryGenerator() CM_OVERRIDE; - void Compute(cmLocalGenerator* lg); + void Compute(cmLocalGenerator* lg) CM_OVERRIDE; std::string GetDestination(std::string const& config) const; protected: - virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); - virtual void GenerateScriptForConfig(std::ostream& os, - const std::string& config, - Indent const& indent); + void GenerateScriptActions(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent const& indent) CM_OVERRIDE; void AddDirectoryInstallRule(std::ostream& os, const std::string& config, Indent const& indent, std::vector const& dirs); diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 256c0c9cf..4435f538b 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -32,11 +32,11 @@ public: const char* component, MessageLevel message, bool exclude_from_all, const char* filename, const char* name_space, bool exportOld); - ~cmInstallExportGenerator(); + ~cmInstallExportGenerator() CM_OVERRIDE; cmExportSet* GetExportSet() { return this->ExportSet; } - void Compute(cmLocalGenerator* lg); + void Compute(cmLocalGenerator* lg) CM_OVERRIDE; cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; } @@ -45,9 +45,11 @@ public: std::string const& GetDestination() const { return this->Destination; } protected: - virtual void GenerateScript(std::ostream& os); - virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); - virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + void GenerateScript(std::ostream& os) CM_OVERRIDE; + void GenerateScriptConfigs(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, + Indent const& indent) CM_OVERRIDE; void GenerateImportFile(cmExportSet const* exportSet); void GenerateImportFile(const char* config, cmExportSet const* exportSet); void ComputeTempDir(); diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 0d0388a86..cf2c9ffb9 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmInstallFilesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmInstallFilesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "install_files"; } + std::string GetName() const CM_OVERRIDE { return "install_files"; } /** * This is called at the end after all the information @@ -46,8 +46,8 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - virtual void FinalPass(); - virtual bool HasFinalPass() const { return !this->IsFilesForm; } + void FinalPass() CM_OVERRIDE; + bool HasFinalPass() const CM_OVERRIDE { return !this->IsFilesForm; } cmTypeMacro(cmInstallFilesCommand, cmCommand); diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 0e738d396..5cb09f45e 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -27,17 +27,17 @@ public: const char* component, MessageLevel message, bool exclude_from_all, const char* rename, bool optional = false); - virtual ~cmInstallFilesGenerator(); + ~cmInstallFilesGenerator() CM_OVERRIDE; - void Compute(cmLocalGenerator* lg); + void Compute(cmLocalGenerator* lg) CM_OVERRIDE; std::string GetDestination(std::string const& config) const; protected: - virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); - virtual void GenerateScriptForConfig(std::ostream& os, - const std::string& config, - Indent const& indent); + void GenerateScriptActions(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent const& indent) CM_OVERRIDE; void AddFilesInstallRule(std::ostream& os, std::string const& config, Indent const& indent, std::vector const& files); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index e271d53cb..b003e783e 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -37,7 +37,7 @@ public: std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all); - virtual ~cmInstallGenerator(); + ~cmInstallGenerator() CM_OVERRIDE; void AddInstallRule(std::ostream& os, std::string const& dest, cmInstallType type, @@ -60,7 +60,7 @@ public: virtual void Compute(cmLocalGenerator*) {} protected: - virtual void GenerateScript(std::ostream& os); + void GenerateScript(std::ostream& os) CM_OVERRIDE; std::string CreateComponentTest(const char* component, bool exclude_from_all); diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index b104c6916..b56a9b19d 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmInstallProgramsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmInstallProgramsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "install_programs"; } + std::string GetName() const CM_OVERRIDE { return "install_programs"; } /** * This is called at the end after all the information @@ -46,9 +46,9 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - virtual void FinalPass(); + void FinalPass() CM_OVERRIDE; - virtual bool HasFinalPass() const { return true; } + bool HasFinalPass() const CM_OVERRIDE { return true; } cmTypeMacro(cmInstallProgramsCommand, cmCommand); diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index ff2f2fa89..dc00359f3 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -22,10 +22,10 @@ class cmInstallScriptGenerator : public cmInstallGenerator public: cmInstallScriptGenerator(const char* script, bool code, const char* component, bool exclude_from_all); - virtual ~cmInstallScriptGenerator(); + ~cmInstallScriptGenerator() CM_OVERRIDE; protected: - virtual void GenerateScript(std::ostream& os); + void GenerateScript(std::ostream& os) CM_OVERRIDE; std::string Script; bool Code; }; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 2fd85b5f2..b1c28b8ed 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -27,7 +27,7 @@ public: std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, bool optional); - virtual ~cmInstallTargetGenerator(); + ~cmInstallTargetGenerator() CM_OVERRIDE; /** Select the policy for installing shared library linkable name symlinks. */ @@ -54,7 +54,7 @@ public: const std::string& config, NameType nameType = NameNormal); - void Compute(cmLocalGenerator* lg); + void Compute(cmLocalGenerator* lg) CM_OVERRIDE; cmGeneratorTarget* GetTarget() const { return this->Target; } @@ -63,10 +63,9 @@ public: std::string GetDestination(std::string const& config) const; protected: - virtual void GenerateScript(std::ostream& os); - virtual void GenerateScriptForConfig(std::ostream& os, - const std::string& config, - Indent const& indent); + void GenerateScript(std::ostream& os) CM_OVERRIDE; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent const& indent) CM_OVERRIDE; typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&, Indent const&, const std::string&, diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index b0d04b0a6..b7d7f33d8 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmInstallTargetsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmInstallTargetsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "install_targets"; } + std::string GetName() const CM_OVERRIDE { return "install_targets"; } cmTypeMacro(cmInstallTargetsCommand, cmCommand); }; diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index 7014a6905..721d66354 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -28,19 +28,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmLinkDirectoriesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmLinkDirectoriesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "link_directories"; } + std::string GetName() const CM_OVERRIDE { return "link_directories"; } cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 6ab50ce45..45cc4d7ae 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmLinkLibrariesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmLinkLibrariesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "link_libraries"; } + std::string GetName() const CM_OVERRIDE { return "link_libraries"; } cmTypeMacro(cmLinkLibrariesCommand, cmCommand); }; diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 56d9694ad..1c33c9689 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -24,24 +24,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmListCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmListCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "list"; } + std::string GetName() const CM_OVERRIDE { return "list"; } cmTypeMacro(cmListCommand, cmCommand); diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 67d93acc6..075580903 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmLoadCacheCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmLoadCacheCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "load_cache"; } + std::string GetName() const CM_OVERRIDE { return "load_cache"; } cmTypeMacro(cmLoadCacheCommand, cmCommand); diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 081c22ea3..c2a5d4644 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -37,12 +37,12 @@ public: } ///! clean up any memory allocated by the plugin - ~cmLoadedCommand(); + ~cmLoadedCommand() CM_OVERRIDE; /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmLoadedCommand* newC = new cmLoadedCommand; // we must copy when we clone @@ -54,8 +54,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus&); + bool InitialPass(std::vector const& args, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called at the end after all the information @@ -63,8 +63,8 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - virtual void FinalPass(); - virtual bool HasFinalPass() const + void FinalPass() CM_OVERRIDE; + bool HasFinalPass() const CM_OVERRIDE { return this->info.FinalPass ? true : false; } @@ -72,7 +72,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return info.Name; } + std::string GetName() const CM_OVERRIDE { return info.Name; } static const char* LastName; static void TrapsForSignals(int sig) diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index e00a01e62..6552845b8 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -17,10 +17,10 @@ class cmLoadCommandCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmLoadCommandCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "load_command"; } + cmCommand* Clone() CM_OVERRIDE { return new cmLoadCommandCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "load_command"; } cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index fd17ae380..0a8753d2c 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -24,7 +24,7 @@ class cmLocalCommonGenerator : public cmLocalGenerator public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd); - ~cmLocalCommonGenerator(); + ~cmLocalCommonGenerator() CM_OVERRIDE; std::string const& GetConfigName() { return this->ConfigName; } @@ -34,7 +34,7 @@ public: } std::string GetTargetFortranFlags(cmGeneratorTarget const* target, - std::string const& config); + std::string const& config) CM_OVERRIDE; protected: cmOutputConverter::RelativeRoot WorkingDirectory; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 98993604b..75da32890 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -34,12 +34,12 @@ class cmLocalNinjaGenerator : public cmLocalCommonGenerator public: cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf); - virtual ~cmLocalNinjaGenerator(); + ~cmLocalNinjaGenerator() CM_OVERRIDE; - virtual void Generate(); + void Generate() CM_OVERRIDE; - virtual std::string GetTargetDirectory( - cmGeneratorTarget const* target) const; + std::string GetTargetDirectory(cmGeneratorTarget const* target) const + CM_OVERRIDE; const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const; cmGlobalNinjaGenerator* GetGlobalNinjaGenerator(); @@ -72,19 +72,19 @@ public: void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps); - virtual std::string ConvertToLinkReference( - std::string const& lib, - cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL); + std::string ConvertToLinkReference(std::string const& lib, + cmOutputConverter::OutputFormat format = + cmOutputConverter::SHELL) CM_OVERRIDE; - virtual void ComputeObjectFilenames( + void ComputeObjectFilenames( std::map& mapping, - cmGeneratorTarget const* gt = 0); + cmGeneratorTarget const* gt = 0) CM_OVERRIDE; protected: - virtual std::string ConvertToIncludeReference( + std::string ConvertToIncludeReference( std::string const& path, cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL, - bool forceFullPaths = false); + bool forceFullPaths = false) CM_OVERRIDE; private: cmGeneratedFileStream& GetBuildFileStream() const; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index a65a1a1cf..319a587cf 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -33,14 +33,14 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf); - virtual ~cmLocalUnixMakefileGenerator3(); + ~cmLocalUnixMakefileGenerator3() CM_OVERRIDE; - virtual void ComputeHomeRelativeOutputPath(); + void ComputeHomeRelativeOutputPath() CM_OVERRIDE; /** * Generate the makefile for this directory. */ - virtual void Generate(); + void Generate() CM_OVERRIDE; // this returns the relative path between the HomeOutputDirectory and this // local generators StartOutputDirectory @@ -90,8 +90,9 @@ public: const std::string& tgt); // append flags to a string - virtual void AppendFlags(std::string& flags, const std::string& newFlags); - virtual void AppendFlags(std::string& flags, const char* newFlags); + void AppendFlags(std::string& flags, + const std::string& newFlags) CM_OVERRIDE; + void AppendFlags(std::string& flags, const char* newFlags) CM_OVERRIDE; // append an echo command enum EchoColor @@ -114,8 +115,8 @@ public: /** Get whether the makefile is to have color. */ bool GetColorMakefile() const { return this->ColorMakefile; } - virtual std::string GetTargetDirectory( - cmGeneratorTarget const* target) const; + std::string GetTargetDirectory(cmGeneratorTarget const* target) const + CM_OVERRIDE; // create a command that cds to the start dir then runs the commands void CreateCDCommand(std::vector& commands, @@ -130,11 +131,11 @@ public: /** Called from command-line hook to bring dependencies up to date for a target. */ - virtual bool UpdateDependencies(const char* tgtInfo, bool verbose, - bool color); + bool UpdateDependencies(const char* tgtInfo, bool verbose, + bool color) CM_OVERRIDE; /** Called from command-line hook to clear dependencies. */ - virtual void ClearDependencies(cmMakefile* mf, bool verbose); + void ClearDependencies(cmMakefile* mf, bool verbose) CM_OVERRIDE; /** write some extra rules such as make test etc */ void WriteSpecialTargetsTop(std::ostream& makefileStream); @@ -253,9 +254,9 @@ private: cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative); - virtual void ComputeObjectFilenames( + void ComputeObjectFilenames( std::map& mapping, - cmGeneratorTarget const* gt = 0); + cmGeneratorTarget const* gt = 0) CM_OVERRIDE; friend class cmMakefileTargetGenerator; friend class cmMakefileExecutableTargetGenerator; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 2caa401e8..ee9dc8af7 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -21,7 +21,7 @@ public: cmMacroHelperCommand() {} ///! clean up any memory allocated by the macro - ~cmMacroHelperCommand() {} + ~cmMacroHelperCommand() CM_OVERRIDE {} /** * This is used to avoid including this command @@ -29,12 +29,12 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() const { return false; } + bool ShouldAppearInDocumentation() const CM_OVERRIDE { return false; } /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmMacroHelperCommand* newC = new cmMacroHelperCommand; // we must copy when we clone @@ -48,16 +48,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InvokeInitialPass(const std::vector& args, - cmExecutionStatus&); + bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus&) CM_OVERRIDE; - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -65,7 +66,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return this->Args[0]; } + std::string GetName() const CM_OVERRIDE { return this->Args[0]; } cmTypeMacro(cmMacroHelperCommand, cmCommand); diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 11d2e1c4e..541b54f09 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -20,10 +20,10 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker { public: cmMacroFunctionBlocker() { this->Depth = 0; } - virtual ~cmMacroFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, - cmExecutionStatus&); - virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf); + ~cmMacroFunctionBlocker() CM_OVERRIDE {} + bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; + bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE; std::vector Args; std::vector Functions; @@ -37,24 +37,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmMacroCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmMacroCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "macro"; } + std::string GetName() const CM_OVERRIDE { return "macro"; } cmTypeMacro(cmMacroCommand, cmCommand); }; diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 1a8639893..de4ab8b2e 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -29,24 +29,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmMakeDirectoryCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmMakeDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "make_directory"; } + std::string GetName() const CM_OVERRIDE { return "make_directory"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmMakeDirectoryCommand, cmCommand); }; diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h index 64cb17f9b..39def2766 100644 --- a/Source/cmMakefileExecutableTargetGenerator.h +++ b/Source/cmMakefileExecutableTargetGenerator.h @@ -18,11 +18,11 @@ class cmMakefileExecutableTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target); - virtual ~cmMakefileExecutableTargetGenerator(); + ~cmMakefileExecutableTargetGenerator() CM_OVERRIDE; /* the main entry point for this class. Writes the Makefiles associated with this target */ - virtual void WriteRuleFiles(); + void WriteRuleFiles() CM_OVERRIDE; protected: virtual void WriteExecutableRule(bool relink); diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index f72dbd78a..935d8b19f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -18,11 +18,11 @@ class cmMakefileLibraryTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target); - virtual ~cmMakefileLibraryTargetGenerator(); + ~cmMakefileLibraryTargetGenerator() CM_OVERRIDE; /* the main entry point for this class. Writes the Makefiles associated with this target */ - virtual void WriteRuleFiles(); + void WriteRuleFiles() CM_OVERRIDE; protected: void WriteObjectLibraryRules(); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index c513026af..7749d8bd0 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -35,7 +35,7 @@ class cmMakefileTargetGenerator : public cmCommonTargetGenerator public: // constructor to set the ivars cmMakefileTargetGenerator(cmGeneratorTarget* target); - virtual ~cmMakefileTargetGenerator(); + ~cmMakefileTargetGenerator() CM_OVERRIDE; // construct using this factory call static cmMakefileTargetGenerator* New(cmGeneratorTarget* tgt); @@ -83,7 +83,8 @@ protected: { } - void operator()(cmSourceFile const& source, const char* pkgloc); + void operator()(cmSourceFile const& source, + const char* pkgloc) CM_OVERRIDE; private: cmMakefileTargetGenerator* Generator; @@ -161,7 +162,8 @@ protected: std::vector& makefile_depends, bool useWatcomQuote); - void AddIncludeFlags(std::string& flags, const std::string& lang); + void AddIncludeFlags(std::string& flags, + const std::string& lang) CM_OVERRIDE; virtual void CloseFileStreams(); void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang, diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h index dbb312c3b..b41fb8b68 100644 --- a/Source/cmMakefileUtilityTargetGenerator.h +++ b/Source/cmMakefileUtilityTargetGenerator.h @@ -18,11 +18,11 @@ class cmMakefileUtilityTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target); - virtual ~cmMakefileUtilityTargetGenerator(); + ~cmMakefileUtilityTargetGenerator() CM_OVERRIDE; /* the main entry point for this class. Writes the Makefiles associated with this target */ - virtual void WriteRuleFiles(); + void WriteRuleFiles() CM_OVERRIDE; protected: }; diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index add43c95f..bb1b83c15 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmMarkAsAdvancedCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmMarkAsAdvancedCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "mark_as_advanced"; } + std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; } /** * This determines if the command is invoked when in script mode. @@ -45,7 +45,7 @@ public: * make many of the modules usable in cmake/ctest scripts, (among them * FindUnixMake.cmake used by the CTEST_BUILD command. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand); }; diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index 3ac6f415f..b99e790bb 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -21,24 +21,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmMathCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmMathCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "math"; } + std::string GetName() const CM_OVERRIDE { return "math"; } cmTypeMacro(cmMathCommand, cmCommand); diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index afc5509b6..61767a1d6 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -24,24 +24,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmMessageCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmMessageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "message"; } + std::string GetName() const CM_OVERRIDE { return "message"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmMessageCommand, cmCommand); }; diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index 300618ce3..f466e175a 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -27,9 +27,9 @@ class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator { public: cmNinjaNormalTargetGenerator(cmGeneratorTarget* target); - ~cmNinjaNormalTargetGenerator(); + ~cmNinjaNormalTargetGenerator() CM_OVERRIDE; - void Generate(); + void Generate() CM_OVERRIDE; private: std::string LanguageLinkerRule() const; diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 44346c1b0..9740f0e08 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -37,7 +37,7 @@ public: cmNinjaTargetGenerator(cmGeneratorTarget* target); /// Destructor. - virtual ~cmNinjaTargetGenerator(); + ~cmNinjaTargetGenerator() CM_OVERRIDE; virtual void Generate() = 0; @@ -79,7 +79,8 @@ protected: std::string ComputeFlagsForObject(cmSourceFile const* source, const std::string& language); - void AddIncludeFlags(std::string& flags, std::string const& lang); + void AddIncludeFlags(std::string& flags, + std::string const& lang) CM_OVERRIDE; std::string ComputeDefines(cmSourceFile const* source, const std::string& language); @@ -134,7 +135,8 @@ protected: { } - void operator()(cmSourceFile const& source, const char* pkgloc); + void operator()(cmSourceFile const& source, + const char* pkgloc) CM_OVERRIDE; private: cmNinjaTargetGenerator* Generator; diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h index fec294696..0c33a5468 100644 --- a/Source/cmNinjaUtilityTargetGenerator.h +++ b/Source/cmNinjaUtilityTargetGenerator.h @@ -23,9 +23,9 @@ class cmNinjaUtilityTargetGenerator : public cmNinjaTargetGenerator { public: cmNinjaUtilityTargetGenerator(cmGeneratorTarget* target); - ~cmNinjaUtilityTargetGenerator(); + ~cmNinjaUtilityTargetGenerator() CM_OVERRIDE; - void Generate(); + void Generate() CM_OVERRIDE; }; #endif // ! cmNinjaUtilityTargetGenerator_h diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index 491f45e62..6e6b076f5 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmOptionCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmOptionCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "option"; } + std::string GetName() const CM_OVERRIDE { return "option"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmOptionCommand, cmCommand); }; diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 7a6f5a65e..8838d094c 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -20,10 +20,10 @@ class cmOutputRequiredFilesCommand : public cmCommand { public: cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand); - virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "output_required_files"; } + cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "output_required_files"; } void ListDependencies(cmDependInformation const* info, FILE* fout, std::set* visited); diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h index 46d9daa71..fcd9992d6 100644 --- a/Source/cmParseArgumentsCommand.h +++ b/Source/cmParseArgumentsCommand.h @@ -24,24 +24,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmParseArgumentsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmParseArgumentsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "cmake_parse_arguments"; } + std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; } cmTypeMacro(cmParseArgumentsCommand, cmCommand); }; diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index a48e52b7b..9d082b2f6 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -62,7 +62,7 @@ public: char Separator; char LineEnd; bool IgnoreCR; - virtual bool ProcessChunk(const char* data, int length); + bool ProcessChunk(const char* data, int length) CM_OVERRIDE; /** Implement in a subclass to process one line of input. It should return true only if it is interested in more data. */ @@ -79,7 +79,7 @@ public: } private: - virtual bool ProcessLine() { return true; } + bool ProcessLine() CM_OVERRIDE { return true; } }; /** Run a process and send output to given parsers. */ diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index a4e63671e..3318df1a1 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -28,19 +28,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmProjectCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmProjectCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "project"; } + std::string GetName() const CM_OVERRIDE { return "project"; } cmTypeMacro(cmProjectCommand, cmCommand); }; diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 2014828da..78d5510cd 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -30,19 +30,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmQTWrapCPPCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapCPPCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "qt_wrap_cpp"; } + std::string GetName() const CM_OVERRIDE { return "qt_wrap_cpp"; } }; #endif diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 48cfc7772..a34a7bfee 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -28,19 +28,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmQTWrapUICommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapUICommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "qt_wrap_ui"; } + std::string GetName() const CM_OVERRIDE { return "qt_wrap_ui"; } }; #endif diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index c226a543e..1deff36ef 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmRemoveCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmRemoveCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "remove"; } + std::string GetName() const CM_OVERRIDE { return "remove"; } cmTypeMacro(cmRemoveCommand, cmCommand); }; diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index b440307d7..7fb2e5fbe 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmRemoveDefinitionsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmRemoveDefinitionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "remove_definitions"; } + std::string GetName() const CM_OVERRIDE { return "remove_definitions"; } cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand); }; diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 44cd4c845..ddf361375 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmReturnCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmReturnCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "return"; } + std::string GetName() const CM_OVERRIDE { return "return"; } cmTypeMacro(cmReturnCommand, cmCommand); }; diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 47246c9d2..3c9e7d735 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmSeparateArgumentsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSeparateArgumentsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "separate_arguments"; } + std::string GetName() const CM_OVERRIDE { return "separate_arguments"; } cmTypeMacro(cmSeparateArgumentsCommand, cmCommand); }; diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 65af8acfd..b51eed0dd 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmSetCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set"; } + std::string GetName() const CM_OVERRIDE { return "set"; } cmTypeMacro(cmSetCommand, cmCommand); }; diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index a393eee99..ef476ec30 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -17,24 +17,30 @@ class cmSetDirectoryPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmSetDirectoryPropertiesCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmSetDirectoryPropertiesCommand; + } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_directory_properties"; } + std::string GetName() const CM_OVERRIDE + { + return "set_directory_properties"; + } /** * Static entry point for use by other commands diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index a85d6529f..e78b04c75 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -19,24 +19,24 @@ class cmSetPropertyCommand : public cmCommand public: cmSetPropertyCommand(); - virtual cmCommand* Clone() { return new cmSetPropertyCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_property"; } + std::string GetName() const CM_OVERRIDE { return "set_property"; } /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } cmTypeMacro(cmSetPropertyCommand, cmCommand); diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 20e6b930a..f6b4de03b 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -17,19 +17,25 @@ class cmSetSourceFilesPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmSetSourceFilesPropertiesCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmSetSourceFilesPropertiesCommand; + } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_source_files_properties"; } + std::string GetName() const CM_OVERRIDE + { + return "set_source_files_properties"; + } cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand); diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 122c15e4f..1ed8d90f6 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -17,19 +17,19 @@ class cmSetTargetPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmSetTargetPropertiesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSetTargetPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_target_properties"; } + std::string GetName() const CM_OVERRIDE { return "set_target_properties"; } /** * Used by this command and cmSetPropertiesCommand diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index e469b2aa6..712ab3683 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -17,19 +17,19 @@ class cmSetTestsPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmSetTestsPropertiesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSetTestsPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_tests_properties"; } + std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; } cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index a4812f725..7a9ca9d49 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmSiteNameCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSiteNameCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "site_name"; } + std::string GetName() const CM_OVERRIDE { return "site_name"; } cmTypeMacro(cmSiteNameCommand, cmCommand); }; diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 0458656c9..81dfad6e7 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -26,19 +26,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmSourceGroupCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSourceGroupCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "source_group"; } + std::string GetName() const CM_OVERRIDE { return "source_group"; } cmTypeMacro(cmSourceGroupCommand, cmCommand); }; diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 23d482c25..23dc9dbd2 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -29,24 +29,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmStringCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmStringCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "string"; } + std::string GetName() const CM_OVERRIDE { return "string"; } cmTypeMacro(cmStringCommand, cmCommand); diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 9da91c47b..08eb9a0b2 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmSubdirCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmSubdirCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "subdirs"; } + std::string GetName() const CM_OVERRIDE { return "subdirs"; } cmTypeMacro(cmSubdirCommand, cmCommand); }; diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index a15ee3ed2..41b27c8e8 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -17,10 +17,10 @@ class cmSubdirDependsCommand : public cmCommand { public: - virtual cmCommand* Clone() { return new cmSubdirDependsCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "subdir_depends"; } + cmCommand* Clone() CM_OVERRIDE { return new cmSubdirDependsCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "subdir_depends"; } cmTypeMacro(cmSubdirDependsCommand, cmCommand); }; diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 29d86c59d..1689a758d 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -21,30 +21,36 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTargetCompileDefinitionsCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmTargetCompileDefinitionsCommand; + } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "target_compile_definitions"; } + std::string GetName() const CM_OVERRIDE + { + return "target_compile_definitions"; + } cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase); private: - virtual void HandleImportedTarget(const std::string& tgt); - virtual void HandleMissingTarget(const std::string& name); + void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; + void HandleMissingTarget(const std::string& name) CM_OVERRIDE; - virtual bool HandleDirectContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); - virtual std::string Join(const std::vector& content); + bool HandleDirectContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; + std::string Join(const std::vector& content) CM_OVERRIDE; }; #endif diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index 3d883e9b7..4fae84a85 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -16,23 +16,23 @@ class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase { - virtual cmCommand* Clone() { return new cmTargetCompileFeaturesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileFeaturesCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; - virtual std::string GetName() const { return "target_compile_features"; } + std::string GetName() const CM_OVERRIDE { return "target_compile_features"; } cmTypeMacro(cmTargetCompileFeaturesCommand, cmTargetPropCommandBase); private: - virtual void HandleImportedTarget(const std::string& tgt); - virtual void HandleMissingTarget(const std::string& name); + void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; + void HandleMissingTarget(const std::string& name) CM_OVERRIDE; - virtual bool HandleDirectContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); - virtual std::string Join(const std::vector& content); + bool HandleDirectContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; + std::string Join(const std::vector& content) CM_OVERRIDE; }; #endif diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 231448b43..723962970 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -21,30 +21,30 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTargetCompileOptionsCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileOptionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "target_compile_options"; } + std::string GetName() const CM_OVERRIDE { return "target_compile_options"; } cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase); private: - virtual void HandleImportedTarget(const std::string& tgt); - virtual void HandleMissingTarget(const std::string& name); + void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; + void HandleMissingTarget(const std::string& name) CM_OVERRIDE; - virtual bool HandleDirectContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); - virtual std::string Join(const std::vector& content); + bool HandleDirectContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; + std::string Join(const std::vector& content) CM_OVERRIDE; }; #endif diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 4c907bd13..ba5d9800f 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -21,34 +21,40 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTargetIncludeDirectoriesCommand; } + cmCommand* Clone() CM_OVERRIDE + { + return new cmTargetIncludeDirectoriesCommand; + } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "target_include_directories"; } + std::string GetName() const CM_OVERRIDE + { + return "target_include_directories"; + } cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase); private: - virtual void HandleImportedTarget(const std::string& tgt); - virtual void HandleMissingTarget(const std::string& name); + void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; + void HandleMissingTarget(const std::string& name) CM_OVERRIDE; - virtual bool HandleDirectContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); - virtual void HandleInterfaceContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); + bool HandleDirectContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; + void HandleInterfaceContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; - virtual std::string Join(const std::vector& content); + std::string Join(const std::vector& content) CM_OVERRIDE; }; #endif diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 016993d52..4f58639e2 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -27,19 +27,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTargetLinkLibrariesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTargetLinkLibrariesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "target_link_libraries"; } + std::string GetName() const CM_OVERRIDE { return "target_link_libraries"; } cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand); diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index 304e176fb..9073204f8 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -21,31 +21,31 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTargetSourcesCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTargetSourcesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "target_sources"; } + std::string GetName() const CM_OVERRIDE { return "target_sources"; } cmTypeMacro(cmTargetSourcesCommand, cmTargetPropCommandBase); private: - virtual void HandleImportedTarget(const std::string& tgt); - virtual void HandleMissingTarget(const std::string& name); + void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; + void HandleMissingTarget(const std::string& name) CM_OVERRIDE; - virtual bool HandleDirectContent(cmTarget* tgt, - const std::vector& content, - bool prepend, bool system); + bool HandleDirectContent(cmTarget* tgt, + const std::vector& content, + bool prepend, bool system) CM_OVERRIDE; - virtual std::string Join(const std::vector& content); + std::string Join(const std::vector& content) CM_OVERRIDE; }; #endif diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index f946a1c3f..66d590eaf 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -27,18 +27,20 @@ public: cmTestGenerator(cmTest* test, std::vector const& configurations = std::vector()); - virtual ~cmTestGenerator(); + ~cmTestGenerator() CM_OVERRIDE; void Compute(cmLocalGenerator* lg); protected: - virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); - virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); - virtual void GenerateScriptForConfig(std::ostream& os, - const std::string& config, - Indent const& indent); - virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent); - virtual bool NeedsScriptNoConfig() const; + void GenerateScriptConfigs(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent const& indent) CM_OVERRIDE; + void GenerateScriptNoConfig(std::ostream& os, + Indent const& indent) CM_OVERRIDE; + bool NeedsScriptNoConfig() const CM_OVERRIDE; void GenerateOldStyle(std::ostream& os, Indent const& indent); cmLocalGenerator* LG; diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index e50d54c6d..abfe33579 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTryCompileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTryCompileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "try_compile"; } + std::string GetName() const CM_OVERRIDE { return "try_compile"; } cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile); }; diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index 26c077763..b8eb1de13 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -25,19 +25,19 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmTryRunCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmTryRunCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "try_run"; } + std::string GetName() const CM_OVERRIDE { return "try_run"; } cmTypeMacro(cmTryRunCommand, cmCoreTryCompile); diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index faa8f9bbb..6429c1082 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -25,24 +25,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmUnsetCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmUnsetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "unset"; } + std::string GetName() const CM_OVERRIDE { return "unset"; } cmTypeMacro(cmUnsetCommand, cmCommand); }; diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 5a97a610e..5a4403532 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -18,11 +18,11 @@ class cmUseMangledMesaCommand : public cmCommand { public: cmTypeMacro(cmUseMangledMesaCommand, cmCommand); - virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "use_mangled_mesa"; } - virtual bool IsScriptable() const { return true; } + cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; } + bool IsScriptable() const CM_OVERRIDE { return true; } protected: void CopyAndFullPathMesaHeader(const char* source, const char* outdir); }; diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index a709de15a..2eb961fbb 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -18,10 +18,10 @@ class cmUtilitySourceCommand : public cmCommand { public: cmTypeMacro(cmUtilitySourceCommand, cmCommand); - virtual cmCommand* Clone() { return new cmUtilitySourceCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "utility_source"; } + cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "utility_source"; } }; #endif diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index b83f615c1..c4b0817e8 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -18,10 +18,10 @@ class cmVariableRequiresCommand : public cmCommand { public: cmTypeMacro(cmVariableRequiresCommand, cmCommand); - virtual cmCommand* Clone() { return new cmVariableRequiresCommand; } - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); - virtual std::string GetName() const { return "variable_requires"; } + cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; } + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; + std::string GetName() const CM_OVERRIDE { return "variable_requires"; } }; #endif diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index aad53cbf9..1d402af7e 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -24,34 +24,34 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmVariableWatchCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmVariableWatchCommand; } //! Default constructor cmVariableWatchCommand(); //! Destructor. - ~cmVariableWatchCommand(); + ~cmVariableWatchCommand() CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** This command does not really have a final pass but it needs to stay alive since it owns variable watch callback information. */ - virtual bool HasFinalPass() const { return true; } + bool HasFinalPass() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "variable_watch"; } + std::string GetName() const CM_OVERRIDE { return "variable_watch"; } cmTypeMacro(cmVariableWatchCommand, cmCommand); diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 0f35be8fa..bd354c74a 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -21,10 +21,10 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: cmWhileFunctionBlocker(cmMakefile* mf); - ~cmWhileFunctionBlocker(); - virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&); - virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf); + ~cmWhileFunctionBlocker() CM_OVERRIDE; + bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; std::vector Args; std::vector Functions; @@ -41,20 +41,21 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmWhileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmWhileCommand; } /** * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ - virtual bool InvokeInitialPass(const std::vector& args, - cmExecutionStatus&); + bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus&) CM_OVERRIDE; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, cmExecutionStatus&) + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE { return false; } @@ -62,12 +63,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "while"; } + std::string GetName() const CM_OVERRIDE { return "while"; } cmTypeMacro(cmWhileCommand, cmCommand); }; diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index b0eef9c4d..db24b0e17 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -24,24 +24,24 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() { return new cmWriteFileCommand; } + cmCommand* Clone() CM_OVERRIDE { return new cmWriteFileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus& status); + bool InitialPass(std::vector const& args, + cmExecutionStatus& status) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() const { return true; } + bool IsScriptable() const CM_OVERRIDE { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "write_file"; } + std::string GetName() const CM_OVERRIDE { return "write_file"; } cmTypeMacro(cmWriteFileCommand, cmCommand); }; From b4b73f56a26c1e1d630e3f262d2d4bafee8231c4 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 27 Jun 2016 23:23:35 +0200 Subject: [PATCH 158/929] cxx features: add check for nullptr --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_nullptr.cxx | 14 ++++++++++++++ Source/cmConfigure.cmake.h.in | 7 +++++++ bootstrap | 1 + 4 files changed, 23 insertions(+) create mode 100644 Source/Checks/cm_cxx_nullptr.cxx diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 18dbaf8a1..6fde7b67d 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,7 @@ function(cm_check_cxx_feature name) endfunction() if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(nullptr) cm_check_cxx_feature(override) cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_set) diff --git a/Source/Checks/cm_cxx_nullptr.cxx b/Source/Checks/cm_cxx_nullptr.cxx new file mode 100644 index 000000000..500684aee --- /dev/null +++ b/Source/Checks/cm_cxx_nullptr.cxx @@ -0,0 +1,14 @@ +int test(int) +{ + return -1; +} + +int test(int*) +{ + return 0; +} + +int main() +{ + return test(nullptr); +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index a8d4f58c6..7e48b2d9a 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,12 +29,19 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 +#cmakedefine CMake_HAVE_CXX_NULLPTR #cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" +#ifdef CMake_HAVE_CXX_NULLPTR +#define CM_NULLPTR nullptr +#else +#define CM_NULLPTR 0 +#endif + #ifdef CMake_HAVE_CXX_OVERRIDE #define CM_OVERRIDE override #else diff --git a/bootstrap b/bootstrap index a9f340226..60d63c311 100755 --- a/bootstrap +++ b/bootstrap @@ -1272,6 +1272,7 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" +cmake_report cmConfigure.h${_tmp} "#define CM_NULLPTR 0" cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE" # Regenerate configured headers From 7287893d411dde3b9afc6a4c8896dd9d15db9e04 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 28 Jun 2016 00:01:07 -0400 Subject: [PATCH 159/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 478c6bcbc..4e2ea5885 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160627) +set(CMake_VERSION_PATCH 20160628) #set(CMake_VERSION_RC 1) From 1d6909a287bb73b5ec7bf51ec56f7efcf2a869eb Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 27 Jun 2016 22:44:16 +0200 Subject: [PATCH 160/929] use CM_NULLPTR --- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 16 +- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 4 +- Source/CPack/IFW/cmCPackIFWPackage.cxx | 8 +- Source/CPack/IFW/cmCPackIFWRepository.cxx | 4 +- Source/CPack/cmCPackArchiveGenerator.cxx | 6 +- Source/CPack/cmCPackComponentGroup.h | 4 +- Source/CPack/cmCPackDebGenerator.cxx | 10 +- Source/CPack/cmCPackGenerator.cxx | 22 +-- Source/CPack/cmCPackGenerator.h | 2 +- Source/CPack/cmCPackGeneratorFactory.cxx | 4 +- Source/CPack/cmCPackLog.cxx | 8 +- Source/CPack/cmCPackNSISGenerator.cxx | 14 +- Source/CPack/cmCPackRPMGenerator.cxx | 4 +- Source/CPack/cpack.cxx | 12 +- Source/CTest/cmCTestBZR.cxx | 14 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 18 +- Source/CTest/cmCTestBuildCommand.cxx | 16 +- Source/CTest/cmCTestBuildHandler.cxx | 23 +-- Source/CTest/cmCTestCVS.cxx | 5 +- Source/CTest/cmCTestCommand.h | 4 +- Source/CTest/cmCTestConfigureCommand.cxx | 17 +- Source/CTest/cmCTestCoverageCommand.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 10 +- Source/CTest/cmCTestCurl.cxx | 2 +- Source/CTest/cmCTestGIT.cxx | 39 ++-- Source/CTest/cmCTestGenericHandler.cxx | 4 +- Source/CTest/cmCTestHG.cxx | 11 +- Source/CTest/cmCTestHandlerCommand.cxx | 4 +- Source/CTest/cmCTestLaunch.cxx | 12 +- Source/CTest/cmCTestMemCheckHandler.cxx | 18 +- Source/CTest/cmCTestP4.cxx | 14 +- Source/CTest/cmCTestRunTest.cxx | 6 +- Source/CTest/cmCTestSVN.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 16 +- Source/CTest/cmCTestStartCommand.cxx | 6 +- Source/CTest/cmCTestSubmitCommand.cxx | 4 +- Source/CTest/cmCTestSubmitHandler.cxx | 14 +- Source/CTest/cmCTestSubmitHandler.h | 2 +- Source/CTest/cmCTestTestCommand.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 15 +- Source/CTest/cmCTestUpdateCommand.cxx | 4 +- Source/CTest/cmCTestUpdateHandler.cxx | 2 +- Source/CTest/cmCTestUploadCommand.cxx | 2 +- Source/CTest/cmCTestVC.cxx | 2 +- Source/CTest/cmCTestVC.h | 8 +- Source/CTest/cmParseMumpsCoverage.cxx | 4 +- Source/CTest/cmProcess.cxx | 4 +- Source/CursesDialog/ccmake.cxx | 27 +-- .../cmCursesCacheEntryComposite.cxx | 6 +- Source/CursesDialog/cmCursesForm.cxx | 4 +- .../CursesDialog/cmCursesLongMessageForm.cxx | 8 +- Source/CursesDialog/cmCursesMainForm.cxx | 34 ++-- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesWidget.cxx | 2 +- Source/cmAddCustomCommandCommand.cxx | 2 +- Source/cmAddCustomTargetCommand.cxx | 2 +- Source/cmArchiveWrite.cxx | 7 +- Source/cmArchiveWrite.h | 4 +- Source/cmBuildCommand.cxx | 4 +- Source/cmCPluginAPI.cxx | 22 +-- Source/cmCTest.cxx | 50 +++--- Source/cmCTest.h | 8 +- Source/cmCacheManager.cxx | 10 +- Source/cmCacheManager.h | 7 +- Source/cmCommand.h | 2 +- Source/cmCommandArgumentParserHelper.cxx | 10 +- Source/cmCommandArgumentsHelper.cxx | 28 +-- Source/cmCommandArgumentsHelper.h | 10 +- Source/cmCommonTargetGenerator.cxx | 2 +- Source/cmComputeLinkDepends.cxx | 6 +- Source/cmComputeLinkDepends.h | 2 +- Source/cmComputeLinkInformation.cxx | 18 +- Source/cmComputeLinkInformation.h | 5 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmConditionEvaluator.cxx | 2 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmCryptoHash.cxx | 2 +- Source/cmCurl.h | 2 +- Source/cmCustomCommand.cxx | 4 +- Source/cmCustomCommandGenerator.cxx | 2 +- Source/cmDefinitions.cxx | 2 +- Source/cmDepends.cxx | 12 +- Source/cmDepends.h | 2 +- Source/cmDependsC.cxx | 10 +- Source/cmDependsFortran.cxx | 2 +- Source/cmDependsJavaParserHelper.cxx | 10 +- Source/cmDocumentation.cxx | 16 +- Source/cmDocumentation.h | 2 +- Source/cmDynamicLoader.cxx | 4 +- Source/cmELF.cxx | 20 +-- Source/cmExecProgramCommand.cxx | 8 +- Source/cmExecProgramCommand.h | 3 +- Source/cmExecuteProcessCommand.cxx | 6 +- Source/cmExportBuildFileGenerator.cxx | 4 +- Source/cmExportCommand.cxx | 6 +- Source/cmExportTryCompileFileGenerator.cxx | 3 +- Source/cmExprParserHelper.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 14 +- Source/cmExtraEclipseCDT4Generator.cxx | 6 +- Source/cmExtraEclipseCDT4Generator.h | 2 +- Source/cmExtraKateGenerator.cxx | 4 +- Source/cmExtraSublimeTextGenerator.cxx | 13 +- Source/cmFLTKWrapUICommand.cxx | 4 +- Source/cmFileCommand.cxx | 32 ++-- Source/cmFindCommon.cxx | 4 +- Source/cmFindPackageCommand.cxx | 4 +- Source/cmFortranParserImpl.cxx | 5 +- Source/cmGeneratorExpression.h | 12 +- Source/cmGeneratorExpressionDAGChecker.h | 2 +- .../cmGeneratorExpressionEvaluationFile.cxx | 16 +- Source/cmGeneratorExpressionNode.cxx | 15 +- Source/cmGeneratorTarget.cxx | 137 +++++++------- Source/cmGeneratorTarget.h | 6 +- Source/cmGetCMakePropertyCommand.cxx | 2 +- Source/cmGetDirectoryPropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 4 +- Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmGetTargetPropertyCommand.cxx | 2 +- Source/cmGetTestPropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 54 +++--- Source/cmGlobalGenerator.h | 16 +- Source/cmGlobalGeneratorFactory.h | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 20 +-- Source/cmGlobalNinjaGenerator.cxx | 20 +-- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 8 +- Source/cmGraphVizWriter.cxx | 14 +- Source/cmHexFileConverter.cxx | 12 +- Source/cmIncludeCommand.cxx | 2 +- Source/cmInstallCommand.cxx | 50 +++--- Source/cmInstallCommandArguments.cxx | 22 +-- Source/cmInstallDirectoryGenerator.cxx | 4 +- Source/cmInstallExportGenerator.cxx | 9 +- Source/cmInstallFilesGenerator.cxx | 6 +- Source/cmInstallGenerator.h | 13 +- Source/cmInstallScriptGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 6 +- Source/cmInstalledFile.cxx | 2 +- Source/cmLinkItem.h | 4 +- Source/cmLinkedTree.h | 2 +- Source/cmListFileCache.cxx | 6 +- Source/cmLoadCommandCommand.cxx | 10 +- Source/cmLocalGenerator.cxx | 34 ++-- Source/cmLocalGenerator.h | 8 +- Source/cmLocalNinjaGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 12 +- Source/cmLocalUnixMakefileGenerator3.h | 12 +- Source/cmLocale.h | 2 +- Source/cmMakefile.cxx | 59 +++--- Source/cmMakefile.h | 35 ++-- .../cmMakefileExecutableTargetGenerator.cxx | 10 +- Source/cmMakefileLibraryTargetGenerator.cxx | 8 +- Source/cmMakefileTargetGenerator.cxx | 56 +++--- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- Source/cmMarkAsAdvancedCommand.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 8 +- Source/cmOSXBundleGenerator.cxx | 2 +- Source/cmOrderDirectories.h | 3 +- Source/cmOutputConverter.cxx | 6 +- Source/cmOutputRequiredFilesCommand.cxx | 8 +- Source/cmPolicies.cxx | 12 +- Source/cmProcessTools.cxx | 14 +- Source/cmProcessTools.h | 4 +- Source/cmProperty.cxx | 2 +- Source/cmPropertyMap.cxx | 2 +- Source/cmQTWrapCPPCommand.cxx | 2 +- Source/cmQTWrapUICommand.cxx | 4 +- Source/cmQtAutoGeneratorInitializer.cxx | 12 +- Source/cmQtAutoGenerators.cxx | 12 +- Source/cmScriptGenerator.cxx | 4 +- Source/cmSearchPath.cxx | 10 +- Source/cmSearchPath.h | 6 +- Source/cmSetCommand.cxx | 4 +- Source/cmSetPropertyCommand.cxx | 10 +- Source/cmSiteNameCommand.cxx | 3 +- Source/cmSourceFile.cxx | 8 +- Source/cmSourceFile.h | 2 +- Source/cmSourceFileLocation.cxx | 2 +- Source/cmSourceGroup.cxx | 6 +- Source/cmSourceGroup.h | 2 +- Source/cmSourceGroupCommand.cxx | 2 +- Source/cmState.cxx | 16 +- Source/cmState.h | 2 +- Source/cmSystemTools.cxx | 27 +-- Source/cmSystemTools.h | 40 +++-- Source/cmTarget.cxx | 168 +++++++++--------- Source/cmTarget.h | 2 +- Source/cmTargetLinkLibrariesCommand.cxx | 4 +- Source/cmTestGenerator.cxx | 4 +- Source/cmTimestamp.cxx | 6 +- Source/cmTryRunCommand.cxx | 25 +-- Source/cmUnsetCommand.cxx | 2 +- Source/cmUtilitySourceCommand.cxx | 4 +- Source/cmVariableWatch.h | 11 +- Source/cmake.cxx | 21 +-- Source/cmake.h | 3 +- Source/cmakemain.cxx | 25 +-- Source/cmcmd.cxx | 39 ++-- Source/ctest.cxx | 11 +- 201 files changed, 1143 insertions(+), 1075 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index accba083d..4a5eb9038 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::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::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 74f6da671..13a361309 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 405d66844..5db06e61f 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 e4fa569b1..ee6d5e5ec 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 baf6719ca..b1f686468 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 5361d955f..01a9e76f5 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 b659359c0..3edc430b0 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::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 c8b075d79..914d0dc20 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 6313a0e28..23e4bb7f9 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 22108351b..0f0268fa2 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 ff06eb8b9..339323ed2 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 5123edda2..d8ff90712 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -212,7 +212,7 @@ int cmCPackNSISGenerator::PackageFiles() std::map::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 bc101118f..2568d17d9 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 425afd9e8..b4a2c6fe2 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -27,13 +27,13 @@ #include 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 [options]" }, - { 0, 0 } + { CM_NULLPTR, " cpack -G [options]" }, + { CM_NULLPTR, CM_NULLPTR } }; static const char* cmDocumentationOptions[][2] = { @@ -47,7 +47,7 @@ static const char* cmDocumentationOptions[][2] = { { "-R ", "override/define CPACK_PACKAGE_VERSION" }, { "-B ", "override/define CPACK_PACKAGE_DIRECTORY" }, { "--vendor ", "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 17d4eefa3..0e08e1c0f 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(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 632f45211..eddbddc52 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 05cccbfe2..408a1a898 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 a4d9deeaa..f96ef6d66 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 df1968504..37bdf9a3f 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 22a2c8ed8..b0c92066f 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 a90f27ad2..a8237048a 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 223d010cd..86e3ce47d 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 a631db958..7102533a9 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 4818324fe..6b8e5b56f 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 responseData; std::vector debugData; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 36a781e9e..61dbe33b5 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 18caabe0a..7755ee994 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 298804b59..eb3d611bc 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}\n" "\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 76f971dbe..e1361a19e 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 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 99fa9e7c3..477f16ef0 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 6f1a2c495..dfa8a1a3b 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 072da29f7..d4a32f1f8 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 48582c9a5..9e3802aae 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(¤t_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 e4b6e255c..eae0c6ce9 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -291,7 +291,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector 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 44b6b934b..b747c64c3 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 99d431af5..c64d16b53 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -32,12 +32,12 @@ bool cmCTestStartCommand::InitialPass(std::vector 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 664552af9..54da3834e 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 3aacde09f..67388ad06 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 c2c9a8536..4cca6eb0b 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 7b437c6ac..1d064db93 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 3ee9c5f97..1b6b44208 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 ... this->DartStuff.compile("()"); @@ -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& 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& 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 f1bae5d62..bc06da628 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 4eaa16b0a..8131c901f 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 c85db0208..7393d21d5 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(handler)->SetFiles(this->Files); diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index e9934e502..3376588d0 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 4ae38eb41..eb85a2363 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 e5dd74a9f..d786d7997 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 db5151c07..92fe64266 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 be8751cbb..606c9541e 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -24,29 +24,30 @@ #include 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 \n" - " ccmake " }, - { 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 \n" + " ccmake " }, + { 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 bdfc8e9b2..ea12756ce 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 aa4710f06..b3320c9f5 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 d03d3300d..48cc42c58 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 b740eb0b2..9ae38d62d 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -36,8 +36,8 @@ cmCursesMainForm::cmCursesMainForm(std::vector 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(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( 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(); @@ -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( 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::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( field_userptr(this->Fields[findex - 2])); diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index a8e99b6ba..d17ee33f5 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 3707d0d39..6eb5310a3 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 100ed1d58..49f27958e 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 d8fd1d862..400be7712 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 depends, outputs, output, byproducts; bool verbatim = false; bool append = false; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ac08cb260..9dc7c590f 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 sources; // Keep track of parser state. diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 235cf88c6..ceb7d31cf 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(&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 72d8f3a6d..f847d09b7 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 586e8a811..fb143a2b9 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -36,8 +36,8 @@ bool cmBuildCommand::MainSignature(std::vector 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 a78300cb6..f97791a67 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 no_byproducts; std::vector 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(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(arg); cmCPluginAPISourceFile* osf = static_cast(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 2e47298a2..3694f09c7 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(¤ttime); // return ::CleanString(ctime(¤ttime)); 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 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 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& 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(¤t_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 65ecaa4dd..833cd969e 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -120,7 +120,7 @@ public: typedef std::set SetOfStrings; ///! Process Command line arguments - int Run(std::vector&, std::string* output = 0); + int Run(std::vector&, 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 const& process_output); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index bcef3c84c..bdd73037c 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 153e9575c..23318673a 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 be90a469e..a5f20e6df 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 a4f3c7d56..294117ca6 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(strlen(str)); } diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx index c336bc53b..1345bd5e9 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::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* args, std::vector* unconsumedArgs) { - if (args == 0) { + if (args == CM_NULLPTR) { return; } @@ -227,8 +227,8 @@ void cmCommandArgumentsHelper::Parse(const std::vector* args, (*argIt)->Reset(); } - cmCommandArgument* activeArgument = 0; - const cmCommandArgument* previousArgument = 0; + cmCommandArgument* activeArgument = CM_NULLPTR; + const cmCommandArgument* previousArgument = CM_NULLPTR; for (std::vector::const_iterator it = args->begin(); it != args->end(); ++it) { for (std::vector::iterator argIt = @@ -246,10 +246,10 @@ void cmCommandArgumentsHelper::Parse(const std::vector* 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 27fef1f70..913314881 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& 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 101093d7f..7ad18f064 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 2129394a7..fffb77d8c 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::iterator cmComputeLinkDepends::AllocateLinkEntry( std::map::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 _LIB_DEPENDS variable. diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 6aa40c312..4a33aff61 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 1eefbb1d7..7db5df3be 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::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 c0ddc532a..023c781b6 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 570405a69..ff7eb0b83 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 7006b629c..67b2571d7 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 0149fdfc7..7d35a9e81 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -77,7 +77,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } const char* sourceDirectory = argv[2].c_str(); - const char* projectName = 0; + const char* projectName = CM_NULLPTR; std::string targetName; std::vector cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0] std::vector compileDefs; diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 85049ca9f..e54b3c785 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -30,7 +30,7 @@ cmsys::auto_ptr cmCryptoHash::New(const char* algo) } else if (strcmp(algo, "SHA512") == 0) { return cmsys::auto_ptr(new cmCryptoHashSHA512); } else { - return cmsys::auto_ptr(0); + return cmsys::auto_ptr(CM_NULLPTR); } } diff --git a/Source/cmCurl.h b/Source/cmCurl.h index eac7f1351..26bf94e09 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 4c5bd0320..2b9248d57 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 99bb60116..315a1b6d4 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 28b6677c8..e0fb59b7d 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 5df3cc120..b25e3cef2 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 a62f8c281..0e1cbb925 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 57e719cc8..18e123e9c 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& sources, std::set dependencies; bool haveDeps = false; - if (this->ValidDeps != 0) { + if (this->ValidDeps != CM_NULLPTR) { std::map::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 bbda68883..9ea1e4851 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 238e7a149..79c466919 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 cmDependsJavaParserHelper::GetFilesProduced() std::vector::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 413dacd62..919a45ea1 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -49,12 +49,12 @@ static const char* cmDocumentationStandardOptions[][2] = { { "--help-variable-list []", "List variables with help available and exit." }, { "--help-variables []", "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& 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& 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 dd99ca89f..ac36c8b0a 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 7d0bbdcf4..4c31733f7 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 16294ea46..59667cd6b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -672,7 +672,7 @@ cmELF::StringEntry const* cmELFInternalImpl::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::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::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::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::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 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 f3f8c2f7e..58bbc3156 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -90,7 +90,7 @@ bool cmExecProgramCommand::InitialPass(std::vector 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 ef87aacdd..7cd4f9f17 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 575cdc315..d97b25f8e 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -161,7 +161,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector 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 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 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 8ca7a1199..a53d285da 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 a0e7e45e6..3cb575ecb 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 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 5a826f2ba..fdc076002 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 cge = ge.Parse(prop); diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 2ba9b8da7..0771a4eab 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 dee666b9b..fbfbccc98 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 f964b9726..16cb08236 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 ff6e4b65f..0400ad5e1 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 02159dde3..b757a49eb 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 2b9f64fef..c166e2630 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 sourceFiles; target->GetSourceFiles(sourceFiles, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index ebd62232d..03ee31e40 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -73,8 +73,8 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector 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 c1fca517c..4aecf7c62 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -231,17 +231,17 @@ bool cmFileCommand::HandleReadCommand(std::vector 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 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 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 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 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 638c1d115..d255ceb76 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -234,13 +234,13 @@ void cmFindCommon::GetIgnoredPaths(std::vector& 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 c133fcfc6..09fa795c0 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 934e9284a..a72204ae8 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -65,7 +65,8 @@ cmFortranParser_s::cmFortranParser_s(std::vector 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 71fbba3cd..5d02427b9 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 28ca824a6..6b7fe9ae5 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 5b48eea0d..f9dbc2d45 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::iterator it = outputFiles.find(outputFileName); @@ -97,8 +97,8 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( for (std::vector::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 599ea8d3a..830979fe8 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 3668c8297..c7dd3e4ec 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -491,7 +491,7 @@ std::vector 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& files, this->DebugSourcesDone = true; } - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", + CM_NULLPTR, CM_NULLPTR); UNORDERED_SET 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& 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& 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 cmGeneratorTarget::GetIncludeDirectories( std::vector includes; UNORDERED_SET uniqueIncludes; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "INCLUDE_DIRECTORIES", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR); std::vector debugProperties; const char* debugProp = @@ -2487,8 +2488,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector& result, { UNORDERED_SET uniqueOptions; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "COMPILE_OPTIONS", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR); std::vector debugProperties; const char* debugProp = @@ -2539,8 +2540,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector& result, { UNORDERED_SET uniqueFeatures; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "COMPILE_FEATURES", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR); std::vector debugProperties; const char* debugProp = @@ -2589,8 +2590,8 @@ void cmGeneratorTarget::GetCompileDefinitions( { UNORDERED_SET uniqueOptions; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "COMPILE_DEFINITIONS", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR); std::vector 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 @@ -3316,7 +3317,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender, } if (emitted.insert(*pi).second) { getLinkInterfaceDependentProperty(depender, *pi, config, t, - 0); + CM_NULLPTR); if (cmSystemTools::GetErrorOccuredFlag()) { return; } @@ -3394,24 +3395,25 @@ void cmGeneratorTarget::CheckPropertyCompatibility( } checkPropertyConsistency(this, li->Target, strBool, emittedBools, - config, BoolType, 0); + config, BoolType, CM_NULLPTR); if (cmSystemTools::GetErrorOccuredFlag()) { return; } - checkPropertyConsistency( - this, li->Target, strString, emittedStrings, config, StringType, 0); + checkPropertyConsistency(this, li->Target, strString, + emittedStrings, config, StringType, + CM_NULLPTR); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, strNumMin, emittedMinNumbers, config, - NumberMinType, 0); + NumberMinType, CM_NULLPTR); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, strNumMax, emittedMaxNumbers, config, - NumberMaxType, 0); + NumberMaxType, CM_NULLPTR); if (cmSystemTools::GetErrorOccuredFlag()) { return; } @@ -3544,7 +3546,7 @@ std::pair 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 consistentNumberProperty(const char* lhs, @@ -3553,7 +3555,7 @@ std::pair 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 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(this, p, config, "FALSE", - BoolType, 0); + BoolType, CM_NULLPTR); } const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty( const std::string& p, const std::string& config) const { return checkInterfacePropertyCompatibility( - 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( - 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( - 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& items, bool& hadHeadSensitiveCondition) const { cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, CM_NULLPTR, + CM_NULLPTR); // The $ 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 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 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 2ee9bef4d..f9987aa6f 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 331aab9ec..c89d03019 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 1b5bcc9e2..a331e78c9 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 06f750446..7c49c9ac4 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 e64befe14..7b30a7de7 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 dded9f751..228ec6931 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 65990210f..5eaf87297 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 536c5d286..3ec16c0e2 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::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(i) + 1.0f) / static_cast(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 no_byproducts; std::vector 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 789e51526..089a63701 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 40678da0a..67875197d 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 68a25389e..bbd6baaa5 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, "") != 0) || - (strstr(line, "") != 0) || - (strstr(line, "") != 0) || - (strstr(line, "") != 0) || - (strstr(line, "") != 0) || - (strstr(line, "") != 0)) { + if ((strstr(line, "") != CM_NULLPTR) || + (strstr(line, "") != CM_NULLPTR) || + (strstr(line, "") != CM_NULLPTR) || + (strstr(line, "") != CM_NULLPTR) || + (strstr(line, "") != CM_NULLPTR) || + (strstr(line, "") != CM_NULLPTR)) { continue; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3aec63049..91f08e64d 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 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 ea51fbf6d..69ec6cab8 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 cc5d1ba3e..f115ecba9 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 3963cf891..ed35ecdbc 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -149,7 +149,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) for (std::map::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::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::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::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 9609e952f..34fd6268a 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(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 cb9b74d26..360ebeb4b 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -77,7 +77,7 @@ bool cmIncludeCommand::InitialPass(std::vector 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 e9de8dffd..86ab85aee 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -186,7 +186,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector 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 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 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 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 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 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 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 unknownArgs; ica.Parse(&args, &unknownArgs); @@ -744,7 +746,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) for (std::vector::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 dirs; - const char* destination = 0; + const char* destination = CM_NULLPTR; std::string permissions_file; std::string permissions_dir; std::vector configurations; @@ -1103,7 +1105,7 @@ bool cmInstallCommand::HandleExportMode(std::vector 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 unknownArgs; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 57e37a3a1..312c50e06 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& 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 671ab4ca6..a637b2557 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 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 2fef3a840..62500127c 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 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 8c1b357d3..8885ef2f4 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 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 b003e783e..ad9fc2851 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 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 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 1b0f1d19c..76d6b718f 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(), component, + : cmInstallGenerator(CM_NULLPTR, std::vector(), component, MessageDefault, exclude_from_all) , Script(script) , Code(code) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index d56bb053b..448d27853 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 ed0f74b5e..bfc5cf123 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 0fbe093fd..8aa398147 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 1a8539681..6b3107444 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 44604186d..28b378148 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 c2a5d4644..ddf6ce6c9 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 const& args, cmExecutionStatus&) @@ -128,7 +128,7 @@ bool cmLoadedCommand::InitialPass(std::vector const& args, // create argc and argv and then invoke the command int argc = static_cast(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 0de9895b5..ff767e644 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::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 66fbe01c9..fa4bb3065 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& 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 75da32890..6e6108793 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -78,7 +78,7 @@ public: void ComputeObjectFilenames( std::map& 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 0478a3aa3..c6cfa88cb 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -340,8 +340,8 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule( std::vector depends; depends.push_back(output); std::vector 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 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 319a587cf..42d1d9167 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -110,7 +110,8 @@ public: std::string Arg; }; void AppendEcho(std::vector& 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& 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& commands, const std::vector& 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& 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 e69c32eb5..f922c0341 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 e8c1576b7..eae4258bb 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 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 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& 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::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& name, const char* regex) { - cmSourceGroup* sg = 0; + cmSourceGroup* sg = CM_NULLPTR; std::vector currentName; int i = 0; const int lastElement = static_cast(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& 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 c68cd1c87..642b6919c 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& 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& 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& 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& byproducts, const std::vector& 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& 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 const& inArgs, std::vector& outArgs, - const char* filename = 0) const; + const char* filename = CM_NULLPTR) const; bool ExpandArguments(std::vector const& inArgs, std::vector& 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 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 ba4c6e6b5..9a37a332b 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 5348b8089..380fd7d4e 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 8b341a1ac..e922fbd57 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(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 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& 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 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 6e44e8f78..27006eeea 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 07f1fa834..2fb6a75d8 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -35,7 +35,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector 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 04ba842d9..77d3901dc 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 954c73e0d..a876efa20 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(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 c19cae0d0..dbfe6eb34 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 fc1a388f2..38e197c95 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 const& extra); void AddLanguageDirectories(std::vector const& dirs); diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index b92c074da..411184c7b 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 29f1accde..ef636e72e 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 85f0fa342..124fb6a3d 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 446752e59..34b8df2f0 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 9d082b2f6..61bfc6406 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 4910616bb..133258f43 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 de1281ebe..1e1ff910a 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 f63672b97..ef8255a0e 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -80,7 +80,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector 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 4c1da3627..a948dd6aa 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -111,8 +111,8 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, std::vector 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 98851d629..4a63aad75 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 6a6d72f47..7ada43120 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 5fed10708..b8aae5d5e 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 a0cce126d..ca3a57faa 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 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& suffixes) void cmSearchPath::AddPrefixPaths(const std::vector& 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& 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 835196fd1..65f703fe7 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& GetPaths() const { return this->Paths; } @@ -47,8 +47,8 @@ public: protected: void AddPrefixPaths(const std::vector& 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 Paths; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 5f4cfee3e..148436860 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -59,7 +59,7 @@ bool cmSetCommand::InitialPass(std::vector 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 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 73f743746..8fe8ade3b 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 702af4dab..5c14991e2 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -55,7 +55,8 @@ bool cmSiteNameCommand::InitialPass(std::vector 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 5b0acee92..04727b24f 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 b1623bdd4..a3808f7ba 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 a89d1e8e3..099a6f07a 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 f27b572fd..d9529a24f 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 const& cmSourceGroup::GetGroupChildren() const diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 8603e95e7..1f5232e60 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 252819c8f..6db14c0a4 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -28,7 +28,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector const& args, std::vector 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 d2cfaba71..f2fe134bb 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::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 cmState::Snapshot::UnusedKeys() const diff --git a/Source/cmState.h b/Source/cmState.h index 935faecda..e5f99173b 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 26cbfb6bf..2d463f315 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -583,7 +583,7 @@ bool cmSystemTools::RunSingleCommand(std::vector 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 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 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 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(getpid()); unsigned int tv_sec = static_cast(t.tv_sec); unsigned int tv_usec = static_cast(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 df2c1f743..39e79948a 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 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 5e5ed2b29..ceebf9315 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::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::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_". 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 9e095c2de..5829d4f34 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 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 774577a3a..1c4a9ceca 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 e5998259a..462edf937 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 emulatorWithArgs; cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); std::string emulatorExe(emulatorWithArgs[0]); diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 2a70ed04c..c3c1d17ad 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 19837a7ae..7b190483d 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -124,8 +124,9 @@ bool cmTryRunCommand::InitialPass(std::vector 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 c04c44ad8..05ba65a16 100644 --- a/Source/cmUnsetCommand.cxx +++ b/Source/cmUnsetCommand.cxx @@ -47,7 +47,7 @@ bool cmUnsetCommand::InitialPass(std::vector 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 f7d766e3b..c50cbfbbc 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -38,7 +38,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector 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 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 be8f72fb3..5ddb9075a 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 654100bf8..79e7c2b92 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& 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& 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 9ac69354b..4a5376d99 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 495aae54f..521a5bf16 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] \n" - " cmake [options] " }, - { 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] \n" + " cmake [options] " }, + { 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 161256e25..2427286ea 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -315,7 +315,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& 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& 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& 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& 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& args) // Execute command from remaining arguments. std::vector 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& 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& 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& 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& 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& 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& args, int type) if (args.size() < 2) { return -1; } - bool verbose = cmSystemTools::GetEnv("VERBOSE") != NULL; + bool verbose = cmSystemTools::GetEnv("VERBOSE") != CM_NULLPTR; std::vector expandedArgs; for (std::vector::iterator i = args.begin(); i != args.end(); ++i) { @@ -1273,7 +1279,7 @@ int cmcmd::VisualStudioLink(std::vector& args, int type) } static bool RunCommand(const char* comment, std::vector& 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& 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 4edd62e4b..38ff64f23 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 , --build-config ", "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. From 843402b04a72ec1f99f0f712c4eb73abbcb67cba Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Jun 2016 09:42:08 -0400 Subject: [PATCH 161/929] GenerateExportHeader: Add option to specify custom content --- .../dev/GenerateExportHeader-custom-content.rst | 6 ++++++ Modules/GenerateExportHeader.cmake | 17 ++++++++++++++--- Modules/exportheader.cmake.in | 2 +- .../lib_shared_and_static/CMakeLists.txt | 3 +++ .../libshared_and_static.cpp | 4 ++++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/GenerateExportHeader-custom-content.rst diff --git a/Help/release/dev/GenerateExportHeader-custom-content.rst b/Help/release/dev/GenerateExportHeader-custom-content.rst new file mode 100644 index 000000000..161261ccc --- /dev/null +++ b/Help/release/dev/GenerateExportHeader-custom-content.rst @@ -0,0 +1,6 @@ +GenerateExportHeader-custom-content +----------------------------------- + +* The :module:`GenerateExportHeader` module learned a new + ``CUSTOM_CONTENT_FROM_VARIABLE`` option to specify a variable + containing custom content for inclusion in the generated header. diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 6389d3072..6205b8ccb 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -20,6 +20,7 @@ # [NO_DEPRECATED_MACRO_NAME ] # [DEFINE_NO_DEPRECATED] # [PREFIX_NAME ] +# [CUSTOM_CONTENT_FROM_VARIABLE ] # ) # # @@ -60,8 +61,10 @@ # The CMake fragment will generate a file in the # ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the # macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``, -# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. The -# resulting file should be installed with other headers in the library. +# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. +# They will be followed by content taken from the variable specified by +# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any. +# The resulting file should be installed with other headers in the library. # # The ``BASE_NAME`` argument can be used to override the file name and the # names used for the macros: @@ -288,7 +291,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) set(options DEFINE_NO_DEPRECATED) set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE - NO_DEPRECATED_MACRO_NAME) + NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE) set(multiValueArgs) cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}" @@ -361,6 +364,14 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) endif() string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION) + if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE) + if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}") + set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}") + else() + set(CUSTOM_CONTENT "") + endif() + endif() + configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in" "${EXPORT_FILE_NAME}" @ONLY) endmacro() diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in index 7cfbcbda4..9dd75bf56 100644 --- a/Modules/exportheader.cmake.in +++ b/Modules/exportheader.cmake.in @@ -38,5 +38,5 @@ # define @NO_DEPRECATED_MACRO_NAME@ # endif #endif - +@CUSTOM_CONTENT@ #endif diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt index c1be12556..a05774648 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -25,9 +25,12 @@ add_library(shared_variant SHARED ${lib_SRCS}) set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) add_library(static_variant ${lib_SRCS}) +set(MY_CUSTOM_CONTENT "#define MY_CUSTOM_CONTENT_ADDED") + generate_export_header(shared_variant BASE_NAME libshared_and_static PREFIX_NAME MYPREFIX_ + CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT ) set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 276490569..83b8f9859 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -1,6 +1,10 @@ #include "libshared_and_static.h" +#ifndef MY_CUSTOM_CONTENT_ADDED +# error "MY_CUSTOM_CONTENT_ADDED not defined!" +#endif + int LibsharedAndStatic::libshared_and_static() const { return 0; From f05f5b01d0a690e5f3e06be2c702ee659433c326 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Tue, 28 Jun 2016 23:05:37 +0200 Subject: [PATCH 162/929] cmliblzma: always build as static library --- Utilities/cmliblzma/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 89205366f..e80668002 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -182,10 +182,6 @@ SET(LZMA_SRCS liblzma/simple/x86.c ) -IF(WIN32 AND BUILD_SHARED_LIBS) - SET(LZMA_SRCS ${LZMA_SRCS} liblzma/liblzma_w32res.rc) -ENDIF() - CONFIGURE_FILE(config.h.in config.h @ONLY) INCLUDE_DIRECTORIES( @@ -209,7 +205,7 @@ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") ENDIF() -ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) +ADD_LIBRARY(cmliblzma STATIC ${LZMA_SRCS}) IF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Disable the XL compiler optimizer because it causes crashes From b9b3ec4d98b03c180b2e6b9ad8edba7f75576353 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 29 Jun 2016 00:01:05 -0400 Subject: [PATCH 163/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4e2ea5885..9d2e2d41c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160628) +set(CMake_VERSION_PATCH 20160629) #set(CMake_VERSION_RC 1) From 3f77655d060ae48fabd9dc5c445cad813a70db42 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 29 Jun 2016 11:33:31 +0200 Subject: [PATCH 164/929] CM_OVERRIDE: fix feature test for clang Clang refuses to default initialize an instance of a class that does not have a default constructor. Fix the check by adding default constructors. Don't use brace initialization like it is proposed in the error message. We want to test the override support independent from the support for brace initialization. --- Source/Checks/cm_cxx_override.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx index e1969684d..5a33fbb78 100644 --- a/Source/Checks/cm_cxx_override.cxx +++ b/Source/Checks/cm_cxx_override.cxx @@ -1,11 +1,13 @@ struct Foo { + Foo() {} virtual ~Foo() {} virtual int test() const = 0; }; struct Bar : Foo { + Bar() {} ~Bar() override {} int test() const override { return 0; } }; From 4e8480db5425e0acbbd6394593417aab2a1fc3e5 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 29 Jun 2016 09:31:51 +0200 Subject: [PATCH 165/929] cmTypeMacro: mark overridden functions with CM_OVERRIDE --- Source/cmTypeMacro.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/cmTypeMacro.h b/Source/cmTypeMacro.h index 5c534c353..147eba82a 100644 --- a/Source/cmTypeMacro.h +++ b/Source/cmTypeMacro.h @@ -15,7 +15,7 @@ // All subclasses of cmCommand or cmCTestGenericHandler should // invoke this macro. #define cmTypeMacro(thisClass, superclass) \ - virtual const char* GetNameOfClass() { return #thisClass; } \ + const char* GetNameOfClass() CM_OVERRIDE { return #thisClass; } \ typedef superclass Superclass; \ static bool IsTypeOf(const char* type) \ { \ @@ -24,7 +24,10 @@ } \ return Superclass::IsTypeOf(type); \ } \ - virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \ + bool IsA(const char* type) CM_OVERRIDE \ + { \ + return thisClass::IsTypeOf(type); \ + } \ static thisClass* SafeDownCast(cmObject* c) \ { \ if (c && c->IsA(#thisClass)) { \ From a9252441b3c03572808b15155f31b4e60b150d0e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Jun 2016 09:09:54 -0400 Subject: [PATCH 166/929] Tests: Run clang-format on GenerateExportHeader code --- .../lib_shared_and_static/libshared_and_static.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 83b8f9859..846c20749 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -2,7 +2,7 @@ #include "libshared_and_static.h" #ifndef MY_CUSTOM_CONTENT_ADDED -# error "MY_CUSTOM_CONTENT_ADDED not defined!" +#error "MY_CUSTOM_CONTENT_ADDED not defined!" #endif int LibsharedAndStatic::libshared_and_static() const From d582c23a47ceef09e80435d6b986e3938f7f1521 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Jun 2016 15:10:18 -0400 Subject: [PATCH 167/929] try_compile: Add policy CMP0066 to honor CMAKE__FLAGS_ In the `try_compile` source file signature we propagate the caller's value of `CMAKE__FLAGS` into the test project. Extend this to propagate `CMAKE__FLAGS_` too instead of always using the default value in the test project. This will be useful, for example, to allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`). However, some projects may currently depend on this not being done, so we need to activate the behavior using a policy. This change was originally made by commit v3.6.0-rc1~160^2 (try_compile: Honor CMAKE__FLAGS_ changes, 2016-04-11) but without the policy and so had to be reverted during the 3.6 release candidate cycle. Fixes #16174. --- Help/manual/cmake-policies.7.rst | 8 +++ Help/policy/CMP0066.rst | 27 +++++++++ Help/release/dev/try_compile-config-flags.rst | 7 +++ .../variable/CMAKE_POLICY_WARNING_CMPNNNN.rst | 2 + Source/cmCoreTryCompile.cxx | 37 ++++++++++++ Source/cmPolicies.h | 5 +- Tests/RunCMake/try_compile/CMP0066-stderr.txt | 15 +++++ Tests/RunCMake/try_compile/CMP0066-stdout.txt | 4 ++ Tests/RunCMake/try_compile/CMP0066.cmake | 58 +++++++++++++++++++ Tests/RunCMake/try_compile/RunCMakeTest.cmake | 1 + Tests/RunCMake/try_compile/src.c | 3 + 11 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 Help/policy/CMP0066.rst create mode 100644 Help/release/dev/try_compile-config-flags.rst create mode 100644 Tests/RunCMake/try_compile/CMP0066-stderr.txt create mode 100644 Tests/RunCMake/try_compile/CMP0066-stdout.txt create mode 100644 Tests/RunCMake/try_compile/CMP0066.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 43f4637fb..0cfe98389 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.7 +================================ + +.. toctree:: + :maxdepth: 1 + + CMP0066: Honor per-config flags in try_compile() source-file signature. + Policies Introduced by CMake 3.4 ================================ diff --git a/Help/policy/CMP0066.rst b/Help/policy/CMP0066.rst new file mode 100644 index 000000000..d1dcb0ec6 --- /dev/null +++ b/Help/policy/CMP0066.rst @@ -0,0 +1,27 @@ +CMP0066 +------- + +Honor per-config flags in :command:`try_compile` source-file signature. + +The source file signature of the :command:`try_compile` command uses the value +of the :variable:`CMAKE__FLAGS` variable in the test project so that the +test compilation works as it would in the main project. However, CMake 3.6 and +below do not also honor config-specific compiler flags such as those in the +:variable:`CMAKE__FLAGS_DEBUG` variable. CMake 3.7 and above prefer to +honor config-specific compiler flags too. This policy provides compatibility +for projects that do not expect config-specific compiler flags to be used. + +The ``OLD`` behavior of this policy is to ignore config-specific flag +variables like :variable:`CMAKE__FLAGS_DEBUG` and only use CMake's +built-in defaults for the current compiler and platform. + +The ``NEW`` behavior of this policy is to honor config-specific flag +variabldes like :variable:`CMAKE__FLAGS_DEBUG`. + +This policy was introduced in CMake version 3.7. Unlike most policies, +CMake version |release| does *not* warn by default when this policy +is not set and simply uses OLD behavior. See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0066 >` +variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/try_compile-config-flags.rst b/Help/release/dev/try_compile-config-flags.rst new file mode 100644 index 000000000..ebfd6a4cc --- /dev/null +++ b/Help/release/dev/try_compile-config-flags.rst @@ -0,0 +1,7 @@ +try_compile-config-flags +------------------------ + +* The :command:`try_compile` command source file signature now honors + configuration-specific flags (e.g. :variable:`CMAKE__FLAGS_DEBUG`) + in the generated test project. Previously only the default such flags + for the current toolchain were used. See policy :policy:`CMP0066`. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index 582f9e495..36cf75f59 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -15,6 +15,8 @@ warn by default: policy :policy:`CMP0060`. * ``CMAKE_POLICY_WARNING_CMP0065`` controls the warning for policy :policy:`CMP0065`. +* ``CMAKE_POLICY_WARNING_CMP0066`` controls the warning for + policy :policy:`CMP0066`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 805d8e864..e9367b133 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -334,6 +334,43 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0066)) { + case cmPolicies::WARN: + if (this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0066")) { + std::ostringstream w; + /* clang-format off */ + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0066) << "\n" + "For compatibility with older versions of CMake, try_compile " + "is not honoring caller config-specific compiler flags " + "(e.g. CMAKE_C_FLAGS_DEBUG) in the test project." + ; + /* clang-format on */ + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + case cmPolicies::OLD: + // OLD behavior is to do nothing. + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066)); + case cmPolicies::NEW: { + // NEW behavior is to pass config-specific compiler flags. + static std::string const cfgDefault = "DEBUG"; + std::string const cfg = + !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault; + for (std::set::iterator li = testLangs.begin(); + li != testLangs.end(); ++li) { + std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg; + const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg); + fprintf(fout, "set(%s %s)\n", langFlagsCfg.c_str(), + cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "") + .c_str()); + } + } break; + } switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0056)) { case cmPolicies::WARN: if (this->Makefile->PolicyOptionalWarningEnabled( diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ff49e3163..0c8ff6039 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -203,7 +203,10 @@ class cmPolicy; SELECT(POLICY, CMP0065, \ "Do not add flags to export symbols from executables without " \ "the ENABLE_EXPORTS target property.", \ - 3, 4, 0, cmPolicies::WARN) + 3, 4, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0066, \ + "Honor per-config flags in try_compile() source-file signature.", 3, \ + 7, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/try_compile/CMP0066-stderr.txt b/Tests/RunCMake/try_compile/CMP0066-stderr.txt new file mode 100644 index 000000000..b14e2900e --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066-stderr.txt @@ -0,0 +1,15 @@ +before try_compile with CMP0066 WARN-default +after try_compile with CMP0066 WARN-default +* +CMake Warning \(dev\) at CMP0066.cmake:[0-9]+ \(try_compile\): + Policy CMP0066 is not set: Honor per-config flags in try_compile\(\) + source-file signature. Run "cmake --help-policy CMP0066" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + For compatibility with older versions of CMake, try_compile is not honoring + caller config-specific compiler flags \(e.g. CMAKE_C_FLAGS_DEBUG\) in the + test project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/try_compile/CMP0066-stdout.txt b/Tests/RunCMake/try_compile/CMP0066-stdout.txt new file mode 100644 index 000000000..1eb2f8352 --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066-stdout.txt @@ -0,0 +1,4 @@ +-- try_compile with CMP0066 WARN-default worked as expected +-- try_compile with CMP0066 WARN-enabled worked as expected +-- try_compile with CMP0066 OLD worked as expected +-- try_compile with CMP0066 NEW worked as expected diff --git a/Tests/RunCMake/try_compile/CMP0066.cmake b/Tests/RunCMake/try_compile/CMP0066.cmake new file mode 100644 index 000000000..4b95251a0 --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066.cmake @@ -0,0 +1,58 @@ +enable_language(C) +set(CMAKE_C_FLAGS_RELEASE "-DPP_ERROR ${CMAKE_C_FLAGS_DEBUG}") +set(CMAKE_TRY_COMPILE_CONFIGURATION Release) + +#----------------------------------------------------------------------------- +message("before try_compile with CMP0066 WARN-default") +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 WARN-default failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 WARN-default worked as expected") +endif() +message("after try_compile with CMP0066 WARN-default") + +#----------------------------------------------------------------------------- +set(CMAKE_POLICY_WARNING_CMP0066 ON) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 WARN-enabled failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 WARN-enabled worked as expected") +endif() + +#----------------------------------------------------------------------------- +cmake_policy(SET CMP0066 OLD) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 OLD failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 OLD worked as expected") +endif() + +#----------------------------------------------------------------------------- +cmake_policy(SET CMP0066 NEW) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(RESULT) + message(FATAL_ERROR "try_compile with CMP0066 NEW passed but should have failed:\n${out}") +elseif(NOT "x${out}" MATCHES "PP_ERROR is defined") + message(FATAL_ERROR "try_compile with CMP0066 NEW did not fail with PP_ERROR:\n${out}") +else() + message(STATUS "try_compile with CMP0066 NEW worked as expected") +endif() diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 4f30f1d40..522433aee 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -25,6 +25,7 @@ run_cmake(TargetTypeInvalid) run_cmake(TargetTypeStatic) run_cmake(CMP0056) +run_cmake(CMP0066) if(RunCMake_GENERATOR MATCHES "Make|Ninja") # Use a single build tree for a few tests without cleaning. diff --git a/Tests/RunCMake/try_compile/src.c b/Tests/RunCMake/try_compile/src.c index 8488f4e58..5e513825c 100644 --- a/Tests/RunCMake/try_compile/src.c +++ b/Tests/RunCMake/try_compile/src.c @@ -2,3 +2,6 @@ int main(void) { return 0; } +#ifdef PP_ERROR +#error PP_ERROR is defined +#endif From b5ec5b0901177ebcd116d6ddd66ed114549014ec Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Jun 2016 10:17:52 -0400 Subject: [PATCH 168/929] Avoid using KWSys auto_ptr by adopting it ourselves Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|' --- Help/manual/cmake-developer.7.rst | 7 +- Source/CMakeLists.txt | 1 + Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/CTest/cmCTestUpdateHandler.cxx | 4 +- Source/cmCTest.cxx | 8 +- Source/cmCryptoHash.cxx | 16 +- Source/cmCryptoHash.h | 4 +- Source/cmCustomCommand.cxx | 2 +- Source/cmCustomCommandGenerator.cxx | 4 +- Source/cmELF.cxx | 13 +- Source/cmExportFileGenerator.cxx | 10 +- Source/cmExportLibraryDependenciesCommand.cxx | 8 +- Source/cmExportTryCompileFileGenerator.cxx | 2 +- Source/cmFileCommand.cxx | 14 +- Source/cmFindPackageCommand.cxx | 33 ++- Source/cmForEachCommand.cxx | 7 +- Source/cmGeneratorExpression.cxx | 6 +- Source/cmGeneratorExpression.h | 7 +- .../cmGeneratorExpressionEvaluationFile.cxx | 7 +- Source/cmGeneratorExpressionEvaluationFile.h | 11 +- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.cxx | 30 ++- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 4 +- Source/cmGraphVizWriter.cxx | 5 +- Source/cmIfCommand.cxx | 3 +- Source/cmInstallDirectoryGenerator.cxx | 2 +- Source/cmInstallFilesGenerator.cxx | 2 +- Source/cmInstalledFile.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmLocalVisualStudioGenerator.h | 7 +- Source/cmMakefile.cxx | 19 +- Source/cmMakefile.h | 13 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmStringCommand.cxx | 2 +- Source/cmTarget.h | 2 +- Source/cmVariableWatch.cxx | 4 +- Source/cmVisualStudio10TargetGenerator.cxx | 19 +- Source/cmWhileCommand.cxx | 3 +- Source/cm_auto_ptr.hxx | 221 ++++++++++++++++++ Source/cmake.cxx | 16 +- Source/cmcmd.cxx | 5 +- bootstrap | 1 - 50 files changed, 381 insertions(+), 173 deletions(-) create mode 100644 Source/cm_auto_ptr.hxx diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 7bfdcadcb..afaccc6ed 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -24,9 +24,10 @@ to build with such toolchains. std::auto_ptr ------------- -Some implementations have a ``std::auto_ptr`` which can not be used as a -return value from a function. ``std::auto_ptr`` may not be used. Use -``cmsys::auto_ptr`` instead. +The ``std::auto_ptr`` template is deprecated in C++11. We want to use it +so we can build on C++98 compilers but we do not want to turn off compiler +warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR`` +macro instead. size_t ------ diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fd739841a..d49ebbb20 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -364,6 +364,7 @@ set(SRCS cmake.cxx cmake.h + cm_auto_ptr.hxx cm_get_date.h cm_get_date.c cm_sha2.h diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b5b364d26..97216c391 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1044,7 +1044,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) std::string cmCPackWIXGenerator::CreateHashedId( std::string const& path, std::string const& normalizedFilename) { - cmsys::auto_ptr sha1 = cmCryptoHash::New("SHA1"); + CM_AUTO_PTR sha1 = cmCryptoHash::New("SHA1"); std::string hash = sha1->HashString(path.c_str()); std::string identifier; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 914d0dc20..df8bb0f9a 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -624,7 +624,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr mf( + CM_AUTO_PTR mf( new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!installSubDirectory.empty() && installSubDirectory != "/") { tempInstallDirectory += installSubDirectory; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index b4a2c6fe2..771519c91 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -185,7 +185,7 @@ int main(int argc, char const* const* argv) cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); - cmsys::auto_ptr globalMF( + CM_AUTO_PTR globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 477f16ef0..3eed79efa 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -612,7 +612,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmake.h" -#include +#include void cmCTestLaunch::LoadConfig() { cmake cm; @@ -620,7 +620,7 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if (cmSystemTools::FileExists(fname.c_str()) && diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1b6b44208..cd250fbba 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1352,7 +1352,7 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8131c901f..ac7eb05c0 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -30,7 +30,7 @@ #include "cmCTestSVN.h" #include "cmCTestVC.h" -#include +#include //#include #include @@ -159,7 +159,7 @@ int cmCTestUpdateHandler::ProcessHandler() , this->Quiet); // Create an object to interact with the VCS tool. - cmsys::auto_ptr vc; + CM_AUTO_PTR vc; switch (this->UpdateType) { case e_CVS: vc.reset(new cmCTestCVS(this->CTest, ofs)); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 3694f09c7..9950a843d 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -51,7 +51,7 @@ #include #include -#include +#include #include #include @@ -474,7 +474,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf.get())) { cmCTestOptionalLog( @@ -1165,7 +1165,7 @@ int cmCTest::RunTest(std::vector argv, std::string* output, } std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); - cmsys::auto_ptr saveEnv; + CM_AUTO_PTR saveEnv; if (modifyEnv) { saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); cmSystemTools::AppendEnv(*environment); @@ -1193,7 +1193,7 @@ int cmCTest::RunTest(std::vector argv, std::string* output, *output = ""; } - cmsys::auto_ptr saveEnv; + CM_AUTO_PTR saveEnv; if (modifyEnv) { saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); cmSystemTools::AppendEnv(*environment); diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index e54b3c785..8d60c1f1a 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -15,22 +15,22 @@ #include #include -cmsys::auto_ptr cmCryptoHash::New(const char* algo) +CM_AUTO_PTR cmCryptoHash::New(const char* algo) { if (strcmp(algo, "MD5") == 0) { - return cmsys::auto_ptr(new cmCryptoHashMD5); + return CM_AUTO_PTR(new cmCryptoHashMD5); } else if (strcmp(algo, "SHA1") == 0) { - return cmsys::auto_ptr(new cmCryptoHashSHA1); + return CM_AUTO_PTR(new cmCryptoHashSHA1); } else if (strcmp(algo, "SHA224") == 0) { - return cmsys::auto_ptr(new cmCryptoHashSHA224); + return CM_AUTO_PTR(new cmCryptoHashSHA224); } else if (strcmp(algo, "SHA256") == 0) { - return cmsys::auto_ptr(new cmCryptoHashSHA256); + return CM_AUTO_PTR(new cmCryptoHashSHA256); } else if (strcmp(algo, "SHA384") == 0) { - return cmsys::auto_ptr(new cmCryptoHashSHA384); + return CM_AUTO_PTR(new cmCryptoHashSHA384); } else if (strcmp(algo, "SHA512") == 0) { - return cmsys::auto_ptr(new cmCryptoHashSHA512); + return CM_AUTO_PTR(new cmCryptoHashSHA512); } else { - return cmsys::auto_ptr(CM_NULLPTR); + return CM_AUTO_PTR(CM_NULLPTR); } } diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 85adf6967..6aaaf937d 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -14,13 +14,13 @@ #include "cmStandardIncludes.h" -#include +#include class cmCryptoHash { public: virtual ~cmCryptoHash() {} - static cmsys::auto_ptr New(const char* algo); + static CM_AUTO_PTR New(const char* algo); std::string HashString(const std::string& input); std::string HashFile(const std::string& file); diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 2b9248d57..7533369fa 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -13,7 +13,7 @@ #include "cmMakefile.h" -#include +#include cmCustomCommand::cmCustomCommand() : Backtrace() diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 315a1b6d4..6165bcf11 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -66,7 +66,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const } } - cmsys::auto_ptr cge = this->GE->Parse(argv0); + CM_AUTO_PTR cge = this->GE->Parse(argv0); std::string exe = cge->Evaluate(this->LG, this->Config); return exe; @@ -145,7 +145,7 @@ std::vector const& cmCustomCommandGenerator::GetDepends() const std::vector depends = this->CC.GetDepends(); for (std::vector::const_iterator i = depends.begin(); i != depends.end(); ++i) { - cmsys::auto_ptr cge = this->GE->Parse(*i); + CM_AUTO_PTR cge = this->GE->Parse(*i); std::vector result; cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config), result); diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 59667cd6b..15755cbc6 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -13,8 +13,8 @@ #include "cmELF.h" +#include #include -#include // Include the ELF format information system header. #if defined(__OpenBSD__) @@ -107,7 +107,7 @@ public: }; // Construct and take ownership of the file stream object. - cmELFInternal(cmELF* external, cmsys::auto_ptr& fin, + cmELFInternal(cmELF* external, CM_AUTO_PTR& fin, ByteOrderType order) : External(external) , Stream(*fin.release()) @@ -237,7 +237,7 @@ public: typedef typename Types::tagtype tagtype; // Construct with a stream and byte swap indicator. - cmELFInternalImpl(cmELF* external, cmsys::auto_ptr& fin, + cmELFInternalImpl(cmELF* external, CM_AUTO_PTR& fin, ByteOrderType order); // Return the number of sections as specified by the ELF header. @@ -537,8 +537,9 @@ private: }; template -cmELFInternalImpl::cmELFInternalImpl( - cmELF* external, cmsys::auto_ptr& fin, ByteOrderType order) +cmELFInternalImpl::cmELFInternalImpl(cmELF* external, + CM_AUTO_PTR& fin, + ByteOrderType order) : cmELFInternal(external, fin, order) { // Read the main header. @@ -755,7 +756,7 @@ cmELF::cmELF(const char* fname) : Internal(CM_NULLPTR) { // Try to open the file. - cmsys::auto_ptr fin(new cmsys::ifstream(fname)); + CM_AUTO_PTR fin(new cmsys::ifstream(fname)); // Quit now if the file could not be opened. if (!fin.get() || !*fin) { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 736c7da7b..d93e40676 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -25,8 +25,8 @@ #include "cmVersion.h" #include +#include #include -#include static std::string cmExportFileGeneratorEscape(std::string const& str) { @@ -69,15 +69,15 @@ const char* cmExportFileGenerator::GetMainExportFileName() const bool cmExportFileGenerator::GenerateImportFile() { // Open the output file to generate it. - cmsys::auto_ptr foutPtr; + CM_AUTO_PTR foutPtr; if (this->AppendMode) { // Open for append. - cmsys::auto_ptr ap( + CM_AUTO_PTR ap( new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app)); foutPtr = ap; } else { // Generate atomically and with copy-if-different. - cmsys::auto_ptr ap( + CM_AUTO_PTR ap( new cmGeneratedFileStream(this->MainImportFile.c_str(), true)); ap->SetCopyIfDifferent(true); foutPtr = ap; @@ -393,7 +393,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( std::string dirs = cmGeneratorExpression::Preprocess( tei->InterfaceIncludeDirectories, preprocessRule, true); this->ReplaceInstallPrefix(dirs); - cmsys::auto_ptr cge = ge.Parse(dirs); + CM_AUTO_PTR cge = ge.Parse(dirs); std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "", false, target); diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index ab43aa8a5..c8272cb89 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -16,7 +16,7 @@ #include "cmVersion.h" #include "cmake.h" -#include +#include bool cmExportLibraryDependenciesCommand::InitialPass( std::vector const& args, cmExecutionStatus&) @@ -53,13 +53,13 @@ void cmExportLibraryDependenciesCommand::FinalPass() void cmExportLibraryDependenciesCommand::ConstFinalPass() const { // Use copy-if-different if not appending. - cmsys::auto_ptr foutPtr; + CM_AUTO_PTR foutPtr; if (this->Append) { - cmsys::auto_ptr ap( + CM_AUTO_PTR ap( new cmsys::ofstream(this->Filename.c_str(), std::ios::app)); foutPtr = ap; } else { - cmsys::auto_ptr ap( + CM_AUTO_PTR ap( new cmGeneratedFileStream(this->Filename.c_str(), true)); ap->SetCopyIfDifferent(true); foutPtr = ap; diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index fdc076002..2916e6b2d 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -66,7 +66,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, CM_NULLPTR, CM_NULLPTR); - cmsys::auto_ptr cge = ge.Parse(prop); + CM_AUTO_PTR cge = ge.Parse(prop); cmTarget dummyHead; dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4aecf7c62..5a1238b17 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -34,12 +34,12 @@ // include sys/stat.h after sys/types.h #include +#include #include #include #include #include #include -#include // Table of permissions flags. #if defined(_WIN32) && !defined(__CYGWIN__) @@ -330,7 +330,7 @@ bool cmFileCommand::HandleHashCommand(std::vector const& args) return false; } - cmsys::auto_ptr hash(cmCryptoHash::New(args[0].c_str())); + CM_AUTO_PTR hash(cmCryptoHash::New(args[0].c_str())); if (hash.get()) { std::string out = hash->HashFile(args[1]); if (!out.empty()) { @@ -2478,7 +2478,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector const& args) const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); std::string expectedHash; std::string hashMatchMSG; - cmsys::auto_ptr hash; + CM_AUTO_PTR hash; bool showProgress = false; while (i != args.end()) { @@ -2534,7 +2534,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector const& args) this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5."); return false; } - hash = cmsys::auto_ptr(cmCryptoHash::New("MD5")); + hash = CM_AUTO_PTR(cmCryptoHash::New("MD5")); hashMatchMSG = "MD5 sum"; expectedHash = cmSystemTools::LowerCase(*i); } else if (*i == "SHOW_PROGRESS") { @@ -2555,7 +2555,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector const& args) } std::string algo = i->substr(0, pos); expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1)); - hash = cmsys::auto_ptr(cmCryptoHash::New(algo.c_str())); + hash = CM_AUTO_PTR(cmCryptoHash::New(algo.c_str())); if (!hash.get()) { std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; err += algo; @@ -2971,11 +2971,11 @@ void cmFileCommand::AddEvaluationFile(const std::string& inputName, cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression outputGe(lfbt); - cmsys::auto_ptr outputCge = + CM_AUTO_PTR outputCge = outputGe.Parse(outputExpr); cmGeneratorExpression conditionGe(lfbt); - cmsys::auto_ptr conditionCge = + CM_AUTO_PTR conditionCge = conditionGe.Parse(condition); this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge, diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 09fa795c0..d5fd75dc0 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1500,9 +1500,9 @@ void cmFindPackageCommand::StoreVersionFound() this->Makefile->AddDefinition(ver + "_COUNT", buf); } +#include #include #include -#include class cmFileList; class cmFileListGeneratorBase @@ -1515,10 +1515,10 @@ protected: private: bool Search(cmFileList&); virtual bool Search(std::string const& parent, cmFileList&) = 0; - virtual cmsys::auto_ptr Clone() const = 0; + virtual CM_AUTO_PTR Clone() const = 0; friend class cmFileList; cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next); - cmsys::auto_ptr Next; + CM_AUTO_PTR Next; }; class cmFileList @@ -1551,7 +1551,7 @@ public: private: virtual bool Visit(std::string const& fullPath) = 0; friend class cmFileListGeneratorBase; - cmsys::auto_ptr First; + CM_AUTO_PTR First; cmFileListGeneratorBase* Last; }; @@ -1621,9 +1621,9 @@ private: std::string fullPath = parent + this->String; return this->Consider(fullPath, lister); } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( + CM_AUTO_PTR g( new cmFileListGeneratorFixed(*this)); return g; } @@ -1655,9 +1655,9 @@ private: } return false; } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( + CM_AUTO_PTR g( new cmFileListGeneratorEnumerate(*this)); return g; } @@ -1706,9 +1706,9 @@ private: } return false; } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( + CM_AUTO_PTR g( new cmFileListGeneratorProject(*this)); return g; } @@ -1763,9 +1763,9 @@ private: } return false; } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( + CM_AUTO_PTR g( new cmFileListGeneratorMacProject(*this)); return g; } @@ -1807,9 +1807,9 @@ private: } return false; } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( + CM_AUTO_PTR g( new cmFileListGeneratorCaseInsensitive(*this)); return g; } @@ -1853,10 +1853,9 @@ private: } return false; } - cmsys::auto_ptr Clone() const CM_OVERRIDE + CM_AUTO_PTR Clone() const CM_OVERRIDE { - cmsys::auto_ptr g( - new cmFileListGeneratorGlob(*this)); + CM_AUTO_PTR g(new cmFileListGeneratorGlob(*this)); return g; } }; diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index daf43e652..c6e5f0665 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmForEachCommand.h" -#include +#include cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf) : Makefile(mf) @@ -36,8 +36,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endofreach for this statement if (!this->Depth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } @@ -184,7 +183,7 @@ bool cmForEachCommand::InitialPass(std::vector const& args, bool cmForEachCommand::HandleInMode(std::vector const& args) { - cmsys::auto_ptr f( + CM_AUTO_PTR f( new cmForEachFunctionBlocker(this->Makefile)); f->Args.push_back(args[0]); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 53243b8e6..983bfb4ae 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -26,14 +26,14 @@ cmGeneratorExpression::cmGeneratorExpression( { } -cmsys::auto_ptr cmGeneratorExpression::Parse( +CM_AUTO_PTR cmGeneratorExpression::Parse( std::string const& input) { - return cmsys::auto_ptr( + return CM_AUTO_PTR( new cmCompiledGeneratorExpression(this->Backtrace, input)); } -cmsys::auto_ptr cmGeneratorExpression::Parse( +CM_AUTO_PTR cmGeneratorExpression::Parse( const char* input) { return this->Parse(std::string(input ? input : "")); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 5d02427b9..2f9160873 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -17,8 +17,8 @@ #include "cmListFileCache.h" +#include #include -#include class cmGeneratorTarget; class cmLocalGenerator; @@ -47,9 +47,8 @@ public: cmListFileBacktrace const& backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); - cmsys::auto_ptr Parse( - std::string const& input); - cmsys::auto_ptr Parse(const char* input); + CM_AUTO_PTR Parse(std::string const& input); + CM_AUTO_PTR Parse(const char* input); enum PreprocessContext { diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index f9dbc2d45..c01c4fc6b 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -23,9 +23,8 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( const std::string& input, - cmsys::auto_ptr outputFileExpr, - cmsys::auto_ptr condition, - bool inputIsContent) + CM_AUTO_PTR outputFileExpr, + CM_AUTO_PTR condition, bool inputIsContent) : Input(input) , OutputFileExpr(outputFileExpr) , Condition(condition) @@ -135,7 +134,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); cmGeneratorExpression contentGE(lfbt); - cmsys::auto_ptr inputExpression = + CM_AUTO_PTR inputExpression = contentGE.Parse(inputContent); std::map outputFiles; diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index bfd6add29..52ba2d8c2 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -14,7 +14,7 @@ #include "cmGeneratorExpression.h" -#include +#include #include class cmLocalGenerator; @@ -24,9 +24,8 @@ class cmGeneratorExpressionEvaluationFile public: cmGeneratorExpressionEvaluationFile( const std::string& input, - cmsys::auto_ptr outputFileExpr, - cmsys::auto_ptr condition, - bool inputIsContent); + CM_AUTO_PTR outputFileExpr, + CM_AUTO_PTR condition, bool inputIsContent); void Generate(cmLocalGenerator* lg); @@ -42,8 +41,8 @@ private: private: const std::string Input; - const cmsys::auto_ptr OutputFileExpr; - const cmsys::auto_ptr Condition; + const CM_AUTO_PTR OutputFileExpr; + const CM_AUTO_PTR Condition; std::vector Files; const bool InputIsContent; }; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 830979fe8..ca7250be1 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -24,7 +24,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( cmGeneratorExpressionDAGChecker* dagChecker) { cmGeneratorExpression ge(context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); + CM_AUTO_PTR cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(lg, context->Config, context->Quiet, headTarget, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c7dd3e4ec..c9cbd0008 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -42,13 +42,13 @@ class cmGeneratorTarget::TargetPropertyEntry static cmLinkImplItem NoLinkImplItem; public: - TargetPropertyEntry(cmsys::auto_ptr cge, + TargetPropertyEntry(CM_AUTO_PTR cge, cmLinkImplItem const& item = NoLinkImplItem) : ge(cge) , LinkImplItem(item) { } - const cmsys::auto_ptr ge; + const CM_AUTO_PTR ge; cmLinkImplItem const& LinkImplItem; }; cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem; @@ -253,7 +253,7 @@ void CreatePropertyGeneratorExpressions( for (std::vector::const_iterator it = entries.begin(); it != entries.end(); ++it, ++btIt) { cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr cge = ge.Parse(*it); + CM_AUTO_PTR cge = ge.Parse(*it); cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge)); } @@ -443,7 +443,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, // Now evaluate genex and update the previously-prepared map entry. cmGeneratorExpression ge; - cmsys::auto_ptr cge = ge.Parse(outName); + CM_AUTO_PTR cge = ge.Parse(outName); i->second = cge->Evaluate(this->LocalGenerator, config); } else if (i->second.empty()) { // An empty map entry indicates we have been called recursively @@ -461,7 +461,7 @@ void cmGeneratorTarget::AddSource(const std::string& src) this->Target->AddSource(src); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr cge = ge.Parse(src); + CM_AUTO_PTR cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->SourceEntries.push_back(new TargetPropertyEntry(cge)); this->SourceFilesMap.clear(); @@ -477,7 +477,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector const& srcs) this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr cge = ge.Parse(srcFiles); + CM_AUTO_PTR cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->SourceEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -862,7 +862,7 @@ static void AddInterfaceEntries( if (it->Target) { std::string genex = "$"; cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr cge = ge.Parse(genex); + CM_AUTO_PTR cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); entries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); @@ -2119,8 +2119,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) // Check for target references in generator expressions. for (cmCustomCommandLine::const_iterator cli = cit->begin(); cli != cit->end(); ++cli) { - const cmsys::auto_ptr cge = - ge.Parse(*cli); + const CM_AUTO_PTR cge = ge.Parse(*cli); cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true); std::set geTargets = cge->GetTargets(); targets.insert(geTargets.begin(), geTargets.end()); @@ -2405,7 +2404,7 @@ std::vector cmGeneratorTarget::GetIncludeDirectories( libDir = frameworkCheck.match(1); cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(libDir.c_str()); linkInterfaceIncludeDirectoriesEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -2629,7 +2628,7 @@ void cmGeneratorTarget::GetCompileDefinitions( } case cmPolicies::OLD: { cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(configProp); linkInterfaceCompileDefinitionsEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -3981,7 +3980,7 @@ void cmGeneratorTarget::ExpandLinkItems( dagChecker.SetTransitivePropertiesOnly(); } std::vector libs; - cmsys::auto_ptr cge = ge.Parse(value); + CM_AUTO_PTR cge = ge.Parse(value); cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config, false, headTarget, this, &dagChecker), @@ -4246,8 +4245,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, if (const char* config_outdir = this->GetProperty(configProp)) { // Use the user-specified per-configuration output directory. cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(config_outdir); + CM_AUTO_PTR cge = ge.Parse(config_outdir); out = cge->Evaluate(this->LocalGenerator, config); // Skip per-configuration subdirectory. @@ -4255,7 +4253,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, } else if (const char* outdir = this->GetProperty(propertyName)) { // Use the user-specified output directory. cmGeneratorExpression ge; - cmsys::auto_ptr cge = ge.Parse(outdir); + CM_AUTO_PTR cge = ge.Parse(outdir); out = cge->Evaluate(this->LocalGenerator, config); // Skip per-configuration subdirectory if the value contained a @@ -4990,7 +4988,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR); cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr const cge = ge.Parse(*le); + CM_AUTO_PTR const cge = ge.Parse(*le); std::string const evaluated = cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker); cmSystemTools::ExpandListArgument(evaluated, llibs); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a33bd8b67..262909ff3 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -674,7 +674,7 @@ std::set cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( target->Target->GetMakefile()->GetDefinition( "CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(propertyValue); if (cmSystemTools::IsOn( cge->Evaluate(target->GetLocalGenerator(), *i))) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e82cb16cd..e65ca0961 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -24,7 +24,7 @@ #include "cmXCodeObject.h" #include "cmake.h" -#include +#include #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmXMLParser.h" @@ -175,7 +175,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( parser.ParseFile( "/Developer/Applications/Xcode.app/Contents/version.plist"); } - cmsys::auto_ptr gg( + CM_AUTO_PTR gg( new cmGlobalXCodeGenerator(cm, parser.Version)); if (gg->XcodeVersion == 20) { cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index ed35ecdbc..adb9936a1 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -64,9 +64,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator ggi(&cm); - cmsys::auto_ptr mf( - new cmMakefile(&ggi, cm.GetCurrentSnapshot())); - cmsys::auto_ptr lg(ggi.CreateLocalGenerator(mf.get())); + CM_AUTO_PTR mf(new cmMakefile(&ggi, cm.GetCurrentSnapshot())); + CM_AUTO_PTR lg(ggi.CreateLocalGenerator(mf.get())); const char* inFileName = settingsFileName; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index cb5ba76b1..dd04136a9 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -46,8 +46,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endif for this if statement, then start executing if (!this->ScopeDepth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index a637b2557..3928231f0 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -69,7 +69,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( cmGeneratorExpression ge; for (std::vector::const_iterator i = this->Directories.begin(); i != this->Directories.end(); ++i) { - cmsys::auto_ptr cge = ge.Parse(*i); + CM_AUTO_PTR cge = ge.Parse(*i); cmSystemTools::ExpandListArgument( cge->Evaluate(this->LocalGenerator, config), dirs); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 8885ef2f4..93a740cb4 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -90,7 +90,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig( cmGeneratorExpression ge; for (std::vector::const_iterator i = this->Files.begin(); i != this->Files.end(); ++i) { - cmsys::auto_ptr cge = ge.Parse(*i); + CM_AUTO_PTR cge = ge.Parse(*i); cmSystemTools::ExpandListArgument( cge->Evaluate(this->LocalGenerator, config), files); } diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index d00089100..00ff611e8 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -22,7 +22,7 @@ class cmInstalledFile { public: - typedef cmsys::auto_ptr + typedef CM_AUTO_PTR CompiledGeneratorExpressionPtrType; typedef std::vector ExpressionVectorType; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c6cfa88cb..759707727 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -30,8 +30,8 @@ #include "cmDependsJava.h" #endif +#include #include -#include #include #include @@ -121,7 +121,7 @@ void cmLocalUnixMakefileGenerator3::Generate() if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { continue; } - cmsys::auto_ptr tg( + CM_AUTO_PTR tg( cmMakefileTargetGenerator::New(*t)); if (tg.get()) { tg->WriteRuleFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2f6bf0725..c38e99c44 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1850,7 +1850,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules( if (!addedPrelink) { event.Write(target->GetPreLinkCommands()); } - cmsys::auto_ptr pcc( + CM_AUTO_PTR pcc( this->MaybeCreateImplibDir(target, configName, this->FortranProject)); if (pcc.get()) { event.Write(*pcc); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 85ab6153c..bdb1c2b87 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -74,12 +74,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( } } -cmsys::auto_ptr +CM_AUTO_PTR cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target, const std::string& config, bool isFortran) { - cmsys::auto_ptr pcc; + CM_AUTO_PTR pcc; // If an executable exports symbols then VS wants to create an // import library but forgets to create the output directory. diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index c24d81360..87acda261 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -16,7 +16,7 @@ #include "cmGlobalVisualStudioGenerator.h" -#include +#include class cmSourceFile; class cmSourceGroup; @@ -59,8 +59,9 @@ protected: virtual bool CustomCommandUseLocal() const { return false; } /** Construct a custom command to make exe import lib dir. */ - cmsys::auto_ptr MaybeCreateImplibDir( - cmGeneratorTarget* target, const std::string& config, bool isFortran); + CM_AUTO_PTR MaybeCreateImplibDir(cmGeneratorTarget* target, + const std::string& config, + bool isFortran); }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eae4258bb..0d550dd50 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -35,10 +35,10 @@ #include "cmake.h" #include // required for atoi +#include #include #include #include -#include #include #include // for isspace @@ -262,7 +262,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, // Lookup the command prototype. if (cmCommand* proto = this->GetState()->GetCommand(name)) { // Clone the prototype. - cmsys::auto_ptr pcmd(proto->Clone()); + CM_AUTO_PTR pcmd(proto->Clone()); pcmd->SetMakefile(this); // Decide whether to invoke the command. @@ -589,9 +589,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const void cmMakefile::AddEvaluationFile( const std::string& inputFile, - cmsys::auto_ptr outputName, - cmsys::auto_ptr condition, - bool inputIsContent) + CM_AUTO_PTR outputName, + CM_AUTO_PTR condition, bool inputIsContent) { this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile( inputFile, outputName, condition, inputIsContent)); @@ -2890,7 +2889,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) FunctionBlockersType::size_type barrier = this->FunctionBlockerBarriers.back(); while (this->FunctionBlockers.size() > barrier) { - cmsys::auto_ptr fb(this->FunctionBlockers.back()); + CM_AUTO_PTR fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if (reportError) { // Report the context in which the unclosed block was opened. @@ -3027,7 +3026,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) this->FunctionBlockers.push_back(fb); } -cmsys::auto_ptr cmMakefile::RemoveFunctionBlocker( +CM_AUTO_PTR cmMakefile::RemoveFunctionBlocker( cmFunctionBlocker* fb, const cmListFileFunction& lff) { // Find the function blocker stack barrier for the current scope. @@ -3060,11 +3059,11 @@ cmsys::auto_ptr cmMakefile::RemoveFunctionBlocker( } cmFunctionBlocker* b = *pos; this->FunctionBlockers.erase(pos); - return cmsys::auto_ptr(b); + return CM_AUTO_PTR(b); } } - return cmsys::auto_ptr(); + return CM_AUTO_PTR(); } const char* cmMakefile::GetHomeDirectory() const @@ -3692,7 +3691,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name, cmState::TargetType type, bool global) { // Create the target. - cmsys::auto_ptr target(new cmTarget); + CM_AUTO_PTR target(new cmTarget); target->SetType(type, name); target->MarkAsImported(global); target->SetMakefile(this); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 642b6919c..d07b4e161 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -28,8 +28,8 @@ #include "cmSourceGroup.h" #endif +#include #include -#include #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX_UNORDERED_MAP #include @@ -97,7 +97,7 @@ public: * Remove the function blocker whose scope ends with the given command. * This returns ownership of the function blocker object. */ - cmsys::auto_ptr RemoveFunctionBlocker( + CM_AUTO_PTR RemoveFunctionBlocker( cmFunctionBlocker* fb, const cmListFileFunction& lff); /** @@ -771,11 +771,10 @@ public: void EnforceDirectoryLevelRules() const; - void AddEvaluationFile( - const std::string& inputFile, - cmsys::auto_ptr outputName, - cmsys::auto_ptr condition, - bool inputIsContent); + void AddEvaluationFile(const std::string& inputFile, + CM_AUTO_PTR outputName, + CM_AUTO_PTR condition, + bool inputIsContent); std::vector GetEvaluationFiles() const; std::vector GetExportBuildFileGenerators() diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e922fbd57..2f9c4dac8 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -134,7 +134,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() if (const char* additional_clean_files = this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) { cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(additional_clean_files); cmSystemTools::ExpandListArgument( diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7ada43120..4b40c0816 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -155,7 +155,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, snapshot.GetDirectory().SetCurrentBinary(targetDirectory); snapshot.GetDirectory().SetCurrentSource(targetDirectory); - cmsys::auto_ptr mf(new cmMakefile(&gg, snapshot)); + CM_AUTO_PTR mf(new cmMakefile(&gg, snapshot)); gg.SetCurrentMakefile(mf.get()); this->ReadAutogenInfoFile(mf.get(), targetDirectory, config); diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index a348aef06..dce468759 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -89,7 +89,7 @@ bool cmStringCommand::HandleHashCommand(std::vector const& args) return false; } - cmsys::auto_ptr hash(cmCryptoHash::New(args[0].c_str())); + CM_AUTO_PTR hash(cmCryptoHash::New(args[0].c_str())); if (hash.get()) { std::string out = hash->HashString(args[2]); this->Makefile->AddDefinition(args[1], out.c_str()); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5829d4f34..209a7298d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -19,7 +19,7 @@ #include "cmPolicies.h" #include "cmPropertyMap.h" -#include +#include #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX_UNORDERED_MAP #include diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 11eaa9368..56e2770d0 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -13,7 +13,7 @@ #include "cmAlgorithms.h" -#include +#include static const char* const cmVariableWatchAccessStrings[] = { "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS", @@ -48,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method, void* client_data /*=0*/, DeleteData delete_data /*=0*/) { - cmsys::auto_ptr p(new cmVariableWatch::Pair); + CM_AUTO_PTR p(new cmVariableWatch::Pair); p->Method = method; p->ClientData = client_data; p->DeleteDataCall = delete_data; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 635fad2f5..13e7c8992 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -42,7 +42,7 @@ #include "cmVisualStudioGeneratorOptions.h" #include "windows.h" -#include +#include cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { @@ -1229,8 +1229,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) if (!deployContent.empty()) { cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(deployContent); + CM_AUTO_PTR cge = ge.Parse(deployContent); // Deployment location cannot be set on a configuration basis if (!deployLocation.empty()) { this->WriteString("", 3); @@ -1684,7 +1683,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // copied from cmLocalVisualStudio7Generator.cxx 805 // TODO: Integrate code below with cmLocalVisualStudio7Generator. - cmsys::auto_ptr pOptions(new Options( + CM_AUTO_PTR pOptions(new Options( this->LocalGenerator, Options::Compiler, this->GetClFlagTable())); Options& clOptions = *pOptions; @@ -1848,7 +1847,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions() bool cmVisualStudio10TargetGenerator::ComputeRcOptions( std::string const& configName) { - cmsys::auto_ptr pOptions(new Options( + CM_AUTO_PTR pOptions(new Options( this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable())); Options& rcOptions = *pOptions; @@ -1905,7 +1904,7 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( std::string const& configName) { - cmsys::auto_ptr pOptions(new Options( + CM_AUTO_PTR pOptions(new Options( this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable())); Options& masmOptions = *pOptions; @@ -2058,7 +2057,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* nativeLibDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(nativeLibDirectoriesExpression); std::string nativeLibDirs = cge->Evaluate(this->LocalGenerator, configName); @@ -2071,7 +2070,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( this->GeneratorTarget->GetProperty( "ANDROID_NATIVE_LIB_DEPENDENCIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(nativeLibDependenciesExpression); std::string nativeLibDeps = cge->Evaluate(this->LocalGenerator, configName); @@ -2090,7 +2089,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* jarDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr cge = + CM_AUTO_PTR cge = ge.Parse(jarDirectoriesExpression); std::string jarDirectories = cge->Evaluate(this->LocalGenerator, configName); @@ -2150,7 +2149,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string const& config) { - cmsys::auto_ptr pOptions(new Options( + CM_AUTO_PTR pOptions(new Options( this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this)); Options& linkOptions = *pOptions; diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index bec28613f..93a62717e 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -37,8 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endwhile for this while loop then execute if (!this->Depth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } diff --git a/Source/cm_auto_ptr.hxx b/Source/cm_auto_ptr.hxx new file mode 100644 index 000000000..2cd35c330 --- /dev/null +++ b/Source/cm_auto_ptr.hxx @@ -0,0 +1,221 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef CM_AUTO_PTR_HXX +#define CM_AUTO_PTR_HXX + +#include + +// FIXME: Use std::auto_ptr on compilers that do not warn about it. +#define CM_AUTO_PTR cm::auto_ptr + +// The HP compiler cannot handle the conversions necessary to use +// auto_ptr_ref to pass an auto_ptr returned from one function +// directly to another function as in use_auto_ptr(get_auto_ptr()). +// We instead use const_cast to achieve the syntax on those platforms. +// We do not use const_cast on other platforms to maintain the C++ +// standard design and guarantee that if an auto_ptr is bound +// to a reference-to-const then ownership will be maintained. +#if defined(__HP_aCC) +#define cm_AUTO_PTR_REF 0 +#define cm_AUTO_PTR_CONST const +#define cm_AUTO_PTR_CAST(a) cast(a) +#else +#define cm_AUTO_PTR_REF 1 +#define cm_AUTO_PTR_CONST +#define cm_AUTO_PTR_CAST(a) a +#endif + +// In C++11, clang will warn about using dynamic exception specifications +// as they are deprecated. But as this class is trying to faithfully +// mimic std::auto_ptr, we want to keep the 'throw()' decorations below. +// So we suppress the warning. +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated") +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif +#endif + +namespace cm { + +template +class auto_ptr; + +#if cm_AUTO_PTR_REF +namespace detail { +// The auto_ptr_ref template is supposed to be a private member of +// auto_ptr but Borland 5.8 cannot handle it. Instead put it in +// a private namespace. +template +struct auto_ptr_ref +{ + Y* p_; + + // The extra constructor argument prevents implicit conversion to + // auto_ptr_ref from auto_ptr through the constructor. Normally + // this should be done with the explicit keyword but Borland 5.x + // generates code in the conversion operator to call itself + // infinately. + auto_ptr_ref(Y* p, int) + : p_(p) + { + } +}; +} +#endif + +/** C++98 Standard Section 20.4.5 - Template class auto_ptr. */ +template +class auto_ptr +{ +#if !cm_AUTO_PTR_REF + template + static inline auto_ptr& cast(auto_ptr const& a) + { + return const_cast&>(a); + } +#endif + + /** The pointer to the object held. */ + X* x_; + +public: + /** The type of object held by the auto_ptr. */ + typedef X element_type; + + /** Construct from an auto_ptr holding a compatible object. This + transfers ownership to the newly constructed auto_ptr. */ + template + auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw() + : x_(cm_AUTO_PTR_CAST(a).release()) + { + } + + /** Assign from an auto_ptr holding a compatible object. This + transfers ownership to the left-hand-side of the assignment. */ + template + auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw() + { + this->reset(cm_AUTO_PTR_CAST(a).release()); + return *this; + } + + /** + * Explicitly construct from a raw pointer. This is typically + * called with the result of operator new. For example: + * + * auto_ptr ptr(new X()); + */ + explicit auto_ptr(X* p = 0) throw() + : x_(p) + { + } + + /** Construct from another auto_ptr holding an object of the same + type. This transfers ownership to the newly constructed + auto_ptr. */ + auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw() + : x_(cm_AUTO_PTR_CAST(a).release()) + { + } + + /** Assign from another auto_ptr holding an object of the same type. + This transfers ownership to the newly constructed auto_ptr. */ + auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw() + { + this->reset(cm_AUTO_PTR_CAST(a).release()); + return *this; + } + + /** Destruct and delete the object held. */ + ~auto_ptr() throw() + { + // Assume object destructor is nothrow. + delete this->x_; + } + + /** Dereference and return a reference to the object held. */ + X& operator*() const throw() { return *this->x_; } + + /** Return a pointer to the object held. */ + X* operator->() const throw() { return this->x_; } + + /** Return a pointer to the object held. */ + X* get() const throw() { return this->x_; } + + /** Return a pointer to the object held and reset to hold no object. + This transfers ownership to the caller. */ + X* release() throw() + { + X* x = this->x_; + this->x_ = 0; + return x; + } + + /** Assume ownership of the given object. The object previously + held is deleted. */ + void reset(X* p = 0) throw() + { + if (this->x_ != p) { + // Assume object destructor is nothrow. + delete this->x_; + this->x_ = p; + } + } + + /** Convert to an auto_ptr holding an object of a compatible type. + This transfers ownership to the returned auto_ptr. */ + template + operator auto_ptr() throw() + { + return auto_ptr(this->release()); + } + +#if cm_AUTO_PTR_REF + /** Construct from an auto_ptr_ref. This is used when the + constructor argument is a call to a function returning an + auto_ptr. */ + auto_ptr(detail::auto_ptr_ref r) throw() + : x_(r.p_) + { + } + + /** Assign from an auto_ptr_ref. This is used when a function + returning an auto_ptr is passed on the right-hand-side of an + assignment. */ + auto_ptr& operator=(detail::auto_ptr_ref r) throw() + { + this->reset(r.p_); + return *this; + } + + /** Convert to an auto_ptr_ref. This is used when a function + returning an auto_ptr is the argument to the constructor of + another auto_ptr. */ + template + operator detail::auto_ptr_ref() throw() + { + return detail::auto_ptr_ref(this->release(), 1); + } +#endif +}; + +} // namespace cm + +// Undo warning suppression. +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated") +#pragma clang diagnostic pop +#endif +#endif + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 79e7c2b92..c5976053e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -397,7 +397,7 @@ void cmake::ReadListFile(const std::vector& args, snapshot.GetDirectory().SetCurrentSource( cmSystemTools::GetCurrentWorkingDirectory()); snapshot.SetDefaultDefinitions(); - cmsys::auto_ptr mf(new cmMakefile(gg, snapshot)); + CM_AUTO_PTR mf(new cmMakefile(gg, snapshot)); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); cmSystemTools::ConvertToUnixSlashes(file); @@ -1743,7 +1743,7 @@ int cmake::CheckBuildSystem() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { if (verbose) { @@ -1764,14 +1764,12 @@ int cmake::CheckBuildSystem() } // Create the generator and use it to clear the dependencies. - cmsys::auto_ptr ggd( - this->CreateGlobalGenerator(genName)); + CM_AUTO_PTR ggd(this->CreateGlobalGenerator(genName)); if (ggd.get()) { cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cmsys::auto_ptr mfd( + CM_AUTO_PTR mfd( new cmMakefile(ggd.get(), cm.GetCurrentSnapshot())); - cmsys::auto_ptr lgd( - ggd->CreateLocalGenerator(mfd.get())); + CM_AUTO_PTR lgd(ggd->CreateLocalGenerator(mfd.get())); lgd->ClearDependencies(mfd.get(), verbose); } } @@ -1911,7 +1909,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) void cmake::GenerateGraphViz(const char* fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE - cmsys::auto_ptr gvWriter( + CM_AUTO_PTR gvWriter( new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); std::string settingsFile = this->GetHomeOutputDirectory(); @@ -2392,7 +2390,7 @@ int cmake::Build(const std::string& dir, const std::string& target, std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return 1; } - cmsys::auto_ptr gen( + CM_AUTO_PTR gen( this->CreateGlobalGenerator(cachedGenerator)); if (!gen.get()) { std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2427286ea..010a3b20a 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -765,9 +765,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary(startOutDir); snapshot.GetDirectory().SetCurrentSource(startDir); - cmsys::auto_ptr mf(new cmMakefile(ggd, snapshot)); - cmsys::auto_ptr lgd( - ggd->CreateLocalGenerator(mf.get())); + CM_AUTO_PTR mf(new cmMakefile(ggd, snapshot)); + CM_AUTO_PTR lgd(ggd->CreateLocalGenerator(mf.get())); // Actually scan dependencies. return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0 diff --git a/bootstrap b/bootstrap index 60d63c311..ad0c8ecc5 100755 --- a/bootstrap +++ b/bootstrap @@ -365,7 +365,6 @@ KWSYS_CXX_SOURCES="\ SystemTools" KWSYS_FILES="\ - auto_ptr.hxx \ Directory.hxx \ Encoding.h \ Encoding.hxx \ From ec8f744a11dfcab9560387168cab76260aa0b777 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Tue, 28 Jun 2016 23:10:11 +0200 Subject: [PATCH 169/929] Add script to update liblzma from upstream --- Utilities/Scripts/update-liblzma.bash | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 Utilities/Scripts/update-liblzma.bash diff --git a/Utilities/Scripts/update-liblzma.bash b/Utilities/Scripts/update-liblzma.bash new file mode 100755 index 000000000..31de67144 --- /dev/null +++ b/Utilities/Scripts/update-liblzma.bash @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="liblzma" +readonly ownership="liblzma upstream " +readonly subtree="Utilities/cmliblzma" +readonly repo="http://git.tukaani.org/xz.git" +readonly tag="v5.0.5" +readonly shortlog=false +readonly paths=" + COPYING + src/common/common_w32res.rc + src/common/sysdefs.h + src/common/tuklib_integer.h + src/liblzma/ +" + +extract_source () { + git_archive + pushd "${extractdir}/${name}-reduced" + mv src/common . + mv src/liblzma . + rmdir src + popd +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" From d38a37ea1539eafec6cec6ef59cc9419531cad91 Mon Sep 17 00:00:00 2001 From: liblzma upstream Date: Sun, 30 Jun 2013 18:03:54 +0300 Subject: [PATCH 170/929] liblzma 2013-06-30 (b69900ed) Code extracted from: http://git.tukaani.org/xz.git at commit b69900ed0b2f914fc6c0a180dcb522dbe5b80ea7 (v5.0.5). From ca4276e435e251e1b2011a7a523aecdbf85c18ec Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Jun 2016 10:06:16 -0400 Subject: [PATCH 171/929] liblzma: Remove CMake-specific README We will now manage the liblzma source tree updates using the `Utilities/Scripts/update-liblzma.bash` script. Drop the README that covered the old method. --- Utilities/cmliblzma/README-CMake.txt | 66 ---------------------------- 1 file changed, 66 deletions(-) delete mode 100644 Utilities/cmliblzma/README-CMake.txt diff --git a/Utilities/cmliblzma/README-CMake.txt b/Utilities/cmliblzma/README-CMake.txt deleted file mode 100644 index b51299707..000000000 --- a/Utilities/cmliblzma/README-CMake.txt +++ /dev/null @@ -1,66 +0,0 @@ -The Utilities/cmliblzma directory contains a reduced distribution -of the liblzma source tree with only the library source code and -CMake build system. It is not a submodule; the actual content is part -of our source tree and changes can be made and committed directly. - -We update from upstream using Git's "subtree" merge strategy. A -special branch contains commits of upstream liblzma snapshots and -nothing else. No Git ref points explicitly to the head of this -branch, but it is merged into our history. - -Update liblzma from upstream as follows. Create a local branch to -explicitly reference the upstream snapshot branch head: - - git branch liblzma-upstream c289e634 - -Use a temporary directory to checkout the branch: - - mkdir liblzma-tmp - cd liblzma-tmp - git init - git pull .. liblzma-upstream - rm -rf * - -Now place the (reduced) liblzma content in this directory. See -instructions shown by - - git log c289e634 - -for help extracting the content from the upstream svn repo. Then run -the following commands to commit the new version. Substitute the -appropriate date and version number: - - git add --all - - GIT_AUTHOR_NAME='liblzma upstream' \ - GIT_AUTHOR_EMAIL='xz-devel@tukaani.org' \ - GIT_AUTHOR_DATE='Sun Jun 30 19:55:49 2013 +0300' \ - git commit -m 'liblzma 5.0.5-gb69900ed (reduced)' && - git commit --amend - -Edit the commit message to describe the procedure used to obtain the -content. Then push the changes back up to the main local repository: - - git push .. HEAD:liblzma-upstream - cd .. - rm -rf liblzma-tmp - -Create a topic in the main repository on which to perform the update: - - git checkout -b update-liblzma master - -Merge the liblzma-upstream branch as a subtree: - - git merge -s recursive -X subtree=Utilities/cmliblzma \ - liblzma-upstream - -If there are conflicts, resolve them and commit. Build and test the -tree. Commit any additional changes needed to succeed. - -Finally, run - - git rev-parse --short=8 liblzma-upstream - -to get the commit from which the liblzma-upstream branch must be started -on the next update. Edit the "git branch liblzma-upstream" line above to -record it, and commit this file. From d4f524040e8b9573bd568e4bb6b6ddb70d6ab366 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Jun 2016 10:07:48 -0400 Subject: [PATCH 172/929] liblzma: Revise update script to get version 5.0.8 --- Utilities/Scripts/update-liblzma.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Scripts/update-liblzma.bash b/Utilities/Scripts/update-liblzma.bash index 31de67144..088eb91e0 100755 --- a/Utilities/Scripts/update-liblzma.bash +++ b/Utilities/Scripts/update-liblzma.bash @@ -8,7 +8,7 @@ readonly name="liblzma" readonly ownership="liblzma upstream " readonly subtree="Utilities/cmliblzma" readonly repo="http://git.tukaani.org/xz.git" -readonly tag="v5.0.5" +readonly tag="v5.0.8" readonly shortlog=false readonly paths=" COPYING From e4d3914639d1e7b41337c9626b91458c4fe6ae95 Mon Sep 17 00:00:00 2001 From: liblzma upstream Date: Sun, 21 Dec 2014 17:06:21 +0200 Subject: [PATCH 173/929] liblzma 2014-12-21 (265e5ffb) Code extracted from: http://git.tukaani.org/xz.git at commit 265e5ffb70d9c175b424621576294d28807efd9b (v5.0.8). --- liblzma/Makefile.am | 22 +++++++++++++++++++++- liblzma/api/lzma/block.h | 3 +++ liblzma/api/lzma/version.h | 2 +- liblzma/check/crc32_fast.c | 2 +- liblzma/check/sha256.c | 2 +- liblzma/lzma/lzma_encoder_presets.c | 8 +++++--- 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/liblzma/Makefile.am b/liblzma/Makefile.am index 0529ff848..c81990a94 100644 --- a/liblzma/Makefile.am +++ b/liblzma/Makefile.am @@ -24,7 +24,7 @@ liblzma_la_CPPFLAGS = \ -I$(top_srcdir)/src/liblzma/simple \ -I$(top_srcdir)/src/common \ -DTUKLIB_SYMBOL_PREFIX=lzma_ -liblzma_la_LDFLAGS = -no-undefined -version-info 5:5:0 +liblzma_la_LDFLAGS = -no-undefined -version-info 5:8:0 include $(srcdir)/common/Makefile.inc include $(srcdir)/check/Makefile.inc @@ -88,3 +88,23 @@ endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = liblzma.pc EXTRA_DIST += liblzma.pc.in + +pc_verbose = $(pc_verbose_@AM_V@) +pc_verbose_ = $(pc_verbose_@AM_DEFAULT_V@) +pc_verbose_0 = @echo " PC " $@; + +liblzma.pc: $(srcdir)/liblzma.pc.in + $(AM_V_at)rm -f $@ + $(pc_verbose)sed \ + -e 's,@prefix[@],$(prefix),g' \ + -e 's,@exec_prefix[@],$(exec_prefix),g' \ + -e 's,@libdir[@],$(libdir),g' \ + -e 's,@includedir[@],$(includedir),g' \ + -e 's,@PACKAGE_URL[@],$(PACKAGE_URL),g' \ + -e 's,@PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \ + -e 's,@PTHREAD_CFLAGS[@],$(PTHREAD_CFLAGS),g' \ + -e 's,@PTHREAD_LIBS[@],$(PTHREAD_LIBS),g' \ + < $(srcdir)/liblzma.pc.in > $@ || { rm -f $@; exit 1; } + +clean-local: + rm -f liblzma.pc diff --git a/liblzma/api/lzma/block.h b/liblzma/api/lzma/block.h index 8a4bf2323..e6710a7bc 100644 --- a/liblzma/api/lzma/block.h +++ b/liblzma/api/lzma/block.h @@ -318,6 +318,9 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode( * The size of the Block Header must have already been decoded with * lzma_block_header_size_decode() macro and stored to block->header_size. * + * The integrity check type from Stream Header must have been stored + * to block->check. + * * block->filters must have been allocated, but they don't need to be * initialized (possible existing filter options are not freed). * diff --git a/liblzma/api/lzma/version.h b/liblzma/api/lzma/version.h index 66e93965d..09866b982 100644 --- a/liblzma/api/lzma/version.h +++ b/liblzma/api/lzma/version.h @@ -22,7 +22,7 @@ */ #define LZMA_VERSION_MAJOR 5 #define LZMA_VERSION_MINOR 0 -#define LZMA_VERSION_PATCH 5 +#define LZMA_VERSION_PATCH 8 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE #ifndef LZMA_VERSION_COMMIT diff --git a/liblzma/check/crc32_fast.c b/liblzma/check/crc32_fast.c index 94da85592..3de02638d 100644 --- a/liblzma/check/crc32_fast.c +++ b/liblzma/check/crc32_fast.c @@ -20,7 +20,7 @@ #include "crc_macros.h" -// If you make any changes, do some bench marking! Seemingly unrelated +// If you make any changes, do some benchmarking! Seemingly unrelated // changes can very easily ruin the performance (and very probably is // very compiler dependent). extern LZMA_API(uint32_t) diff --git a/liblzma/check/sha256.c b/liblzma/check/sha256.c index 23bda9222..f2cc0d71a 100644 --- a/liblzma/check/sha256.c +++ b/liblzma/check/sha256.c @@ -80,7 +80,7 @@ static const uint32_t SHA256_K[64] = { static void -transform(uint32_t state[static 8], const uint32_t data[static 16]) +transform(uint32_t state[8], const uint32_t data[16]) { uint32_t W[16]; uint32_t T[8]; diff --git a/liblzma/lzma/lzma_encoder_presets.c b/liblzma/lzma/lzma_encoder_presets.c index 21e427a8d..8484b7744 100644 --- a/liblzma/lzma/lzma_encoder_presets.c +++ b/liblzma/lzma/lzma_encoder_presets.c @@ -30,14 +30,16 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << (uint8_t []){ - 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + static const uint8_t dict_pow2[] + = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + options->dict_size = UINT32_C(1) << dict_pow2[level]; if (level <= 3) { options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + static const uint8_t depths[] = { 4, 8, 24, 48 }; + options->depth = depths[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; From cd1415b548cd19652d71056dff09f0c31a8260a0 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Tue, 28 Jun 2016 22:06:17 +0300 Subject: [PATCH 174/929] CPackComponents: add cpack_append_list_variable_set_command It's like add variable, but wrap each item to quotes. Can be used for multi args properties. --- Modules/CPackComponent.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 038a71734..6a330867e 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -360,6 +360,20 @@ macro(cpack_append_string_variable_set_command var strvar) endif () endmacro() +# Macro that appends a SET command for the given list variable name (var) +# to the macro named strvar, but only if the variable named "var" +# has been defined. It's like add variable, but wrap each item to quotes. +# The string will eventually be appended to a CPack configuration file. +macro(cpack_append_list_variable_set_command var strvar) + if (DEFINED ${var}) + string(APPEND ${strvar} "set(${var}") + foreach(_val IN LISTS ${var}) + string(APPEND ${strvar} "\n \"${_val}\"") + endforeach() + string(APPEND ${strvar} ")\n") + endif () +endmacro() + # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been set to true. The string will eventually be From 9e505285e3c5fc2556d8638c0e0d0228aaeee95d Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Tue, 28 Jun 2016 22:19:05 +0300 Subject: [PATCH 175/929] CPackIFW: Using cpack_append_list_variable_set_command This is necessary for proper processing of the list items. --- Modules/CPackIFW.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 083fc28ae..2f0e03efd 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -571,7 +571,7 @@ macro(cpack_ifw_configure_component compname) endforeach() foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) - cpack_append_variable_set_command( + cpack_append_list_variable_set_command( CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME} _CPACK_IFWCOMP_STR) endforeach() @@ -604,7 +604,7 @@ macro(cpack_ifw_configure_component_group grpname) endforeach() foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) - cpack_append_variable_set_command( + cpack_append_list_variable_set_command( CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME} _CPACK_IFWGRP_STR) endforeach() From 2c759971e4b2a51a140e00c995bd9f062dd8df59 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 30 Jun 2016 00:01:07 -0400 Subject: [PATCH 176/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9d2e2d41c..94f6daf1e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160629) +set(CMake_VERSION_PATCH 20160630) #set(CMake_VERSION_RC 1) From 73a3c0cd9857b519350df09811f78c29e3fbd7be Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 30 Jun 2016 10:43:51 -0400 Subject: [PATCH 177/929] cmake-gui: Add build option to use Qt5 xcb plugin statically This will enable builds against a static Qt5. --- Source/QtDialog/CMakeLists.txt | 6 ++++++ Source/QtDialog/CMakeSetup.cxx | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 68c65ac0f..80c0dc0e8 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -36,6 +36,12 @@ if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") + if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) + list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) + set_property(SOURCE CMakeSetup.cxx + PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin) + endif() + # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly # Qt5 support is missing there. diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index c849d5292..ff3a7b2ea 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,10 @@ static int cmOSXInstall(std::string dir); static void cmAddPluginPath(); #endif +#if defined(USE_QXcbIntegrationPlugin) +Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); +#endif + int main(int argc, char** argv) { cmsys::Encoding::CommandLineArguments encoding_args = From f408a5b1b9ebb7649537b78cf1303b46860eafee Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 1 Jul 2016 00:01:05 -0400 Subject: [PATCH 178/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 94f6daf1e..2a98911b7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160630) +set(CMake_VERSION_PATCH 20160701) #set(CMake_VERSION_RC 1) From f7d23e675357c1ac895e81fda08957007794bb66 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Thu, 30 Jun 2016 10:11:53 -0400 Subject: [PATCH 179/929] KWSys 2016-06-30 (96f06c8e) Code extracted from: http://public.kitware.com/KWSys.git at commit 96f06c8e93d2b5e0395c9f413d1649563a2015d8 (master). Upstream Shortlog ----------------- Brad King (1): 96f06c8e Drop the auto_ptr.hxx component of KWSys --- CMakeLists.txt | 2 - auto_ptr.hxx.in | 219 ------------------------------------------------ testAutoPtr.cxx | 166 ------------------------------------ 3 files changed, 387 deletions(-) delete mode 100644 auto_ptr.hxx.in delete mode 100644 testAutoPtr.cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b1539416..39b03b374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -663,7 +663,6 @@ SET(KWSYS_CLASSES) SET(KWSYS_H_FILES Configure SharedForward) SET(KWSYS_HXX_FILES Configure String hashtable hash_fun hash_map hash_set - auto_ptr ) # Add selected C++ classes. @@ -903,7 +902,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # C++ tests IF(NOT WATCOM) SET(KWSYS_CXX_TESTS - testAutoPtr testHashSTL ) ENDIF() diff --git a/auto_ptr.hxx.in b/auto_ptr.hxx.in deleted file mode 100644 index ad9654cb4..000000000 --- a/auto_ptr.hxx.in +++ /dev/null @@ -1,219 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef @KWSYS_NAMESPACE@_auto_ptr_hxx -#define @KWSYS_NAMESPACE@_auto_ptr_hxx - -#include <@KWSYS_NAMESPACE@/Configure.hxx> - -// The HP compiler and VS6 cannot handle the conversions necessary to use -// auto_ptr_ref to pass an auto_ptr returned from one function -// directly to another function as in use_auto_ptr(get_auto_ptr()). -// We instead use const_cast to achieve the syntax on those platforms. -// We do not use const_cast on other platforms to maintain the C++ -// standard design and guarantee that if an auto_ptr is bound -// to a reference-to-const then ownership will be maintained. -#if defined(__HP_aCC) || (defined(_MSC_VER) && _MSC_VER <= 1200) -# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 0 -# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST const -# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) cast(a) -#else -# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 1 -# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST -# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) a -#endif - -// In C++11, clang will warn about using dynamic exception specifications -// as they are deprecated. But as this class is trying to faithfully -// mimic std::auto_ptr, we want to keep the 'throw()' decorations below. -// So we suppress the warning. -#if defined(__clang__) && defined(__has_warning) -# if __has_warning("-Wdeprecated") -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated" -# endif -#endif - -namespace @KWSYS_NAMESPACE@ -{ - -template class auto_ptr; - -#if @KWSYS_NAMESPACE@_AUTO_PTR_REF -namespace detail -{ -// The auto_ptr_ref template is supposed to be a private member of -// auto_ptr but Borland 5.8 cannot handle it. Instead put it in -// a private namespace. -template struct auto_ptr_ref -{ - Y* p_; - - // The extra constructor argument prevents implicit conversion to - // auto_ptr_ref from auto_ptr through the constructor. Normally - // this should be done with the explicit keyword but Borland 5.x - // generates code in the conversion operator to call itself - // infinately. - auto_ptr_ref(Y* p, int): p_(p) {} -}; -} -#endif - -/** C++98 Standard Section 20.4.5 - Template class auto_ptr. */ -template -class auto_ptr -{ -#if !@KWSYS_NAMESPACE@_AUTO_PTR_REF - template - static inline auto_ptr& cast(auto_ptr const& a) - { return const_cast&>(a); } -#endif - - /** The pointer to the object held. */ - X* x_; - -public: - /** The type of object held by the auto_ptr. */ - typedef X element_type; - - /** Construct from an auto_ptr holding a compatible object. This - transfers ownership to the newly constructed auto_ptr. */ - template - auto_ptr(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw(): - x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()) - { - } - - /** Assign from an auto_ptr holding a compatible object. This - transfers ownership to the left-hand-side of the assignment. */ - template - auto_ptr& operator=(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw() - { - this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()); - return *this; - } - - /** - * Explicitly construct from a raw pointer. This is typically - * called with the result of operator new. For example: - * - * auto_ptr ptr(new X()); - */ - explicit auto_ptr(X* p=0) throw(): x_(p) - { - } - - /** Construct from another auto_ptr holding an object of the same - type. This transfers ownership to the newly constructed - auto_ptr. */ - auto_ptr(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw(): - x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()) - { - } - - /** Assign from another auto_ptr holding an object of the same type. - This transfers ownership to the newly constructed auto_ptr. */ - auto_ptr& operator=(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw() - { - this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()); - return *this; - } - - /** Destruct and delete the object held. */ - ~auto_ptr() throw() - { - // Assume object destructor is nothrow. - delete this->x_; - } - - /** Dereference and return a reference to the object held. */ - X& operator*() const throw() - { - return *this->x_; - } - - /** Return a pointer to the object held. */ - X* operator->() const throw() - { - return this->x_; - } - - /** Return a pointer to the object held. */ - X* get() const throw() - { - return this->x_; - } - - /** Return a pointer to the object held and reset to hold no object. - This transfers ownership to the caller. */ - X* release() throw() - { - X* x = this->x_; - this->x_ = 0; - return x; - } - - /** Assume ownership of the given object. The object previously - held is deleted. */ - void reset(X* p=0) throw() - { - if(this->x_ != p) - { - // Assume object destructor is nothrow. - delete this->x_; - this->x_ = p; - } - } - - /** Convert to an auto_ptr holding an object of a compatible type. - This transfers ownership to the returned auto_ptr. */ - template operator auto_ptr() throw() - { - return auto_ptr(this->release()); - } - -#if @KWSYS_NAMESPACE@_AUTO_PTR_REF - /** Construct from an auto_ptr_ref. This is used when the - constructor argument is a call to a function returning an - auto_ptr. */ - auto_ptr(detail::auto_ptr_ref r) throw(): x_(r.p_) - { - } - - /** Assign from an auto_ptr_ref. This is used when a function - returning an auto_ptr is passed on the right-hand-side of an - assignment. */ - auto_ptr& operator=(detail::auto_ptr_ref r) throw() - { - this->reset(r.p_); - return *this; - } - - /** Convert to an auto_ptr_ref. This is used when a function - returning an auto_ptr is the argument to the constructor of - another auto_ptr. */ - template operator detail::auto_ptr_ref() throw() - { - return detail::auto_ptr_ref(this->release(), 1); - } -#endif -}; - -} // namespace @KWSYS_NAMESPACE@ - -// Undo warning suppression. -#if defined(__clang__) && defined(__has_warning) -# if __has_warning("-Wdeprecated") -# pragma clang diagnostic pop -# endif -#endif - -#endif diff --git a/testAutoPtr.cxx b/testAutoPtr.cxx deleted file mode 100644 index ed75ff447..000000000 --- a/testAutoPtr.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifdef __BORLANDC__ -# pragma warn -8027 /* 'for' not inlined. */ -# pragma warn -8026 /* exception not inlined. */ -#endif -#include "kwsysPrivate.h" -#include KWSYS_HEADER(auto_ptr.hxx) -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -# include "auto_ptr.hxx.in" -#endif - -#include - -#define ASSERT(x,y) if (!(x)) { printf("FAIL: " y "\n"); status = 1; } - -int instances = 0; // don't declare as static - -struct A -{ - A() { ++instances; } - ~A() { --instances; } - A* self() {return this; } -}; -struct B: public A {}; - -static int function_call(kwsys::auto_ptr a) -{ - return a.get()? 1:0; -} - -static A* get_A(A& a) { return &a; } - -static kwsys::auto_ptr generate_auto_ptr_A() -{ - return kwsys::auto_ptr(new A); -} - -static kwsys::auto_ptr generate_auto_ptr_B() -{ - return kwsys::auto_ptr(new B); -} - -int testAutoPtr(int, char*[]) -{ - int status = 0; - - // Keep everything in a subscope so we can detect leaks. - { - kwsys::auto_ptr pa0; - kwsys::auto_ptr pa1(new A()); - kwsys::auto_ptr pb1(new B()); - kwsys::auto_ptr pb2(new B()); - kwsys::auto_ptr pa2(new B()); - - A* ptr = get_A(*pa1); - ASSERT(ptr == pa1.get(), - "auto_ptr does not return correct object when dereferenced"); - ptr = pa1->self(); - ASSERT(ptr == pa1.get(), - "auto_ptr does not return correct pointer from operator->"); - - A* before = pa0.get(); - pa0.reset(new A()); - ASSERT(pa0.get() && pa0.get() != before, - "auto_ptr empty after reset(new A())"); - - before = pa0.get(); - pa0.reset(new B()); - ASSERT(pa0.get() && pa0.get() != before, - "auto_ptr empty after reset(new B())"); - - delete pa0.release(); - ASSERT(!pa0.get(), "auto_ptr holds an object after release()"); - - kwsys::auto_ptr pa3(pb1); - ASSERT(!pb1.get(), - "auto_ptr full after being used to construct another"); - ASSERT(pa3.get(), - "auto_ptr empty after construction from another"); - - { - kwsys::auto_ptr pa; - pa = pa3; - ASSERT(!pa3.get(), - "auto_ptr full after assignment to another"); - ASSERT(pa.get(), - "auto_ptr empty after assignment from another"); - } - - { - kwsys::auto_ptr pa; - pa = pb2; - ASSERT(!pb2.get(), - "auto_ptr full after assignment to compatible"); - ASSERT(pa.get(), - "auto_ptr empty after assignment from compatible"); - } - - { - int receive = function_call(pa2); - ASSERT(receive, - "auto_ptr did not receive ownership in called function"); - ASSERT(!pa2.get(), - "auto_ptr did not release ownership to called function"); - } - - { - int received = function_call(generate_auto_ptr_A()); - ASSERT(received, - "auto_ptr in called function did not take ownership " - "from factory function"); - } - -#if 0 - // Is this allowed by the standard? - { - int received = function_call(generate_auto_ptr_B()); - ASSERT(received, - "auto_ptr in called function did not take ownership " - "from factory function with conversion"); - } -#endif - - { - kwsys::auto_ptr pa(generate_auto_ptr_A()); - ASSERT(pa.get(), - "auto_ptr empty after construction from factory function"); - } - - { - kwsys::auto_ptr pa; - pa = generate_auto_ptr_A(); - ASSERT(pa.get(), - "auto_ptr empty after assignment from factory function"); - } - - { - kwsys::auto_ptr pa(generate_auto_ptr_B()); - ASSERT(pa.get(), - "auto_ptr empty after construction from compatible factory function"); - } - - { - kwsys::auto_ptr pa; - pa = generate_auto_ptr_B(); - ASSERT(pa.get(), - "auto_ptr empty after assignment from compatible factory function"); - } - } - - ASSERT(instances == 0, "auto_ptr leaked an object"); - - return status; -} From e1e54295e82ef93e9c88bccb097721f13537e16d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 1 Jul 2016 11:16:38 -0400 Subject: [PATCH 180/929] Utilities/Release: Compile OS X binary as C++11 We already compile with `-stdlib=libc++` as required for Qt 5.6. We can compile as C++11 and still deploy to OS X 10.7. --- Utilities/Release/osx_release.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index 35705eda1..e7e5ba427 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -13,6 +13,8 @@ set(CFLAGS "") set(CXXFLAGS "-stdlib=libc++") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release +CMAKE_C_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=11 CMAKE_OSX_ARCHITECTURES:STRING=x86_64 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE @@ -21,8 +23,6 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON CMAKE_SKIP_RPATH:BOOL=TRUE -CMake_NO_C_STANDARD:BOOL=TRUE -CMake_NO_CXX_STANDARD:BOOL=TRUE CMake_TEST_NO_FindPackageModeMakefileTest:BOOL=TRUE ") set(ENV [[ From 3643390d49b567214f9008091aa0e1f4ebe7782a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 1 Jul 2016 13:52:10 -0400 Subject: [PATCH 181/929] Strip CMAKE__FLAGS[_] initializer whitespace --- Modules/CMakeASMInformation.cmake | 9 +++++---- Modules/CMakeCInformation.cmake | 9 +++++---- Modules/CMakeCXXInformation.cmake | 9 +++++---- Modules/CMakeFortranInformation.cmake | 9 +++++---- Modules/CMakeRCInformation.cmake | 4 ++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 0e547c467..1bb16ac24 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -76,10 +76,11 @@ endif() # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends: set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") - set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT}" CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT) +endforeach() + set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING "Flags used by the assembler during all build types.") diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index fa87ca84c..98eedc42d 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -111,10 +111,11 @@ if(NOT CMAKE_MODULE_EXISTS) endif() set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_C_FLAGS_INIT STREQUAL " ") - set(CMAKE_C_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_C_FLAGS${c}_INIT}" CMAKE_C_FLAGS${c}_INIT) +endforeach() + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index b35280f96..07e4f395d 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -206,10 +206,11 @@ endforeach() # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_CXX_FLAGS_INIT STREQUAL " ") - set(CMAKE_CXX_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_CXX_FLAGS${c}_INIT}" CMAKE_CXX_FLAGS${c}_INIT) +endforeach() + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 1fd097235..45dbfcc5b 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -173,10 +173,11 @@ endif() set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") - set(CMAKE_Fortran_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_Fortran_FLAGS${c}_INIT}" CMAKE_Fortran_FLAGS${c}_INIT) +endforeach() + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING "Flags for Fortran compiler.") diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 94abd4be8..60276e215 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -28,9 +28,9 @@ set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) +string(STRIP "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CMAKE_RC_FLAGS_INIT) - -set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING +set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING "Flags for Windows Resource Compiler.") # These are the only types of flags that should be passed to the rc From b02814ed7464f11286db2d0038cc88c66ce18676 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 2 Jul 2016 00:01:08 -0400 Subject: [PATCH 182/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2a98911b7..2ff810008 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160701) +set(CMake_VERSION_PATCH 20160702) #set(CMake_VERSION_RC 1) From a24cd6525ad656901b663f4d7bc0990db4c8c8ec Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 3 Jul 2016 00:01:02 -0400 Subject: [PATCH 183/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2ff810008..6de0a7ab3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160702) +set(CMake_VERSION_PATCH 20160703) #set(CMake_VERSION_RC 1) From 7523267ca0e1a6c45f3b7eed332bca6e35f32752 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 4 Jul 2016 00:01:03 -0400 Subject: [PATCH 184/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6de0a7ab3..a9501fa9d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160703) +set(CMake_VERSION_PATCH 20160704) #set(CMake_VERSION_RC 1) From b9eb3408b4bb750b2cc3f80803a5806d6ee46f13 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 5 Jul 2016 00:01:03 -0400 Subject: [PATCH 185/929] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a9501fa9d..26e82191c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160704) +set(CMake_VERSION_PATCH 20160705) #set(CMake_VERSION_RC 1) From 898cb987b4a2ed027f7ec9308a128cab97feabf9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 4 May 2016 14:23:24 -0400 Subject: [PATCH 186/929] cmCTest: Fix typo --- Source/cmCTest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 3694f09c7..59a58d0ce 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2131,7 +2131,7 @@ int cmCTest::Run(std::vector& args, std::string* output) } } - // now what sould cmake do? if --build-and-test was specified then + // now what should cmake do? if --build-and-test was specified then // we run the build and test handler and return if (cmakeAndTest) { this->Verbose = true; From 280d0a6947aee7d73404a3d5d0a795d490a781db Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 28 Jun 2016 18:04:07 -0400 Subject: [PATCH 187/929] cmCTest: Improve readability adding "RunCMakeAndTest()" and "ExecuteTests()" --- Source/cmCTest.cxx | 126 ++++++++++++++++++++++++--------------------- Source/cmCTest.h | 3 ++ 2 files changed, 71 insertions(+), 58 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 59a58d0ce..9c6117a3a 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2134,72 +2134,82 @@ int cmCTest::Run(std::vector& args, std::string* output) // now what should cmake do? if --build-and-test was specified then // we run the build and test handler and return if (cmakeAndTest) { - this->Verbose = true; - cmCTestBuildAndTestHandler* handler = - static_cast(this->GetHandler("buildtest")); - int retv = handler->ProcessHandler(); - *output = handler->GetOutput(); -#ifdef CMAKE_BUILD_WITH_CMAKE - cmDynamicLoader::FlushCache(); -#endif - if (retv != 0) { - cmCTestLog(this, DEBUG, - "build and test failing returning: " << retv << std::endl); - } - return retv; + return this->RunCMakeAndTest(output); } if (executeTests) { - int res; - // call process directory - if (this->RunConfigurationScript) { - if (this->ExtraVerbose) { - cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl); - } - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); - it != this->TestingHandlers.end(); ++it) { - it->second->SetVerbose(this->ExtraVerbose); - it->second->SetSubmitIndex(this->SubmitIndex); - } - this->GetHandler("script")->SetVerbose(this->Verbose); - res = this->GetHandler("script")->ProcessHandler(); - if (res != 0) { - cmCTestLog(this, DEBUG, - "running script failing returning: " << res << std::endl); - } - - } else { - // What is this? -V seems to be the same as -VV, - // and Verbose is always on in this case - this->ExtraVerbose = this->Verbose; - this->Verbose = true; - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); - it != this->TestingHandlers.end(); ++it) { - it->second->SetVerbose(this->Verbose); - it->second->SetSubmitIndex(this->SubmitIndex); - } - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) { - res = 12; - cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." - << std::endl); - } else { - res = this->ProcessTests(); - } - this->Finalize(); - } - if (res != 0) { - cmCTestLog(this, DEBUG, - "Running a test(s) failed returning : " << res << std::endl); - } - return res; + return this->ExecuteTests(); } return 1; } +int cmCTest::ExecuteTests() +{ + int res; + // call process directory + if (this->RunConfigurationScript) { + if (this->ExtraVerbose) { + cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl); + } + cmCTest::t_TestingHandlers::iterator it; + for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); + ++it) { + it->second->SetVerbose(this->ExtraVerbose); + it->second->SetSubmitIndex(this->SubmitIndex); + } + this->GetHandler("script")->SetVerbose(this->Verbose); + res = this->GetHandler("script")->ProcessHandler(); + if (res != 0) { + cmCTestLog(this, DEBUG, + "running script failing returning: " << res << std::endl); + } + + } else { + // What is this? -V seems to be the same as -VV, + // and Verbose is always on in this case + this->ExtraVerbose = this->Verbose; + this->Verbose = true; + cmCTest::t_TestingHandlers::iterator it; + for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); + ++it) { + it->second->SetVerbose(this->Verbose); + it->second->SetSubmitIndex(this->SubmitIndex); + } + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) { + res = 12; + cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." + << std::endl); + } else { + res = this->ProcessTests(); + } + this->Finalize(); + } + if (res != 0) { + cmCTestLog(this, DEBUG, + "Running a test(s) failed returning : " << res << std::endl); + } + return res; +} + +int cmCTest::RunCMakeAndTest(std::string* output) +{ + this->Verbose = true; + cmCTestBuildAndTestHandler* handler = + static_cast(this->GetHandler("buildtest")); + int retv = handler->ProcessHandler(); + *output = handler->GetOutput(); +#ifdef CMAKE_BUILD_WITH_CMAKE + cmDynamicLoader::FlushCache(); +#endif + if (retv != 0) { + cmCTestLog(this, DEBUG, "build and test failing returning: " << retv + << std::endl); + } + return retv; +} + void cmCTest::SetNotesFiles(const char* notes) { if (!notes) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 833cd969e..d8e48b104 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -579,6 +579,9 @@ private: //! Output errors from a test void OutputTestErrors(std::vector const& process_output); + int RunCMakeAndTest(std::string* output); + int ExecuteTests(); + bool SuppressUpdatingCTestConfiguration; bool Debug; From 6d8b9aa65ab06300a50f6c23897b9e37cadccc47 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 20 Jun 2016 20:37:55 -0400 Subject: [PATCH 188/929] cmCTest: Improve readability adding "HandleTest(Action|Model)Argument()" --- Source/cmCTest.cxx | 108 +++++++++++++++++++++++++++------------------ Source/cmCTest.h | 8 ++++ 2 files changed, 73 insertions(+), 43 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 9c6117a3a..858808ac6 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2044,52 +2044,15 @@ int cmCTest::Run(std::vector& args, std::string* output) this->AddVariableDefinition(input); } - if (this->CheckArgument(arg, "-T", "--test-action") && - (i < args.size() - 1)) { - this->ProduceXML = true; - i++; - if (!this->SetTest(args[i].c_str(), false)) { - executeTests = false; - cmCTestLog(this, ERROR_MESSAGE, - "CTest -T called with incorrect option: " << args[i] - << std::endl); - cmCTestLog(this, ERROR_MESSAGE, "Available options are:" - << std::endl - << " " << ctestExec << " -T all" << std::endl - << " " << ctestExec << " -T start" << std::endl - << " " << ctestExec << " -T update" << std::endl - << " " << ctestExec << " -T configure" << std::endl - << " " << ctestExec << " -T build" << std::endl - << " " << ctestExec << " -T test" << std::endl - << " " << ctestExec << " -T coverage" << std::endl - << " " << ctestExec << " -T memcheck" << std::endl - << " " << ctestExec << " -T notes" << std::endl - << " " << ctestExec << " -T submit" << std::endl); - } + // calls SetTest(, /*report=*/ false) to enable the corresponding + // stage. is a string like 'All', 'Start', or 'Udpate'. + if (!this->HandleTestActionArgument(ctestExec, i, args)) { + executeTests = false; } // what type of test model - if (this->CheckArgument(arg, "-M", "--test-model") && - (i < args.size() - 1)) { - i++; - std::string const& str = args[i]; - if (cmSystemTools::LowerCase(str) == "nightly") { - this->SetTestModel(cmCTest::NIGHTLY); - } else if (cmSystemTools::LowerCase(str) == "continuous") { - this->SetTestModel(cmCTest::CONTINUOUS); - } else if (cmSystemTools::LowerCase(str) == "experimental") { - this->SetTestModel(cmCTest::EXPERIMENTAL); - } else { - executeTests = false; - cmCTestLog(this, ERROR_MESSAGE, - "CTest -M called with incorrect option: " << str - << std::endl); - cmCTestLog(this, ERROR_MESSAGE, "Available options are:" - << std::endl - << " " << ctestExec << " -M Continuous" << std::endl - << " " << ctestExec << " -M Experimental" << std::endl - << " " << ctestExec << " -M Nightly" << std::endl); - } + if (!this->HandleTestModelArgument(ctestExec, i, args)) { + executeTests = false; } if (this->CheckArgument(arg, "--extra-submit") && i < args.size() - 1) { @@ -2144,6 +2107,65 @@ int cmCTest::Run(std::vector& args, std::string* output) return 1; } +bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i, + const std::vector& args) +{ + bool success = true; + std::string arg = args[i]; + if (this->CheckArgument(arg, "-T", "--test-action") && + (i < args.size() - 1)) { + this->ProduceXML = true; + i++; + if (!this->SetTest(args[i].c_str(), false)) { + success = false; + cmCTestLog(this, ERROR_MESSAGE, "CTest -T called with incorrect option: " + << args[i] << std::endl); + cmCTestLog(this, ERROR_MESSAGE, "Available options are:" + << std::endl + << " " << ctestExec << " -T all" << std::endl + << " " << ctestExec << " -T start" << std::endl + << " " << ctestExec << " -T update" << std::endl + << " " << ctestExec << " -T configure" << std::endl + << " " << ctestExec << " -T build" << std::endl + << " " << ctestExec << " -T test" << std::endl + << " " << ctestExec << " -T coverage" << std::endl + << " " << ctestExec << " -T memcheck" << std::endl + << " " << ctestExec << " -T notes" << std::endl + << " " << ctestExec << " -T submit" << std::endl); + } + } + return success; +} + +bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i, + const std::vector& args) +{ + bool success = true; + std::string arg = args[i]; + if (this->CheckArgument(arg, "-M", "--test-model") && + (i < args.size() - 1)) { + i++; + std::string const& str = args[i]; + if (cmSystemTools::LowerCase(str) == "nightly") { + this->SetTestModel(cmCTest::NIGHTLY); + } else if (cmSystemTools::LowerCase(str) == "continuous") { + this->SetTestModel(cmCTest::CONTINUOUS); + } else if (cmSystemTools::LowerCase(str) == "experimental") { + this->SetTestModel(cmCTest::EXPERIMENTAL); + } else { + success = false; + cmCTestLog(this, ERROR_MESSAGE, "CTest -M called with incorrect option: " + << str << std::endl); + cmCTestLog(this, ERROR_MESSAGE, "Available options are:" + << std::endl + << " " << ctestExec << " -M Continuous" << std::endl + << " " << ctestExec << " -M Experimental" << std::endl + << " " << ctestExec << " -M Nightly" << std::endl); + } + } + return success; +} + int cmCTest::ExecuteTests() { int res; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index d8e48b104..f42a27446 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -579,6 +579,14 @@ private: //! Output errors from a test void OutputTestErrors(std::vector const& process_output); + //! Handle the --test-action command line argument + bool HandleTestActionArgument(const char* ctestExec, size_t& i, + const std::vector& args); + + //! Handle the --test-model command line argument + bool HandleTestModelArgument(const char* ctestExec, size_t& i, + const std::vector& args); + int RunCMakeAndTest(std::string* output); int ExecuteTests(); From 7c87ab755c96ad3f3fc6288d23c02cd0f4898785 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 20 Jun 2016 20:40:55 -0400 Subject: [PATCH 189/929] cmCTest: Facilitate code reading adding consistent comments in Run() --- Source/cmCTest.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 858808ac6..4508f1368 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2018,7 +2018,7 @@ int cmCTest::Run(std::vector& args, std::string* output) // handle the script arguments -S -SR -SP this->HandleScriptArguments(i, args, SRArgumentSpecified); - // handle a request for a dashboard + // --dashboard: handle a request for a dashboard std::string arg = args[i]; if (this->CheckArgument(arg, "-D", "--dashboard") && i < args.size() - 1) { this->ProduceXML = true; @@ -2044,17 +2044,18 @@ int cmCTest::Run(std::vector& args, std::string* output) this->AddVariableDefinition(input); } - // calls SetTest(, /*report=*/ false) to enable the corresponding - // stage. is a string like 'All', 'Start', or 'Udpate'. + // --test-action: calls SetTest(, /*report=*/ false) to enable + // the corresponding stage if (!this->HandleTestActionArgument(ctestExec, i, args)) { executeTests = false; } - // what type of test model + // --test-model: what type of test model if (!this->HandleTestModelArgument(ctestExec, i, args)) { executeTests = false; } + // --extra-submit if (this->CheckArgument(arg, "--extra-submit") && i < args.size() - 1) { this->ProduceXML = true; this->SetTest("Submit"); @@ -2069,6 +2070,7 @@ int cmCTest::Run(std::vector& args, std::string* output) cmakeAndTest = true; } + // --schedule-random if (this->CheckArgument(arg, "--schedule-random")) { this->ScheduleType = "Random"; } @@ -2087,6 +2089,7 @@ int cmCTest::Run(std::vector& args, std::string* output) } } // the close of the for argument loop + // handle CTEST_PARALLEL_LEVEL environment variable if (!this->ParallelLevelSetInCli) { if (const char* parallel = cmSystemTools::GetEnv("CTEST_PARALLEL_LEVEL")) { int plevel = atoi(parallel); From 30c5f94c5bbf1a5cd07858a9c037442f41b65d73 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 20 Jun 2016 20:43:42 -0400 Subject: [PATCH 190/929] cmCTest: Rename "ProcessTests()" to "ProcessSteps()" and improve doxygen --- Source/cmCTest.cxx | 4 ++-- Source/cmCTest.h | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4508f1368..fc218c96f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -886,7 +886,7 @@ int cmCTest::ExecuteHandler(const char* shandler) return handler->ProcessHandler(); } -int cmCTest::ProcessTests() +int cmCTest::ProcessSteps() { int res = 0; bool notest = true; @@ -2207,7 +2207,7 @@ int cmCTest::ExecuteTests() cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." << std::endl); } else { - res = this->ProcessTests(); + res = this->ProcessSteps(); } this->Finalize(); } diff --git a/Source/cmCTest.h b/Source/cmCTest.h index f42a27446..5c34a94c4 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -129,16 +129,21 @@ public: void Finalize(); /** - * Process the tests. This is the main routine. The execution of the - * tests should look like this: + * Process the dashboard client steps. + * + * Steps are enabled using SetTest() + * + * The execution of the steps (or #Part) should look like this: * * ctest foo; * foo.Initialize(); * // Set some things on foo - * foo.ProcessTests(); + * foo.ProcessSteps(); * foo.Finalize(); + * + * \sa Initialize(), Finalize(), Part, PartInfo, SetTest() */ - int ProcessTests(); + int ProcessSteps(); /* * A utility function that returns the nightly time From 0076fb100b90f16163cccd06e89565b5c45316c1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 20 Jun 2016 20:56:43 -0400 Subject: [PATCH 191/929] cmCTest: Update doxygen to be consistent --- Source/cmCTest.h | 153 ++++++++++++++++++++++++++++------------------- 1 file changed, 91 insertions(+), 62 deletions(-) diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 5c34a94c4..b6657c95f 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -53,6 +53,13 @@ class cmXMLWriter; #endif #define cout no_cout_use_cmCTestLog +/** \class cmCTest + * \brief Represents a ctest invocation. + * + * This class represents a ctest invocation. It is the top level class when + * running ctest. + * + */ class cmCTest { friend class cmCTestRunTest; @@ -119,7 +126,7 @@ public: typedef std::vector VectorOfStrings; typedef std::set SetOfStrings; - ///! Process Command line arguments + /** Process Command line arguments */ int Run(std::vector&, std::string* output = CM_NULLPTR); /** @@ -135,22 +142,24 @@ public: * * The execution of the steps (or #Part) should look like this: * + * /code * ctest foo; * foo.Initialize(); * // Set some things on foo * foo.ProcessSteps(); * foo.Finalize(); + * /endcode * * \sa Initialize(), Finalize(), Part, PartInfo, SetTest() */ int ProcessSteps(); - /* + /** * A utility function that returns the nightly time */ struct tm* GetNightlyTime(std::string const& str, bool tomorrowtag); - /* + /** * Is the tomorrow tag set? */ bool GetTomorrowTag() { return this->TomorrowTag; } @@ -160,14 +169,14 @@ public: */ int TestDirectory(bool memcheck); - ///! what is the configuraiton type, e.g. Debug, Release etc. + /** what is the configuraiton type, e.g. Debug, Release etc. */ std::string const& GetConfigType(); double GetTimeOut() { return this->TimeOut; } void SetTimeOut(double t) { this->TimeOut = t; } double GetGlobalTimeout() { return this->GlobalTimeout; } - // how many test to run at the same time + /** how many test to run at the same time */ int GetParallelLevel() { return this->ParallelLevel; } void SetParallelLevel(int); @@ -205,19 +214,19 @@ public: cmCTest(); ~cmCTest(); - //! Set the notes files to be created. + /** Set the notes files to be created. */ void SetNotesFiles(const char* notes); void PopulateCustomVector(cmMakefile* mf, const std::string& definition, std::vector& vec); void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); - ///! Get the current time as string + /** Get the current time as string */ std::string CurrentTime(); - //! tar/gzip and then base 64 encode a file + /** tar/gzip and then base 64 encode a file */ std::string Base64GzipEncodeFile(std::string const& file); - //! base64 encode a file + /** base64 encode a file */ std::string Base64EncodeFile(std::string const& file); /** @@ -227,11 +236,13 @@ public: */ double GetRemainingTimeAllowed(); - ///! Open file in the output directory and set the stream + /** + * Open file in the output directory and set the stream + */ bool OpenOutputFile(const std::string& path, const std::string& name, cmGeneratedFileStream& stream, bool compress = false); - ///! Should we only show what we would do? + /** Should we only show what we would do? */ bool GetShowOnly(); bool ShouldUseHTTP10() { return this->UseHTTP10; } @@ -247,11 +258,11 @@ public: std::string GetStopTime() { return this->StopTime; } void SetStopTime(std::string const& time); - // Used for parallel ctest job scheduling + /** Used for parallel ctest job scheduling */ std::string GetScheduleType() { return this->ScheduleType; } void SetScheduleType(std::string type) { this->ScheduleType = type; } - ///! The max output width + /** The max output width */ int GetMaxTestNameWidth() const; void SetMaxTestNameWidth(int w) { this->MaxTestNameWidth = w; } @@ -279,31 +290,37 @@ public: 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. + /** + * 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. + */ static std::string SafeBuildIdField(const std::string& value); - //! Start CTest XML output file + /** Start CTest XML output file */ void StartXML(cmXMLWriter& xml, bool append); - //! End CTest XML output file + /** End CTest XML output file */ void EndXML(cmXMLWriter& xml); - //! Run command specialized for make and configure. Returns process status - // and retVal is return value or exception. + /** + * Run command specialized for make and configure. Returns process status + * and retVal is return value or exception. + */ int RunMakeCommand(const char* command, std::string& output, int* retVal, const char* dir, int timeout, std::ostream& ofs); - /* - * return the current tag - */ + /** Return the current tag */ std::string GetCurrentTag(); - //! Get the path to the build tree + /** Get the path to the build tree */ std::string GetBinaryDir(); - //! Get the short path to the file. This means if the file is in binary or - // source directory, it will become /.../relative/path/to/file + /** + * Get the short path to the file. + * + * This means if the file is in binary or + * source directory, it will become /.../relative/path/to/file + */ std::string GetShortPathToFile(const char* fname); enum @@ -313,7 +330,7 @@ public: CONTINUOUS }; - // provide some more detailed info on the return code for ctest + /** provide some more detailed info on the return code for ctest */ enum { UPDATE_ERRORS = 0x01, @@ -325,14 +342,16 @@ public: SUBMIT_ERRORS = 0x40 }; - ///! Are we producing XML + /** Are we producing XML */ bool GetProduceXML(); void SetProduceXML(bool v); - //! Run command specialized for tests. Returns process status and retVal is - // return value or exception. If environment is non-null, it is used to set - // environment variables prior to running the test. After running the test, - // environment variables are restored to their previous values. + /** + * Run command specialized for tests. Returns process status and retVal is + * return value or exception. If environment is non-null, it is used to set + * environment variables prior to running the test. After running the test, + * environment variables are restored to their previous values. + */ int RunTest(std::vector args, std::string* output, int* retVal, std::ostream* logfile, double testTimeOut, std::vector* environment); @@ -343,13 +362,13 @@ public: */ int ExecuteHandler(const char* handler); - /* + /** * Get the handler object */ cmCTestGenericHandler* GetHandler(const char* handler); cmCTestGenericHandler* GetInitializedHandler(const char* handler); - /* + /** * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, @@ -357,37 +376,42 @@ public: const std::string& cmake_var, bool suppress = false); - //! Make string safe to be send as an URL + /** Make string safe to be send as an URL */ static std::string MakeURLSafe(const std::string&); /** Decode a URL to the original string. */ static std::string DecodeURL(const std::string&); - //! Should ctect configuration be updated. When using new style ctest - // script, this should be true. + /** + * Should ctect configuration be updated. When using new style ctest + * script, this should be true. + */ void SetSuppressUpdatingCTestConfiguration(bool val) { this->SuppressUpdatingCTestConfiguration = val; } - //! Add overwrite to ctest configuration. - // The format is key=value + /** + * Add overwrite to ctest configuration. + * + * The format is key=value + */ void AddCTestConfigurationOverwrite(const std::string& encstr); - //! Create XML file that contains all the notes specified + /** Create XML file that contains all the notes specified */ int GenerateNotesFile(const VectorOfStrings& files); - //! Submit extra files to the server + /** Submit extra files to the server */ bool SubmitExtraFiles(const char* files); bool SubmitExtraFiles(const VectorOfStrings& files); - //! Set the output log file name + /** Set the output log file name */ void SetOutputLogFileName(const char* name); - //! Set the visual studio or Xcode config type + /** Set the visual studio or Xcode config type */ void SetConfigType(const char* ct); - //! Various log types + /** Various log types */ enum { DEBUG = 0, @@ -400,15 +424,15 @@ public: OTHER }; - //! Add log to the output + /** Add log to the output */ void Log(int logType, const char* file, int line, const char* msg, bool suppress = false); - //! Get the version of dart server + /** Get the version of dart server */ int GetDartVersion() { return this->DartVersion; } int GetDropSiteCDash() { return this->DropSiteCDash; } - //! Add file to be submitted + /** Add file to be submitted */ void AddSubmitFile(Part part, const char* name); std::vector const& GetSubmitFiles(Part part) { @@ -416,7 +440,9 @@ public: } void ClearSubmitFiles(Part part) { this->Parts[part].SubmitFiles.clear(); } - //! Read the custom configuration files and apply them to the current ctest + /** + * Read the custom configuration files and apply them to the current ctest + */ int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf); std::vector& GetInitialCommandLineArguments() @@ -424,7 +450,7 @@ public: return this->InitialCommandLineArguments; } - //! Set the track to submit to + /** Set the track to submit to */ void SetSpecificTrack(const char* track); const char* GetSpecificTrack(); @@ -452,10 +478,13 @@ public: { return this->Definitions; } - // return the number of times a test should be run + + /** Return the number of times a test should be run */ int GetTestRepeat() { return this->RepeatTests; } - // return true if test should run until fail + + /** Return true if test should run until fail */ bool GetRepeatUntilFail() { return this->RepeatUntilFail; } + private: int RepeatTests; bool RepeatUntilFail; @@ -490,7 +519,7 @@ private: bool ShowOnly; - //! Map of configuration properties + /** Map of configuration properties */ typedef std::map CTestConfigurationMap; std::string CTestConfigFile; @@ -554,41 +583,41 @@ private: */ int Initialize(const char* binary_dir, cmCTestStartCommand* command); - //! parse the option after -D and convert it into the appropriate steps + /** parse the option after -D and convert it into the appropriate steps */ bool AddTestsForDashboardType(std::string& targ); - //! read as "emit an error message for an unknown -D value" + /** read as "emit an error message for an unknown -D value" */ void ErrorMessageUnknownDashDValue(std::string& val); - //! add a variable definition from a command line -D value + /** add a variable definition from a command line -D value */ bool AddVariableDefinition(const std::string& arg); - //! parse and process most common command line arguments + /** parse and process most common command line arguments */ bool HandleCommandLineArguments(size_t& i, std::vector& args, std::string& errormsg); - //! hande the -S -SP and -SR arguments + /** hande the -S -SP and -SR arguments */ void HandleScriptArguments(size_t& i, std::vector& args, bool& SRArgumentSpecified); - //! Reread the configuration file + /** Reread the configuration file */ bool UpdateCTestConfiguration(); - //! Create note from files. + /** Create note from files. */ int GenerateCTestNotesOutput(cmXMLWriter& xml, const VectorOfStrings& files); - //! Check if the argument is the one specified + /** Check if the argument is the one specified */ bool CheckArgument(const std::string& arg, const char* varg1, const char* varg2 = CM_NULLPTR); - //! Output errors from a test + /** Output errors from a test */ void OutputTestErrors(std::vector const& process_output); - //! Handle the --test-action command line argument + /** Handle the --test-action command line argument */ bool HandleTestActionArgument(const char* ctestExec, size_t& i, const std::vector& args); - //! Handle the --test-model command line argument + /** Handle the --test-model command line argument */ bool HandleTestModelArgument(const char* ctestExec, size_t& i, const std::vector& args); From 7c67d4011e56fad3cf775818110fbd8d5d4be766 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 4 May 2016 22:32:45 -0400 Subject: [PATCH 192/929] Help: Consistently use quotes and fix punctuation in ctest(1) manual --- Help/manual/ctest.1.rst | 101 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index e79733300..04b1d0123 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -56,7 +56,7 @@ Options Enable failover. This option allows ctest to resume a test set execution that was - previously interrupted. If no interruption occurred, the -F option + previously interrupted. If no interruption occurred, the ``-F`` option will have no effect. ``-j , --parallel `` @@ -77,12 +77,12 @@ Options Make ctest quiet. This option will suppress all the output. The output log file will - still be generated if the --output-log is specified. Options such - as --verbose, --extra-verbose, and --debug are ignored if --quiet is - specified. + still be generated if the ``--output-log`` is specified. Options such + as ``--verbose``, ``--extra-verbose``, and ``--debug`` are ignored + if ``--quiet`` is specified. ``-O , --output-log `` - Output to log file + Output to log file. This option tells ctest to write all its output to a log file. @@ -90,7 +90,7 @@ Options Disable actual execution of tests. This option tells ctest to list the tests that would be run but not - actually run them. Useful in conjunction with the -R and -E + actually run them. Useful in conjunction with the ``-R`` and ``-E`` options. ``-L , --label-regex `` @@ -118,7 +118,7 @@ Options given regular expression. ``-D , --dashboard `` - Execute dashboard test + Execute dashboard test. This option tells ctest to act as a CDash client and perform a dashboard test. All tests are , where Mode can be @@ -126,26 +126,27 @@ Options Update, Configure, Build, Test, Coverage, and Submit. ``-D :=`` - Define a variable for script mode + Define a variable for script mode. Pass in variable values on the command line. Use in conjunction - with -S to pass variable values to a dashboard script. Parsing -D + with ``-S`` to pass variable values to a dashboard script. Parsing ``-D`` arguments as variable values is only attempted if the value - following -D does not match any of the known dashboard types. + following ``-D`` does not match any of the known dashboard types. ``-M , --test-model `` - Sets the model for a dashboard + Sets the model for a dashboard. - This option tells ctest to act as a CDash client where the TestModel - can be Experimental, Nightly, and Continuous. Combining -M and -T - is similar to -D + This option tells ctest to act as a CDash client where the ```` + can be ``Experimental``, ``Nightly``, and ``Continuous``. + Combining ``-M`` and ``-T`` is similar to ``-D``. ``-T , --test-action `` - Sets the dashboard action to perform + Sets the dashboard action to perform. This option tells ctest to act as a CDash client and perform some - action such as start, build, test etc. Combining -M and -T is - similar to -D + action such as ``start``, ``build``, ``test`` etc. See + `Dashboard Client Steps`_ for the full list of actions. + Combining ``-M`` and ``-T`` is similar to ``-D``. ``--track `` Specify the track to submit dashboard to @@ -156,24 +157,24 @@ Options arbitrary. ``-S