diff options
58 files changed, 683 insertions, 314 deletions
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 5600b35..6003565 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -38,6 +38,10 @@ if(CPACK_GENERATOR MATCHES "IFW") @_CPACK_IFW_PACKAGE_ICON@ set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") + set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT + "@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs") + # Uninstaller configuration + set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") # Package configuration group set(CPACK_IFW_PACKAGE_GROUP CMake) # Group configuration diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index cc2fbb8..7f20d10 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -37,6 +37,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" + "Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 92e3001..9865eeb 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -35,3 +35,7 @@ with an error instead of just a warning. :command:`project` command. It is important to establish version and policy settings before invoking other commands whose behavior they may affect. See also policy :policy:`CMP0000`. + + Calling ``cmake_minimum_required()`` inside a :command:`function` + limits some effects to the function scope when invoked. Such calls + should not be made with the intention of having global effects. diff --git a/Help/release/dev/cpack-ifw-updates.rst b/Help/release/dev/cpack-ifw-updates.rst new file mode 100644 index 0000000..c01f04b --- /dev/null +++ b/Help/release/dev/cpack-ifw-updates.rst @@ -0,0 +1,5 @@ +cpack-ifw-updates +----------------- + +* The :manual:`cpack(1)` ``IFW`` generator and the :module:`CPackIFW` + module learned to support Qt Framework Installer 2.0 tools. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 0ccb042..226153c 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -28,29 +28,33 @@ # # .. variable:: CPACK_DEBIAN_PACKAGE_NAME # +# The Debian package summary +# # * Mandatory : YES -# * Default : CPACK_PACKAGE_NAME (lower case) +# * Default : :variable:`CPACK_PACKAGE_NAME` (lower case) # -# The debian package summary # # .. variable:: CPACK_DEBIAN_PACKAGE_VERSION # +# The Debian package version +# # * Mandatory : YES -# * Default : CPACK_PACKAGE_VERSION +# * Default : :variable:`CPACK_PACKAGE_VERSION` # -# The debian package version # # .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE # +# The Debian package architecture +# # * Mandatory : YES -# * Default : Output of dpkg --print-architecture (or i386 if dpkg is not found) +# * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386` +# if :code:`dpkg` is not found) # -# The debian package architecture # # .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS # CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS # -# May be used to set deb dependencies. +# Sets the Debian dependencies of this package. # # * Mandatory : NO # * Default : @@ -64,7 +68,7 @@ # If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or # more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` # is set for this component, the discovered dependencies will be appended -# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` intead of +# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of # :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If # :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string, # only the automatically discovered dependencies will be set for this @@ -76,15 +80,16 @@ # # .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER # +# The Debian package maintainer +# # * Mandatory : YES -# * Default : CPACK_PACKAGE_CONTACT +# * Default : :code:`CPACK_PACKAGE_CONTACT` # -# The debian package maintainer # # .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION # CPACK_COMPONENT_<COMPONENT>_DESCRIPTION # -# The debian package description +# The Debian package description # # * Mandatory : YES # * Default : @@ -92,6 +97,7 @@ # - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or # - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` # +# # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION # # * Mandatory : YES @@ -99,33 +105,40 @@ # # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE # +# The compression used for creating the Debian package. +# Possible values are: lzma, xz, bzip2 and gzip. +# # * Mandatory : YES # * Default : 'gzip' # -# Possible values are: lzma, xz, bzip2 and gzip. # # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY # +# The Debian package priority +# # * Mandatory : YES # * Default : 'optional' # -# The debian package priority # # .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE # -# * Mandatory : NO -# * Default : - -# # The URL of the web site for this package, preferably (when applicable) the # site from which the original source can be obtained and any additional # upstream documentation or information may be found. -# The content of this field is a simple URL without any surrounding -# characters such as <>. +# +# * Mandatory : NO +# * Default : - +# +# .. note:: +# +# The content of this field is a simple URL without any surrounding +# characters such as <>. +# # # .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS # CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS # -# May be set to ON in order to use dpkg-shlibdeps to generate +# May be set to ON in order to use :code:`dpkg-shlibdeps` to generate # better package dependency list. # # * Mandatory : NO @@ -141,92 +154,132 @@ # may fail to find your own shared libs. # See http://www.cmake.org/Wiki/CMake_RPATH_handling. # -# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG # -# * Mandatory : NO -# * Default : - +# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG # # May be set when invoking cpack in order to trace debug information # during CPackDeb run. # +# * Mandatory : NO +# * Default : - +# # .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS # +# Sets the `Pre-Depends` field of the Debian package. +# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it +# also forces :code:`dpkg` to complete installation of the packages named +# before even starting the installation of the package which declares the +# pre-dependency. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# This field is like Depends, except that it also forces dpkg to complete installation of -# the packages named before even starting the installation of the package which declares -# the pre-dependency. +# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES # +# Sets the `Enhances` field of the Debian package. +# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works +# in the opposite direction: declares that a package can enhance the +# functionality of another package. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# This field is similar to Suggests but works in the opposite direction. -# It is used to declare that a package can enhance the functionality of another package. +# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS # +# Sets the `Breaks` field of the Debian package. +# When a binary package (P) declares that it breaks other packages (B), +# :code:`dpkg` will not allow the package (P) which declares `Breaks` be +# **unpacked** unless the packages that will be broken (B) are deconfigured +# first. +# As long as the package (P) is configured, the previously deconfigured +# packages (B) cannot be reconfigured again. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# When one binary package declares that it breaks another, dpkg will refuse to allow the -# package which declares Breaks be installed unless the broken package is deconfigured first, -# and it will refuse to allow the broken package to be reconfigured. +# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks +# # # .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS # +# Sets the `Conflicts` field of the Debian package. +# When one binary package declares a conflict with another using a `Conflicts` +# field, :code:`dpkg` will not allow them to be unpacked on the system at +# the same time. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# When one binary package declares a conflict with another using a Conflicts field, -# dpkg will refuse to allow them to be installed on the system at the same time. +# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts +# +# .. note:: +# +# This is a stronger restriction than +# :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the +# broken package from being configured while the breaking package is in +# the "Unpacked" state but allows both packages to be unpacked at the same +# time. # # .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES # +# Sets the `Provides` field of the Debian package. +# A virtual package is one which appears in the `Provides` control field of +# another package. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# A virtual package is one which appears in the Provides control field of another package. +# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual +# # # .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES # +# Sets the `Replaces` field of the Debian package. +# Packages can declare in their control file that they should overwrite +# files in certain other packages, or completely replace other packages. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# Packages can declare in their control file that they should overwrite -# files in certain other packages, or completely replace other packages. +# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# # # .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS # +# Sets the `Recommends` field of the Debian package. +# Allows packages to declare a strong, but not absolute, dependency on other +# packages. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# Allows packages to declare a strong, but not absolute, dependency on other packages. +# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# # # .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS # +# Sets the `Suggests` field of the Debian package. +# Allows packages to declare a suggested package install grouping. +# # * Mandatory : NO # * Default : - # -# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# Allows packages to declare a suggested package install grouping. +# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# # # .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # +# This variable allow advanced user to add custom script to the +# control.tar.gz. +# Typical usage is for conffiles, postinst, postrm, prerm. +# # * Mandatory : NO # * Default : - # -# This variable allow advanced user to add custom script to the -# control.tar.gz Typical usage is for conffiles, postinst, postrm, prerm. # Usage:: # # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index e5b7601..6649933 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -2,7 +2,7 @@ # CPackIFW # -------- # -# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html +# .. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html # # This module looks for the location of the command line utilities supplied with # the Qt Installer Framework (QtIFW_). @@ -33,18 +33,26 @@ # # You can use the following variables to change behavior of CPack ``IFW`` generator. # +# Debug +# """""" +# +# .. variable:: CPACK_IFW_VERBOSE +# +# Set to ``ON`` to enable addition debug output. +# By default is ``OFF``. +# # Package # """"""" # # .. variable:: CPACK_IFW_PACKAGE_TITLE # # Name of the installer as displayed on the title bar. -# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` +# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. # # .. variable:: CPACK_IFW_PACKAGE_PUBLISHER # # Publisher of the software (as shown in the Windows Control Panel). -# By default used :variable:`CPACK_PACKAGE_VENDOR` +# By default used :variable:`CPACK_PACKAGE_VENDOR`. # # .. variable:: CPACK_IFW_PRODUCT_URL # @@ -63,6 +71,12 @@ # # Filename for a logo is used as QWizard::LogoPixmap. # +# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY +# +# Name of the default program group for the product in the Windows Start menu. +# +# By default used :variable:`CPACK_IFW_PACKAGE_NAME`. +# # .. variable:: CPACK_IFW_TARGET_DIRECTORY # # Default target directory for installation. @@ -85,6 +99,35 @@ # The root package name, which will be used if configuration group is not # specified # +# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME +# +# Filename of the generated maintenance tool. +# The platform-specific executable file extension is appended. +# +# By default used QtIFW_ defaults (``maintenancetool``). +# +# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE +# +# Filename for the configuration of the generated maintenance tool. +# +# By default used QtIFW_ defaults (``maintenancetool.ini``). +# +# .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS +# +# Set to ``ON`` if the installation path can contain non-ASCII characters. +# +# Is ``ON`` for QtIFW_ less 2.0 tools. +# +# .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH +# +# Set to ``OFF`` if the installation path cannot contain space characters. +# +# Is ``ON`` for QtIFW_ less 2.0 tools. +# +# .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT +# +# Filename for a custom installer control script. +# # .. variable:: CPACK_IFW_REPOSITORIES_ALL # # The list of remote repositories. @@ -113,6 +156,10 @@ # Tools # """""""" # +# .. variable:: CPACK_IFW_FRAMEWORK_VERSION +# +# The version of used QtIFW_ tools. +# # .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE # # The path to "binarycreator" command line client. @@ -276,16 +323,16 @@ # Qt Installer Framework Manual: # # Index page -# http://qt-project.org/doc/qtinstallerframework/index.html +# http://doc.qt.io/qtinstallerframework/index.html # # Component Scripting -# http://qt-project.org/doc/qtinstallerframework/scripting.html +# http://doc.qt.io/qtinstallerframework/scripting.html # # Predefined Variables -# http://qt-project.org/doc/qtinstallerframework/scripting.html#predefined-variables +# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables # -# Download Qt Installer Framework for you platform from Qt Project site: -# http://download.qt-project.org/official_releases/qt-installer-framework/ +# Download Qt Installer Framework for you platform from Qt site: +# http://download.qt.io/official_releases/qt-installer-framework # #============================================================================= @@ -324,8 +371,14 @@ else() endif() set(_CPACK_IFW_SUFFIXES +# Common "bin" - "QtIFW-1.7.0/bin" +# Second branch + "QtIFW2.3.0/bin" + "QtIFW2.2.0/bin" + "QtIFW2.1.0/bin" + "QtIFW2.0.0/bin" +# First branch "QtIFW-1.6.0/bin" "QtIFW-1.5.0/bin" "QtIFW-1.4.0/bin" @@ -351,6 +404,26 @@ find_program(CPACK_IFW_REPOGEN_EXECUTABLE ) mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE) +# Look for 'installerbase' + +find_program(CPACK_IFW_INSTALLERBASE_EXECUTABLE + NAMES installerbase + PATHS ${_CPACK_IFW_PATHS} + PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES} + DOC "QtIFW installer executable base" + ) +mark_as_advanced(CPACK_IFW_INSTALLERBASE_EXECUTABLE) + +# Look for 'devtool' (appeared in the second branch) + +find_program(CPACK_IFW_DEVTOOL_EXECUTABLE + NAMES devtool + PATHS ${_CPACK_IFW_PATHS} + PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES} + DOC "QtIFW devtool command line client" + ) +mark_as_advanced(CPACK_IFW_DEVTOOL_EXECUTABLE) + # ## Next code is included only once # @@ -359,6 +432,27 @@ if(NOT CPackIFW_CMake_INCLUDED) set(CPackIFW_CMake_INCLUDED 1) #============================================================================= +# Framework version +#============================================================================= + +if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND CPACK_IFW_DEVTOOL_EXECUTABLE) + execute_process(COMMAND + "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" --framework-version + OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION) + if(CPACK_IFW_FRAMEWORK_VERSION) + string(REPLACE " " "" + CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") + string(REPLACE "\t" "" + CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") + string(REPLACE "\n" "" + CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") + if(CPACK_IFW_VERBOSE) + message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version") + endif() + endif() +endif() + +#============================================================================= # Macro definition #============================================================================= @@ -514,4 +608,7 @@ macro(cpack_ifw_add_repository reponame) endmacro() +# Resolve package control script +_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT) + endif() # NOT CPackIFW_CMake_INCLUDED diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 14c9e3a..060aedd 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 2) -set(CMake_VERSION_PATCH 20150517) +set(CMake_VERSION_PATCH 20150519) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 0439ff6..80ba068 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -29,6 +29,8 @@ #include <cmMakefile.h> #include <cmGeneratedFileStream.h> #include <cmXMLSafe.h> +#include <cmVersionConfig.h> +#include <cmTimestamp.h> //---------------------------------------------------------------------------- cmCPackIFWGenerator::cmCPackIFWGenerator() @@ -41,6 +43,27 @@ cmCPackIFWGenerator::~cmCPackIFWGenerator() } //---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionLess(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionGreater(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionEqual(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- int cmCPackIFWGenerator::PackageFiles() { cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl); @@ -59,7 +82,12 @@ int cmCPackIFWGenerator::PackageFiles() if (!Installer.Repositories.empty()) { std::string ifwCmd = RepoGen; - ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + + if(IsVersionLess("2.0.0")) + { + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + } + ifwCmd += " -p " + this->toplevel + "/packages"; if(!PkgsDirsVector.empty()) @@ -216,8 +244,7 @@ const char *cmCPackIFWGenerator::GetPackagingInstallPrefix() //---------------------------------------------------------------------------- const char *cmCPackIFWGenerator::GetOutputExtension() { - const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX"); - return suffix ? suffix : cmCPackGenerator::GetOutputExtension(); + return ExecutableSuffix.c_str(); } //---------------------------------------------------------------------------- @@ -267,6 +294,17 @@ int cmCPackIFWGenerator::InitializeInternal() RepoGen = RepoGenStr; } + // Framework version + if(const char* FrameworkVersionSrt = + this->GetOption("CPACK_IFW_FRAMEWORK_VERSION")) + { + FrameworkVersion = FrameworkVersionSrt; + } + else + { + FrameworkVersion = "1.9.9"; + } + // Variables that Change Behavior // Resolve duplicate names @@ -307,6 +345,24 @@ int cmCPackIFWGenerator::InitializeInternal() return 0; } + // Executable suffix + if(const char *optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) + { + ExecutableSuffix = optExeSuffix; + if(ExecutableSuffix.empty()) + { + std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME")); + if(sysName == "Linux") + { + ExecutableSuffix = ".run"; + } + } + } + else + { + ExecutableSuffix = cmCPackGenerator::GetOutputExtension(); + } + return this->Superclass::InitializeInternal(); } @@ -552,3 +608,20 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage( = ComponentPackages.find(component); return pit != ComponentPackages.end() ? pit->second : 0; } + +//---------------------------------------------------------------------------- +void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + xout << "<!-- Generated by CPack " << CMake_VERSION << " IFW generator " + << "for QtIFW "; + if(IsVersionLess("2.0")) + { + xout << "less 2.0"; + } + else + { + xout << FrameworkVersion; + } + xout << " tools at " << cmTimestamp().CurrentTime("", true) << " -->" + << std::endl; +} diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 1d4d67b..3246861 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,6 +13,7 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h +#include <cmGeneratedFileStream.h> #include <CPack/cmCPackGenerator.h> #include "cmCPackIFWPackage.h" @@ -44,6 +45,21 @@ public: */ virtual ~cmCPackIFWGenerator(); + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionLess(const char *version); + + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionGreater(const char *version); + + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionEqual(const char *version); + protected: // cmCPackGenerator reimplementation /** @@ -105,6 +121,8 @@ protected: // Methods cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const; cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const; + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); + protected: // Data friend class cmCPackIFWPackage; @@ -126,6 +144,8 @@ protected: // Data private: std::string RepoGen; std::string BinCreator; + std::string FrameworkVersion; + std::string ExecutableSuffix; bool OnlineOnly; bool ResolveDuplicateNames; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 4a99e50..8c77a2c 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -51,6 +51,25 @@ bool cmCPackIFWInstaller::IsOn(const std::string &op) const } //---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionLess(const char *version) +{ + return Generator ? Generator->IsVersionLess(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionGreater(const char *version) +{ + return Generator ? Generator->IsVersionGreater(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionEqual(const char *version) +{ + return Generator ? Generator->IsVersionEqual(version) : false; +} + + +//---------------------------------------------------------------------------- void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; @@ -151,6 +170,17 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } } + // Start menu + if (const char* optIFW_START_MENU_DIR = + this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) + { + StartMenuDir = optIFW_START_MENU_DIR; + } + else + { + StartMenuDir = Name; + } + // Default target directory for installation if (const char* optIFW_TARGET_DIRECTORY = GetOption("CPACK_IFW_TARGET_DIRECTORY")) @@ -177,7 +207,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Repositories Repositories.clear(); RepositoryStruct Repo; - if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) + if(const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) { Repo.Url = site; Repositories.push_back(Repo); @@ -245,6 +275,53 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } } } + + // Maintenance tool + if(const char* optIFW_MAINTENANCE_TOOL = + this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) + { + MaintenanceToolName = optIFW_MAINTENANCE_TOOL; + } + + // Maintenance tool ini file + if(const char* optIFW_MAINTENANCE_TOOL_INI = + this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) + { + MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI; + } + + // Allow non-ASCII characters + if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) + { + if(IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) + { + AllowNonAsciiCharacters = "true"; + } + else + { + AllowNonAsciiCharacters = "false"; + } + } + + // Space in path + if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) + { + if(IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) + { + AllowSpaceInPath = "true"; + } + else + { + AllowSpaceInPath = "false"; + } + } + + // Control script + if(const char* optIFW_CONTROL_SCRIPT = + this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) + { + ControlScript = optIFW_CONTROL_SCRIPT; + } } //---------------------------------------------------------------------------- @@ -259,7 +336,10 @@ void cmCPackIFWInstaller::GenerateInstallerFile() // Output stream cmGeneratedFileStream xout((Directory + "/config/config.xml").data()); - xout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; + xout << "<?xml version=\"1.0\"?>" << std::endl; + + WriteGeneratedByToStrim(xout); + xout << "<Installer>" << std::endl; xout << " <Name>" << cmXMLSafe(Name).str() << "</Name>" << std::endl; @@ -313,11 +393,20 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout << " <Logo>" << name << "</Logo>" << std::endl; } + // Start menu + if(!IsVersionLess("2.0")) + { + xout << " <StartMenuDir>" << StartMenuDir + << "</StartMenuDir>" << std::endl; + } + + // Target dir if(!TargetDir.empty()) { xout << " <TargetDir>" << TargetDir << "</TargetDir>" << std::endl; } + // Admin target dir if(!AdminTargetDir.empty()) { xout << " <AdminTargetDir>" << AdminTargetDir @@ -364,11 +453,52 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout << " </RemoteRepositories>" << std::endl; } - // CPack IFW default policy - xout << " <!-- CPack IFW default policy -->" << std::endl; - xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>" - << std::endl; - xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl; + // Maintenance tool + if(!IsVersionLess("2.0") && !MaintenanceToolName.empty()) + { + xout << " <MaintenanceToolName>" << MaintenanceToolName + << "</MaintenanceToolName>" << std::endl; + } + + // Maintenance tool ini file + if(!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty()) + { + xout << " <MaintenanceToolIniFile>" << MaintenanceToolIniFile + << "</MaintenanceToolIniFile>" << std::endl; + } + + // Different allows + if(IsVersionLess("2.0")) + { + // CPack IFW default policy + xout << " <!-- CPack IFW default policy for QtIFW less 2.0 -->" + << std::endl; + xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>" + << std::endl; + xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl; + } + else + { + if(!AllowNonAsciiCharacters.empty()) + { + xout << " <AllowNonAsciiCharacters>" << AllowNonAsciiCharacters + << "</AllowNonAsciiCharacters>" << std::endl; + } + if(!AllowSpaceInPath.empty()) + { + xout << " <AllowAllowSpaceInPath>" << AllowSpaceInPath + << "</AllowSpaceInPath>" << std::endl; + } + } + + // Control script (copy to config dir) + if(!IsVersionLess("2.0") && !ControlScript.empty()) + { + std::string name = cmSystemTools::GetFilenameName(ControlScript); + std::string path = Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data()); + xout << " <ControlScript>" << name << "</ControlScript>" << std::endl; + } xout << "</Installer>" << std::endl; } @@ -402,5 +532,10 @@ void cmCPackIFWInstaller::GeneratePackageFiles() { cmCPackIFWPackage* package = pit->second; package->GeneratePackageFile(); - } + } +} + +void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + if(Generator) Generator->WriteGeneratedByToStrim(xout); } diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 5824d33..4cba5b2 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,6 +13,7 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h +#include <cmGeneratedFileStream.h> #include <cmStandardIncludes.h> class cmCPackIFWPackage; @@ -69,17 +70,39 @@ public: // Configuration /// Filename for a logo std::string Logo; + /// Name of the default program group in the Windows Start menu + std::string StartMenuDir; + /// Default target directory for installation std::string TargetDir; /// Default target directory for installation with administrator rights std::string AdminTargetDir; + /// Filename of the generated maintenance tool + std::string MaintenanceToolName; + + /// Filename for the configuration of the generated maintenance tool + std::string MaintenanceToolIniFile; + + /// Set to true if the installation path can contain non-ASCII characters + std::string AllowNonAsciiCharacters; + + /// Set to false if the installation path cannot contain space characters + std::string AllowSpaceInPath; + + /// Filename for a custom installer control script + std::string ControlScript; + public: // Internal implementation const char* GetOption(const std::string& op) const; bool IsOn(const std::string& op) const; + bool IsVersionLess(const char *version); + bool IsVersionGreater(const char *version); + bool IsVersionEqual(const char *version); + void ConfigureFromOptions(); void GenerateInstallerFile(); @@ -90,6 +113,9 @@ public: // Internal implementation PackagesMap Packages; std::vector<RepositoryStruct> Repositories; std::string Directory; + +protected: + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); }; #endif // cmCPackIFWInstaller_h diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 38cef87..5474ad1b 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -132,6 +132,24 @@ bool cmCPackIFWPackage::IsOn(const std::string &op) const } //---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionLess(const char *version) +{ + return Generator ? Generator->IsVersionLess(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionGreater(const char *version) +{ + return Generator ? Generator->IsVersionGreater(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionEqual(const char *version) +{ + return Generator ? Generator->IsVersionEqual(version) : false; +} + +//---------------------------------------------------------------------------- std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent *component) { if (!component) return ""; @@ -432,6 +450,9 @@ void cmCPackIFWPackage::GeneratePackageFile() cmGeneratedFileStream xout((Directory + "/meta/package.xml").data()); xout << "<?xml version=\"1.0\"?>" << std::endl; + + WriteGeneratedByToStrim(xout); + xout << "<Package>" << std::endl; xout << " <DisplayName>" << DisplayName @@ -538,3 +559,8 @@ void cmCPackIFWPackage::GeneratePackageFile() xout << "</Package>" << std::endl; } + +void cmCPackIFWPackage::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + if(Generator) Generator->WriteGeneratedByToStrim(xout); +} diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 9fc9bd0..d2f7927 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -14,6 +14,7 @@ #define cmCPackIFWPackage_h #include <cmStandardIncludes.h> +#include <cmGeneratedFileStream.h> class cmCPackComponent; class cmCPackComponentGroup; @@ -107,6 +108,10 @@ public: // Internal implementation const char* GetOption(const std::string& op) const; bool IsOn(const std::string& op) const; + bool IsVersionLess(const char *version); + bool IsVersionGreater(const char *version); + bool IsVersionEqual(const char *version); + std::string GetComponentName(cmCPackComponent *component); void DefaultConfiguration(); @@ -128,6 +133,9 @@ public: // Internal implementation std::set<DependenceStruct*> AlienDependencies; // Patch to package directory std::string Directory; + +protected: + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); }; #endif // cmCPackIFWPackage_h diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e254e9a..6e30f8c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -715,7 +715,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..29484cf 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -201,7 +201,7 @@ int main (int argc, char const* const* argv) cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); - cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index de6ecde..d3edc80 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -752,7 +752,7 @@ void cmCTestLaunch::LoadConfig() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..7ee9d85 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -340,7 +340,7 @@ void cmCTestScriptHandler::CreateCMake() this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); - this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(); + this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(); this->Makefile = this->LocalGenerator->GetMakefile(); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 95cdf3b..5d40f91 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1573,7 +1573,7 @@ void cmCTestTestHandler::GetListOfTests() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/QtIFW/controlscript.qs b/Source/QtIFW/controlscript.qs new file mode 100644 index 0000000..d1a9b10 --- /dev/null +++ b/Source/QtIFW/controlscript.qs @@ -0,0 +1,6 @@ +// controlscript.qs - CMake installation control script + +function Controller() +{ + // do nothing now +} diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 5491611..570dba1 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -18,7 +18,7 @@ Component.prototype.createOperations = function() installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/uninstall.exe", - installer.value("StartMenuDir") + "/Uninstall.lnk"); + installer.value("TargetDir") + "/cmake-maintenance.exe", + installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 403a459..f3c4da5 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -512,7 +512,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index f54bc4d..e2c6876 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -18,32 +18,29 @@ cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal( - const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend) + const std::string& key, StackIter begin, StackIter end) { - assert(rbegin != rend); - MapType::const_iterator i = rbegin->Map.find(key); - if (i != rbegin->Map.end()) + assert(begin != end); + MapType::const_iterator i = begin->Map.find(key); + if (i != begin->Map.end()) { return i->second; } - std::list<cmDefinitions>::reverse_iterator rit = rbegin; - ++rit; - if (rit == rend) + StackIter it = begin; + ++it; + if (it == end) { return cmDefinitions::NoDef; } - Def const& def = cmDefinitions::GetInternal(key, rit, rend); - return rbegin->Map.insert(MapType::value_type(key, def)).first->second; + Def const& def = cmDefinitions::GetInternal(key, it, end); + return begin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- const char* cmDefinitions::Get(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend) + StackIter begin, StackIter end) { - Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); + Def const& def = cmDefinitions::GetInternal(key, begin, end); return def.Exists? def.c_str() : 0; } @@ -77,36 +74,24 @@ std::vector<std::string> cmDefinitions::LocalKeys() const } //---------------------------------------------------------------------------- -cmDefinitions cmDefinitions::MakeClosure( - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend) +cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin, + StackConstIter end) { - std::set<std::string> undefined; cmDefinitions closure; - closure.MakeClosure(undefined, rbegin, rend); - return closure; -} - -//---------------------------------------------------------------------------- -void -cmDefinitions::MakeClosure(std::set<std::string>& undefined, - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend) -{ - for (std::list<cmDefinitions>::const_reverse_iterator it = rbegin; - it != rend; ++it) + std::set<std::string> undefined; + for (StackConstIter it = begin; it != end; ++it) { // Consider local definitions. for(MapType::const_iterator mi = it->Map.begin(); mi != it->Map.end(); ++mi) { // Use this key if it is not already set or unset. - if(this->Map.find(mi->first) == this->Map.end() && + if(closure.Map.find(mi->first) == closure.Map.end() && undefined.find(mi->first) == undefined.end()) { if(mi->second.Exists) { - this->Map.insert(*mi); + closure.Map.insert(*mi); } else { @@ -115,22 +100,29 @@ cmDefinitions::MakeClosure(std::set<std::string>& undefined, } } } + return closure; } //---------------------------------------------------------------------------- std::vector<std::string> -cmDefinitions::ClosureKeys(std::set<std::string>& bound) const +cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end) { + std::set<std::string> bound; std::vector<std::string> defined; - defined.reserve(this->Map.size()); - for(MapType::const_iterator mi = this->Map.begin(); - mi != this->Map.end(); ++mi) + + for (StackConstIter it = begin; it != end; ++it) { - // Use this key if it is not already set or unset. - if(bound.insert(mi->first).second && mi->second.Exists) + defined.reserve(defined.size() + it->Map.size()); + for(MapType::const_iterator mi = it->Map.begin(); + mi != it->Map.end(); ++mi) { - defined.push_back(mi->first); + // Use this key if it is not already set or unset. + if(bound.insert(mi->first).second && mi->second.Exists) + { + defined.push_back(mi->first); + } } } + return defined; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index b244793..80643a9 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -28,12 +28,13 @@ */ class cmDefinitions { + typedef std::list<cmDefinitions>::reverse_iterator StackIter; + typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter; public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ static const char* Get(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend); + StackIter begin, StackIter end); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); @@ -43,12 +44,10 @@ public: /** Get the set of all local keys. */ std::vector<std::string> LocalKeys() const; - std::vector<std::string> - ClosureKeys(std::set<std::string>& bound) const; + static std::vector<std::string> ClosureKeys(StackConstIter begin, + StackConstIter end); - static cmDefinitions MakeClosure( - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend); + static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end); private: // String with existence boolean. @@ -74,11 +73,7 @@ private: MapType Map; static Def const& GetInternal(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend); - void MakeClosure(std::set<std::string>& undefined, - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend); + StackIter begin, StackIter end); }; #endif diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index d4da5a4..201465d 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -12,47 +12,44 @@ #ifndef cmExecutionStatus_h #define cmExecutionStatus_h -#include "cmObject.h" +#include "cmStandardIncludes.h" /** \class cmExecutionStatus * \brief Superclass for all command status classes * * when a command is involked it may set values on a command status instance */ -class cmExecutionStatus : public cmObject +class cmExecutionStatus { public: - cmTypeMacro(cmExecutionStatus, cmObject); + cmExecutionStatus() { this->Clear(); } - cmExecutionStatus() { this->Clear();} - - virtual void SetReturnInvoked(bool val) + void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } - virtual bool GetReturnInvoked() + bool GetReturnInvoked() { return this->ReturnInvoked; } - virtual void SetBreakInvoked(bool val) + void SetBreakInvoked(bool val) { this->BreakInvoked = val; } - virtual bool GetBreakInvoked() + bool GetBreakInvoked() { return this->BreakInvoked; } - virtual void SetContinueInvoked(bool val) + void SetContinueInvoked(bool val) { this->ContinueInvoked = val; } - virtual bool GetContinueInvoked() + bool GetContinueInvoked() { return this->ContinueInvoked; } - virtual void Clear() + void Clear() { this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; this->NestedError = false; } - virtual void SetNestedError(bool val) { this->NestedError = val; } - virtual bool GetNestedError() { return this->NestedError; } - + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } -protected: +private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index fdd1018..001adb1 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -94,8 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass } // we push a scope on the makefile - cmMakefile::LexicalPushPop lexScope(this->Makefile); cmMakefile::ScopePushPop varScope(this->Makefile); + cmMakefile::LexicalPushPop lexScope(this->Makefile); static_cast<void>(varScope); // Push a weak policy scope which restores the policies recorded at diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index d191056..0ee98a8 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -22,6 +22,10 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->ToolSupportsColor = true; this->UseLinkScript = false; this->WindowsShell = true; + this->IncludeDirective = "!include"; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; } @@ -43,11 +47,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIncludeDirective("!include"); - lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); return lg; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1c9c475..cf9e6e6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1099,7 +1099,7 @@ void cmGlobalGenerator::Configure() this->ClearGeneratorMembers(); // start with this directory - cmLocalGenerator *lg = this->CreateLocalGenerator(); + cmLocalGenerator *lg = this->MakeLocalGenerator(); this->LocalGenerators.push_back(lg); // set the Start directories @@ -1882,6 +1882,12 @@ void cmGlobalGenerator::EnableInstallTarget() } cmLocalGenerator * +cmGlobalGenerator::MakeLocalGenerator(cmLocalGenerator *parent) +{ + return this->CreateLocalGenerator(parent); +} + +cmLocalGenerator * cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent) { return new cmLocalGenerator(this, parent); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3b2a41f..c9bb9b4 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -52,8 +52,7 @@ public: cmGlobalGenerator(); virtual ~cmGlobalGenerator(); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); + cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } @@ -354,6 +353,7 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + std::string MakeSilentFlag; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; @@ -442,6 +442,9 @@ protected: virtual bool UseFolderProperty(); private: + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent); + cmMakefile* TryCompileOuterMakefile; float FirstTimeProgress; // If you add a new map here, make sure it is copied diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 25613eb..3ddbeb6 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -21,6 +21,10 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->UseLinkScript = false; this->WindowsShell = true; this->NMake = true; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; + this->MakeSilentFlag = "/nologo"; } void cmGlobalJOMMakefileGenerator @@ -46,20 +50,6 @@ void cmGlobalJOMMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("/nologo"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalJOMMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 4831309..fa596f6 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -36,9 +36,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index b6adcbb..fe3321e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -93,18 +93,6 @@ void cmGlobalMSYSMakefileGenerator } } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(true); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalMSYSMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 1795d86..4d5ee1e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -35,9 +35,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 5b92eeb..17a7301 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -58,18 +58,6 @@ void cmGlobalMinGWMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(true); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalMinGWMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 93f67be..5543d12 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 98d7fb4..6152b29 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -21,6 +21,10 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() this->UseLinkScript = false; this->WindowsShell = true; this->NMake = true; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; + this->MakeSilentFlag = "/nologo"; } void cmGlobalNMakeMakefileGenerator @@ -46,20 +50,6 @@ void cmGlobalNMakeMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("/nologo"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalNMakeMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index cb898ba..69e5084 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a4df493..a43a427 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -33,6 +33,11 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() this->UseLinkScript = true; #endif this->CommandDatabase = NULL; + + this->IncludeDirective = "include"; + this->DefineWindowsNULL = false; + this->PassMakeflags = false; + this->UnixCD = true; } void cmGlobalUnixMakefileGenerator3 @@ -580,7 +585,7 @@ void cmGlobalUnixMakefileGenerator3 else { lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->CreateLocalGenerator()); + (this->MakeLocalGenerator()); // set the Start directories lg->GetMakefile()->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 165a3c8..ac82287 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -132,6 +132,11 @@ public: virtual bool AllowDeleteOnError() const { return true; } virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + + std::string IncludeDirective; + bool DefineWindowsNULL; + bool PassMakeflags; + bool UnixCD; protected: void WriteMainMakefile2(); void WriteMainCMakefile(); diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 181178f..062091f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -26,6 +26,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() this->WindowsShell = true; #endif this->WatcomWMake = true; + this->IncludeDirective = "!include"; + this->DefineWindowsNULL = true; + this->UnixCD = false; + this->MakeSilentFlag = "-h"; } void cmGlobalWatcomWMakeGenerator @@ -44,21 +48,6 @@ void cmGlobalWatcomWMakeGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("-h"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(false); - lg->SetIncludeDirective("!include"); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalWatcomWMakeGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 3af2f9d..b733324 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 99542a9..7cad8a1 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -67,7 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cmake cm; cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 74362ae..29990af 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -62,7 +62,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); this->LinkScriptShell = false; - this->IgnoreLibPrefix = false; this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index fa2f712..c7deeb7 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -470,7 +470,6 @@ protected: bool LinkScriptShell; bool UseRelativePaths; - bool IgnoreLibPrefix; bool Configured; bool EmitUniversalBinaryFlags; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..696b043 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -83,12 +83,7 @@ cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->IncludeDirective = "include"; this->MakefileVariableSize = 0; - this->IgnoreLibPrefix = false; - this->PassMakeflags = false; - this->DefineWindowsNULL = false; - this->UnixCD = true; this->ColorMakefile = false; this->SkipPreprocessedSourceRules = false; this->SkipAssemblySourceRules = false; @@ -720,7 +715,9 @@ cmLocalUnixMakefileGenerator3 makefileStream << "# Set environment variables for the build.\n" << "\n"; - if(this->DefineWindowsNULL) + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); + if(gg->DefineWindowsNULL) { makefileStream << "!IF \"$(OS)\" == \"Windows_NT\"\n" @@ -2143,10 +2140,12 @@ cmLocalUnixMakefileGenerator3 cmd += this->Convert(makefile,NONE,SHELL); cmd += " "; + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); // Pass down verbosity level. - if(!this->GetMakeSilentFlag().empty()) + if(!gg->MakeSilentFlag.empty()) { - cmd += this->GetMakeSilentFlag(); + cmd += gg->MakeSilentFlag; cmd += " "; } @@ -2154,7 +2153,7 @@ cmLocalUnixMakefileGenerator3 // sub-invoked makes via an environment variable. However, some // makes do not support that, so you have to pass the flags // explicitly. - if(this->GetPassMakeflags()) + if(gg->PassMakeflags) { cmd += "-$(MAKEFLAGS) "; } @@ -2346,7 +2345,9 @@ void cmLocalUnixMakefileGenerator3 // support changing the drive letter with just "d:"). const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd "; - if(!this->UnixCD) + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); + if(!gg->UnixCD) { // On Windows we must perform each step separately and then change // back because the shell keeps the working directory between diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7b436a5..0b056ff 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -67,52 +67,11 @@ public: void WriteMakeVariables(std::ostream& makefileStream); /** - * If true, then explicitly pass MAKEFLAGS on the make all target for makes - * that do not use environment variables. - * - */ - void SetPassMakeflags(bool s){this->PassMakeflags = s;} - bool GetPassMakeflags() { return this->PassMakeflags; } - - /** - * Set the flag used to keep the make program silent. - */ - void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; } - std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } - - /** - * If set to true, then NULL is set to nil for non Windows_NT. - * This uses make syntax used by nmake and borland. - * The default is false. - */ - void SetDefineWindowsNULL(bool v) {this->DefineWindowsNULL = v;} - - /** - * If set to true, cd dir && command is used to - * run commands in a different directory. - */ - void SetUnixCD(bool v) {this->UnixCD = v;} - - /** - * Set the string used to include one makefile into another default - * is include. - */ - void SetIncludeDirective(const std::string& s) - { this->IncludeDirective = s; } - const std::string& GetIncludeDirective() { return this->IncludeDirective; } - - /** * Set max makefile variable size, default is 0 which means unlimited. */ void SetMakefileVariableSize(int s) { this->MakefileVariableSize = s; } /** - * If ignore lib prefix is true, then do not strip lib from the name - * of a library. - */ - void SetIgnoreLibPrefix(bool s) { this->IgnoreLibPrefix = s; } - - /** * Set whether passing a make target on a command line requires an * extra level of escapes. */ @@ -303,12 +262,7 @@ private: //========================================================================== // Configuration settings. int MakefileVariableSize; - std::string IncludeDirective; - std::string MakeSilentFlag; std::string ConfigurationName; - bool DefineWindowsNULL; - bool UnixCD; - bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; //========================================================================== diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b8d3af..99d22d6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -94,16 +94,8 @@ public: std::vector<std::string> ClosureKeys() const { - std::vector<std::string> closureKeys; - std::set<std::string> bound; - for (std::list<cmDefinitions>::const_reverse_iterator it = - this->VarStack.rbegin(); it != this->VarStack.rend(); ++it) - { - std::vector<std::string> const& localKeys = it->ClosureKeys(bound); - closureKeys.insert(closureKeys.end(), - localKeys.begin(), localKeys.end()); - } - return closureKeys; + return cmDefinitions::ClosureKeys(this->VarStack.rbegin(), + this->VarStack.rend()); } void PopDefinitions() @@ -1706,7 +1698,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->CreateLocalGenerator(this->LocalGenerator); + ->MakeLocalGenerator(this->LocalGenerator); this->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs @@ -3276,6 +3268,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) this->FunctionBlockerBarriers.back(); while(this->FunctionBlockers.size() > barrier) { + cmMakefile::LoopBlockPop loopBlockPop(this); cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if(reportError) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2ee23d1..9afe09c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -226,7 +226,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() dependFileNameFull += "/depend.make"; *this->BuildFileStream << "# Include any dependencies generated for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) @@ -237,7 +237,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the progress variables for the target. *this->BuildFileStream << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) @@ -270,7 +270,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the flags for the target. *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 617214f..25d929c 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -51,7 +51,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() // Include the progress variables for the target. *this->BuildFileStream << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index c446659..3e7989f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1212,7 +1212,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, cm->SetHomeOutputDirectory(targetDirectory); cm->SetHomeDirectory(targetDirectory); - cmLocalGenerator* lg = gg->CreateLocalGenerator(); + cmLocalGenerator* lg = gg->MakeLocalGenerator(); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg->SetCurrentLocalGenerator(lg); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..c5a98d5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -376,7 +376,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args, std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator()); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -418,7 +418,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) this->SetGlobalGenerator(gg); // read in the list file to fill the cache - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); @@ -1927,7 +1927,7 @@ int cmake::CheckBuildSystem() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -1957,7 +1957,7 @@ int cmake::CheckBuildSystem() ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { - cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator()); lgd->ClearDependencies(mf, verbose); } } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 12bb8ee..3400625 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -646,7 +646,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); - cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator()); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt new file mode 100644 index 0000000..f4ff709 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at FunctionUnmatchedForeach.cmake:[0-9]+ \(f\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake:[0-9]+ \(foreach\) + + is not closed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake new file mode 100644 index 0000000..ee9c184 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake @@ -0,0 +1,5 @@ +function(f) + foreach(i 1) + #endforeach() # missing +endfunction() +f() diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt new file mode 100644 index 0000000..820cd2e --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at MacroUnmatchedForeach.cmake:[0-9]+ \(m\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake:[0-9]+ \(foreach\) + + is not closed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake new file mode 100644 index 0000000..be443dd --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake @@ -0,0 +1,5 @@ +macro(m) + foreach(i 1) + #endforeach() # missing +endmacro() +m() diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index cecd338..c431280 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -108,3 +108,7 @@ run_cmake(CMP0053-NameWithNewlineQuoted) run_cmake(CMP0053-NameWithCarriageReturnQuoted) run_cmake(CMP0053-NameWithEscapedSpacesQuoted) run_cmake(CMP0053-NameWithEscapedTabsQuoted) + +# Function and macro tests. +run_cmake(FunctionUnmatchedForeach) +run_cmake(MacroUnmatchedForeach) |