Make install locations configuration variables

Locations  of various  components  to be  determined at  configuration
time.   This  allows   various   "Standard"  system   layouts  to   be
accomodated. For example on FreeBSD the manpages are usually installed
in the man directory i.e. /usr/local/man whereas the WSJT-X default is
to install them in share/man i.e. /usr/share/man. By setting the CMake
variable  WSJT_MANPAGE_DESTINATION to  either a  relative or  absolute
path the install location can be set:

  $ cmake -D WSJT_MANPAGE_DESTINATION=. ...

will install the manpages at ${CMAKE_INSTALL_PREFIX}/man

The new configuration variables are:

 WSJT_BIN_DESTINATION
 WSJT_LIB_DESTINATION
 WSJT_SHARE_DESTINATION
 WSJT_DOC_DESTINATION
 WSJT_DATA_DESTINATION
 WSJT_MANPAGE_DESTINATION
 WSJT_PLUGIN_DESTINATION
 WSJT_QT_CONF_DESTINATION

NB: changes to the above may break WSJT-X at present where the install
    locations of files used directly by WSJT-X are moved.

Warning: using absolute  paths for these variables  is not recommended
as files may be installed  in unexpected places, particularly when run
with  root  privileges.  All  relative   paths  with  be  relative  to
CMAKE_INSTALL_PREFIX.

Merged from ^/branches/wsjtx.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.6@6201 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-11-29 11:19:44 +00:00
parent d77e450b85
commit 73b1b35685
3 changed files with 47 additions and 37 deletions

View File

