diff options
author | Brad King <brad.king@kitware.com> | 2007-03-16 14:34:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-03-16 14:34:25 (GMT) |
commit | 1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4 (patch) | |
tree | 441301a561d9488ee57afb5d86f77629fc27e602 /Tests/OutOfSource/OutOfSourceSubdir | |
parent | 77da3d9b7944f1fdc8d45c35ffe6653e700d7f68 (diff) | |
download | CMake-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.txt | 20 | ||||
-rw-r--r-- | Tests/OutOfSource/OutOfSourceSubdir/simple.cxx | 5 | ||||
-rw-r--r-- | Tests/OutOfSource/OutOfSourceSubdir/simple.cxx.in | 1 |
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; } |