summaryrefslogtreecommitdiffstats
path: root/Tests/OutOfSource/OutOfSourceSubdir
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-03-16 14:34:25 (GMT)
committerBrad King <brad.king@kitware.com>2007-03-16 14:34:25 (GMT)
commit1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4 (patch)
tree441301a561d9488ee57afb5d86f77629fc27e602 /Tests/OutOfSource/OutOfSourceSubdir
parent77da3d9b7944f1fdc8d45c35ffe6653e700d7f68 (diff)
downloadCMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.zip
CMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.tar.gz
CMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.tar.bz2
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.
Diffstat (limited to 'Tests/OutOfSource/OutOfSourceSubdir')
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt20
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/simple.cxx5
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/simple.cxx.in1
3 files changed, 25 insertions, 1 deletions
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
index bbdaa55..4daf425 100644
--- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
+++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
@@ -2,8 +2,26 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
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}")
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
index 124b7f9..0be7195 100644
--- a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
+++ b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
@@ -5,6 +5,7 @@
#include "testdp.h"
extern int simple();
+extern int simple2();
extern "C" int outlib();
int main ()
@@ -26,5 +27,9 @@ int main ()
{
return -4;
}
+ if(simple2() != 789)
+ {
+ return -5;
+ }
return 0;
}
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx.in b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx.in
new file mode 100644
index 0000000..8339b7c
--- /dev/null
+++ b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx.in
@@ -0,0 +1 @@
+int simple2() { return 789; }