summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-12-29 10:28:11 +0100
committerMattes D <github@xoft.cz>2019-12-29 11:49:00 +0100
commit2894ce3812bf7906e7073eeccc839cb6cbb1b7ac (patch)
treefacdf451c92929bfb90d94902aa13b6bbfbc7c9c
parentCMake: Don't create symlinks if link == orig. (diff)
downloadcuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar.gz
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar.bz2
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar.lz
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar.xz
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.tar.zst
cuberite-2894ce3812bf7906e7073eeccc839cb6cbb1b7ac.zip
-rw-r--r--src/CMakeLists.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bad1500e1..99c7ec7db 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -347,10 +347,6 @@ SET_TARGET_PROPERTIES(${CMAKE_PROJECT_NAME} PROPERTIES
# If the orig and link point to the same thing, does nothing (-> in-source build)
# If ${link} already exists, does nothing.
function(make_symlink orig link)
- # Get OS dependent path to use in `execute_process`
- file(TO_NATIVE_PATH "${orig}" orig)
- file(TO_NATIVE_PATH "${link}" link)
-
# If both are the same, or link already exists, bail out:
if ("${orig}" STREQUAL "${link}")
return()
@@ -364,6 +360,8 @@ function(make_symlink orig link)
if (CMAKE_HOST_UNIX)
set(command ln -s ${orig} ${link})
else()
+ file(TO_NATIVE_PATH "${orig}" orig)
+ file(TO_NATIVE_PATH "${link}" link)
if (IS_DIRECTORY ${orig})
set(command cmd.exe /c mklink /j ${link} ${orig})
else()
@@ -374,11 +372,12 @@ function(make_symlink orig link)
execute_process(
COMMAND ${command}
RESULT_VARIABLE result
- ERROR_VARIABLE output
+ ERROR_VARIABLE stderr
+ OUTPUT_VARIABLE stdout
)
if (NOT ${result} EQUAL 0)
- message(FATAL_ERROR "Could not create symbolic link for: ${link} --> ${orig}: ${output}")
+ message(FATAL_ERROR "Could not create symbolic link for: ${link} --> ${orig}: ${stderr} ${stdout}")
endif()
endfunction(make_symlink)