myx/MyxCMake/lib/macro/CreateSymlink.cmake

12 lines
381 B
CMake
Raw Normal View History

2022-10-04 18:02:40 +00:00
include_guard(GLOBAL)
2022-10-08 22:01:31 +00:00
macro(myx_create_symlink original linkname)
2022-10-20 09:45:27 +00:00
if(UNIX AND (NOT EXISTS ${linkname}))
2022-10-04 18:02:40 +00:00
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
2022-10-20 09:45:27 +00:00
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${original} ${linkname})
2022-10-04 18:02:40 +00:00
else()
file(CREATE_LINK ${original} ${linkname} SYMBOLIC)
endif()
endif()
2022-10-08 22:01:31 +00:00
endmacro(myx_create_symlink original linkname)