[Cmake-commits] [cmake-commits] king committed cmDocumentVariables.cxx 1.20 1.21 cmLocalGenerator.cxx 1.282 1.283 cmLocalGenerator.h 1.103 1.104
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Aug 21 09:54:38 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv4063/Source
Modified Files:
cmDocumentVariables.cxx cmLocalGenerator.cxx
cmLocalGenerator.h
Log Message:
ENH: Allow custom limit on object file path length
Some native build tools, particularly those for cross compiling, may
have a limit on the length of the full path to an object file name that
is lower than the platform otherwise supports. This change allows the
limit to be set by the project toolchain file through the variable
CMAKE_OBJECT_PATH_MAX.
Index: cmDocumentVariables.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentVariables.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -C 2 -d -r1.20 -r1.21
*** cmDocumentVariables.cxx 20 Jul 2008 21:14:00 -0000 1.20
--- cmDocumentVariables.cxx 21 Aug 2008 13:54:36 -0000 1.21
***************
*** 737,740 ****
--- 737,758 ----
"Variables That Describe the System");
+ cm->DefineProperty
+ ("CMAKE_OBJECT_PATH_MAX", cmProperty::VARIABLE,
+ "Maximum object file full-path length allowed by native build tools.",
+ "CMake computes for every source file an object file name that is "
+ "unique to the source file and deterministic with respect to the "
+ "full path to the source file. "
+ "This allows multiple source files in a target to share the same name "
+ "if they lie in different directories without rebuilding when one is "
+ "added or removed. "
+ "However, it can produce long full paths in a few cases, so CMake "
+ "shortens the path using a hashing scheme when the full path to an "
+ "object file exceeds a limit. "
+ "CMake has a built-in limit for each platform that is sufficient for "
+ "common tools, but some native tools may have a lower limit. "
+ "This variable may be set to specify the limit explicitly. "
+ "The value must be an integer no less than 128.",false,
+ "Variables That Describe the System");
+
// Variables that affect the building of object files and
// targets.
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.282
retrieving revision 1.283
diff -C 2 -d -r1.282 -r1.283
*** cmLocalGenerator.cxx 18 Aug 2008 15:39:22 -0000 1.282
--- cmLocalGenerator.cxx 21 Aug 2008 13:54:36 -0000 1.283
***************
*** 102,105 ****
--- 102,142 ----
this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
+ // Choose a maximum object file name length.
+ {
+ #if defined(_WIN32) || defined(__CYGWIN__)
+ this->ObjectPathMax = 250;
+ #else
+ this->ObjectPathMax = 1000;
+ #endif
+ const char* plen = this->Makefile->GetDefinition("CMAKE_OBJECT_PATH_MAX");
+ if(plen && *plen)
+ {
+ unsigned int pmax;
+ if(sscanf(plen, "%u", &pmax) == 1)
+ {
+ if(pmax >= 128)
+ {
+ this->ObjectPathMax = pmax;
+ }
+ else
+ {
+ cmOStringStream w;
+ w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax
+ << ", which is less than the minimum of 128. "
+ << "The value will be ignored.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ }
+ else
+ {
+ cmOStringStream w;
+ w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen
+ << "\", which fails to parse as a positive integer. "
+ << "The value will be ignored.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ }
+ }
+
this->Configured = true;
***************
*** 2315,2328 ****
}
! static bool cmLocalGeneratorCheckObjectName(std::string& objName,
! std::string::size_type dir_len)
{
- // Choose a maximum file name length.
- #if defined(_WIN32) || defined(__CYGWIN__)
- std::string::size_type const max_total_len = 250;
- #else
- std::string::size_type const max_total_len = 1000;
- #endif
-
// Enforce the maximum file name length if possible.
std::string::size_type max_obj_len = max_total_len;
--- 2352,2360 ----
}
! static
! bool cmLocalGeneratorCheckObjectName(std::string& objName,
! std::string::size_type dir_len,
! std::string::size_type max_total_len)
{
// Enforce the maximum file name length if possible.
std::string::size_type max_obj_len = max_total_len;
***************
*** 2415,2419 ****
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
! cmLocalGeneratorCheckObjectName(ssin, dir_len);
#else
(void)dir_len;
--- 2447,2451 ----
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
! cmLocalGeneratorCheckObjectName(ssin, dir_len, this->ObjectPathMax);
#else
(void)dir_len;
Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -C 2 -d -r1.103 -r1.104
*** cmLocalGenerator.h 14 Feb 2008 20:31:08 -0000 1.103
--- cmLocalGenerator.h 21 Aug 2008 13:54:36 -0000 1.104
***************
*** 349,352 ****
--- 349,353 ----
std::map<cmStdString, cmStdString> LanguageToIncludeFlags;
std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
+ std::string::size_type ObjectPathMax;
bool WindowsShell;
bool WindowsVSIDE;
More information about the Cmake-commits
mailing list