Warning, /frameworks/extra-cmake-modules/find-modules/Find7Zip.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2019, 2021, 2023 Friedrich W. H. Kossebau <kossebau@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004
0005 #[=======================================================================[.rst:
0006 Find7Zip
0007 --------
0008
0009 Try to find 7-Zip.
0010
0011 If the 7-Zip executable is not in your PATH, you can provide
0012 an alternative name or full path location with the ``7Zip_EXECUTABLE``
0013 variable.
0014
0015 This will define the following variables:
0016
0017 ``7Zip_FOUND``
0018 TRUE if 7-Zip is available
0019
0020 ``7Zip_EXECUTABLE``
0021 Path to 7-Zip executable
0022
0023 If ``7Zip_FOUND`` is TRUE, it will also define the following imported
0024 target:
0025
0026 ``7Zip::7Zip``
0027 Path to 7-Zip executable
0028
0029 .. note::
0030 It will see to only find the original 7-Zip, not one of the p7zip forks.
0031
0032 Since 5.113.0.
0033 #]=======================================================================]
0034
0035 if(WIN32)
0036 find_program(7Zip_EXECUTABLE NAMES 7z 7za)
0037 else()
0038 # Some p7zip used to be a fork for Linux of older 7-Zip,
0039 # just supporting the 7z format, and occupied the 7z binary name.
0040 # When 7-Zip got its official Linux support, it chose 7zz to not conflict,
0041 # given it also has another set of arguments.
0042 # Later p7zip was forked once more into some p7zip-zstd, using a newer copy of 7-Zip,
0043 # supporting more than 7z format, therefore also many of the arguments known from 7-Zip.
0044 # Being a different project though and now a real fork due to 7-Zip supporting Linux,
0045 # we try to only find the original here, so consumers can rely on the original 7-Zip documentation.
0046 find_program(7Zip_EXECUTABLE NAMES 7zz)
0047 endif()
0048
0049 include(FindPackageHandleStandardArgs)
0050 find_package_handle_standard_args(7Zip
0051 FOUND_VAR
0052 7Zip_FOUND
0053 REQUIRED_VARS
0054 7Zip_EXECUTABLE
0055 )
0056 mark_as_advanced(7Zip_EXECUTABLE)
0057
0058 if(NOT TARGET 7Zip::7Zip AND 7Zip_FOUND)
0059 add_executable(7Zip::7Zip IMPORTED)
0060 set_target_properties(7Zip::7Zip PROPERTIES
0061 IMPORTED_LOCATION "${7Zip_EXECUTABLE}"
0062 )
0063 endif()
0064
0065 include(FeatureSummary)
0066 set_package_properties(7Zip PROPERTIES
0067 URL "https://www.7-zip.org/"
0068 DESCRIPTION "Data (de)compression program"
0069 )