1 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
3 IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
4 SET(BUILD_SHARED_LIBS 1)
6 # Construct a source file outside the tree whose full path is close to
7 # the path length limit. This will cause the full path to the object
8 # file in the build tree to exceed the maximum path length which will
9 # test cmLocalGenerator::CreateSafeUniqueObjectFileName.
10 GET_FILENAME_COMPONENT(DEEPDIR
11 ${OutOfSource_BINARY_DIR}/../OutOfSourceDeep/deeper ABSOLUTE)
13 # Test giving the generator a custom limit.
14 SET(CMAKE_OBJECT_PATH_MAX 220)
16 # Use a separate variable for computation.
17 SET(MAXPATH "${CMAKE_OBJECT_PATH_MAX}")
19 # VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the
20 # path of the source file for no good reason. Reduce the length
21 # limit by 46 characters to account for it. It should still be long
22 # enough to require special object file name conversion.
23 IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
24 MATH(EXPR MAXPATH "${MAXPATH} - 46")
25 ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
27 # MAXPATH less 25 for last /and/deeper/simple.cxx part and small safety
28 MATH(EXPR MAXPATH "${MAXPATH} - 25")
29 STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
30 WHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
31 SET(DEEPDIR ${DEEPDIR}/and/deeper)
32 STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
33 ENDWHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
34 SET(DEEPSRC ${DEEPDIR}/simple.cxx)
35 STRING(LENGTH "${DEEPSRC}" DEEPSRC_LEN)
36 CONFIGURE_FILE(simple.cxx.in ${DEEPSRC} COPYONLY)
38 # Watcom WMake seems to have problems with long command lines. Just
39 # disable this part of the test until it is resolved.
40 IF(${CMAKE_GENERATOR} MATCHES "Watcom WMake")
42 ADD_DEFINITIONS(-DNO_DEEPSRC)
43 ENDIF(${CMAKE_GENERATOR} MATCHES "Watcom WMake")
45 ADD_LIBRARY(testlib testlib.cxx)
46 ADD_EXECUTABLE (simple simple.cxx ../simple.cxx ${DEEPSRC})
47 TARGET_LINK_LIBRARIES(simple testlib outlib)
48 ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
50 # test getting a definition from a subdir
51 SET (WEASELS SIZZLING)
53 GET_DIRECTORY_PROPERTY(incDirs INCLUDE_DIRECTORIES)
55 MESSAGE(FATAL_ERROR "GET_DIRECTORY_PROPERTY(INCLUDE_DIRECTORIES) returned empty list")