diff options
56 files changed, 466 insertions, 347 deletions
diff --git a/Help/release/dev/ifw-user-interfaces.rst b/Help/release/dev/ifw-user-interfaces.rst new file mode 100644 index 0000000..26e241a --- /dev/null +++ b/Help/release/dev/ifw-user-interfaces.rst @@ -0,0 +1,7 @@ +ifw-user-interfaces +------------------- + +* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and + :command:`cpack_ifw_configure_component_group` commands gained a new + ``USER_INTERFACES`` option to add a list of additonal pages to the IFW + installer. diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index ebc5c90..36fc276 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -181,136 +181,161 @@ # # The module defines the following commands: # -# -------------------------------------------------------------------------- -# # .. command:: cpack_ifw_configure_component # -# Sets the arguments specific to the CPack IFW generator. +# Sets the arguments specific to the CPack IFW generator. +# +# :: # -# :: +# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] +# [NAME <name>] +# [VERSION <version>] +# [SCRIPT <script>] +# [PRIORITY <priority>] +# [DEPENDS <com_id> ...] +# [LICENSES <display_name> <file_path> ...] +# [USER_INTERFACES <file_path> <file_path> ...]) # -# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] -# [NAME <name>] -# [VERSION <version>] -# [SCRIPT <script>] -# [PRIORITY <priority>] -# [DEPENDS <com_id> ...] -# [LICENSES <display_name> <file_path> ...]) +# This command should be called after :command:`cpack_add_component` command. # -# This command should be called after :command:`cpack_add_component` command. +# ``COMMON`` +# if set, then the component will be packaged and installed as part +# of a group to which it belongs. # -# ``COMMON`` if set, then the component will be packaged and installed as part -# of a group to which it belongs. +# ``ESSENTIAL`` +# if set, then the package manager stays disabled until that +# component is updated. # -# ``ESSENTIAL`` if set, then the package manager stays disabled until that -# component is updated. +# ``NAME`` +# is used to create domain-like identification for this component. +# By default used origin component name. # -# ``NAME`` is used to create domain-like identification for this component. -# By default used origin component name. +# ``VERSION`` +# is version of component. +# By default used :variable:`CPACK_PACKAGE_VERSION`. # -# ``VERSION`` is version of component. -# By default used :variable:`CPACK_PACKAGE_VERSION`. +# ``SCRIPT`` +# is a relative or absolute path to operations script +# for this component. # -# ``SCRIPT`` is a relative or absolute path to operations script -# for this component. +# ``PRIORITY`` +# is priority of the component in the tree. # -# ``PRIORITY`` is priority of the component in the tree. +# ``DEPENDS`` +# list of dependency component identifiers in QtIFW_ style. # -# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style. +# ``LICENSES`` +# pair of <display_name> and <file_path> of license text for this +# component. You can specify more then one license. # -# ``LICENSES`` pair of <display_name> and <file_path> of license text for this -# component. You can specify more then one license. +# ``USER_INTERFACES`` +# a list of <file_path> representing pages to load # -# -------------------------------------------------------------------------- # # .. command:: cpack_ifw_configure_component_group # -# Sets the arguments specific to the CPack IFW generator. +# Sets the arguments specific to the CPack IFW generator. # -# :: +# :: # -# cpack_ifw_configure_component_group(<groupname> -# [NAME <name>] -# [VERSION <version>] -# [SCRIPT <script>] -# [PRIORITY <priority>] -# [LICENSES <display_name> <file_path> ...]) +# cpack_ifw_configure_component_group(<groupname> +# [NAME <name>] +# [VERSION <version>] +# [SCRIPT <script>] +# [PRIORITY <priority>] +# [LICENSES <display_name> <file_path> ...] +# [USER_INTERFACES <file_path> <file_path> ...]) # -# This command should be called after :command:`cpack_add_component_group` -# command. +# This command should be called after :command:`cpack_add_component_group` +# command. # -# ``NAME`` is used to create domain-like identification for this component -# group. -# By default used origin component group name. +# ``NAME`` +# is used to create domain-like identification for this component group. +# By default used origin component group name. # -# ``VERSION`` is version of component group. -# By default used :variable:`CPACK_PACKAGE_VERSION`. +# ``VERSION`` +# is version of component group. +# By default used :variable:`CPACK_PACKAGE_VERSION`. # -# ``SCRIPT`` is a relative or absolute path to operations script -# for this component group. +# ``SCRIPT`` +# is a relative or absolute path to operations script +# for this component group. # -# ``PRIORITY`` is priority of the component group in the tree. +# ``PRIORITY`` +# is priority of the component group in the tree. # -# ``LICENSES`` pair of <display_name> and <file_path> of license text for this -# component group. You can specify more then one license. +# ``LICENSES`` +# pair of <display_name> and <file_path> of license text for this +# component group. You can specify more then one license. # -# -------------------------------------------------------------------------- +# ``USER_INTERFACES`` +# a list of <file_path> representing pages to load # -# .. command:: cpack_ifw_add_repository # -# Add QtIFW_ specific remote repository to binary installer. +# .. command:: cpack_ifw_add_repository # -# :: +# Add QtIFW_ specific remote repository to binary installer. # -# cpack_ifw_add_repository(<reponame> [DISABLED] -# URL <url> -# [USERNAME <username>] -# [PASSWORD <password>] -# [DISPLAY_NAME <display_name>]) +# :: # -# This command will also add the <reponame> repository -# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. +# cpack_ifw_add_repository(<reponame> [DISABLED] +# URL <url> +# [USERNAME <username>] +# [PASSWORD <password>] +# [DISPLAY_NAME <display_name>]) # -# ``DISABLED`` if set, then the repository will be disabled by default. +# This command will also add the <reponame> repository +# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. # -# ``URL`` is points to a list of available components. +# ``DISABLED`` +# if set, then the repository will be disabled by default. # -# ``USERNAME`` is used as user on a protected repository. +# ``URL`` +# is points to a list of available components. # -# ``PASSWORD`` is password to use on a protected repository. +# ``USERNAME`` +# is used as user on a protected repository. # -# ``DISPLAY_NAME`` is string to display instead of the URL. +# ``PASSWORD`` +# is password to use on a protected repository. # +# ``DISPLAY_NAME`` +# is string to display instead of the URL. # -# -------------------------------------------------------------------------- # # .. command:: cpack_ifw_update_repository # -# Update QtIFW_ specific repository from remote repository. +# Update QtIFW_ specific repository from remote repository. # -# :: +# :: # -# cpack_ifw_update_repository(<reponame> -# [[ADD|REMOVE] URL <url>]| -# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]] -# [USERNAME <username>] -# [PASSWORD <password>] -# [DISPLAY_NAME <display_name>]) +# cpack_ifw_update_repository(<reponame> +# [[ADD|REMOVE] URL <url>]| +# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]] +# [USERNAME <username>] +# [PASSWORD <password>] +# [DISPLAY_NAME <display_name>]) # -# This command will also add the <reponame> repository -# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. +# This command will also add the <reponame> repository +# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. # -# ``URL`` is points to a list of available components. +# ``URL`` +# is points to a list of available components. # -# ``OLD_URL`` is points to a list that will replaced. +# ``OLD_URL`` +# is points to a list that will replaced. # -# ``NEW_URL`` is points to a list that will replace to. +# ``NEW_URL`` +# is points to a list that will replace to. # -# ``USERNAME`` is used as user on a protected repository. +# ``USERNAME`` +# is used as user on a protected repository. # -# ``PASSWORD`` is password to use on a protected repository. +# ``PASSWORD`` +# is password to use on a protected repository. # -# ``DISPLAY_NAME`` is string to display instead of the URL. +# ``DISPLAY_NAME`` +# is string to display instead of the URL. # # Example usage # ^^^^^^^^^^^^^ @@ -362,16 +387,16 @@ # # Qt Installer Framework Manual: # -# Index page +# * Index page: # http://doc.qt.io/qtinstallerframework/index.html # -# Component Scripting +# * Component Scripting: # http://doc.qt.io/qtinstallerframework/scripting.html # -# Predefined Variables +# * Predefined Variables: # http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables # -# Promoting Updates +# * Promoting Updates: # http://doc.qt.io/qtinstallerframework/ifw-updates.html # # Download Qt Installer Framework for you platform from Qt site: @@ -543,6 +568,22 @@ macro(_cpack_ifw_resolve_lisenses _variable) endif() endmacro() +# Resolve full path to a list of provided files +macro(_cpack_ifw_resolve_file_list _variable) + if(${_variable}) + set(_ifw_list_fix) + foreach(_ifw_file_arg ${${_variable}}) + get_filename_component(_ifw_file_arg "${_ifw_file_arg}" ABSOLUTE) + if(EXISTS ${_ifw_file_arg}) + list(APPEND _ifw_list_fix "${_ifw_file_arg}") + else() + message(WARNING "CPack IFW: page file \"${_ifw_file_arg}\" does not exist. Skipping") + endif() + endforeach(_ifw_file_arg) + set(${_variable} "${_ifw_list_fix}") + endif() +endmacro() + # Macro for configure component macro(cpack_ifw_configure_component compname) @@ -550,11 +591,12 @@ macro(cpack_ifw_configure_component compname) set(_IFW_OPT COMMON ESSENTIAL) set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY) - set(_IFW_MULTI_ARGS DEPENDS LICENSES) + set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES) cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES) + _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES) set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n") @@ -589,11 +631,12 @@ macro(cpack_ifw_configure_component_group grpname) set(_IFW_OPT) set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY) - set(_IFW_MULTI_ARGS LICENSES) + set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES) cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES) + _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES) set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n") diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 32a3f0a..84fa541 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -37,7 +37,7 @@ # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: -# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") @@ -81,7 +81,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. set( PostgreSQL_ROOT_DIRECTORIES diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 09f55fa..dcce5e4 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 20160916) +set(CMake_VERSION_PATCH 20160919) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index bc503fc..2d3cf12 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -153,6 +153,7 @@ void cmCPackIFWPackage::DefaultConfiguration() ReleaseDate = ""; Script = ""; Licenses.clear(); + UserInterfaces.clear(); SortingPriority = ""; Default = ""; Essential = ""; @@ -229,6 +230,12 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) Script = option; } + // User interfaces + if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { + UserInterfaces.clear(); + cmSystemTools::ExpandListArgument(option, UserInterfaces); + } + // CMake dependencies if (!component->Dependencies.empty()) { std::vector<cmCPackComponent*>::iterator dit; @@ -322,6 +329,12 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) Script = option; } + // User interfaces + if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { + UserInterfaces.clear(); + cmSystemTools::ExpandListArgument(option, UserInterfaces); + } + // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { Licenses.clear(); @@ -417,6 +430,23 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("Script", name); } + // User Interfaces (copy to meta dir) + std::vector<std::string> userInterfaces = UserInterfaces; + for (size_t i = 0; i < userInterfaces.size(); i++) { + std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]); + std::string path = Directory + "/meta/" + name; + cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(), + path.data()); + userInterfaces[i] = name; + } + if (!userInterfaces.empty()) { + xout.StartElement("UserInterfaces"); + for (size_t i = 0; i < userInterfaces.size(); i++) { + xout.Element("UserInterface", userInterfaces[i]); + } + xout.EndElement(); + } + // Dependencies std::set<DependenceStruct> compDepSet; for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin(); diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 579eeb8..739ae3e 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -99,6 +99,9 @@ public: /// List of license agreements to be accepted by the installing user std::vector<std::string> Licenses; + /// List of pages to load + std::vector<std::string> UserInterfaces; + /// Priority of the component in the tree std::string SortingPriority; diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 6fde7b6..c6a532f 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,8 +32,13 @@ function(cm_check_cxx_feature name) endfunction() if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(make_unique) + if(CMake_HAVE_CXX_MAKE_UNIQUE) + set(CMake_HAVE_CXX_UNIQUE_PTR 1) + endif() cm_check_cxx_feature(nullptr) cm_check_cxx_feature(override) + cm_check_cxx_feature(unique_ptr) cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_make_unique.cxx b/Source/Checks/cm_cxx_make_unique.cxx new file mode 100644 index 0000000..a3ff68f --- /dev/null +++ b/Source/Checks/cm_cxx_make_unique.cxx @@ -0,0 +1,6 @@ +#include <memory> +int main() +{ + std::unique_ptr<int> u = std::make_unique<int>(0); + return *u; +} diff --git a/Source/Checks/cm_cxx_unique_ptr.cxx b/Source/Checks/cm_cxx_unique_ptr.cxx new file mode 100644 index 0000000..a9d4ce5 --- /dev/null +++ b/Source/Checks/cm_cxx_unique_ptr.cxx @@ -0,0 +1,6 @@ +#include <memory> +int main() +{ + std::unique_ptr<int> u(new int(0)); + return *u; +} diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 2c4a4ca..2e28498 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -263,8 +263,8 @@ bool cmAddCustomCommandCommand::InitialPass( // No command for this output exists. std::ostringstream e; - e << "given APPEND option with output \"" << output[0] - << "\" which is not already a custom command output."; + e << "given APPEND option with output\n\"" << output[0] + << "\"\nwhich is not already a custom command output."; this->SetError(e.str()); return false; } diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index fdbd5e7..6ff7575 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -42,9 +42,9 @@ bool cmCMakeHostSystemInformationCommand::InitialPass( result_list += ";"; } std::string value; - if (!this->GetValue(info, key, value)) + if (!this->GetValue(info, key, value)) { return false; - + } result_list += value; } diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 03c4a37..d29e208 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -24,23 +24,27 @@ bool cmCMakePolicyCommand::InitialPass(std::vector<std::string> const& args, if (args[0] == "SET") { return this->HandleSetMode(args); - } else if (args[0] == "GET") { + } + if (args[0] == "GET") { return this->HandleGetMode(args); - } else if (args[0] == "PUSH") { + } + if (args[0] == "PUSH") { if (args.size() > 1) { this->SetError("PUSH may not be given additional arguments."); return false; } this->Makefile->PushPolicy(); return true; - } else if (args[0] == "POP") { + } + if (args[0] == "POP") { if (args.size() > 1) { this->SetError("POP may not be given additional arguments."); return false; } this->Makefile->PopPolicy(); return true; - } else if (args[0] == "VERSION") { + } + if (args[0] == "VERSION") { return this->HandleVersionMode(args); } @@ -148,7 +152,8 @@ bool cmCMakePolicyCommand::HandleVersionMode( if (args.size() <= 1) { this->SetError("VERSION not given an argument"); return false; - } else if (args.size() >= 3) { + } + if (args.size() >= 3) { this->SetError("VERSION given too many arguments"); return false; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index f97791a..3d7839b 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -524,9 +524,8 @@ void CCONV* cmGetSource(void* arg, const char* name) i = cmCPluginAPISourceFiles.insert(entry).first; } return (void*)i->second; - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } void* CCONV cmAddSource(void* arg, void* arg2) @@ -574,12 +573,11 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop) cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg); if (cmSourceFile* rsf = sf->RealSourceFile) { return rsf->GetProperty(prop); - } else { - if (!strcmp(prop, "LOCATION")) { - return sf->FullPath.c_str(); - } - return sf->Properties.GetPropertyValue(prop); } + if (!strcmp(prop, "LOCATION")) { + return sf->FullPath.c_str(); + } + return sf->Properties.GetPropertyValue(prop); } int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop) @@ -587,9 +585,8 @@ int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop) cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg); if (cmSourceFile* rsf = sf->RealSourceFile) { return rsf->GetPropertyAsBool(prop) ? 1 : 0; - } else { - return cmSystemTools::IsOn(cmSourceFileGetProperty(arg, prop)) ? 1 : 0; } + return cmSystemTools::IsOn(cmSourceFileGetProperty(arg, prop)) ? 1 : 0; } void CCONV cmSourceFileSetProperty(void* arg, const char* prop, diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx index 1345bd5..b8fe365 100644 --- a/Source/cmCommandArgumentsHelper.cxx +++ b/Source/cmCommandArgumentsHelper.cxx @@ -57,14 +57,7 @@ bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const if (this->ArgumentsBeforeEmpty) { return true; } - - std::set<const cmCommandArgument*>::const_iterator argIt = - this->ArgumentsBefore.find(current); - if (argIt != this->ArgumentsBefore.end()) { - return true; - } - - return false; + return this->ArgumentsBefore.find(current) != this->ArgumentsBefore.end(); } bool cmCommandArgument::KeyMatches(const std::string& key) const diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index e670dc6..f78e840 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -249,20 +249,19 @@ bool cmConditionEvaluator::GetBooleanValueOld( // Old IsTrue behavior for single argument. if (arg == "0") { return false; - } else if (arg == "1") { + } + if (arg == "1") { return true; - } else { - const char* def = this->GetDefinitionIfUnquoted(arg); - return !cmSystemTools::IsOff(def); } - } else { - // Old GetVariableOrNumber behavior. const char* def = this->GetDefinitionIfUnquoted(arg); - if (!def && atoi(arg.c_str())) { - def = arg.c_str(); - } return !cmSystemTools::IsOff(def); } + // Old GetVariableOrNumber behavior. + const char* def = this->GetDefinitionIfUnquoted(arg); + if (!def && atoi(arg.c_str())) { + def = arg.c_str(); + } + return !cmSystemTools::IsOff(def); } //========================================================================= @@ -274,7 +273,8 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( // Use the policy if it is set. if (this->Policy12Status == cmPolicies::NEW) { return GetBooleanValue(newArg); - } else if (this->Policy12Status == cmPolicies::OLD) { + } + if (this->Policy12Status == cmPolicies::OLD) { return GetBooleanValueOld(newArg, oneArg); } diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index ccea22d..8365367 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -30,8 +30,10 @@ #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_USE_LIBUV #cmakedefine CMAKE_ENCODING_UTF8 +#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE #cmakedefine CMake_HAVE_CXX_NULLPTR #cmakedefine CMake_HAVE_CXX_OVERRIDE +#cmakedefine CMake_HAVE_CXX_UNIQUE_PTR #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e9367b1..3fdf35a 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -565,9 +565,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, if (copyFileError.empty()) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str()); return -1; - } else { - copyFileErrorMessage = emsg.str(); } + copyFileErrorMessage = emsg.str(); } } diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 81d8a1f..ab7e0cc 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -159,10 +159,9 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, if (cmds[i].empty()) { this->SetError(" given COMMAND argument with no value."); return false; - } else { - // Add the null terminating pointer to the command argument list. - cmds[i].push_back(CM_NULLPTR); } + // Add the null terminating pointer to the command argument list. + cmds[i].push_back(CM_NULLPTR); } // Parse the timeout string. diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index e26aba0..d15245e 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -45,24 +45,25 @@ public: protected: // Implement virtual methods from the superclass. - virtual void GeneratePolicyHeaderCode(std::ostream&) {} - virtual void GeneratePolicyFooterCode(std::ostream&) {} - virtual void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = ""); - virtual void GenerateImportFooterCode(std::ostream& os); - virtual void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target); - virtual void GenerateExpectedTargetsCode(std::ostream& os, - const std::string& expectedTargets); - virtual void GenerateImportPropertyCode(std::ostream& os, - const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); - virtual void GenerateMissingTargetsCheckCode( - std::ostream& os, const std::vector<std::string>& missingTargets); - virtual void GenerateInterfaceProperties( + void GeneratePolicyHeaderCode(std::ostream&) CM_OVERRIDE {} + void GeneratePolicyFooterCode(std::ostream&) CM_OVERRIDE {} + void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = "") CM_OVERRIDE; + void GenerateImportFooterCode(std::ostream& os) CM_OVERRIDE; + void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target) CM_OVERRIDE; + void GenerateExpectedTargetsCode( + std::ostream& os, const std::string& expectedTargets) CM_OVERRIDE; + void GenerateImportPropertyCode(std::ostream& os, const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties) + CM_OVERRIDE; + void GenerateMissingTargetsCheckCode( + std::ostream& os, + const std::vector<std::string>& missingTargets) CM_OVERRIDE; + void GenerateInterfaceProperties( cmGeneratorTarget const* target, std::ostream& os, - const ImportPropertyMap& properties); + const ImportPropertyMap& properties) CM_OVERRIDE; }; #endif diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 134a63f..466fad3 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -51,7 +51,8 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, if (args[0] == "PACKAGE") { return this->HandlePackage(args); - } else if (args[0] == "EXPORT") { + } + if (args[0] == "EXPORT") { this->ExportSetName.Follows(CM_NULLPTR); this->ArgumentGroup.Follows(&this->ExportSetName); } else { diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index 4b9f51c..ccfe6f8 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -37,36 +37,37 @@ public: protected: // Implement virtual methods from the superclass. - virtual void GeneratePolicyHeaderCode(std::ostream&) {} - virtual void GeneratePolicyFooterCode(std::ostream&) {} - virtual void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = ""); - virtual void GenerateImportFooterCode(std::ostream& os); - virtual void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target); - virtual void GenerateExpectedTargetsCode(std::ostream& os, - const std::string& expectedTargets); - virtual void GenerateImportPropertyCode(std::ostream& os, - const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); - virtual void GenerateMissingTargetsCheckCode( - std::ostream& os, const std::vector<std::string>& missingTargets); - virtual void GenerateInterfaceProperties( + void GeneratePolicyHeaderCode(std::ostream&) CM_OVERRIDE {} + void GeneratePolicyFooterCode(std::ostream&) CM_OVERRIDE {} + void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = "") CM_OVERRIDE; + void GenerateImportFooterCode(std::ostream& os) CM_OVERRIDE; + void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target) CM_OVERRIDE; + void GenerateExpectedTargetsCode( + std::ostream& os, const std::string& expectedTargets) CM_OVERRIDE; + void GenerateImportPropertyCode(std::ostream& os, const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties) + CM_OVERRIDE; + void GenerateMissingTargetsCheckCode( + std::ostream& os, + const std::vector<std::string>& missingTargets) CM_OVERRIDE; + void GenerateInterfaceProperties( cmGeneratorTarget const* target, std::ostream& os, - const ImportPropertyMap& properties); - virtual void GenerateImportPrefix(std::ostream& os); - virtual void LoadConfigFiles(std::ostream&); - virtual void GenerateRequiredCMakeVersion(std::ostream& os, - const char* versionString); - virtual void CleanupTemporaryVariables(std::ostream&); - virtual void GenerateImportedFileCheckLoop(std::ostream& os); - virtual void GenerateImportedFileChecksCode( + const ImportPropertyMap& properties) CM_OVERRIDE; + void GenerateImportPrefix(std::ostream& os) CM_OVERRIDE; + void LoadConfigFiles(std::ostream&) CM_OVERRIDE; + void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString) CM_OVERRIDE; + void CleanupTemporaryVariables(std::ostream&) CM_OVERRIDE; + void GenerateImportedFileCheckLoop(std::ostream& os) CM_OVERRIDE; + void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, - const std::set<std::string>& importedLocations); - virtual bool GenerateImportFileConfig(const std::string& config, - std::vector<std::string>&); + const std::set<std::string>& importedLocations) CM_OVERRIDE; + bool GenerateImportFileConfig(const std::string& config, + std::vector<std::string>&) CM_OVERRIDE; }; #endif diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index d9c30e7..350c855 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -64,7 +64,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const ap->SetCopyIfDifferent(true); foutPtr = ap; } - std::ostream& fout = *foutPtr.get(); + std::ostream& fout = *foutPtr; if (!fout) { cmSystemTools::Error("Error Writing ", this->Filename.c_str()); diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index b306f19..aa614fc 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -108,7 +108,7 @@ public: } cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator() - const + const CM_OVERRIDE { T* p = new T; p->SetName(GetName()); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c10f426..a13309d 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -104,19 +104,25 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args, std::string subCommand = args[0]; if (subCommand == "WRITE") { return this->HandleWriteCommand(args, false); - } else if (subCommand == "APPEND") { + } + if (subCommand == "APPEND") { return this->HandleWriteCommand(args, true); - } else if (subCommand == "DOWNLOAD") { + } + if (subCommand == "DOWNLOAD") { return this->HandleDownloadCommand(args); - } else if (subCommand == "UPLOAD") { + } + if (subCommand == "UPLOAD") { return this->HandleUploadCommand(args); - } else if (subCommand == "READ") { + } + if (subCommand == "READ") { return this->HandleReadCommand(args); - } else if (subCommand == "MD5" || subCommand == "SHA1" || - subCommand == "SHA224" || subCommand == "SHA256" || - subCommand == "SHA384" || subCommand == "SHA512") { + } + if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" || + subCommand == "SHA256" || subCommand == "SHA384" || + subCommand == "SHA512") { return this->HandleHashCommand(args); - } else if (subCommand == "STRINGS") { + } + if (subCommand == "STRINGS") { return this->HandleStringsCommand(args); } else if (subCommand == "GLOB") { return this->HandleGlobCommand(args, false); @@ -594,8 +600,9 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) // how many octets are there? unsigned int num_utf8_bytes = 0; for (unsigned int j = 0; num_utf8_bytes == 0 && j < 3; j++) { - if ((c & utf8_check_table[j][0]) == utf8_check_table[j][1]) + if ((c & utf8_check_table[j][0]) == utf8_check_table[j][1]) { num_utf8_bytes = j + 2; + } } // get subsequent octets and check that they are valid @@ -1408,11 +1415,14 @@ bool cmFileCopier::Install(const char* fromFile, const char* toFile) if (cmSystemTools::SameFile(fromFile, toFile)) { return true; - } else if (cmSystemTools::FileIsSymlink(fromFile)) { + } + if (cmSystemTools::FileIsSymlink(fromFile)) { return this->InstallSymlink(fromFile, toFile); - } else if (cmSystemTools::FileIsDirectory(fromFile)) { + } + if (cmSystemTools::FileIsDirectory(fromFile)) { return this->InstallDirectory(fromFile, toFile, match_properties); - } else if (cmSystemTools::FileExists(fromFile)) { + } + if (cmSystemTools::FileExists(fromFile)) { return this->InstallFile(fromFile, toFile, match_properties); } return this->ReportMissing(fromFile); @@ -3129,20 +3139,20 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args) if (i >= args.size()) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, merr); return false; + } + if (args[i] == "FUNCTION") { + guard = GUARD_FUNCTION; + } else if (args[i] == "FILE") { + guard = GUARD_FILE; + } else if (args[i] == "PROCESS") { + guard = GUARD_PROCESS; } else { - if (args[i] == "FUNCTION") { - guard = GUARD_FUNCTION; - } else if (args[i] == "FILE") { - guard = GUARD_FILE; - } else if (args[i] == "PROCESS") { - guard = GUARD_PROCESS; - } else { - std::ostringstream e; - e << merr << ", but got:\n \"" << args[i] << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } + std::ostringstream e; + e << merr << ", but got:\n \"" << args[i] << "\"."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; } + } else if (args[i] == "RESULT_VARIABLE") { ++i; if (i >= args.size()) { @@ -3259,7 +3269,8 @@ bool cmFileCommand::HandleTimestampCommand( if (args.size() < 3) { this->SetError("sub-command TIMESTAMP requires at least two arguments."); return false; - } else if (args.size() > 5) { + } + if (args.size() > 5) { this->SetError("sub-command TIMESTAMP takes at most four arguments."); return false; } diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index 6be6abc..64ced9e 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -37,9 +37,8 @@ cmFileLockResult cmFileLock::Release() if (lockResult == 0) { return cmFileLockResult::MakeOk(); - } else { - return cmFileLockResult::MakeSystem(); } + return cmFileLockResult::MakeSystem(); } cmFileLockResult cmFileLock::OpenFile() @@ -47,18 +46,16 @@ cmFileLockResult cmFileLock::OpenFile() this->File = ::open(this->Filename.c_str(), O_RDWR); if (this->File == -1) { return cmFileLockResult::MakeSystem(); - } else { - return cmFileLockResult::MakeOk(); } + return cmFileLockResult::MakeOk(); } cmFileLockResult cmFileLock::LockWithoutTimeout() { if (this->LockFile(F_SETLKW, F_WRLCK) == -1) { return cmFileLockResult::MakeSystem(); - } else { - return cmFileLockResult::MakeOk(); } + return cmFileLockResult::MakeOk(); } cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index c785e6c..fb95152 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -321,7 +321,8 @@ bool cmFindBase::CheckForVariableInCache() this->AlreadyInCacheWithoutMetaInfo = true; } return true; - } else if (cached) { + } + if (cached) { const char* hs = state->GetCacheEntryProperty(this->VariableName, "HELPSTRING"); this->VariableDocumentation = hs ? hs : "(none)"; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 3094fcf..0fd56b5 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -378,9 +378,8 @@ std::string cmFindLibraryCommand::FindNormalLibrary() { if (this->NamesPerDir) { return this->FindNormalLibraryNamesPerDir(); - } else { - return this->FindNormalLibraryDirsPerName(); } + return this->FindNormalLibraryDirsPerName(); } std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir() @@ -428,9 +427,8 @@ std::string cmFindLibraryCommand::FindFrameworkLibrary() { if (this->NamesPerDir) { return this->FindFrameworkLibraryNamesPerDir(); - } else { - return this->FindFrameworkLibraryDirsPerName(); } + return this->FindFrameworkLibraryDirsPerName(); } std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 405dce3..8b7bee2 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1308,18 +1308,16 @@ bool cmFindPackageCommand::CheckPackageRegistryEntry(const std::string& fname, outPaths.AddPath(fname); } return true; - } else { - // The path does not exist. Assume the stream content is - // associated with an old package that no longer exists, and - // delete it to keep the package registry clean. - return false; } - } else { - // The first line in the stream is not the full path to a file or - // directory. Assume the stream content was created by a future - // version of CMake that uses a different format, and leave it. - return true; + // The path does not exist. Assume the stream content is + // associated with an old package that no longer exists, and + // delete it to keep the package registry clean. + return false; } + // The first line in the stream is not the full path to a file or + // directory. Assume the stream content was created by a future + // version of CMake that uses a different format, and leave it. + return true; } void cmFindPackageCommand::FillPrefixesCMakeSystemVariable() @@ -1628,9 +1626,8 @@ private: { if (this->UseSuffixes) { return this->FPC->SearchDirectory(fullPath); - } else { - return this->FPC->CheckDirectory(fullPath); } + return this->FPC->CheckDirectory(fullPath); } cmFindPackageCommand* FPC; bool UseSuffixes; @@ -1653,9 +1650,8 @@ bool cmFileListGeneratorBase::Consider(std::string const& fullPath, { if (this->Next.get()) { return this->Next->Search(fullPath + "/", listing); - } else { - return listing.Visit(fullPath + "/"); } + return listing.Visit(fullPath + "/"); } class cmFileListGeneratorFixed : public cmFileListGeneratorBase diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index d71fc1a..d8f8795 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -136,9 +136,8 @@ std::string cmFindPathCommand::FindNormalHeader() if (cmSystemTools::FileExists(tryPath.c_str())) { if (this->IncludeFileInPath) { return tryPath; - } else { - return *p; } + return *p; } } } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 8d142c9..2cdda4c 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -140,9 +140,8 @@ std::string cmFindProgramCommand::FindNormalProgram() { if (this->NamesPerDir) { return this->FindNormalProgramNamesPerDir(); - } else { - return this->FindNormalProgramDirsPerName(); } + return this->FindNormalProgramDirsPerName(); } std::string cmFindProgramCommand::FindNormalProgramNamesPerDir() diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index dadd080..4dbbd2c 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -81,10 +81,9 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // restore the variable to its prior value mf.AddDefinition(this->Args[0], oldDef.c_str()); return true; - } else { - // close out a nested foreach - this->Depth--; } + // close out a nested foreach + this->Depth--; } // record the command diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index bda96aa..8aa1b77 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -169,10 +169,9 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked( // remove the function blocker now that the function is defined mf.RemoveFunctionBlocker(this, lff); return true; - } else { - // decrement for each nested function that ends - this->Depth--; } + // decrement for each nested function that ends + this->Depth--; } // if it wasn't an endfunction and we are not executing then we must be diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 2307e08..8063328 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -252,19 +252,17 @@ bool cmGetPropertyCommand::HandleTargetMode() if (this->PropertyName == "ALIASED_TARGET") { if (this->Makefile->IsAlias(this->Name)) { return this->StoreResult(target->GetName().c_str()); - } else { - return this->StoreResult(NULL); } + return this->StoreResult(CM_NULLPTR); } return this->StoreResult( target->GetProperty(this->PropertyName, this->Makefile)); - } else { - std::ostringstream e; - e << "could not find TARGET " << this->Name - << ". Perhaps it has not yet been created."; - this->SetError(e.str()); - return false; } + std::ostringstream e; + e << "could not find TARGET " << this->Name + << ". Perhaps it has not yet been created."; + this->SetError(e.str()); + return false; } bool cmGetPropertyCommand::HandleSourceMode() @@ -277,13 +275,11 @@ bool cmGetPropertyCommand::HandleSourceMode() // Get the source file. if (cmSourceFile* sf = this->Makefile->GetOrCreateSource(this->Name)) { return this->StoreResult(sf->GetPropertyForUser(this->PropertyName)); - } else { - std::ostringstream e; - e << "given SOURCE name that could not be found or created: " - << this->Name; - this->SetError(e.str()); - return false; } + std::ostringstream e; + e << "given SOURCE name that could not be found or created: " << this->Name; + this->SetError(e.str()); + return false; } bool cmGetPropertyCommand::HandleTestMode() @@ -347,11 +343,9 @@ bool cmGetPropertyCommand::HandleInstallMode() bool isSet = file->GetProperty(this->PropertyName, value); return this->StoreResult(isSet ? value.c_str() : CM_NULLPTR); - } else { - std::ostringstream e; - e << "given INSTALL name that could not be found or created: " - << this->Name; - this->SetError(e.str()); - return false; } + std::ostringstream e; + e << "given INSTALL name that could not be found or created: " << this->Name; + this->SetError(e.str()); + return false; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 64c9870..ed73450 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -94,6 +94,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileOuterMakefile = CM_NULLPTR; this->ConfigureDoneCMP0026AndCMP0024 = false; + this->FirstTimeProgress = 0.0f; cm->GetState()->SetMinGWMake(false); cm->GetState()->SetMSYSShell(false); diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 34fd626..64ece2d 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -89,7 +89,8 @@ static bool ConvertMotorolaSrecLine(const char* buf, FILE* outFile) if ((buf[1] == '5') || (buf[1] == '7') || (buf[1] == '8') || (buf[1] == '9')) { return true; - } else if (buf[1] == '1') { + } + if (buf[1] == '1') { dataStart = 8; } else if (buf[1] == '2') { dataStart = 10; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index dd04136..f0143e7 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -190,9 +190,8 @@ bool cmIfCommand::InvokeInitialPass( this->Makefile->IssueMessage(cmake::FATAL_ERROR, err); cmSystemTools::SetFatalErrorOccured(); return true; - } else { - this->Makefile->IssueMessage(status, err); } + this->Makefile->IssueMessage(status, err); } cmIfFunctionBlocker* f = new cmIfFunctionBlocker(); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index e464bce..8450360 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -71,19 +71,26 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, // Switch among the command modes. if (args[0] == "SCRIPT") { return this->HandleScriptMode(args); - } else if (args[0] == "CODE") { + } + if (args[0] == "CODE") { return this->HandleScriptMode(args); - } else if (args[0] == "TARGETS") { + } + if (args[0] == "TARGETS") { return this->HandleTargetsMode(args); - } else if (args[0] == "FILES") { + } + if (args[0] == "FILES") { return this->HandleFilesMode(args); - } else if (args[0] == "PROGRAMS") { + } + if (args[0] == "PROGRAMS") { return this->HandleFilesMode(args); - } else if (args[0] == "DIRECTORY") { + } + if (args[0] == "DIRECTORY") { return this->HandleDirectoryMode(args); - } else if (args[0] == "EXPORT") { + } + if (args[0] == "EXPORT") { return this->HandleExportMode(args); - } else if (args[0] == "EXPORT_ANDROID_MK") { + } + if (args[0] == "EXPORT_ANDROID_MK") { return this->HandleExportAndroidMKMode(args); } @@ -340,7 +347,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) << "\" which is not an executable, library, or module."; this->SetError(e.str()); return false; - } else if (target->GetType() == cmState::OBJECT_LIBRARY) { + } + if (target->GetType() == cmState::OBJECT_LIBRARY) { std::ostringstream e; e << "TARGETS given OBJECT library \"" << (*targetIt) << "\" which may not be installed."; @@ -1110,7 +1118,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", &ica.ArgumentGroup); cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); - exp.Follows(0); + exp.Follows(CM_NULLPTR); ica.ArgumentGroup.Follows(&exp); std::vector<std::string> unknownArgs; diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 64efe61..9d0db02 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -143,12 +143,12 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const if (cmSystemTools::FileExists(tb.c_str())) { // The file exists in the binary tree. Use it. return tb; - } else if (cmSystemTools::FileExists(ts.c_str())) { + } + if (cmSystemTools::FileExists(ts.c_str())) { // The file exists in the source tree. Use it. return ts; - } else { - // The file doesn't exist. Assume it will be present in the - // binary tree when the install occurs. - return tb; } + // The file doesn't exist. Assume it will be present in the + // binary tree when the install occurs. + return tb; } diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 2e5fc1f..93e7f6c 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -113,12 +113,12 @@ std::string cmInstallProgramsCommand::FindInstallSource(const char* name) const if (cmSystemTools::FileExists(tb.c_str())) { // The file exists in the binary tree. Use it. return tb; - } else if (cmSystemTools::FileExists(ts.c_str())) { + } + if (cmSystemTools::FileExists(ts.c_str())) { // The file exists in the source tree. Use it. return ts; - } else { - // The file doesn't exist. Assume it will be present in the - // binary tree when the install occurs. - return tb; } + // The file doesn't exist. Assume it will be present in the + // binary tree when the install occurs. + return tb; } diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 5231062..033f549 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -203,10 +203,9 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // remove the function blocker now that the macro is defined mf.RemoveFunctionBlocker(this, lff); return true; - } else { - // decrement for each nested macro that ends - this->Depth--; } + // decrement for each nested macro that ends + this->Depth--; } // if it wasn't an endmacro and we are not executing then we must be diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 335b552..b2384b0 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -336,7 +336,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() std::string targetOutputReal = this->ConvertToNinjaPath(gt.GetFullPath(cfgName, /*implib=*/false, - /*realpath=*/true)); + /*realname=*/true)); cmakeCommand += targetOutputReal; cmakeCommand += " || true"; linkCmds.push_back(cmakeCommand); @@ -414,7 +414,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string targetOutputReal = ConvertToNinjaPath(gt.GetFullPath(cfgName, /*implib=*/false, - /*realpath=*/true)); + /*realname=*/true)); std::string targetOutputImplib = ConvertToNinjaPath(gt.GetFullPath(cfgName, /*implib=*/true)); diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index ef636e7..730ce6d 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -307,10 +307,10 @@ protected: // If dependencies are already done, stop now. if (info->DependDone) { return; - } else { - // Make sure we don't visit the same file more than once. - info->DependDone = true; } + // Make sure we don't visit the same file more than once. + info->DependDone = true; + const char* path = info->FullPath.c_str(); if (!path) { cmSystemTools::Error( @@ -405,15 +405,14 @@ protected: if (result != this->DependInformationMap.end()) { // Found an instance, return it. return result->second; - } else { - // Didn't find an instance. Create a new one and save it. - cmDependInformation* info = new cmDependInformation; - info->FullPath = fullPath; - info->PathOnly = cmSystemTools::GetFilenamePath(fullPath); - info->IncludeName = file; - this->DependInformationMap[fullPath] = info; - return info; } + // Didn't find an instance. Create a new one and save it. + cmDependInformation* info = new cmDependInformation; + info->FullPath = fullPath; + info->PathOnly = cmSystemTools::GetFilenamePath(fullPath); + info->IncludeName = file; + this->DependInformationMap[fullPath] = info; + return info; } /** diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index ca3a57f..46498e6 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -124,9 +124,8 @@ static std::string cmSearchPathStripBin(std::string const& s) // If the path is a PREFIX/bin case then add its parent instead. if ((cmHasLiteralSuffix(s, "/bin")) || (cmHasLiteralSuffix(s, "/sbin"))) { return cmSystemTools::GetFilenamePath(s); - } else { - return s; } + return s; } void cmSearchPath::AddEnvPrefixPath(const std::string& variable, bool stripBin) diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 6bdb28b..0660b76 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -59,7 +59,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, } // SET (VAR PARENT_SCOPE) // Removes the definition of VAR // in the parent scope. - else if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") { + if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") { this->Makefile->RaiseScope(variable, CM_NULLPTR); return true; } diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index 8584118..03b195a 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -45,7 +45,8 @@ bool cmSetDirectoryPropertiesCommand::RunCommand( if (prop == "VARIABLES") { errors = "Variables and cache variables should be set using SET command"; return false; - } else if (prop == "MACROS") { + } + if (prop == "MACROS") { errors = "Commands and macros cannot be set using SET_CMAKE_PROPERTIES"; return false; } diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index addfed4..cfb537f 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -34,43 +34,61 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args, const std::string& subCommand = args[0]; if (subCommand == "REGEX") { return this->HandleRegexCommand(args); - } else if (subCommand == "REPLACE") { + } + if (subCommand == "REPLACE") { return this->HandleReplaceCommand(args); - } else if (subCommand == "MD5" || subCommand == "SHA1" || - subCommand == "SHA224" || subCommand == "SHA256" || - subCommand == "SHA384" || subCommand == "SHA512") { + } + if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" || + subCommand == "SHA256" || subCommand == "SHA384" || + subCommand == "SHA512") { return this->HandleHashCommand(args); - } else if (subCommand == "TOLOWER") { + } + if (subCommand == "TOLOWER") { return this->HandleToUpperLowerCommand(args, false); - } else if (subCommand == "TOUPPER") { + } + if (subCommand == "TOUPPER") { return this->HandleToUpperLowerCommand(args, true); - } else if (subCommand == "COMPARE") { + } + if (subCommand == "COMPARE") { return this->HandleCompareCommand(args); - } else if (subCommand == "ASCII") { + } + if (subCommand == "ASCII") { return this->HandleAsciiCommand(args); - } else if (subCommand == "CONFIGURE") { + } + if (subCommand == "CONFIGURE") { return this->HandleConfigureCommand(args); - } else if (subCommand == "LENGTH") { + } + if (subCommand == "LENGTH") { return this->HandleLengthCommand(args); - } else if (subCommand == "APPEND") { + } + if (subCommand == "APPEND") { return this->HandleAppendCommand(args); - } else if (subCommand == "CONCAT") { + } + if (subCommand == "CONCAT") { return this->HandleConcatCommand(args); - } else if (subCommand == "SUBSTRING") { + } + if (subCommand == "SUBSTRING") { return this->HandleSubstringCommand(args); - } else if (subCommand == "STRIP") { + } + if (subCommand == "STRIP") { return this->HandleStripCommand(args); - } else if (subCommand == "RANDOM") { + } + if (subCommand == "RANDOM") { return this->HandleRandomCommand(args); - } else if (subCommand == "FIND") { + } + if (subCommand == "FIND") { return this->HandleFindCommand(args); - } else if (subCommand == "TIMESTAMP") { + } + if (subCommand == "TIMESTAMP") { return this->HandleTimestampCommand(args); - } else if (subCommand == "MAKE_C_IDENTIFIER") { + } + if (subCommand == "MAKE_C_IDENTIFIER") { return this->HandleMakeCIdentifierCommand(args); - } else if (subCommand == "GENEX_STRIP") { + } + if (subCommand == "GENEX_STRIP") { return this->HandleGenexStripCommand(args); - } else if (subCommand == "UUID") { + } + if (subCommand == "UUID") { return this->HandleUuidCommand(args); } @@ -158,7 +176,8 @@ bool cmStringCommand::HandleConfigureCommand( if (args.size() < 2) { this->SetError("No input string specified."); return false; - } else if (args.size() < 3) { + } + if (args.size() < 3) { this->SetError("No output variable specified."); return false; } @@ -203,14 +222,16 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args) return false; } return this->RegexMatch(args); - } else if (mode == "MATCHALL") { + } + if (mode == "MATCHALL") { if (args.size() < 5) { this->SetError("sub-command REGEX, mode MATCHALL needs " "at least 5 arguments total to command."); return false; } return this->RegexMatchAll(args); - } else if (mode == "REPLACE") { + } + if (mode == "REPLACE") { if (args.size() < 6) { this->SetError("sub-command REGEX, mode REPLACE needs " "at least 6 arguments total to command."); @@ -785,7 +806,8 @@ bool cmStringCommand::HandleTimestampCommand( if (args.size() < 2) { this->SetError("sub-command TIMESTAMP requires at least one argument."); return false; - } else if (args.size() > 4) { + } + if (args.size() > 4) { this->SetError("sub-command TIMESTAMP takes at most three arguments."); return false; } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index b62e225..950db16 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -353,10 +353,9 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, "INTERFACE_LINK_LIBRARIES", this->Target->GetDebugGeneratorExpressions(lib, llt).c_str()); return true; - } else if (this->CurrentProcessingState != - ProcessingKeywordPublicInterface && - this->CurrentProcessingState != - ProcessingPlainPublicInterface) { + } + if (this->CurrentProcessingState != ProcessingKeywordPublicInterface && + this->CurrentProcessingState != ProcessingPlainPublicInterface) { if (this->Target->GetType() == cmState::STATIC_LIBRARY) { std::string configLib = this->Target->GetDebugGeneratorExpressions(lib, llt); diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx index 5bf137c..874015d 100644 --- a/Source/cmUnsetCommand.cxx +++ b/Source/cmUnsetCommand.cxx @@ -36,23 +36,21 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args, return true; } // unset(VAR) - else if (args.size() == 1) { + if (args.size() == 1) { this->Makefile->RemoveDefinition(variable); return true; } // unset(VAR CACHE) - else if ((args.size() == 2) && (args[1] == "CACHE")) { + if ((args.size() == 2) && (args[1] == "CACHE")) { this->Makefile->RemoveCacheDefinition(variable); return true; } // unset(VAR PARENT_SCOPE) - else if ((args.size() == 2) && (args[1] == "PARENT_SCOPE")) { + if ((args.size() == 2) && (args[1] == "PARENT_SCOPE")) { this->Makefile->RaiseScope(variable, CM_NULLPTR); return true; } // ERROR: second argument isn't CACHE or PARENT_SCOPE - else { - this->SetError("called with an invalid second argument"); - return false; - } + this->SetError("called with an invalid second argument"); + return false; } diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index ad558fe..98bd3ff 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -104,10 +104,9 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, messageType); } return true; - } else { - // decrement for each nested while that ends - this->Depth--; } + // decrement for each nested while that ends + this->Depth--; } // record the command diff --git a/Source/cm_auto_ptr.hxx b/Source/cm_auto_ptr.hxx index 2cd35c3..f6c4362 100644 --- a/Source/cm_auto_ptr.hxx +++ b/Source/cm_auto_ptr.hxx @@ -12,7 +12,7 @@ #ifndef CM_AUTO_PTR_HXX #define CM_AUTO_PTR_HXX -#include <cmsys/Configure.hxx> +#include <cmConfigure.h> // FIXME: Use std::auto_ptr on compilers that do not warn about it. #define CM_AUTO_PTR cm::auto_ptr @@ -115,7 +115,7 @@ public: * * auto_ptr<X> ptr(new X()); */ - explicit auto_ptr(X* p = 0) throw() + explicit auto_ptr(X* p = CM_NULLPTR) throw() : x_(p) { } @@ -157,7 +157,7 @@ public: X* release() throw() { X* x = this->x_; - this->x_ = 0; + this->x_ = CM_NULLPTR; return x; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 18a7894..112a5f7 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -595,8 +595,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args) gg->CreateGenerationObjects(); cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName()); cmLocalGenerator* lg = gtgt->GetLocalGenerator(); - lg->GetTargetFlags(buildType, linkLibs, frameworkPath, linkPath, flags, - linkFlags, gtgt, false); + lg->GetTargetFlags(buildType, linkLibs, flags, linkFlags, frameworkPath, + linkPath, gtgt, false); linkLibs = frameworkPath + linkPath + linkLibs; printf("%s\n", linkLibs.c_str()); diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt index 96d0972..cd542d8 100644 --- a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -1,5 +1,8 @@ CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): - add_custom_command given APPEND option with output.* + add_custom_command given APPEND option with output + + .*RunCMake/add_custom_command/AppendNotOutput-build/out.* + which is not already a custom command output. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 168eb86..e7e154e 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -21,7 +21,7 @@ set(qt_xcb_libs set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_C_STANDARD:STRING=11 -CMAKE_CXX_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=14 CMAKE_C_FLAGS:STRING=-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 CMAKE_EXE_LINKER_FLAGS:STRING=-static-libstdc++ -static-libgcc CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index e7e5ba4..12b12d7 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -14,7 +14,7 @@ set(CXXFLAGS "-stdlib=libc++") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_C_STANDARD:STRING=11 -CMAKE_CXX_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=14 CMAKE_OSX_ARCHITECTURES:STRING=x86_64 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index a27efda..f54a4ca 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -27,6 +27,6 @@ get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_EXTRA "git config core.autocrlf true") if(CMAKE_CREATE_VERSION STREQUAL "nightly") # Some tests fail spuriously too often. - set(EXTRA_CTEST_ARGS "-E Qt5Autogen") + set(EXTRA_CTEST_ARGS "-E 'Qt5Autogen|ConsoleBuf'") endif() include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index e39a610..bd2690f 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -28,6 +28,6 @@ get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_EXTRA "git config core.autocrlf true") if(CMAKE_CREATE_VERSION STREQUAL "nightly") # Some tests fail spuriously too often. - set(EXTRA_CTEST_ARGS "-E Qt5Autogen") + set(EXTRA_CTEST_ARGS "-E 'Qt5Autogen|ConsoleBuf'") endif() include(${path}/release_cmake.cmake) |