[cmake-commits] king committed CMakeLists.txt 1.6 1.7 simple.cxx 1.5
1.6 simple.cxx.in NONE 1.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Mar 16 09:34:27 EST 2007
Update of /cvsroot/CMake/CMake/Tests/OutOfSource/OutOfSourceSubdir
In directory public:/mounts/ram/cvs-serv30235/Tests/OutOfSource/OutOfSourceSubdir
Modified Files:
CMakeLists.txt simple.cxx
Added Files:
simple.cxx.in
Log Message:
ENH: Added computation of object file names that are almost always short enough to not exceed the filesystem path length limitation. This is useful when a source file from outside the tree is referenced with a long full path. The object file name previously would contain the entire path which when combined with the build output directory could exceed the filesystem limit. Now CMake recognizes this case and replaces enough of the beginning of the full path to the source file with an md5sum of the replaced portion to make the name fit on disk. This addresses bug#4520.
--- NEW FILE: simple.cxx.in ---
int simple2() { return 789; }
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CMakeLists.txt 10 Oct 2006 01:25:58 -0000 1.6
+++ CMakeLists.txt 16 Mar 2007 14:34:25 -0000 1.7
@@ -2,8 +2,26 @@
IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
SET(BUILD_SHARED_LIBS 1)
+
+ # Construct a source file outside the tree whose full path is close to
+ # the path length limit. This will cause the full path to the object
+ # file in the build tree to exceed the maximum path length which will
+ # 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")
+ STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
+ WHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
+ SET(DEEPDIR ${DEEPDIR}/and/deeper)
+ STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
+ ENDWHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
+ SET(DEEPSRC ${DEEPDIR}/simple.cxx)
+ STRING(LENGTH "${DEEPSRC}" DEEPSRC_LEN)
+ CONFIGURE_FILE(simple.cxx.in ${DEEPSRC} COPYONLY)
+
ADD_LIBRARY(testlib testlib.cxx)
- ADD_EXECUTABLE (simple simple.cxx ../simple.cxx)
+ ADD_EXECUTABLE (simple simple.cxx ../simple.cxx ${DEEPSRC})
TARGET_LINK_LIBRARIES(simple testlib outlib)
ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
Index: simple.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- simple.cxx 10 Oct 2006 01:25:58 -0000 1.5
+++ simple.cxx 16 Mar 2007 14:34:25 -0000 1.6
@@ -5,6 +5,7 @@
#include "testdp.h"
extern int simple();
+extern int simple2();
extern "C" int outlib();
int main ()
@@ -26,5 +27,9 @@
{
return -4;
}
+ if(simple2() != 789)
+ {
+ return -5;
+ }
return 0;
}
More information about the Cmake-commits
mailing list