@ -148,32 +148,40 @@ message (STATUS "******************************************************")
#
# install locations
#
set (WSJT_BIN_DESTINATION bin)
set (WSJT_LIB_DESTINATION lib)
set (WSJT_SHARE_DESTINATION share)
set (WSJT_DOC_DESTINATION doc/${CMAKE_PROJECT_NAME})
set (WSJT_DATA_DESTINATION ${CMAKE_PROJECT_NAME})
set (WSJT_MANPAGE_DESTINATION share)
set (WSJT_PLUGIN_DESTINATION lib/plugins)
set (WSJT_QT_CONF_DESTINATION bin)
set (BIN_DESTINATION bin)
set (LIB_DESTINATION lib)
set (SHARE_DESTINATION share)
set (DOC_DESTINATION ${SHARE_DESTINATION}/doc/${CMAKE_PROJECT_NAME})
set (DATA_DESTINATION ${SHARE_DESTINATION}/${CMAKE_PROJECT_NAME})
set (MANPAGE_DESTINATION ${SHARE_DESTINATION})
set (PLUGIN_DESTINATION lib/plugins)
set (QT_CONF_DESTINATION bin)
if (WIN32)
set (WSJT_SHARE_DESTINATION bin)
set (WSJT_DOC_DESTINATION doc)
set (WSJT_DATA_DESTINATION data)
set (WSJT_PLUGIN_DESTINATION plugins)
set (SHARE_DESTINATION bin)
set (DOC_DESTINATION ${SHARE_DESTINATION}/doc)
set (DATA_DESTINATION ${SHARE_DESTINATION}/data)
set (PLUGIN_DESTINATION plugins)
endif (WIN32)
if (APPLE)
set (WSJT_BIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
set (WSJT_SHARE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_MANPAGE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_DOC_DESTINATION doc)
set (WSJT_DATA_DESTINATION data)
set (WSJT_PLUGIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/PlugIns)
set (WSJT_QT_CONF_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (BIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
set (SHARE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (MANPAGE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (DOC_DESTINATION ${SHARE_DESTINATION}/doc)
set (DATA_DESTINATION ${SHARE_DESTINATION}/data)
set (PLUGIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/PlugIns)
set (QT_CONF_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
endif (APPLE)
set (WSJT_BIN_DESTINATION ${BIN_DESTINATION} CACHE PATH "Path for executables")
set (WSJT_LIB_DESTINATION ${LIB_DESTINATION} CACHE PATH "Path for libraries")
set (WSJT_SHARE_DESTINATION ${SHARE_DESTINATION} CACHE PATH "Path for shared content")
set (WSJT_DOC_DESTINATION ${DOC_DESTINATION} CACHE PATH "Path for documentation")
set (WSJT_DATA_DESTINATION ${DATA_DESTINATION} CACHE PATH "Path for shared RO data")
set (WSJT_MANPAGE_DESTINATION ${MANPAGE_DESTINATION} CACHE PATH "Path for manpages")
set (WSJT_PLUGIN_DESTINATION ${PLUGIN_DESTINATION} CACHE PATH "Path for plugins")
set (WSJT_QT_CONF_DESTINATION ${QT_CONF_DESTINATION} CACHE PATH "Path for the qt.conf file")
#
# Project sources
@ -1025,13 +1033,13 @@ install (FILES
NEWS
INSTALL
BUGS
DESTINATION ${WSJT_SHARE_DESTINATION}/${WSJT_DOC_DESTINATION}
DESTINATION ${WSJT_DOC_DESTINATION}
#COMPONENT runtime
)
install (FILES
contrib/Ephemeris/JPLEPH
DESTINATION ${WSJT_SHARE_DESTINATION}/${WSJT_DATA_DESTINATION}
DESTINATION ${WSJT_DATA_DESTINATION}
#COMPONENT runtime
)
@ -1122,7 +1130,8 @@ if (NOT is_debug_build)
# install a qt.conf file
install (CODE "
file (WRITE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\"
get_filename_component (the_qt_conf \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\" REALPATH)
file (WRITE \"\${the_qt_conf}\"
\"[Paths]
\")
"
@ -1130,7 +1139,7 @@ if (NOT is_debug_build)
)
# if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
set (fixup_exe "\${CMAKE_INSTALL_PREFIX}/${WSJT_BIN_DESTINATION}/${CMAKE_PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set (fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_BIN_DESTINATION}/${CMAKE_PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
#get_filename_component (hamlib_lib_dir ${hamlib_LIBRARIES} PATH)
@ -1166,7 +1175,8 @@ if (NOT is_debug_build)
# add plugins path for Mac Bundle
install (CODE "
file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\"
get_filename_component (the_qt_conf \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\" REALPATH)
file (APPEND \"\${the_qt_conf}\"
\"Plugins = PlugIns
\")
"
@ -1213,7 +1223,8 @@ file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION
# add plugins path for WIN32
file (RELATIVE_PATH _plugins_path "${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}" "${CMAKE_INSTALL_PREFIX}/${WSJT_PLUGIN_DESTINATION}")
install (CODE "
file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\"
get_filename_component (the_qt_conf \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION}/qt.conf\" REALPATH)
file (APPEND \"\${the_qt_conf}\"
\"Plugins = ${_plugins_path}
\")
"
@ -1227,16 +1238,15 @@ file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION
list (APPEND fixup_library_dirs ${hamlib_LIBRARY_DIRS})
install (CODE "
file (GLOB_RECURSE QTPLUGINS
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_PLUGIN_DESTINATION}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH})
include (BundleUtilities)
set (BU_CHMOD_BUNDLE_ITEMS ON)
set (gp_tool ${gp_tool})
# canonicalize path in install context
get_filename_component (the_exe ${fixup_exe} REALPATH)
fixup_bundle (\"\${the_exe}\" \"\${QTPLUGINS}\" \"${fixup_library_dirs}\")
"
get_filename_component (the_path \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_PLUGIN_DESTINATION}\" REALPATH)
file (GLOB_RECURSE QTPLUGINS \"\${the_path}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH})
include (BundleUtilities)
set (BU_CHMOD_BUNDLE_ITEMS ON)
set (gp_tool ${gp_tool})
# canonicalize path in install context
get_filename_component (the_exe ${fixup_exe} REALPATH)
fixup_bundle (\"\${the_exe}\" \"\${QTPLUGINS}\" \"${fixup_library_dirs}\")"
#COMPONENT runtime
)
endif (APPLE OR WIN32)

View File

@ -34,6 +34,6 @@ configure_file (
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/${deb_changelog}.gz
${CMAKE_CURRENT_BINARY_DIR}/copyright
DESTINATION ${WSJT_SHARE_DESTINATION}/${WSJT_DOC_DESTINATION}
DESTINATION ${WSJT_DOC_DESTINATION}
#COMPONENT Debian
)

View File

@ -146,7 +146,7 @@ add_custom_target (docs ALL DEPENDS ${user_guide})
install (FILES
${user_guide}
DESTINATION ${WSJT_SHARE_DESTINATION}/${WSJT_DOC_DESTINATION}
DESTINATION ${WSJT_DOC_DESTINATION}
RENAME ${PROJECT_MANUAL}
#COMPONENT runtime
)