mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-03 20:24:14 +02:00
21 lines
640 B
CMake
21 lines
640 B
CMake
if(NOT DEFINED target OR NOT DEFINED link)
|
|
message(FATAL_ERROR "`target` and `link` must be defined")
|
|
endif()
|
|
|
|
file(CREATE_LINK "${target}" "${link}" RESULT result SYMBOLIC)
|
|
if(result EQUAL 0)
|
|
return()
|
|
endif()
|
|
|
|
if(WIN32)
|
|
set(hint "On Windows, enable Developer Mode to allow symlinks (https://learn.microsoft.com/windows/advanced-settings/developer-mode).")
|
|
endif()
|
|
message(WARNING "Symlink failed (${result}). Falling back to copying. ${hint}")
|
|
|
|
file(REMOVE_RECURSE "${link}")
|
|
if(IS_DIRECTORY "${target}")
|
|
file(COPY "${target}/." DESTINATION "${link}")
|
|
else()
|
|
file(COPY_FILE "${target}" "${link}" ONLY_IF_DIFFERENT)
|
|
endif()
|