summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file/READ_SYMLINK.cmake
blob: 865a2e931e8ad1f3cada53892d90ea208ed594df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
execute_process(COMMAND
  ${CMAKE_COMMAND} -E create_symlink "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/rel.sym")
file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/rel.sym" result)
if(NOT result STREQUAL "test.txt")
  message(SEND_ERROR "Relative symlink is \"${result}\", should be \"test.txt\"")
endif()

execute_process(COMMAND
  ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test.txt" "${CMAKE_CURRENT_BINARY_DIR}/abs.sym")
file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/abs.sym" result)
if(NOT result MATCHES "^.*/Tests/RunCMake/file/READ_SYMLINK-build/test\\.txt$")
  message(SEND_ERROR "Absolute symlink is \"${result}\", should be \"*/Tests/RunCMake/file/READ_SYMLINK-build/test.txt\"")
endif()