Fix write permission check

This commit is contained in:
Matthias Hochsteger 2017-01-10 18:45:49 +01:00
parent b9018982e1
commit 2b16f9994f

View File

@ -53,13 +53,14 @@ else(APPLE)
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
endif(APPLE)
if(UNIX)
# check for write permissions in install directory
message("Checking for write permissions in install directory...")
execute_process(COMMAND mkdir -p ${INSTALL_DIR})
execute_process(COMMAND test -w ${INSTALL_DIR} RESULT_VARIABLE res)
IF(res)
if(res)
message("No write permissions on install directory ${INSTALL_DIR}")
message("The setup routine will now set write permissions by executing following commands, please provide your password when asked for:")
message("sudo mkdir -p ${INSTALL_DIR}")
message("sudo chown -r $ENV{USER}:$ENV{USER} ${INSTALL_DIR}")
message("The setup routine will now set write permissions by executing following commands, please provide your password when asked for it")
message("> sudo mkdir -p ${INSTALL_DIR}")
message("> sudo chown -r $ENV{USER}:$ENV{USER} ${INSTALL_DIR}")
execute_process(COMMAND sudo mkdir -p ${INSTALL_DIR})
execute_process(COMMAND sudo chown -R $ENV{USER}:$ENV{USER} ${INSTALL_DIR})
endif()