diff options
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; } |