Changed windows install path which is now all in a single folder. Added make uninstall target: removes all files that were installed but leaves runtime generated files (db) and directories. Added make purge: removes everything, not leaving a trace on the disk.

This commit is contained in:
cen 2014-08-12 16:36:11 +02:00
parent 833a6e0273
commit 12b9374295
5 changed files with 110 additions and 9 deletions

View file

@ -62,3 +62,21 @@ if(WITH_LUA)
endif(WITH_LUA)
ENABLE_TESTING()
# uninstall target
configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}/cmake_uninstall.cmake)
# purge target
configure_file(
"${CMAKE_MODULE_PATH}/cmake_purge.cmake.in"
"${CMAKE_MODULE_PATH}/cmake_purge.cmake"
IMMEDIATE @ONLY)
add_custom_target(purge
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}/cmake_purge.cmake)

View file

@ -25,9 +25,9 @@ set(MANDIR ${MAN_INSTALL_DIR})
# set default hardcoded config paths
if(WIN32)
set(BNETD_DEFAULT_CONF_FILE "conf/bnetd.conf")
set(D2CS_DEFAULT_CONF_FILE "conf/d2cs.conf")
set(D2DBS_DEFAULT_CONF_FILE "conf/d2dbs.conf")
set(BNETD_DEFAULT_CONF_FILE "../conf/bnetd.conf")
set(D2CS_DEFAULT_CONF_FILE "../conf/d2cs.conf")
set(D2DBS_DEFAULT_CONF_FILE "../conf/d2dbs.conf")
else(WIN32)
set(BNETD_DEFAULT_CONF_FILE "${SYSCONFDIR}/bnetd.conf")
set(D2CS_DEFAULT_CONF_FILE "${SYSCONFDIR}/d2cs.conf")

View file

@ -83,7 +83,7 @@ SET(LOCALE_INSTALL_DIR
if(WIN32)
SET(SYSCONF_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}conf"
"${EXEC_INSTALL_PREFIX}/conf"
CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default conf)"
FORCE
)
@ -106,8 +106,17 @@ SET(INFO_INSTALL_DIR
FORCE
)
if(WIN32)
SET(LOCALSTATE_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/var/${APPLICATION_NAME}"
"${EXEC_INSTALL_PREFIX}/var"
CACHE PATH "The ${APPLICATION_NAME} local state install dir (default prefix/var)"
FORCE
)
else(WIN32)
SET(LOCALSTATE_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/var/${APPLICATION_NAME}"
CACHE PATH "The ${APPLICATION_NAME} local state install dir (default prefix/var)"
FORCE
)
endif(WIN32)

View file

@ -0,0 +1,53 @@
if(WIN32)
message(STATUS "Uninstalling \"@EXEC_INSTALL_PREFIX@\"")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove_directory \"@EXEC_INSTALL_PREFIX@\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"@EXEC_INSTALL_PREFIX@\"")
endif(NOT "${rm_retval}" STREQUAL 0)
else(WIN32)
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
#remove directories
message(STATUS "Uninstalling \"@SYSCONF_INSTALL_DIR@\"")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove_directory \"@SYSCONF_INSTALL_DIR@\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"@SYSCONF_INSTALL_DIR@\"")
endif(NOT "${rm_retval}" STREQUAL 0)
message(STATUS "Uninstalling \"@LOCALSTATE_INSTALL_DIR@\"")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove_directory \"@LOCALSTATE_INSTALL_DIR@\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"@LOCALSTATE_INSTALL_DIR@\"")
endif(NOT "${rm_retval}" STREQUAL 0)
endif(WIN32)

View file

@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)