CMake: Add XZ_TOOL_SCRIPTS

This commit is contained in:
Lasse Collin 2024-06-15 18:07:04 +03:00
parent d274a2bc00
commit 5d5c92b262
1 changed files with 29 additions and 15 deletions

View File

@ -2051,6 +2051,9 @@ endif()
############################################################################# #############################################################################
if(UNIX) if(UNIX)
option(XZ_TOOL_SCRIPTS "Install the scripts \
xzdiff, xzgrep, xzmore, xzless, and their symlinks" ON)
# NOTE: This isn't as sophisticated as in the Autotools build which # NOTE: This isn't as sophisticated as in the Autotools build which
# uses posix-shell.m4 but hopefully this doesn't need to be either. # uses posix-shell.m4 but hopefully this doesn't need to be either.
# CMake likely won't be used on as many (old) obscure systems as the # CMake likely won't be used on as many (old) obscure systems as the
@ -2095,9 +2098,11 @@ if(UNIX)
@ONLY @ONLY
NEWLINE_STYLE LF) NEWLINE_STYLE LF)
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${S}" if(XZ_TOOL_SCRIPTS)
DESTINATION "${CMAKE_INSTALL_BINDIR}" install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${S}"
COMPONENT scripts_Runtime) DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT scripts_Runtime)
endif()
endforeach() endforeach()
# file(CHMOD ...) would need CMake 3.19 so use execute_process instead. # file(CHMOD ...) would need CMake 3.19 so use execute_process instead.
@ -2110,22 +2115,31 @@ if(UNIX)
unset(POSIX_SHELL) unset(POSIX_SHELL)
unset(enable_path_for_scripts) unset(enable_path_for_scripts)
my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}" xzdiff "" if(XZ_TOOL_SCRIPTS)
"${XZDIFF_LINKS}") my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}"
xzdiff "" "${XZDIFF_LINKS}")
my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}" xzgrep "" my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}"
"${XZGREP_LINKS}") xzgrep "" "${XZGREP_LINKS}")
my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}" xzmore "" my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}"
"${XZMORE_LINKS}") xzmore "" "${XZMORE_LINKS}")
my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}" xzless "" my_install_symlinks(scripts_Runtime "${CMAKE_INSTALL_BINDIR}"
"${XZLESS_LINKS}") xzless "" "${XZLESS_LINKS}")
my_install_man(scripts_Documentation src/scripts/xzdiff.1 "${XZDIFF_LINKS}") my_install_man(scripts_Documentation
my_install_man(scripts_Documentation src/scripts/xzgrep.1 "${XZGREP_LINKS}") src/scripts/xzdiff.1 "${XZDIFF_LINKS}")
my_install_man(scripts_Documentation src/scripts/xzmore.1 "${XZMORE_LINKS}")
my_install_man(scripts_Documentation src/scripts/xzless.1 "${XZLESS_LINKS}") my_install_man(scripts_Documentation
src/scripts/xzgrep.1 "${XZGREP_LINKS}")
my_install_man(scripts_Documentation
src/scripts/xzmore.1 "${XZMORE_LINKS}")
my_install_man(scripts_Documentation
src/scripts/xzless.1 "${XZLESS_LINKS}")
endif()
endif() endif()