[PATCH] Add LZMA Module

Mario Bensi mbensi at ipsquad.net
Sun May 6 08:07:22 EDT 2012


---
 Modules/FindLibLZMA.cmake |   45 +++++++++++++++++++++++++++++++++++++=
++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 Modules/FindLibLZMA.cmake

diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
new file mode 100644
index 0000000..1a341b2
--- /dev/null
+++ b/Modules/FindLibLZMA.cmake
@@ -0,0 +1,45 @@
+# - Find LibLZMA
+# Find LibLZMA headers and library
+#
+#  LIBLZMA_FOUND             - True if liblzma is found.
+#  LIBLZMA_INCLUDE_DIRS      - Directory where liblzma headers are loc=
ated.
+#  LIBLZMA_LIBRARIES         - Lzma libraries to link against.
+#  LIBLZMA_HAS_AUTO_DECODER  - True if lzma_auto_decoder() is found (r=
equired).
+#  LIBLZMA_HAS_EASY_ENCODER  - True if lzma_easy_encoder() is found (r=
equired).
+#  LIBLZMA_HAS_LZMA_PRESET   - True if lzma_lzma_preset() is found (re=
quired).
+
+
+# Copyright (c) 2008, Per =C3=98yvind Karlsen, <peroyvind at mandriva.org=
>
+# Copyright (c) 2009, Alexander Neundorf, <neundorf at kde.org>
+# Copyright (c) 2009, Helio Chissini de Castro, <helio at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD =
license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h )
+FIND_LIBRARY(LIBLZMA_LIBRARY lzma)
+
+SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
+SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
+
+
+# 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_LIBRARIES)
+   INCLUDE(CheckLibraryExists)
+   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_auto_decoder "" LIBL=
ZMA_HAS_AUTO_DECODER)
+   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_easy_encoder "" LIBL=
ZMA_HAS_EASY_ENCODER)
+   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_lzma_preset "" LIBLZ=
MA_HAS_LZMA_PRESET)
+ENDIF (LIBLZMA_LIBRARIES)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLZMA  DEFAULT_MSG  LIBLZMA_INCLUD=
E_DIR=20
+                                                        LIBLZMA_LIBRAR=
Y
+                                                        LIBLZMA_HAS_AU=
TO_DECODER
+                                                        LIBLZMA_HAS_EA=
SY_ENCODER
+                                                        LIBLZMA_HAS_LZ=
MA_PRESET
+                                 )
+
+MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
--=20
1.7.7

--nextPart1391628.IsaV6AFGJs
Content-Disposition: attachment; filename="FindLibLZMA.cmake"
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-cmake; charset="utf-8"; name="FindLibLZMA.cmake"

# - Find LibLZMA
# Find LibLZMA headers and library
#
#  LIBLZMA_FOUND             - True if liblzma is found.
#  LIBLZMA_INCLUDE_DIRS      - Directory where liblzma headers are loca=
ted.
#  LIBLZMA_LIBRARIES         - Lzma libraries to link against.
#  LIBLZMA_HAS_AUTO_DECODER  - True if lzma_auto_decoder() is found (re=
quired).
#  LIBLZMA_HAS_EASY_ENCODER  - True if lzma_easy_encoder() is found (re=
quired).
#  LIBLZMA_HAS_LZMA_PRESET   - True if lzma_lzma_preset() is found (req=
uired).


# Copyright (c) 2008, Per =C3=98yvind Karlsen, <peroyvind at mandriva.org>=

# Copyright (c) 2009, Alexander Neundorf, <neundorf at kde.org>
# Copyright (c) 2009, Helio Chissini de Castro, <helio at kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD l=
icense.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h )
FIND_LIBRARY(LIBLZMA_LIBRARY lzma)

SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})


# 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_LIBRARIES)
   INCLUDE(CheckLibraryExists)
   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_auto_decoder "" LIBLZ=
MA_HAS_AUTO_DECODER)
   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_easy_encoder "" LIBLZ=
MA_HAS_EASY_ENCODER)
   CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_lzma_preset "" LIBLZM=
A_HAS_LZMA_PRESET)
ENDIF (LIBLZMA_LIBRARIES)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLZMA  DEFAULT_MSG  LIBLZMA_INCLUDE=
_DIR=20
                                                        LIBLZMA_LIBRARY=

                                                        LIBLZMA_HAS_AUT=
O_DECODER
                                                        LIBLZMA_HAS_EAS=
Y_ENCODER
                                                        LIBLZMA_HAS_LZM=
A_PRESET
                                 )

MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
--nextPart1391628.IsaV6AFGJs--



More information about the CMake mailing list