[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.476 1.477 cmMakefile.h 1.232 1.233
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Jun 26 13:30:18 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv13106/Source
Modified Files:
cmMakefile.cxx cmMakefile.h
Log Message:
BUG: Fix computed directory property DEFINITIONS.
- The property tracks the value formed by add_definitions
and remove_definitions command invocations.
- The string should be maintained for use in returning for the
DEFINITIONS property value.
- It is no longer used for any other purpose.
- The DEFINITIONS property was recently documented as deprecated.
- See bug #7239.
Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.232
retrieving revision 1.233
diff -C 2 -d -r1.232 -r1.233
*** cmMakefile.h 30 Apr 2008 17:42:39 -0000 1.232
--- cmMakefile.h 26 Jun 2008 17:30:10 -0000 1.233
***************
*** 830,833 ****
--- 830,838 ----
std::string DefineFlags;
+ // Track the value of the computed DEFINITIONS property.
+ void AddDefineFlag(const char*, std::string&);
+ void RemoveDefineFlag(const char*, std::string::size_type, std::string&);
+ std::string DefineFlagsOrig;
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::vector<cmSourceGroup> SourceGroups;
Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.476
retrieving revision 1.477
diff -C 2 -d -r1.476 -r1.477
*** cmMakefile.cxx 26 Jun 2008 14:58:44 -0000 1.476
--- cmMakefile.cxx 26 Jun 2008 17:30:10 -0000 1.477
***************
*** 1019,1022 ****
--- 1019,1025 ----
}
+ // Update the string used for the old DEFINITIONS property.
+ this->AddDefineFlag(flag, this->DefineFlagsOrig);
+
// If this is really a definition, update COMPILE_DEFINITIONS.
if(this->ParseDefineFlag(flag, false))
***************
*** 1025,1028 ****
--- 1028,1037 ----
}
+ // Add this flag that does not look like a definition.
+ this->AddDefineFlag(flag, this->DefineFlags);
+ }
+
+ void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
+ {
// remove any \n\r
std::string ret = flag;
***************
*** 1040,1045 ****
}
! this->DefineFlags += " ";
! this->DefineFlags += ret;
}
--- 1049,1054 ----
}
! dflags += " ";
! dflags += ret;
}
***************
*** 1054,1057 ****
--- 1063,1069 ----
}
+ // Update the string used for the old DEFINITIONS property.
+ this->RemoveDefineFlag(flag, len, this->DefineFlagsOrig);
+
// If this is really a definition, update COMPILE_DEFINITIONS.
if(this->ParseDefineFlag(flag, true))
***************
*** 1060,1073 ****
}
// Remove all instances of the flag that are surrounded by
// whitespace or the beginning/end of the string.
! for(std::string::size_type lpos = this->DefineFlags.find(flag, 0);
! lpos != std::string::npos; lpos = this->DefineFlags.find(flag, lpos))
{
std::string::size_type rpos = lpos + len;
! if((lpos <= 0 || isspace(this->DefineFlags[lpos-1])) &&
! (rpos >= this->DefineFlags.size() || isspace(this->DefineFlags[rpos])))
{
! this->DefineFlags.erase(lpos, len);
}
else
--- 1072,1093 ----
}
+ // Remove this flag that does not look like a definition.
+ this->RemoveDefineFlag(flag, len, this->DefineFlags);
+ }
+
+ void cmMakefile::RemoveDefineFlag(const char* flag,
+ std::string::size_type len,
+ std::string& dflags)
+ {
// Remove all instances of the flag that are surrounded by
// whitespace or the beginning/end of the string.
! for(std::string::size_type lpos = dflags.find(flag, 0);
! lpos != std::string::npos; lpos = dflags.find(flag, lpos))
{
std::string::size_type rpos = lpos + len;
! if((lpos <= 0 || isspace(dflags[lpos-1])) &&
! (rpos >= dflags.size() || isspace(dflags[rpos])))
{
! dflags.erase(lpos, len);
}
else
***************
*** 2958,2975 ****
else if (!strcmp("DEFINITIONS",prop))
{
! if(const char* cdefs = this->GetProperty("COMPILE_DEFINITIONS"))
! {
! // Expand the list.
! std::vector<std::string> defs;
! cmSystemTools::ExpandListArgument(cdefs, defs);
! for(std::vector<std::string>::iterator i = defs.begin();
! i != defs.end(); ++i)
! {
! output += "-D";
! output += *i;
! output += " ";
! }
! }
! output += this->GetDefineFlags();
return output.c_str();
}
--- 2978,2982 ----
else if (!strcmp("DEFINITIONS",prop))
{
! output += this->DefineFlagsOrig;
return output.c_str();
}
More information about the Cmake-commits
mailing list