summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-02 18:28:12 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-02 18:28:12 (GMT)
commitac9b7ec1558e1370f578c67b1296fbe778a92b81 (patch)
tree8fe4990c6e318e0bdbf136dcf805e817c024440d /Source/cmGlobalGenerator.cxx
parent7d6a5e097f17720ed21fe5faac1759bf387c7880 (diff)
downloadCMake-ac9b7ec1558e1370f578c67b1296fbe778a92b81.zip
CMake-ac9b7ec1558e1370f578c67b1296fbe778a92b81.tar.gz
CMake-ac9b7ec1558e1370f578c67b1296fbe778a92b81.tar.bz2
ENH: Refactor custom command rule hashing
This simplifies computation of custom command rule hashes to hash content exactly chosen as the custom commands are generated. Unfortunately this will change the hashes of existing build trees from earlier CMake versions, but this is not a big deal. The change is necessary so that in the future we can make optional adjustments to custom command lines at generate time without changing the hashes every time the option is changed.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index be9b0df..b0a6e83 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2004,8 +2004,7 @@ cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk)
//----------------------------------------------------------------------------
void
cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
- std::vector<std::string>::const_iterator first,
- std::vector<std::string>::const_iterator last)
+ std::string const& content)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
// Ignore if there are no outputs.
@@ -2017,16 +2016,12 @@ cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Compute a hash of the rule.
RuleHash hash;
{
- unsigned char const* data;
- int length;
+ unsigned char const* data =
+ reinterpret_cast<unsigned char const*>(content.c_str());
+ int length = static_cast<int>(content.length());
cmsysMD5* sum = cmsysMD5_New();
cmsysMD5_Initialize(sum);
- for(std::vector<std::string>::const_iterator i = first; i != last; ++i)
- {
- data = reinterpret_cast<unsigned char const*>(i->c_str());
- length = static_cast<int>(i->length());
- cmsysMD5_Append(sum, data, length);
- }
+ cmsysMD5_Append(sum, data, length);
cmsysMD5_FinalizeHex(sum, hash.Data);
cmsysMD5_Delete(sum);
}