CMakeLists.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
  2. IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
  3. SET(BUILD_SHARED_LIBS 1)
  4. # Construct a source file outside the tree whose full path is close to
  5. # the path length limit. This will cause the full path to the object
  6. # file in the build tree to exceed the maximum path length which will
  7. # test cmLocalGenerator::CreateSafeUniqueObjectFileName.
  8. GET_FILENAME_COMPONENT(DEEPDIR
  9. ${OutOfSource_BINARY_DIR}/../OutOfSourceDeep/deeper ABSOLUTE)
  10. # The maximum allowed path length on Windows is near this value.
  11. SET(MAXPATH "250")
  12. # VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the
  13. # path of the source file for no good reason. Reduce the length
  14. # limit by 46 characters to account for it. It should still be long
  15. # enough to require special object file name conversion.
  16. IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
  17. MATH(EXPR MAXPATH "${MAXPATH} - 46")
  18. ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 8")
  19. # MAXPATH less 25 for last /and/deeper/simple.cxx part and small safety
  20. MATH(EXPR MAXPATH "${MAXPATH} - 25")
  21. STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
  22. WHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
  23. SET(DEEPDIR ${DEEPDIR}/and/deeper)
  24. STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
  25. ENDWHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}")
  26. SET(DEEPSRC ${DEEPDIR}/simple.cxx)
  27. STRING(LENGTH "${DEEPSRC}" DEEPSRC_LEN)
  28. CONFIGURE_FILE(simple.cxx.in ${DEEPSRC} COPYONLY)
  29. # Watcom WMake seems to have problems with long command lines. Just
  30. # disable this part of the test until it is resolved.
  31. IF(${CMAKE_GENERATOR} MATCHES "Watcom WMake")
  32. SET(DEEPSRC "")
  33. ADD_DEFINITIONS(-DNO_DEEPSRC)
  34. ENDIF(${CMAKE_GENERATOR} MATCHES "Watcom WMake")
  35. ADD_LIBRARY(testlib testlib.cxx)
  36. ADD_EXECUTABLE (simple simple.cxx ../simple.cxx ${DEEPSRC})
  37. TARGET_LINK_LIBRARIES(simple testlib outlib)
  38. ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
  39. # test getting a definition from a subdir
  40. SET (WEASELS SIZZLING)