[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1128-g5a4863a
Stephen Kelly
steveire at gmail.com
Thu Nov 29 15:13:03 EST 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 5a4863aa35575fee5db1095c3da3b7f09d4c8f39 (commit)
via 5a9bca6c9a22575c76af86dce440929856de1f40 (commit)
from 3bd01d6b54035ea2e4b18a9dd5e37df4f8c058cb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a4863aa35575fee5db1095c3da3b7f09d4c8f39
commit 5a4863aa35575fee5db1095c3da3b7f09d4c8f39
Merge: 3bd01d6 5a9bca6
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Nov 29 15:13:01 2012 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Nov 29 15:13:01 2012 -0500
Merge topic 'fix-ExpandVariables-performance' into next
5a9bca6 Try to avoid calling ExpandVariablesInString where not needed.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a9bca6c9a22575c76af86dce440929856de1f40
commit 5a9bca6c9a22575c76af86dce440929856de1f40
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Nov 29 20:57:28 2012 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 29 21:05:37 2012 +0100
Try to avoid calling ExpandVariablesInString where not needed.
The target property INCLUDE_DIRECTORIES can contain generator
expressions, which contain '$' characters and make
the ExpandVariablesInString method execute slow code paths.
Practically, it is probably not necessary to call it anyway as the
expansion only remains for backward compatibility reasons, though
the specific reasons are not known.
This affects any CMake 2.8.10 code which makes (extensive?) use of
generator expressions in INCLUDE_DIRECTORIES target properties.
As that is a new feature in CMake 2.8.10, there are probably few
people affected by it. However, as the target_link_libraries command
in CMake 2.8.11 will populate the INCLUDE_DIRECTORIES property
with generator expressions, this makes the problem more apparent
everywhere.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8498d72..4396740 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2122,6 +2122,13 @@ void cmMakefile::AddExtraDirectory(const char* dir)
this->AuxSourceDirectories.push_back(dir);
}
+//----------------------------------------------------------------------------
+static bool containsVariable(const std::string &lib)
+{
+ const std::string::size_type openpos = lib.find("${");
+ return (openpos != std::string::npos)
+ && (lib.find("}", openpos) != std::string::npos);
+}
// expand CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
// include and library directories.
@@ -2136,8 +2143,11 @@ void cmMakefile::ExpandVariables()
if (includeDirs)
{
std::string dirs = includeDirs;
- this->ExpandVariablesInString(dirs, true, true);
- this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ if (containsVariable(dirs))
+ {
+ this->ExpandVariablesInString(dirs, true, true);
+ this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ }
}
// Also for each target's INCLUDE_DIRECTORIES property:
@@ -2149,8 +2159,17 @@ void cmMakefile::ExpandVariables()
if (includeDirs)
{
std::string dirs = includeDirs;
- this->ExpandVariablesInString(dirs, true, true);
- t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ if (containsVariable(dirs))
+ {
+ // Performance suffers severely when ExpandVariablesInString
+ // is called on strings which contain generator expressions,
+ // presumably because they contain '$' characters.
+ // This expansion is only for compatibility, probably with ancient
+ // cmake versions. Usually the variables are already expanded
+ // so this branch will not be entered.
+ this->ExpandVariablesInString(dirs, true, true);
+ t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ }
}
}
-----------------------------------------------------------------------
Summary of changes:
Source/cmMakefile.cxx | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list