rename variable `l`
[liba.git] / cmake / TargetSupportsSymbolicLink.cmake
blob5f66ad292593080c6619df48e9465ec75c707697
1 function(TARGET_SUPPORTS_SYMBOLIC_LINK)
2   get_filename_component(name ${CMAKE_CURRENT_LIST_FILE} NAME)
3   execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
4     ${CMAKE_CURRENT_LIST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${name}
5     ERROR_QUIET RESULT_VARIABLE result
6   )
7   if(${result} EQUAL 0)
8     set(TARGET_SUPPORTS_SYMBOLIC_LINK 1 CACHE INTERNAL "Test TARGET_SUPPORTS_SYMBOLIC_LINK")
9   else()
10     set(TARGET_SUPPORTS_SYMBOLIC_LINK 0 CACHE INTERNAL "Test TARGET_SUPPORTS_SYMBOLIC_LINK")
11   endif()
12   file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${name})
13 endfunction()
14 if(NOT DEFINED TARGET_SUPPORTS_SYMBOLIC_LINK)
15   TARGET_SUPPORTS_SYMBOLIC_LINK()
16 endif()