summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/cmake_minimum_required.rst4
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0062.rst27
-rw-r--r--Help/release/dev/disallow-install-of-export.rst5
-rw-r--r--Modules/CPackDeb.cmake147
-rwxr-xr-xModules/Squish4RunTestCase.sh4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCoreTryCompile.cxx8
-rw-r--r--Source/cmCustomCommandGenerator.cxx31
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx5
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h2
-rw-r--r--Source/cmGlobalGenerator.cxx11
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx3
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx7
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx8
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx11
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmIfCommand.cxx9
-rw-r--r--Source/cmInstallCommand.cxx49
-rw-r--r--Source/cmLocalGenerator.cxx289
-rw-r--r--Source/cmLocalGenerator.h33
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmLocalGhsMultiGenerator.h2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx17
-rw-r--r--Source/cmLocalNinjaGenerator.h5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx33
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h33
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio10Generator.h3
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio6Generator.h3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio7Generator.h3
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx7
-rw-r--r--Source/cmLocalVisualStudioGenerator.h3
-rw-r--r--Source/cmLocalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalXCodeGenerator.h2
-rw-r--r--Source/cmMakefile.cxx61
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmPolicies.h3
-rw-r--r--Source/cmProjectCommand.cxx2
-rw-r--r--Source/cmState.cxx21
-rw-r--r--Source/cmState.h3
-rw-r--r--Source/cmTestGenerator.cxx16
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in12
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0041/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/IfacePaths/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/include_directories/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW-stderr.txt11
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW.cmake6
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD.cmake6
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-stderr.txt16
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN.cmake4
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake3
75 files changed, 662 insertions, 414 deletions
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/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index e59cce7..2cc3a47 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -119,3 +119,4 @@ All Policies
/policy/CMP0059
/policy/CMP0060
/policy/CMP0061
+ /policy/CMP0062
diff --git a/Help/policy/CMP0062.rst b/Help/policy/CMP0062.rst
new file mode 100644
index 0000000..e2f5a5a
--- /dev/null
+++ b/Help/policy/CMP0062.rst
@@ -0,0 +1,27 @@
+CMP0062
+-------
+
+Disallow install() of export() result.
+
+The :command:`export()` command generates a file containing
+:ref:`Imported Targets`, which is suitable for use from the build
+directory. It is not suitable for installation because it contains absolute
+paths to buildsystem locations, and is particular to a single build
+configuration.
+
+The :command:`install(EXPORT)` generates and installs files which contain
+:ref:`Imported Targets`. These files are generated with relative paths
+(unless the user specifies absolute paths), and are designed for
+multi-configuration use. See :ref:`Creating Packages` for more.
+
+CMake 3.3 no longer allows the use of the :command:`install(FILES)` command
+with the result of the :command:`export()` command.
+
+The ``OLD`` behavior for this policy is to allow installing the result of
+an :command:`export()` command. The ``NEW`` behavior for this policy is
+not to allow installing the result of an :command:`export()` command.
+
+This policy was introduced in CMake version 3.3. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior. Use
+the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW``
+explicitly.
diff --git a/Help/release/dev/disallow-install-of-export.rst b/Help/release/dev/disallow-install-of-export.rst
new file mode 100644
index 0000000..baee26d
--- /dev/null
+++ b/Help/release/dev/disallow-install-of-export.rst
@@ -0,0 +1,5 @@
+disallow-install-of-export
+--------------------------
+
+* Using the output of :command:`export()` with the :command:`install(FILES)`
+ command is no longer allowed. See policy :policy:`CMP0062` for details.
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/Squish4RunTestCase.sh b/Modules/Squish4RunTestCase.sh
index abd5deb..39a3907 100755
--- a/Modules/Squish4RunTestCase.sh
+++ b/Modules/Squish4RunTestCase.sh
@@ -11,11 +11,11 @@ SETTINGSGROUP=$7
$SQUISHSERVER --stop > /dev/null 2>&1
echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR"
-$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit -1
+$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit 255
# sleep 1
echo "Starting the squish server... $SQUISHSERVER --daemon"
-$SQUISHSERVER --daemon || exit -1
+$SQUISHSERVER --daemon || exit 255
# sleep 2
echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index bb3c25c..8f90e00 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 20150515)
+set(CMake_VERSION_PATCH 20150518)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 1109aca..dd276a8 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -242,8 +242,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
// Detect languages to enable.
- cmLocalGenerator* lg = this->Makefile->GetLocalGenerator();
- cmGlobalGenerator* gg = lg->GetGlobalGenerator();
+ cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
std::set<std::string> testLangs;
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
@@ -323,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
const char* flags = this->Makefile->GetDefinition(langFlags);
fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(),
- lg->EscapeForCMake(flags?flags:"").c_str());
+ cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str());
fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
@@ -356,7 +355,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* exeLinkFlags =
this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
- lg->EscapeForCMake(exeLinkFlags?exeLinkFlags:"").c_str());
+ cmLocalGenerator::EscapeForCMake(
+ exeLinkFlags ? exeLinkFlags : "").c_str());
} break;
}
fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}"
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 162d7a1..d23f815 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -51,6 +51,35 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
}
//----------------------------------------------------------------------------
+std::string escapeForShellOldStyle(const std::string& str)
+{
+ std::string result;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // if there are spaces
+ std::string temp = str;
+ if (temp.find(" ") != std::string::npos &&
+ temp.find("\"")==std::string::npos)
+ {
+ result = "\"";
+ result += str;
+ result += "\"";
+ return result;
+ }
+ return str;
+#else
+ for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
+ {
+ if(*ch == ' ')
+ {
+ result += '\\';
+ }
+ result += *ch;
+ }
+ return result;
+#endif
+}
+
+//----------------------------------------------------------------------------
void
cmCustomCommandGenerator
::AppendArguments(unsigned int c, std::string& cmd) const
@@ -63,7 +92,7 @@ cmCustomCommandGenerator
cmd += " ";
if(this->OldStyle)
{
- cmd += this->LG->EscapeForShellOldStyle(arg);
+ cmd += escapeForShellOldStyle(arg);
}
else
{
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 597e08e..d191056 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
+ this->WindowsShell = true;
}
@@ -41,13 +42,11 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(parent);
+ new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetIncludeDirective("!include");
- lg->SetWindowsShell(true);
lg->SetDefineWindowsNULL(true);
lg->SetMakefileVariableSize(32);
lg->SetPassMakeflags(true);
- lg->SetGlobalGenerator(this);
lg->SetUnixCD(false);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 3f79414..4f24d2d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -19,7 +19,7 @@
*
* cmGlobalBorlandMakefileGenerator manages nmake build process for a tree
*/
-class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
+class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalBorlandMakefileGenerator();
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 746be4d..1c9c475 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -71,6 +71,13 @@ cmGlobalGenerator::cmGlobalGenerator()
this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0;
this->TryCompileOuterMakefile = 0;
+
+ this->WindowsShell = false;
+ this->WindowsVSIDE = false;
+ this->WatcomWMake = false;
+ this->MinGWMake = false;
+ this->NMake = false;
+ this->MSYSShell = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
@@ -1877,9 +1884,7 @@ void cmGlobalGenerator::EnableInstallTarget()
cmLocalGenerator *
cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
{
- cmLocalGenerator *lg = new cmLocalGenerator(parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalGenerator(this, parent);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 22ba288..3b2a41f 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -354,6 +354,13 @@ public:
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif
+ bool WindowsShell;
+ bool WindowsVSIDE;
+ bool WatcomWMake;
+ bool MinGWMake;
+ bool NMake;
+ bool MSYSShell;
+
protected:
virtual void Generate();
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 181a517..d6bf75c 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -35,8 +35,7 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
cmLocalGenerator *
cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent);
- lg->SetGlobalGenerator(this);
+ cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(this, parent);
this->SetCurrentLocalGenerator(lg);
return lg;
}
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index cfa5072..25613eb 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -19,6 +19,8 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator()
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
+ this->WindowsShell = true;
+ this->NMake = true;
}
void cmGlobalJOMMakefileGenerator
@@ -49,14 +51,11 @@ cmLocalGenerator *
cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg
- = new cmLocalUnixMakefileGenerator3(parent);
+ = new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
- lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
- lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true);
- lg->SetNMake(true);
lg->SetUnixCD(false);
return lg;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index fa23491..b6adcbb 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -21,6 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
+ this->MSYSShell = true;
}
std::string
@@ -97,10 +98,7 @@ cmLocalGenerator *
cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(parent);
- lg->SetWindowsShell(false);
- lg->SetMSYSShell(true);
- lg->SetGlobalGenerator(this);
+ new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index b128870..5b92eeb 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -19,6 +19,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = true;
+ this->WindowsShell = true;
+ this->MinGWMake = true;
}
void cmGlobalMinGWMakefileGenerator
@@ -61,13 +63,10 @@ cmLocalGenerator *
cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(parent);
- lg->SetWindowsShell(true);
- lg->SetGlobalGenerator(this);
+ new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
- lg->SetMinGWMake(true);
return lg;
}
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index a3b3dd7..98d7fb4 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -19,6 +19,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
+ this->WindowsShell = true;
+ this->NMake = true;
}
void cmGlobalNMakeMakefileGenerator
@@ -49,14 +51,11 @@ cmLocalGenerator *
cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(parent);
+ new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
- lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
- lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true);
- lg->SetNMake(true);
lg->SetUnixCD(false);
return lg;
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 65e80e4..9a952a3 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -488,6 +488,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
, ComputingUnknownDependencies(false)
, PolicyCMP0058(cmPolicies::WARN)
{
+#ifdef _WIN32
+ this->WindowsShell = true;
+#endif
// // Ninja is not ported to non-Unix OS yet.
// this->ForceUnixPaths = true;
this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
@@ -500,9 +503,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
cmLocalGenerator*
cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalNinjaGenerator(this, parent);
}
void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 95998ae..a4df493 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -56,9 +56,7 @@ void cmGlobalUnixMakefileGenerator3
cmLocalGenerator *
cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalUnixMakefileGenerator3(this, parent);
}
//----------------------------------------------------------------------------
@@ -524,7 +522,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalUnixMakefileGenerator3* lg)
{
// Only subdirectories need these rules.
- if(!lg->GetParent())
+ if(lg->IsRootMakefile())
{
return;
}
@@ -1029,7 +1027,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// for the passed in makefile or if this is the top Makefile wripte out
// the targets
- if (lg2 == lg || !lg->GetParent())
+ if (lg2 == lg || lg->IsRootMakefile())
{
// for each target Generate the rule files for each target.
cmTargets& targets = lg2->GetMakefile()->GetTargets();
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6481ec2..04bb6ce 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -311,11 +311,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalVisualStudio10Generator* lg =
- new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10,
- parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalVisualStudio10Generator(
+ cmLocalVisualStudioGenerator::VS10, this, parent);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 45d6d95..36ae0a4 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -240,11 +240,8 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalVisualStudio10Generator* lg =
- new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11,
- parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalVisualStudio10Generator(
+ cmLocalVisualStudioGenerator::VS11, this, parent);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index e298b06..17b2fc7 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -220,11 +220,8 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalVisualStudio10Generator* lg =
- new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12,
- parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalVisualStudio10Generator(
+ cmLocalVisualStudioGenerator::VS12, this, parent);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 6642d88..90fcc7e 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -131,9 +131,6 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *
cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalVisualStudio10Generator* lg =
- new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14,
- parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalVisualStudio10Generator(
+ cmLocalVisualStudioGenerator::VS14, this, parent);
}
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 55e70b3..570314e 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,9 +173,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
cmLocalGenerator *
cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalVisualStudio6Generator(this, parent);
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index db34d44..308e858 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -30,9 +30,8 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71,
- parent);
+ this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
- lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index ead5ddc..a2faddd 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -255,9 +255,8 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7,
- parent);
+ this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
- lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7174f21..ff9ff10 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -130,9 +130,8 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8,
- parent);
+ this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
- lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 0303c27..8adde23 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -119,9 +119,8 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9,
- parent);
+ this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
- lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 60d545b..b74ba6f 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -23,6 +23,8 @@
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
{
+ this->WindowsShell = true;
+ this->WindowsVSIDE = true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 77c6474..181178f 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -22,6 +22,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
this->ToolSupportsColor = true;
this->NeedSymbolicMark = true;
this->EmptyRuleHackCommand = "@cd .";
+#ifdef _WIN32
+ this->WindowsShell = true;
+#endif
+ this->WatcomWMake = true;
}
void cmGlobalWatcomWMakeGenerator
@@ -45,14 +49,9 @@ cmLocalGenerator *
cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
cmLocalUnixMakefileGenerator3* lg
- = new cmLocalUnixMakefileGenerator3(parent);
+ = new cmLocalUnixMakefileGenerator3(this, parent);
lg->SetDefineWindowsNULL(true);
-#ifdef _WIN32
- lg->SetWindowsShell(true);
-#endif
- lg->SetWatcomWMake(true);
lg->SetMakeSilentFlag("-h");
- lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(false);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 742750c..4a7411c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,9 +371,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
cmLocalGenerator *
cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
{
- cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent);
- lg->SetGlobalGenerator(this);
- return lg;
+ return new cmLocalXCodeGenerator(this, parent);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 6dea5c1..3551f83 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -20,15 +20,14 @@
static std::string cmIfCommandError(
- cmMakefile* mf, std::vector<cmExpandedCommandArgument> const& args)
+ std::vector<cmExpandedCommandArgument> const& args)
{
- cmLocalGenerator* lg = mf->GetLocalGenerator();
std::string err = "given arguments:\n ";
for(std::vector<cmExpandedCommandArgument>::const_iterator i = args.begin();
i != args.end(); ++i)
{
err += " ";
- err += lg->EscapeForCMake(i->GetValue());
+ err += cmLocalGenerator::EscapeForCMake(i->GetValue());
}
err += "\n";
return err;
@@ -118,7 +117,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
if (!errorString.empty())
{
- std::string err = cmIfCommandError(&mf, expandedArguments);
+ std::string err = cmIfCommandError(expandedArguments);
err += errorString;
mf.IssueMessage(messType, err);
if (messType == cmake::FATAL_ERROR)
@@ -206,7 +205,7 @@ bool cmIfCommand
if (!errorString.empty())
{
- std::string err = cmIfCommandError(this->Makefile, expandedArguments);
+ std::string err = cmIfCommandError(expandedArguments);
err += errorString;
if (status == cmake::FATAL_ERROR)
{
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 78603c8..899b088 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -848,13 +848,15 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
return false;
}
+ const std::vector<std::string>& filesVector = files.GetVector();
+
// Check if there is something to do.
- if(files.GetVector().empty())
+ if(filesVector.empty())
{
return true;
}
- if(!ica.GetRename().empty() && files.GetVector().size() > 1)
+ if(!ica.GetRename().empty() && filesVector.size() > 1)
{
// The rename option works only with one file.
std::ostringstream e;
@@ -864,11 +866,52 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
}
std::vector<std::string> absFiles;
- if (!this->MakeFilesFullPath(args[0].c_str(), files.GetVector(), absFiles))
+ if (!this->MakeFilesFullPath(args[0].c_str(), filesVector, absFiles))
{
return false;
}
+ cmPolicies::PolicyStatus status =
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0062);
+
+ cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
+ for(std::vector<std::string>::const_iterator fileIt = filesVector.begin();
+ fileIt != filesVector.end(); ++fileIt)
+ {
+ if (gg->IsExportedTargetsFile(*fileIt))
+ {
+ const char *modal = 0;
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+
+ switch(status)
+ {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ modal = "may";
+ messageType = cmake::FATAL_ERROR;
+ }
+ if (modal)
+ {
+ e << "The file\n " << *fileIt << "\nwas generated by the export() "
+ "command. It " << modal << " not be installed with the "
+ "install() command. Use the install(EXPORT) mechanism "
+ "instead. See the cmake-packages(7) manual for more.\n";
+ this->Makefile->IssueMessage(messageType, e.str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+ }
+ }
+
if (!ica.Finalize())
{
return false;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 88c88cd..74362ae 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,20 +43,24 @@
#include <StorageDefs.h>
#endif
-cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent)
+cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent)
{
- this->Makefile = 0; // moved to after set on global
+ this->GlobalGenerator = gg;
this->Parent = parent;
if (parent)
{
parent->AddChild(this);
+ this->StateSnapshot =
+ this->GetState()->CreateSnapshot(parent->StateSnapshot);
+ }
+ else
+ {
+ this->StateSnapshot =
+ this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState()));
}
- this->WindowsShell = false;
- this->WindowsVSIDE = false;
- this->WatcomWMake = false;
- this->MinGWMake = false;
- this->NMake = false;
- this->MSYSShell = false;
+ this->Makefile = new cmMakefile(this);
+
this->LinkScriptShell = false;
this->IgnoreLibPrefix = false;
this->UseRelativePaths = false;
@@ -73,6 +77,11 @@ cmLocalGenerator::~cmLocalGenerator()
delete this->Makefile;
}
+bool cmLocalGenerator::IsRootMakefile() const
+{
+ return !this->GetParent();
+}
+
//----------------------------------------------------------------------------
class cmLocalGeneratorCurrent
{
@@ -105,7 +114,7 @@ void cmLocalGenerator::Configure()
static_cast<void>(clg);
// make sure the CMakeFiles dir is there
- std::string filesDir = this->Makefile->GetCurrentBinaryDirectory();
+ std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
filesDir += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(filesDir.c_str());
@@ -181,48 +190,10 @@ void cmLocalGenerator::ComputeObjectMaxPath()
void cmLocalGenerator::ReadInputFile()
{
// Look for the CMakeLists.txt file.
- std::string currentStart = this->Makefile->GetCurrentSourceDirectory();
+ std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
currentStart += "/CMakeLists.txt";
- if(cmSystemTools::FileExists(currentStart.c_str(), true))
- {
- this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
- return;
- }
-
- if(!this->Parent)
- {
- return;
- }
-
- // The file is missing. Check policy CMP0014.
- cmMakefile* mf = this->Parent->GetMakefile();
- std::ostringstream e;
- e << "The source directory\n"
- << " " << this->Makefile->GetCurrentSourceDirectory() << "\n"
- << "does not contain a CMakeLists.txt file.";
- switch (mf->GetPolicyStatus(cmPolicies::CMP0014))
- {
- case cmPolicies::WARN:
- // Print the warning.
- e << "\n"
- << "CMake does not support this case but it used "
- << "to work accidentally and is being allowed for "
- << "compatibility."
- << "\n"
- << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
- mf->IssueMessage(cmake::AUTHOR_WARNING, e.str());
- case cmPolicies::OLD:
- // OLD behavior does not warn.
- return;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- e << "\n"
- << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014);
- case cmPolicies::NEW:
- // NEW behavior prints the error.
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
- break;
- }
+ assert(cmSystemTools::FileExists(currentStart.c_str(), true));
+ this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
}
void cmLocalGenerator::SetupPathConversions()
@@ -231,31 +202,23 @@ void cmLocalGenerator::SetupPathConversions()
// Convert
std::string outdir;
outdir =
- cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory());
+ cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory());
cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents);
- outdir =
- cmSystemTools::CollapseFullPath(
- this->Makefile->GetCurrentSourceDirectory());
+ outdir = cmSystemTools::CollapseFullPath(
+ this->StateSnapshot.GetCurrentSourceDirectory());
cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents);
outdir = cmSystemTools::CollapseFullPath
- (this->Makefile->GetHomeOutputDirectory());
+ (this->GetState()->GetBinaryDirectory());
cmSystemTools::SplitPath(outdir,
this->HomeOutputDirectoryComponents);
outdir = cmSystemTools::CollapseFullPath
- (this->Makefile->GetCurrentBinaryDirectory());
+ (this->StateSnapshot.GetCurrentBinaryDirectory());
cmSystemTools::SplitPath(outdir,
this->StartOutputDirectoryComponents);
}
-
-void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
-{
- this->GlobalGenerator = gg;
- this->Makefile = new cmMakefile(this);
-}
-
void cmLocalGenerator::ConfigureFinalPass()
{
this->Makefile->ConfigureFinalPass();
@@ -300,7 +263,7 @@ void cmLocalGenerator::GenerateTestFiles()
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
- std::string file = this->Makefile->GetCurrentBinaryDirectory();
+ std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
file += "/";
file += "CTestTestfile.cmake";
@@ -309,9 +272,9 @@ void cmLocalGenerator::GenerateTestFiles()
fout << "# CMake generated Testfile for " << std::endl
<< "# Source directory: "
- << this->Makefile->GetCurrentSourceDirectory() << std::endl
+ << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl
<< "# Build directory: "
- << this->Makefile->GetCurrentBinaryDirectory() << std::endl
+ << this->StateSnapshot.GetCurrentBinaryDirectory() << std::endl
<< "# " << std::endl
<< "# This file includes the relevant testing commands "
<< "required for " << std::endl
@@ -425,9 +388,9 @@ void cmLocalGenerator::GenerateInstallRules()
}
// Create the install script file.
- std::string file = this->Makefile->GetCurrentBinaryDirectory();
- std::string homedir = this->Makefile->GetHomeOutputDirectory();
- std::string currdir = this->Makefile->GetCurrentBinaryDirectory();
+ std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
+ std::string homedir = this->GetState()->GetBinaryDirectory();
+ std::string currdir = this->StateSnapshot.GetCurrentBinaryDirectory();
cmSystemTools::ConvertToUnixSlashes(file);
cmSystemTools::ConvertToUnixSlashes(homedir);
cmSystemTools::ConvertToUnixSlashes(currdir);
@@ -442,7 +405,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Write the header.
fout << "# Install script for directory: "
- << this->Makefile->GetCurrentSourceDirectory()
+ << this->StateSnapshot.GetCurrentSourceDirectory()
<< std::endl << std::endl;
fout << "# Set the install prefix" << std::endl
<< "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
@@ -577,6 +540,16 @@ void cmLocalGenerator::GenerateTargetManifest()
}
}
+cmState* cmLocalGenerator::GetState() const
+{
+ return this->GlobalGenerator->GetCMakeInstance()->GetState();
+}
+
+cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
+{
+ return this->StateSnapshot;
+}
+
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const std::string& lang,
cmSourceFile& source,
@@ -651,7 +624,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
source.GetFullPath(),
commandLines,
comment.c_str(),
- this->Makefile->GetCurrentBinaryDirectory()
+ this->StateSnapshot.GetCurrentBinaryDirectory()
);
}
@@ -673,12 +646,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
!sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
{
std::string dir_max;
- dir_max += this->Makefile->GetCurrentBinaryDirectory();
+ dir_max += this->StateSnapshot.GetCurrentBinaryDirectory();
dir_max += "/";
std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
if(!obj.empty())
{
- std::string ofname = this->Makefile->GetCurrentBinaryDirectory();
+ std::string ofname = this->StateSnapshot.GetCurrentBinaryDirectory();
ofname += "/";
ofname += obj;
objVector.push_back(ofname);
@@ -748,7 +721,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
"",
commandLines,
comment.c_str(),
- this->Makefile->GetCurrentBinaryDirectory()
+ this->StateSnapshot.GetCurrentBinaryDirectory()
);
this->Makefile->GetSource(targetFullPath);
target.Target->AddSource(targetFullPath);
@@ -1242,7 +1215,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
// If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a
// space.
- if(this->WindowsShell && result.find(' ') != result.npos &&
+ if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos &&
cmSystemTools::FileExists(remote.c_str()))
{
std::string tmp;
@@ -1552,19 +1525,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
if(includeBinaryDir)
{
if(emitted.find(
- this->Makefile->GetCurrentBinaryDirectory()) == emitted.end())
+ this->StateSnapshot.GetCurrentBinaryDirectory()) == emitted.end())
{
- dirs.push_back(this->Makefile->GetCurrentBinaryDirectory());
- emitted.insert(this->Makefile->GetCurrentBinaryDirectory());
+ dirs.push_back(this->StateSnapshot.GetCurrentBinaryDirectory());
+ emitted.insert(this->StateSnapshot.GetCurrentBinaryDirectory());
}
}
if(includeSourceDir)
{
if(emitted.find(
- this->Makefile->GetCurrentSourceDirectory()) == emitted.end())
+ this->StateSnapshot.GetCurrentSourceDirectory()) == emitted.end())
{
- dirs.push_back(this->Makefile->GetCurrentSourceDirectory());
- emitted.insert(this->Makefile->GetCurrentSourceDirectory());
+ dirs.push_back(this->StateSnapshot.GetCurrentSourceDirectory());
+ emitted.insert(this->StateSnapshot.GetCurrentSourceDirectory());
}
}
@@ -1606,8 +1579,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// it is requested by the project.
if(this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"))
{
- const char* topSourceDir = this->Makefile->GetHomeDirectory();
- const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
+ const char* topSourceDir = this->GetState()->GetSourceDirectory();
+ const char* topBinaryDir = this->GetState()->GetBinaryDirectory();
for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
@@ -2165,7 +2138,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// Treat the name as relative to the source directory in which it
// was given.
- dep = this->Makefile->GetCurrentSourceDirectory();
+ dep = this->StateSnapshot.GetCurrentSourceDirectory();
dep += "/";
dep += inName;
return true;
@@ -2614,7 +2587,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
{
// Append the definition with proper escaping.
std::string def = dflag;
- if(this->WatcomWMake)
+ if(this->GlobalGenerator->WatcomWMake)
{
// The Watcom compiler does its own command line parsing instead
// of using the windows shell rules. Definitions are one of
@@ -2717,10 +2690,10 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
{
switch (relroot)
{
- case HOME: return this->Makefile->GetHomeDirectory();
- case START: return this->Makefile->GetCurrentSourceDirectory();
- case HOME_OUTPUT: return this->Makefile->GetHomeOutputDirectory();
- case START_OUTPUT: return this->Makefile->GetCurrentBinaryDirectory();
+ case HOME: return this->GetState()->GetSourceDirectory();
+ case START: return this->StateSnapshot.GetCurrentSourceDirectory();
+ case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory();
+ case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory();
default: break;
}
return 0;
@@ -2793,7 +2766,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
// For the MSYS shell convert drive letters to posix paths, so
// that c:/some/path becomes /c/some/path. This is needed to
// avoid problems with the shell path translation.
- if(this->MSYSShell && !this->LinkScriptShell)
+ if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell)
{
if(result.size() > 2 && result[1] == ':')
{
@@ -2801,7 +2774,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
result[0] = '/';
}
}
- if(this->WindowsShell)
+ if(this->GlobalGenerator->WindowsShell)
{
std::replace(result.begin(), result.end(), '/', '\\');
}
@@ -2841,41 +2814,69 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
//----------------------------------------------------------------------------
std::string cmLocalGenerator::FindRelativePathTopSource()
{
- // Relative path conversion within a single tree managed by CMake is
- // safe. We can use our parent relative path top if and only if
- // this is a subdirectory of that top.
- if(cmLocalGenerator* parent = this->GetParent())
+ cmState::Snapshot snapshot = this->StateSnapshot;
+ std::vector<cmState::Snapshot> snapshots;
+ snapshots.push_back(snapshot);
+ while (true)
{
- std::string parentTop = parent->FindRelativePathTopSource();
- if(cmSystemTools::IsSubDirectory(
- this->Makefile->GetCurrentSourceDirectory(), parentTop))
+ snapshot = snapshot.GetParent();
+ if (snapshot.IsValid())
+ {
+ snapshots.push_back(snapshot);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ std::string result = snapshots.front().GetCurrentSourceDirectory();
+
+ for (std::vector<cmState::Snapshot>::const_iterator it =
+ snapshots.begin() + 1; it != snapshots.end(); ++it)
+ {
+ std::string currentSource = it->GetCurrentSourceDirectory();
+ if(cmSystemTools::IsSubDirectory(result, currentSource))
{
- return parentTop;
+ result = currentSource;
}
}
- // Otherwise this directory itself is the new top.
- return this->Makefile->GetCurrentSourceDirectory();
+ return result;
}
//----------------------------------------------------------------------------
std::string cmLocalGenerator::FindRelativePathTopBinary()
{
- // Relative path conversion within a single tree managed by CMake is
- // safe. We can use our parent relative path top if and only if
- // this is a subdirectory of that top.
- if(cmLocalGenerator* parent = this->GetParent())
+ cmState::Snapshot snapshot = this->StateSnapshot;
+ std::vector<cmState::Snapshot> snapshots;
+ snapshots.push_back(snapshot);
+ while (true)
{
- std::string parentTop = parent->FindRelativePathTopBinary();
- if(cmSystemTools::IsSubDirectory(
- this->Makefile->GetCurrentBinaryDirectory(), parentTop))
+ snapshot = snapshot.GetParent();
+ if (snapshot.IsValid())
+ {
+ snapshots.push_back(snapshot);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ std::string result = snapshots.front().GetCurrentBinaryDirectory();
+
+ for (std::vector<cmState::Snapshot>::const_iterator it =
+ snapshots.begin() + 1; it != snapshots.end(); ++it)
+ {
+ std::string currentBinary = it->GetCurrentBinaryDirectory();
+ if(cmSystemTools::IsSubDirectory(result, currentBinary))
{
- return parentTop;
+ result = currentBinary;
}
}
- // Otherwise this directory itself is the new top.
- return this->Makefile->GetCurrentBinaryDirectory();
+ return result;
}
//----------------------------------------------------------------------------
@@ -3284,6 +3285,31 @@ void cmLocalGenerator::ComputeObjectFilenames(
}
+bool cmLocalGenerator::IsWindowsShell() const
+{
+ return this->GlobalGenerator->WindowsShell;
+}
+
+bool cmLocalGenerator::IsWatcomWMake() const
+{
+ return this->GlobalGenerator->WatcomWMake;
+}
+
+bool cmLocalGenerator::IsMinGWMake() const
+{
+ return this->GlobalGenerator->MinGWMake;
+}
+
+bool cmLocalGenerator::IsNMake() const
+{
+ return this->GlobalGenerator->NMake;
+}
+
+void cmLocalGenerator::SetConfiguredCMP0014(bool configured)
+{
+ this->Configured = configured;
+}
+
//----------------------------------------------------------------------------
std::string
cmLocalGenerator
@@ -3392,35 +3418,6 @@ cmLocalGenerator
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str)
-{
- std::string result;
-#if defined(_WIN32) && !defined(__CYGWIN__)
- // if there are spaces
- std::string temp = str;
- if (temp.find(" ") != std::string::npos &&
- temp.find("\"")==std::string::npos)
- {
- result = "\"";
- result += str;
- result += "\"";
- return result;
- }
- return str;
-#else
- for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
- {
- if(*ch == ' ')
- {
- result += '\\';
- }
- result += *ch;
- }
- return result;
-#endif
-}
-
-//----------------------------------------------------------------------------
static bool cmLocalGeneratorIsShellOperator(const std::string& str)
{
static std::set<std::string> shellOperators;
@@ -3456,7 +3453,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
// Compute the flags for the target shell environment.
int flags = 0;
- if(this->WindowsVSIDE)
+ if(this->GlobalGenerator->WindowsVSIDE)
{
flags |= cmsysSystem_Shell_Flag_VSIDE;
}
@@ -3476,27 +3473,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
{
flags |= cmsysSystem_Shell_Flag_WatcomQuote;
}
- if(this->WatcomWMake)
+ if(this->GlobalGenerator->WatcomWMake)
{
flags |= cmsysSystem_Shell_Flag_WatcomWMake;
}
- if(this->MinGWMake)
+ if(this->GlobalGenerator->MinGWMake)
{
flags |= cmsysSystem_Shell_Flag_MinGWMake;
}
- if(this->NMake)
+ if(this->GlobalGenerator->NMake)
{
flags |= cmsysSystem_Shell_Flag_NMake;
}
// Compute the buffer size needed.
- int size = (this->WindowsShell ?
+ int size = (this->GlobalGenerator->WindowsShell ?
cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
// Compute the shell argument itself.
std::vector<char> arg(size);
- if(this->WindowsShell)
+ if(this->GlobalGenerator->WindowsShell)
{
cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index befddbf..fa2f712 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -13,6 +13,7 @@
#define cmLocalGenerator_h
#include "cmStandardIncludes.h"
+#include "cmState.h"
class cmMakefile;
class cmGlobalGenerator;
@@ -33,9 +34,12 @@ class cmCustomCommandGenerator;
class cmLocalGenerator
{
public:
- cmLocalGenerator(cmLocalGenerator* parent);
+ cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalGenerator();
+ /// @return whether we are processing the top CMakeLists.txt file.
+ bool IsRootMakefile() const;
+
/**
* Generate the makefile for this directory.
*/
@@ -88,8 +92,8 @@ public:
const cmGlobalGenerator *GetGlobalGenerator() const {
return this->GlobalGenerator; }
- ///! Set the Global Generator, done on creation by the GlobalGenerator
- void SetGlobalGenerator(cmGlobalGenerator *gg);
+ cmState* GetState() const;
+ cmState::Snapshot GetStateSnapshot() const;
/**
* Convert something to something else. This is a centralized conversion
@@ -298,9 +302,6 @@ public:
bool forEcho = false,
bool useWatcomQuote = false);
- /** Backwards-compatibility version of EscapeForShell. */
- std::string EscapeForShellOldStyle(const std::string& str);
-
/** Escape the given string as an argument in a CMake script. */
static std::string EscapeForCMake(const std::string& str);
@@ -385,6 +386,13 @@ public:
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = 0);
+ bool IsWindowsShell() const;
+ bool IsWatcomWMake() const;
+ bool IsMinGWMake() const;
+ bool IsNMake() const;
+
+ void SetConfiguredCMP0014(bool configured);
+
protected:
///! put all the libraries for a target on into the given stream
virtual void OutputLinkLibraries(std::string& linkLibraries,
@@ -448,10 +456,8 @@ protected:
void ReadInputFile();
cmMakefile *Makefile;
+ cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
- // members used for relative path function ConvertToMakefilePath
- std::string RelativePathToSourceDir;
- std::string RelativePathToBinaryDir;
std::vector<std::string> HomeDirectoryComponents;
std::vector<std::string> StartDirectoryComponents;
std::vector<std::string> HomeOutputDirectoryComponents;
@@ -461,18 +467,13 @@ protected:
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
- bool WindowsShell;
- bool WindowsVSIDE;
- bool WatcomWMake;
- bool MinGWMake;
- bool NMake;
- bool ForceUnixPath;
- bool MSYSShell;
+
bool LinkScriptShell;
bool UseRelativePaths;
bool IgnoreLibPrefix;
bool Configured;
bool EmitUniversalBinaryFlags;
+
// Hack for ExpandRuleVariable until object-oriented version is
// committed.
std::string TargetImplib;
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index fa2a1a5..ddef3f5 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -16,8 +16,9 @@
#include "cmGhsMultiTargetGenerator.h"
#include "cmGeneratedFileStream.h"
-cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent)
- : cmLocalGenerator(parent)
+cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent)
+ : cmLocalGenerator(gg, parent)
{
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index 7afef56..ec25cba 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,7 +25,7 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
- cmLocalGhsMultiGenerator(cmLocalGenerator* parent);
+ cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalGhsMultiGenerator();
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 4e817a0..f1f1202 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -22,14 +22,12 @@
#include <assert.h>
-cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent)
- : cmLocalGenerator(parent)
+cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent)
+ : cmLocalGenerator(gg, parent)
, ConfigName("")
, HomeRelativeOutputPath("")
{
-#ifdef _WIN32
- this->WindowsShell = true;
-#endif
this->TargetImplib = "$TARGET_IMPLIB";
}
@@ -50,7 +48,7 @@ void cmLocalNinjaGenerator::Generate()
#endif
// We do that only once for the top CMakeLists.txt file.
- if(this->isRootMakefile())
+ if(this->IsRootMakefile())
{
this->WriteBuildFileTop();
@@ -181,11 +179,6 @@ cmake* cmLocalNinjaGenerator::GetCMakeInstance()
return this->GetGlobalGenerator()->GetCMakeInstance();
}
-bool cmLocalNinjaGenerator::isRootMakefile() const
-{
- return !this->GetParent();
-}
-
void cmLocalNinjaGenerator::WriteBuildFileTop()
{
// For the build file.
@@ -314,7 +307,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
<< "# Write statements declared in CMakeLists.txt:" << std::endl
<< "# " << this->Makefile->GetCurrentListFile() << std::endl
;
- if(this->isRootMakefile())
+ if(this->IsRootMakefile())
os << "# Which is the root file." << std::endl;
cmGlobalNinjaGenerator::WriteDivider(os);
os << std::endl;
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index d72677b..3a6e030 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator
{
public:
/// Default constructor.
- cmLocalNinjaGenerator(cmLocalGenerator* parent);
+ cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
/// Destructor.
virtual ~cmLocalNinjaGenerator();
@@ -59,9 +59,6 @@ public:
std::string const& GetConfigName() const
{ return this->ConfigName; }
- /// @return whether we are processing the top CMakeLists.txt file.
- bool isRootMakefile() const;
-
/// @returns the relative path between the HomeOutputDirectory and this
/// local generators StartOutputDirectory.
std::string GetHomeRelativeOutputPath() const
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index bf6fb61..f11c79e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,10 +80,9 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent)
- : cmLocalGenerator(parent)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
+ : cmLocalGenerator(gg, parent)
{
- this->WindowsShell = false;
this->IncludeDirective = "include";
this->MakefileVariableSize = 0;
this->IgnoreLibPrefix = false;
@@ -679,7 +678,7 @@ cmLocalUnixMakefileGenerator3
// Write the list of commands.
os << cmWrap("\t", commands, "", "\n") << "\n";
- if(symbolic && !this->WatcomWMake)
+ if(symbolic && !this->IsWatcomWMake())
{
os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
}
@@ -696,7 +695,7 @@ std::string
cmLocalUnixMakefileGenerator3
::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
{
- if(this->WatcomWMake &&
+ if(this->IsWatcomWMake() &&
cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos)
{
@@ -730,7 +729,7 @@ cmLocalUnixMakefileGenerator3
<< "NULL=nul\n"
<< "!ENDIF\n";
}
- if(this->WindowsShell)
+ if(this->IsWindowsShell())
{
makefileStream
<< "SHELL = cmd.exe\n"
@@ -798,7 +797,8 @@ cmLocalUnixMakefileGenerator3
makefileStream, "Disable implicit rules so canonical targets will work.",
".SUFFIXES", no_depends, no_commands, false);
- if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack)
+ if(!this->IsNMake()
+ && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack)
{
// turn off RCS and SCCS automatic stuff from gmake
makefileStream
@@ -810,7 +810,7 @@ cmLocalUnixMakefileGenerator3
depends.push_back(".hpux_make_needs_suffix_list");
this->WriteMakeRule(makefileStream, 0,
".SUFFIXES", depends, no_commands, false);
- if(this->WatcomWMake)
+ if(this->IsWatcomWMake())
{
// Switch on WMake feature, if an error or interrupt occurs during
// makefile processing, the current target being made may be deleted
@@ -828,7 +828,7 @@ cmLocalUnixMakefileGenerator3
<< "VERBOSE = 1\n"
<< "\n";
}
- if(this->WatcomWMake)
+ if(this->IsWatcomWMake())
{
makefileStream <<
"!ifndef VERBOSE\n"
@@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
const std::string& newFlags)
{
- if(this->WatcomWMake && !newFlags.empty())
+ if(this->IsWatcomWMake() && !newFlags.empty())
{
std::string newf = newFlags;
if(newf.find("\\\"") != newf.npos)
@@ -1112,7 +1112,7 @@ cmLocalUnixMakefileGenerator3
//
bool useCall = false;
- if (this->WindowsShell)
+ if (this->IsWindowsShell())
{
std::string suffix;
if (cmd.size() > 4)
@@ -1179,7 +1179,7 @@ cmLocalUnixMakefileGenerator3
{
cmd = "call " + cmd;
}
- else if (this->NMake && cmd[0]=='"')
+ else if (this->IsNMake() && cmd[0]=='"')
{
cmd = "echo >nul && " + cmd;
}
@@ -1261,7 +1261,7 @@ cmLocalUnixMakefileGenerator3
f != files.end(); ++f)
{
std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
- fout << " " << this->EscapeForCMake(fc) << "\n";
+ fout << " " << cmLocalGenerator::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
@@ -2060,7 +2060,7 @@ void cmLocalUnixMakefileGenerator3
di != defines.end(); ++di)
{
cmakefileStream
- << " " << this->EscapeForCMake(*di) << "\n";
+ << " " << cmLocalGenerator::EscapeForCMake(*di) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2113,7 +2113,8 @@ void cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator tri = transformRules.begin();
tri != transformRules.end(); ++tri)
{
- cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n";
+ cmakefileStream << " "
+ << cmLocalGenerator::EscapeForCMake(*tri) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2343,7 +2344,7 @@ void cmLocalUnixMakefileGenerator3
// used by NMake and Borland make does not support "cd /d" so this
// feature simply cannot work with them (Borland make does not even
// support changing the drive letter with just "d:").
- const char* cd_cmd = this->MinGWMake? "cd /d " : "cd ";
+ const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd ";
if(!this->UnixCD)
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index aee22ec..7b436a5 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,7 +34,8 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
{
public:
- cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent);
+ cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent);
virtual ~cmLocalUnixMakefileGenerator3();
/**
@@ -80,36 +81,6 @@ public:
std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
/**
- * Set to true if the shell being used is the windows shell.
- * This controls if statements in the makefile and the SHELL variable.
- * The default is false.
- */
- void SetWindowsShell(bool v) {this->WindowsShell = v;}
-
- /**
- * Set to true if the make tool being used is Watcom WMake.
- */
- void SetWatcomWMake(bool v) {this->WatcomWMake = v;}
-
- /**
- * Set to true if the make tool being used is MinGW Make.
- */
- void SetMinGWMake(bool v) {this->MinGWMake = v;}
- bool IsMinGWMake() const { return this->MinGWMake; }
-
- /**
- * Set to true if the make tool being used is NMake.
- */
- void SetNMake(bool v) {this->NMake = v;}
-
- /**
- * Set to true if the shell being used is the MSYS shell.
- * This controls if statements in the makefile and the SHELL variable.
- * The default is false.
- */
- void SetMSYSShell(bool v) {this->MSYSShell = v;}
-
- /**
* 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.
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 73a4ec8..06a3b6c 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,8 +62,9 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent):
- cmLocalVisualStudio7Generator(v, parent)
+::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent):
+ cmLocalVisualStudio7Generator(v, gg, parent)
{
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index f90daa0..987e08b 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,7 +25,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent);
+ cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent);
virtual ~cmLocalVisualStudio10Generator();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 6d89b15..42da639 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,8 +24,9 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmLocalGenerator* parent):
- cmLocalVisualStudioGenerator(VS6, parent)
+::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent):
+ cmLocalVisualStudioGenerator(VS6, gg, parent)
{
}
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index 1a0a614..a6e0b3d 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,7 +29,8 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio6Generator(cmLocalGenerator* parent);
+ cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent);
virtual ~cmLocalVisualStudio6Generator();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 2152f77..63c18a7 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -55,8 +55,9 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent):
- cmLocalVisualStudioGenerator(v, parent)
+::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent):
+ cmLocalVisualStudioGenerator(v, gg, parent)
{
this->ExtraFlagTable = 0;
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index cfbc63c..1891369 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,7 +35,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent);
+ cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent);
virtual ~cmLocalVisualStudio7Generator();
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 854ad34..4a596d5 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,11 +19,10 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent)
- : cmLocalGenerator(parent)
+::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent)
+ : cmLocalGenerator(gg, parent)
{
- this->WindowsShell = true;
- this->WindowsVSIDE = true;
this->Version = v;
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 562d595..1152e82 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -45,7 +45,8 @@ public:
VS14 = 140
};
- cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent);
+ cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
+ cmLocalGenerator* parent);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 1d3a8cf..a957c27 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -15,8 +15,9 @@
#include "cmMakefile.h"
//----------------------------------------------------------------------------
-cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent)
- : cmLocalGenerator(parent)
+cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent)
+ : cmLocalGenerator(gg, parent)
{
// the global generator does this, so do not
// put these flags into the language flags
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 1a5760f..54bc6df 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -24,7 +24,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalXCodeGenerator(cmLocalGenerator* parent);
+ cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4ded936..7b8d3af 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -153,27 +153,13 @@ public:
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
: Internal(new Internals),
LocalGenerator(localGenerator),
- StateSnapshot(localGenerator->GetGlobalGenerator()
- ->GetCMakeInstance()->GetState())
+ StateSnapshot(localGenerator->GetStateSnapshot())
{
this->Internal->PushDefinitions();
this->Internal->VarInitStack.push(std::set<std::string>());
this->Internal->VarUsageStack.push(std::set<std::string>());
this->Internal->IsSourceFileTryCompile = false;
- if (this->LocalGenerator->GetParent())
- {
- cmMakefile* parentMf = this->LocalGenerator->GetParent()->GetMakefile();
- this->StateSnapshot =
- this->GetState()->CreateSnapshot(parentMf->StateSnapshot);
- }
- else
- {
- this->StateSnapshot =
- this->GetState()->CreateSnapshot(this->StateSnapshot);
- }
-
-
// Initialize these first since AddDefaultDefinitions calls AddDefinition
this->WarnUnused = false;
this->CheckSystemVars = false;
@@ -212,7 +198,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->HeaderFileExtensions.push_back( "txx" );
this->DefineFlags = " ";
- this->LocalGenerator = localGenerator;
this->AddDefaultDefinitions();
@@ -1657,12 +1642,47 @@ void cmMakefile::InitializeFromParent()
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
{
lg2->GetMakefile()->InitializeFromParent();
+ std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory();
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Entering ";
- msg += lg2->GetMakefile()->GetCurrentSourceDirectory();
+ msg += currentStart;
cmSystemTools::Message(msg.c_str());
}
+
+ currentStart += "/CMakeLists.txt";
+ if(!cmSystemTools::FileExists(currentStart.c_str(), true))
+ {
+ // The file is missing. Check policy CMP0014.
+ std::ostringstream e;
+ e << "The source directory\n"
+ << " " << currentStart << "\n"
+ << "does not contain a CMakeLists.txt file.";
+ switch (this->GetPolicyStatus(cmPolicies::CMP0014))
+ {
+ case cmPolicies::WARN:
+ // Print the warning.
+ e << "\n"
+ << "CMake does not support this case but it used "
+ << "to work accidentally and is being allowed for "
+ << "compatibility."
+ << "\n"
+ << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
+ this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ case cmPolicies::OLD:
+ // OLD behavior does not warn.
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ e << "\n"
+ << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014);
+ case cmPolicies::NEW:
+ // NEW behavior prints the error.
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ lg2->SetConfiguredCMP0014(true);
+ return;
+ }
// finally configure the subdir
lg2->Configure();
if (this->GetCMakeInstance()->GetDebugOutput())
@@ -4131,11 +4151,12 @@ const char *cmMakefile::GetProperty(const std::string& prop,
output = "";
if (prop == "PARENT_DIRECTORY")
{
- if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
+ cmState::Snapshot parent = this->StateSnapshot.GetParent();
+ if(parent.IsValid())
{
- output = plg->GetMakefile()->GetCurrentSourceDirectory();
+ return parent.GetCurrentSourceDirectory();
}
- return output.c_str();
+ return "";
}
else if (prop == "INCLUDE_REGULAR_EXPRESSION" )
{
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a4dad1e..2ee23d1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1118,8 +1118,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
pi != this->MultipleOutputPairs.end(); ++pi)
{
*this->InfoFileStream
- << " " << this->LocalGenerator->EscapeForCMake(pi->first)
- << " " << this->LocalGenerator->EscapeForCMake(pi->second)
+ << " " << cmLocalGenerator::EscapeForCMake(pi->first)
+ << " " << cmLocalGenerator::EscapeForCMake(pi->second)
<< "\n";
}
*this->InfoFileStream << " )\n\n";
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 536dcdc..eb56494 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -211,6 +211,9 @@ class cmPolicy;
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0061, \
"CTest does not by default tell make to ignore errors (-i).", \
+ 3, 3, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0062, \
+ "Disallow install() of export() result.", \
3, 3, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index a9029a0..176cb0d 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -53,7 +53,7 @@ bool cmProjectCommand
// CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build
// will work.
if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME")
- || (this->Makefile->GetLocalGenerator()->GetParent() == 0) )
+ || (this->Makefile->GetLocalGenerator()->IsRootMakefile()))
{
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
this->Makefile->AddCacheDefinition
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 67a2274..82a2939 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -522,3 +522,24 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
cmSystemTools::CollapseFullPath(
this->State->OutputLocations[this->Position]);
}
+
+bool cmState::Snapshot::IsValid() const
+{
+ return this->State ? true : false;
+}
+
+cmState::Snapshot cmState::Snapshot::GetParent() const
+{
+ Snapshot snapshot;
+ if (!this->State)
+ {
+ return snapshot;
+ }
+ PositionType parentPos = this->State->ParentPositions[this->Position];
+ if (parentPos > 0)
+ {
+ snapshot = Snapshot(this->State, parentPos);
+ }
+
+ return snapshot;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index d10fae3..ed58c64 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -36,6 +36,9 @@ public:
const char* GetCurrentBinaryDirectory() const;
void SetCurrentBinaryDirectory(std::string const& dir);
+ bool IsValid() const;
+ Snapshot GetParent() const;
+
private:
friend class cmState;
cmState* State;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index add80fa..7e11d8c 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -82,7 +82,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// be translated.
std::string exe = command[0];
cmMakefile* mf = this->Test->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
cmTarget* target = mf->FindTargetToUse(exe);
if(target && target->GetType() == cmTarget::EXECUTABLE)
{
@@ -98,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
std::string emulatorExe(emulatorWithArgs[0]);
cmSystemTools::ConvertToUnixSlashes(emulatorExe);
- os << lg->EscapeForCMake(emulatorExe) << " ";
+ os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " ";
for(std::vector<std::string>::const_iterator ei =
emulatorWithArgs.begin()+1;
ei != emulatorWithArgs.end();
++ei)
{
- os << lg->EscapeForCMake(*ei) << " ";
+ os << cmLocalGenerator::EscapeForCMake(*ei) << " ";
}
}
}
@@ -116,11 +115,12 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
// Generate the command line with full escapes.
- os << lg->EscapeForCMake(exe);
+ os << cmLocalGenerator::EscapeForCMake(exe);
for(std::vector<std::string>::const_iterator ci = command.begin()+1;
ci != command.end(); ++ci)
{
- os << " " << lg->EscapeForCMake(ge.Parse(*ci)->Evaluate(mf, config));
+ os << " " << cmLocalGenerator::EscapeForCMake(
+ ge.Parse(*ci)->Evaluate(mf, config));
}
// Finish the test command.
@@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
i != pm.end(); ++i)
{
os << " " << i->first
- << " " << lg->EscapeForCMake(
+ << " " << cmLocalGenerator::EscapeForCMake(
ge.Parse(i->second.GetValue())->Evaluate(mf, config));
}
os << ")" << std::endl;
@@ -197,8 +197,6 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
fout << ")" << std::endl;
// Output properties for the test.
- cmMakefile* mf = this->Test->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
cmPropertyMap& pm = this->Test->GetProperties();
if(!pm.empty())
{
@@ -208,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
i != pm.end(); ++i)
{
fout << " " << i->first
- << " " << lg->EscapeForCMake(i->second.GetValue());
+ << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue());
}
fout << ")" << std::endl;
}
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index 33fe5f3..8145db7 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -16,8 +16,13 @@ string(REPLACE "\\" "\\\\" HOME "${HOME}")
# (i.e. - is it an "in source" build?)
#
set(in_source_build 0)
+set(build_under_source 0)
-if(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
+string(FIND "${CMake_BINARY_DIR}" "${CMake_SOURCE_DIR}/" pos)
+if(pos EQUAL 0)
+ message("build dir is *inside* source dir")
+ set(build_under_source 1)
+elseif(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
message("build dir *is* source dir")
set(in_source_build 1)
else()
@@ -39,8 +44,13 @@ message("bin_len='${bin_len}'")
message("substr_len='${substr_len}'")
message("bin_dir='${bin_dir}'")
message("in_source_build='${in_source_build}'")
+message("build_under_source='${build_under_source}'")
message("")
+if(build_under_source)
+ message(STATUS "Skipping rest of test because build tree is under source tree")
+ return()
+endif()
# If this does not appear to be a git checkout, just pass the test here
# and now. (Do not let the test fail if it is run in a tree *exported* from a
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 8fafa3b..fadd0fe 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -1,6 +1,9 @@
cmake_minimum_required (VERSION 2.6)
project(FindPackageTest)
+# Protect tests from running inside the default install prefix.
+set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")
+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
diff --git a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
index a5e2114..e7f27a1 100644
--- a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+# Protect tests from running inside the default install prefix.
+set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
+
run_cmake(CMP0041-OLD)
run_cmake(CMP0041-NEW)
run_cmake(CMP0041-WARN)
diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
new file mode 100644
index 0000000..d95bb33
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\):
+ subdirs called with incorrect number of arguments
++
+No tests were found!!!$
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 22a8d20..0cb11ac 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -26,3 +26,16 @@ function(run_repeat_until_fail_tests)
)
endfunction()
run_repeat_until_fail_tests()
+
+function(run_BadCTestTestfile)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BadCTestTestfile)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+subdirs()
+")
+
+ run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND})
+endfunction()
+run_BadCTestTestfile()
diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
index 489e3df..066c83e 100644
--- a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
+++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake
@@ -6,6 +6,9 @@ macro(run_cmake test)
_run_cmake(${test})
endmacro()
+# Protect tests from running inside the default install prefix.
+set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
+
run_cmake(RelativePathInInterface)
run_cmake(RelativePathInGenex)
run_cmake(export-NOWARN)
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
index 3f624f8..54d5e97 100644
--- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+# Protect tests from running inside the default install prefix.
+set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
+
run_cmake(NotFoundContent)
run_cmake(DebugIncludes)
run_cmake(TID-bad-target)
diff --git a/Tests/RunCMake/install/CMP0062-NEW-result.txt b/Tests/RunCMake/install/CMP0062-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/CMP0062-NEW-stderr.txt b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
new file mode 100644
index 0000000..b03f629
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at CMP0062-NEW.cmake:[0-9]+ \(install\):
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-NEW-build/exported.cmake
+
+ was generated by the export\(\) command. It may not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/install/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake
new file mode 100644
index 0000000..a696f56
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0062 NEW)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-OLD-result.txt b/Tests/RunCMake/install/CMP0062-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake
new file mode 100644
index 0000000..94b809a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0062 OLD)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-WARN-result.txt b/Tests/RunCMake/install/CMP0062-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-WARN-stderr.txt b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
new file mode 100644
index 0000000..12ae745
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
@@ -0,0 +1,16 @@
+CMake Warning \(dev\) at CMP0062-WARN.cmake:[0-9]+ \(install\):
+ Policy CMP0062 is not set: Disallow install\(\) of export\(\) result. Run
+ "cmake --help-policy CMP0062" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-WARN-build/exported.cmake
+
+ was generated by the export\(\) command. It should not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake
new file mode 100644
index 0000000..0435a64
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN.cmake
@@ -0,0 +1,4 @@
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 7149603..a5f5bd0 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -7,3 +7,6 @@ run_cmake(SkipInstallRulesWarning)
run_cmake(SkipInstallRulesNoWarning1)
run_cmake(SkipInstallRulesNoWarning2)
run_cmake(TARGETS-DESTINATION-bad)
+run_cmake(CMP0062-OLD)
+run_cmake(CMP0062-NEW)
+run_cmake(CMP0062-WARN)