mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 22:10:32 +00:00
86578eccf2
Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
67 lines
3.1 KiB
CMake
67 lines
3.1 KiB
CMake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
#.rst:
|
|
# FindLibLZMA
|
|
# -----------
|
|
#
|
|
# Find LibLZMA
|
|
#
|
|
# Find LibLZMA headers and library
|
|
#
|
|
# ::
|
|
#
|
|
# LIBLZMA_FOUND - True if liblzma is found.
|
|
# LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located.
|
|
# LIBLZMA_LIBRARIES - Lzma libraries to link against.
|
|
# LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required).
|
|
# LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required).
|
|
# LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required).
|
|
# LIBLZMA_VERSION_MAJOR - The major version of lzma
|
|
# LIBLZMA_VERSION_MINOR - The minor version of lzma
|
|
# LIBLZMA_VERSION_PATCH - The patch version of lzma
|
|
# LIBLZMA_VERSION_STRING - version number as a string (ex: "5.0.3")
|
|
|
|
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
|
|
find_library(LIBLZMA_LIBRARY lzma)
|
|
|
|
if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
|
|
file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+")
|
|
|
|
string(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}")
|
|
string(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}")
|
|
string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}")
|
|
|
|
set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}")
|
|
unset(LIBLZMA_HEADER_CONTENTS)
|
|
endif()
|
|
|
|
# We're using new code known now as XZ, even library still been called LZMA
|
|
# it can be found in http://tukaani.org/xz/
|
|
# Avoid using old codebase
|
|
if (LIBLZMA_LIBRARY)
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
|
|
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
|
set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
|
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
|
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
|
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
|
|
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
|
endif ()
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR
|
|
LIBLZMA_LIBRARY
|
|
LIBLZMA_HAS_AUTO_DECODER
|
|
LIBLZMA_HAS_EASY_ENCODER
|
|
LIBLZMA_HAS_LZMA_PRESET
|
|
VERSION_VAR LIBLZMA_VERSION_STRING
|
|
)
|
|
|
|
if (LIBLZMA_FOUND)
|
|
set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
|
|
set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
|
|
endif ()
|
|
|
|
mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
|