QtDialog: Add option to control XDG file install destination

Create a `CMAKE_XDGDATA_DIR` option and add a corresponding flag to the
`bootstrap` script.  This is needed for multiarch layouts where the
prefix is `/usr/${host}` but where architecture-independent files (like
the XDG-specific ones) are installed to `/usr/share`.
This commit is contained in:
Niels Ole Salscheider 2015-12-21 16:02:11 +01:00 committed by Brad King
parent ba88bfcf21
commit 7656662148
3 changed files with 15 additions and 3 deletions

View File

@ -3,24 +3,29 @@ if(BEOS)
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU
set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # HAIKU
elseif(CYGWIN) elseif(CYGWIN)
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # CYGWIN
else() else()
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER
set(CMAKE_XDGDATA_DIR_DEFAULT "share") # OTHER
endif() endif()
set(CMAKE_DATA_DIR_DESC "data") set(CMAKE_DATA_DIR_DESC "data")
set(CMAKE_DOC_DIR_DESC "docs") set(CMAKE_DOC_DIR_DESC "docs")
set(CMAKE_MAN_DIR_DESC "man pages") set(CMAKE_MAN_DIR_DESC "man pages")
set(CMAKE_XDGDATA_DIR_DESC "XDG specific files")
foreach(v foreach(v
CMAKE_DATA_DIR CMAKE_DATA_DIR
CMAKE_DOC_DIR CMAKE_DOC_DIR
CMAKE_MAN_DIR CMAKE_MAN_DIR
CMAKE_XDGDATA_DIR
) )
# Populate the cache with empty values so we know when the user sets them. # Populate the cache with empty values so we know when the user sets them.
set(${v} "" CACHE STRING "") set(${v} "" CACHE STRING "")

View File

@ -193,7 +193,7 @@ if(UNIX AND NOT APPLE)
foreach (size IN ITEMS 32 128) foreach (size IN ITEMS 32 128)
install( install(
FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png"
DESTINATION "share/icons/hicolor/${size}x${size}/apps" DESTINATION "${CMAKE_XDGDATA_DIR}/icons/hicolor/${size}x${size}/apps"
${COMPONENT} ${COMPONENT}
RENAME "CMakeSetup.png") RENAME "CMakeSetup.png")
endforeach () endforeach ()
@ -201,10 +201,10 @@ if(UNIX AND NOT APPLE)
# install a desktop file so CMake appears in the application start menu # install a desktop file so CMake appears in the application start menu
# with an icon # with an icon
install(FILES CMake.desktop install(FILES CMake.desktop
DESTINATION share/applications DESTINATION "${CMAKE_XDGDATA_DIR}/applications"
${COMPONENT}) ${COMPONENT})
install(FILES cmakecache.xml install(FILES cmakecache.xml
DESTINATION share/mime/packages DESTINATION "${CMAKE_XDGDATA_DIR}/mime/packages"
${COMPONENT}) ${COMPONENT})
endif() endif()

View File

@ -63,9 +63,11 @@ cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.tx
cmake_data_dir_keyword="OTHER" cmake_data_dir_keyword="OTHER"
cmake_doc_dir_keyword="OTHER" cmake_doc_dir_keyword="OTHER"
cmake_man_dir_keyword="OTHER" cmake_man_dir_keyword="OTHER"
cmake_xdgdata_dir_keyword="OTHER"
cmake_data_dir="" cmake_data_dir=""
cmake_doc_dir="" cmake_doc_dir=""
cmake_man_dir="" cmake_man_dir=""
cmake_xdgdata_dir=""
cmake_init_file="" cmake_init_file=""
cmake_bootstrap_system_libs="" cmake_bootstrap_system_libs=""
cmake_bootstrap_qt_gui="" cmake_bootstrap_qt_gui=""
@ -214,6 +216,7 @@ fi
cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`" cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`" cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`" cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc" CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como " CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
@ -428,6 +431,8 @@ Directory and file names:
['"${cmake_doc_dir_default}"'] ['"${cmake_doc_dir_default}"']
--mandir=DIR install man pages files in PREFIX/DIR/manN --mandir=DIR install man pages files in PREFIX/DIR/manN
['"${cmake_man_dir_default}"'] ['"${cmake_man_dir_default}"']
--xdgdatadir=DIR install XDG specific files in PREFIX/DIR
['"${cmake_xdgdata_dir_default}"']
' '
exit 10 exit 10
} }
@ -616,6 +621,7 @@ while test $# != 0; do
--datadir=*) cmake_data_dir=`cmake_arg "$1"` ;; --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
--docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;; --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
--mandir=*) cmake_man_dir=`cmake_arg "$1"` ;; --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
--xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
--init=*) cmake_init_file=`cmake_arg "$1"` ;; --init=*) cmake_init_file=`cmake_arg "$1"` ;;
--system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
--no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
@ -1368,6 +1374,7 @@ set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path pre
set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
# Add configuration settings given as command-line options. # Add configuration settings given as command-line options.