[Cmake-commits] CMake branch, next, updated. v2.8.4-1553-ga6b573a
Brad King
brad.king at kitware.com
Tue May 17 09:01:21 EDT 2011
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 a6b573ab744f37cb4ba89c0aaac45312db7831e6 (commit)
via 169bb05f90258447a0b93379364374eb03e45bf7 (commit)
via 4e2185cbd0d37dd642eefdc3365e8985d8f688c0 (commit)
from e061c8bfaec0e8f48b73a2208bafd63269c6a1cd (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=a6b573ab744f37cb4ba89c0aaac45312db7831e6
commit a6b573ab744f37cb4ba89c0aaac45312db7831e6
Merge: e061c8b 169bb05
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue May 17 09:00:54 2011 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 17 09:00:54 2011 -0400
Merge topic 'output-compile-lines' into next
169bb05 Provide std::map<>::at for use in run_compile_commands
4e2185c Make std::map usage more portable in language=>flags/defines maps
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=169bb05f90258447a0b93379364374eb03e45bf7
commit 169bb05f90258447a0b93379364374eb03e45bf7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue May 17 08:56:08 2011 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue May 17 08:56:08 2011 -0400
Provide std::map<>::at for use in run_compile_commands
Many compilers we support do not provide the at() member of std::map.
Use the workaround added by commit a7e7a04a (Fix run_compile_commands
build on Apple GCC 3.3, 2011-05-16) for all compilers.
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 31049d3..d7422a8 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -5,7 +5,6 @@ public:
class CommandType: public std::map<cmStdString, cmStdString>
{
public:
-#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4
cmStdString const& at(cmStdString const& k) const
{
const_iterator i = this->find(k);
@@ -13,7 +12,6 @@ public:
static cmStdString empty;
return empty;
}
-#endif
};
typedef std::vector<CommandType> TranslationUnitsType;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4e2185cbd0d37dd642eefdc3365e8985d8f688c0
commit 4e2185cbd0d37dd642eefdc3365e8985d8f688c0
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue May 17 08:50:55 2011 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue May 17 08:50:55 2011 -0400
Make std::map usage more portable in language=>flags/defines maps
Older versions of GCC, the HP compiler, and the SGI MIPSpro compiler do
not like the use of make_pair in this case and the conversions it
requires:
a value of type "const char *" cannot be used to initialize an entity
of type "char [1]"
/usr/include/g++-3/stl_pair.h:68: assignment of read-only location
Instead use a map lookup pattern already used throughout the rest of our
source tree.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 6d3fbe0..d0df8f0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -249,11 +249,12 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
}
//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) {
- std::pair<std::map<std::string, std::string>::iterator, bool>
- insert_result = this->FlagsByLanguage.insert(std::make_pair(l, ""));
- if (insert_result.second) {
- std::string& flags = insert_result.first->second;
+std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
+{
+ ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
+ if (i == this->FlagsByLanguage.end())
+ {
+ std::string flags;
const char *lang = l.c_str();
bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
@@ -284,15 +285,19 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) {
// Add include directory flags.
this->LocalGenerator->
AppendFlags(flags,this->GetFrameworkFlags().c_str());
- }
- return insert_result.first->second;
+
+ ByLanguageMap::value_type entry(l, flags);
+ i = this->FlagsByLanguage.insert(entry).first;
+ }
+ return i->second;
}
-std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) {
- std::pair<std::map<std::string, std::string>::iterator, bool>
- insert_result = this->DefinesByLanguage.insert(std::make_pair(l, ""));
- if (insert_result.second) {
- std::string &defines = insert_result.first->second;
+std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
+{
+ ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
+ if (i == this->DefinesByLanguage.end())
+ {
+ std::string defines;
const char *lang = l.c_str();
// Add the export symbol definition for shared library objects.
if(const char* exportMacro = this->Target->GetExportMacro())
@@ -312,8 +317,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) {
(defines, this->Makefile->GetProperty(defPropName.c_str()), lang);
this->LocalGenerator->AppendDefines
(defines, this->Target->GetProperty(defPropName.c_str()), lang);
- }
- return insert_result.first->second;
+
+ ByLanguageMap::value_type entry(l, defines);
+ i = this->DefinesByLanguage.insert(entry).first;
+ }
+ return i->second;
}
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index db87ebc..b68f8bf 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -216,10 +216,11 @@ protected:
std::string MacContentDirectory;
std::set<cmStdString> MacContentFolders;
+ typedef std::map<cmStdString, cmStdString> ByLanguageMap;
std::string GetFlags(const std::string &l);
- std::map<std::string, std::string> FlagsByLanguage;
+ ByLanguageMap FlagsByLanguage;
std::string GetDefines(const std::string &l);
- std::map<std::string, std::string> DefinesByLanguage;
+ ByLanguageMap DefinesByLanguage;
// Target-wide Fortran module output directory.
bool FortranModuleDirectoryComputed;
-----------------------------------------------------------------------
Summary of changes:
Source/cmMakefileTargetGenerator.cxx | 36 +++++++++++++++++++------------
Source/cmMakefileTargetGenerator.h | 5 ++-
Tests/CMakeLib/run_compile_commands.cxx | 2 -
3 files changed, 25 insertions(+), 18 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list