check for write permissions at INSTALL_DIR on Unix platforms

This commit is contained in:
Matthias Hochsteger 2017-01-10 12:01:48 +01:00
parent 77dde0977b
commit d557e59a69
2 changed files with 16 additions and 5 deletions

View File

@ -248,11 +248,6 @@ endif(INSTALL_PROFILES)
#######################################################################
if(INSTALL_DEPENDENCIES)
include (InstallRequiredSystemLibraries)
# find_library(LIBGOMP NAMES gomp.1)
# find_library(LIBSTDCXX NAMES stdc++.6)
# find_library(LIBGCCS NAMES gcc_s.1)
# install( FILES "${Boost_LIBRARIES}" ${LIBGOMP} ${LIBSTDCXX} ${LIBGCCS} DESTINATION ${ng_install_dir_lib} COMPONENT netgen )
# install( FILES "${Boost_LIBRARIES}" DESTINATION ${ng_install_dir_lib} COMPONENT netgen )
get_filename_component(MY_LIB_DIR ${TK_LIBRARY} DIRECTORY)
if(APPLE)
if(TIX_LIBRARY)

View File

@ -51,6 +51,22 @@ if(APPLE)
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
execute_process(COMMAND test -w ${INSTALL_DIR} RESULT_VARIABLE 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}")
execute_process(COMMAND sudo mkdir -p ${INSTALL_DIR})
execute_process(COMMAND sudo chown -R $ENV{USER}:$ENV{USER} ${INSTALL_DIR})
endif()
execute_process(COMMAND test -w ${INSTALL_DIR} RESULT_VARIABLE res)
if(res)
message(WARNING "still no write access at install directory, please set permissions manually")
endif()
endif(UNIX)
if(NOT WIN32)
find_package(ZLIB REQUIRED)