CMake: Remove LINUX_LOCAL_DEV and symlink required files

This commit is contained in:
Joshua Vandaële
2026-07-24 03:45:13 +02:00
parent fa2a250f01
commit 3d9f46cd64
3 changed files with 65 additions and 42 deletions
+20
View File
@@ -0,0 +1,20 @@
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()