[cmake-commits] king committed CMakeLists.txt 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 20 07:16:37 EST 2007


Update of /cvsroot/CMake/CMake/Tests/OutOfSource/OutOfSourceSubdir
In directory public:/mounts/ram/cvs-serv31824

Modified Files:
	CMakeLists.txt 
Log Message:
BUG: Work around VS8 conversion to a relative path for the long source name.  It takes the nice full path we give it, converts to relative, and then repacks relative on top of the build directory resulting in a path longer than its own maxpath even though the original path given was short enough.  Even VS6 dealt with it better.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- CMakeLists.txt	16 Mar 2007 14:34:25 -0000	1.7
+++ CMakeLists.txt	20 Mar 2007 12:16:35 -0000	1.8
@@ -9,8 +9,20 @@
   # test cmLocalGenerator::CreateSafeUniqueObjectFileName.
   GET_FILENAME_COMPONENT(DEEPDIR
     ${OutOfSource_BINARY_DIR}/../OutOfSourceDeep/deeper ABSOLUTE)
-  # MAXPATH = 250 less 25 for /and/deeper/simple.cxx part and small safety
-  MATH(EXPR MAXPATH "250 - 25")
+
+  # The maximum allowed path length on Windows is near this value.
+  SET(MAXPATH "250")
+
+  # VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the
+  # path of the source file for no good reason.  Reduce the length
+  # limit by 46 characters to account for it.  It should still be long
+  # enough to require special object file name conversion.
+  IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
+    MATH(EXPR MAXPATH "${MAXPATH} - 46")
+  ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
+
+  # MAXPATH less 25 for last /and/deeper/simple.cxx part and small safety
+  MATH(EXPR MAXPATH "${MAXPATH} - 25")
   STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
   WHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
     SET(DEEPDIR ${DEEPDIR}/and/deeper)



More information about the Cmake-commits mailing list