2012-08-13 21:47:32 +04:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2005-09-13 18:40:38 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
|
|
|
|
set(BUILD_SHARED_LIBS 1)
|
2007-03-16 17:34:25 +03:00
|
|
|
|
|
|
|
# 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.
|
2012-08-13 21:47:32 +04:00
|
|
|
get_filename_component(DEEPDIR
|
2007-03-16 17:34:25 +03:00
|
|
|
${OutOfSource_BINARY_DIR}/../OutOfSourceDeep/deeper ABSOLUTE)
|
2007-03-20 15:16:35 +03:00
|
|
|
|
2008-08-21 17:54:36 +04:00
|
|
|
# Test giving the generator a custom limit.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_OBJECT_PATH_MAX 220)
|
2008-08-21 17:54:36 +04:00
|
|
|
|
|
|
|
# Use a separate variable for computation.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(MAXPATH "${CMAKE_OBJECT_PATH_MAX}")
|
2007-03-20 15:16:35 +03:00
|
|
|
|
|
|
|
# VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the
|
|
|
|
# path of the source file for no good reason. Reduce the length
|
|
|
|
# limit by 46 characters to account for it. It should still be long
|
|
|
|
# enough to require special object file name conversion.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(${CMAKE_GENERATOR} MATCHES "Visual Studio (8|10)")
|
|
|
|
math(EXPR MAXPATH "${MAXPATH} - 46")
|
|
|
|
endif()
|
2007-03-20 15:16:35 +03:00
|
|
|
|
2011-11-11 09:00:49 +04:00
|
|
|
# Ninja imposes a maximum path component count of 30. Permit more
|
|
|
|
# path components in the source path.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(${CMAKE_GENERATOR} MATCHES "Ninja")
|
|
|
|
math(EXPR MAXPATH "${MAXPATH} - 44")
|
|
|
|
endif()
|
2011-11-11 09:00:49 +04:00
|
|
|
|
2007-03-20 15:16:35 +03:00
|
|
|
# MAXPATH less 25 for last /and/deeper/simple.cxx part and small safety
|
2012-08-13 21:47:32 +04:00
|
|
|
math(EXPR MAXPATH "${MAXPATH} - 25")
|
|
|
|
string(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
|
|
|
|
while("${DEEPDIR_LEN}" LESS "${MAXPATH}")
|
|
|
|
set(DEEPDIR ${DEEPDIR}/and/deeper)
|
|
|
|
string(LENGTH "${DEEPDIR}" DEEPDIR_LEN)
|
2012-08-13 21:50:14 +04:00
|
|
|
endwhile()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(DEEPSRC ${DEEPDIR}/simple.cxx)
|
|
|
|
string(LENGTH "${DEEPSRC}" DEEPSRC_LEN)
|
|
|
|
configure_file(simple.cxx.in ${DEEPSRC} COPYONLY)
|
2007-03-16 17:34:25 +03:00
|
|
|
|
2007-03-21 14:16:32 +03:00
|
|
|
# Watcom WMake seems to have problems with long command lines. Just
|
|
|
|
# disable this part of the test until it is resolved.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(${CMAKE_GENERATOR} MATCHES "Watcom WMake")
|
|
|
|
set(DEEPSRC "")
|
|
|
|
add_definitions(-DNO_DEEPSRC)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-03-21 14:16:32 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_library(testlib testlib.cxx)
|
|
|
|
add_executable (simple simple.cxx ../simple.cxx ${DEEPSRC})
|
|
|
|
target_link_libraries(simple testlib outlib)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2005-04-12 17:35:40 +04:00
|
|
|
|
2005-09-13 18:40:38 +04:00
|
|
|
# test getting a definition from a subdir
|
2012-08-13 21:47:32 +04:00
|
|
|
set (WEASELS SIZZLING)
|
2007-07-16 21:26:56 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
get_directory_property(incDirs INCLUDE_DIRECTORIES)
|
|
|
|
if(NOT incDirs)
|
|
|
|
message(FATAL_ERROR "get_directory_property(INCLUDE_DIRECTORIES) returned empty list")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|