diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a34d94..de972f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required( VERSION 2.8.2 ) project( zbackup ) -set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ) +list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ) set( CMAKE_BUILD_TYPE Release ) @@ -18,11 +18,11 @@ find_package( Protobuf REQUIRED ) include_directories( ${PROTOBUF_INCLUDE_DIRS} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) -find_program(PROTOBUF_PROTOC_CHECK NAMES protoc DOC "Protobuf compiler binary") +find_program( PROTOBUF_PROTOC_CHECK NAMES protoc DOC "Protobuf compiler binary" ) -IF(${PROTOBUF_PROTOC_CHECK} STREQUAL "PROTOBUF_PROTOC_CHECK-NOTFOUND") - MESSAGE(FATAL_ERROR "Could not find protobuf compiler. Make sure protobuf-compiler package is installed.") -ENDIF(${PROTOBUF_PROTOC_CHECK} STREQUAL "PROTOBUF_PROTOC_CHECK-NOTFOUND") +IF( ${PROTOBUF_PROTOC_CHECK} STREQUAL "PROTOBUF_PROTOC_CHECK-NOTFOUND" ) + MESSAGE( FATAL_ERROR "Could not find protobuf compiler. Make sure protobuf-compiler package is installed." ) +ENDIF( ${PROTOBUF_PROTOC_CHECK} STREQUAL "PROTOBUF_PROTOC_CHECK-NOTFOUND" ) PROTOBUF_GENERATE_CPP( protoSrcs protoHdrs zbackup.proto ) @@ -32,12 +32,12 @@ find_package( LibLZMA REQUIRED ) include_directories( ${LIBLZMA_INCLUDE_DIRS} ) find_package( LibLZO COMPONENTS LIBLZO_HAS_LZO1X_DECOMPRESS_SAFE LIBLZO_HAS_LZO1X_1_COMPRESS ) -if (LIBLZO_FOUND) - ADD_DEFINITIONS(-DHAVE_LIBLZO) +if ( LIBLZO_FOUND ) + ADD_DEFINITIONS( -DHAVE_LIBLZO ) include_directories( ${LIBLZO_INCLUDE_DIRS} ) -else (LIBLZO_FOUND) - set(LIBLZO_LIBRARIES) -endif (LIBLZO_FOUND) +else ( LIBLZO_FOUND ) + set( LIBLZO_LIBRARIES ) +endif( LIBLZO_FOUND ) file( GLOB sourceFiles "*.cc" ) add_executable( zbackup ${sourceFiles} ${protoSrcs} ${protoHdrs} ) diff --git a/cmake/FindLibLZMA.cmake b/cmake/FindLibLZMA.cmake index ad3c76c..5a2c67d 100644 --- a/cmake/FindLibLZMA.cmake +++ b/cmake/FindLibLZMA.cmake @@ -1,16 +1,23 @@ -# - Find LibLZMA +#.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") +# :: +# +# 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") #============================================================================= # Copyright 2008 Per Øyvind Karlsen @@ -18,65 +25,15 @@ # Copyright 2009 Helio Chissini de Castro # Copyright 2012 Mario Bensi # -# Distributed under the OSI-approved BSD License (the "License"): +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. # -# CMake - Cross Platform Makefile Generator -# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ------------------------------------------------------------------------------ -# -# The above copyright and license notice applies to distributions of -# CMake in source and binary form. Some source files contain additional -# notices of original copyright by their contributors; see each source -# for details. Third-party software packages supplied with CMake under -# compatible licenses provide their own copyright notices documented in -# corresponding subdirectories. -# -# ------------------------------------------------------------------------------ -# -# CMake was initially developed by Kitware with the following sponsorship: -# -# * National Library of Medicine at the National Institutes of Health -# as part of the Insight Segmentation and Registration Toolkit (ITK). -# -# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel -# Visualization Initiative. -# -# * National Alliance for Medical Image Computing (NAMIC) is funded by the -# National Institutes of Health through the NIH Roadmap for Medical Research, -# Grant U54 EB005149. -# -# * Kitware, Inc. +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. #============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) find_path(LIBLZMA_INCLUDE_DIR lzma.h ) @@ -98,17 +55,21 @@ endif() # Avoid using old codebase if (LIBLZMA_LIBRARY) include(CheckLibraryExists) + 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(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA DEFAULT_MSG LIBLZMA_INCLUDE_DIR - LIBLZMA_LIBRARY - LIBLZMA_HAS_AUTO_DECODER - LIBLZMA_HAS_EASY_ENCODER - LIBLZMA_HAS_LZMA_PRESET +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) diff --git a/cmake/FindLibLZO.cmake b/cmake/FindLibLZO.cmake index 9cf9ea2..86a30c3 100644 --- a/cmake/FindLibLZO.cmake +++ b/cmake/FindLibLZO.cmake @@ -1,84 +1,38 @@ -# - Find LibLZO +#.rst: +# FindLibLZO +# ----------- +# +# Find LibLZO +# # Find LibLZO headers and library # -# LIBLZO_FOUND - True if liblzo is found. -# LIBLZO_INCLUDE_DIRS - Directory where liblzo headers are located. -# LIBLZO_LIBRARIES - Lzma libraries to link against. -# LIBLZO_HAS_AUTO_DECODER - True if lzo_auto_decoder() is found (required). -# LIBLZO_HAS_EASY_ENCODER - True if lzo_easy_encoder() is found (required). -# LIBLZO_HAS_LZO_PRESET - True if lzo_lzo_preset() is found (required). -# LIBLZO_VERSION_MAJOR - The major version of lzo -# LIBLZO_VERSION_MINOR - The minor version of lzo -# LIBLZO_VERSION_PATCH - The patch version of lzo -# LIBLZO_VERSION_STRING - version number as a string (ex: "5.0.3") +# :: +# +# LIBLZO_FOUND - True if liblzo is found. +# LIBLZO_INCLUDE_DIRS - Directory where liblzo headers are located. +# LIBLZO_LIBRARIES - Lzo libraries to link against. +# LIBLZO_HAS_LZO1X_DECOMPRESS_SAFE - True if lzo1x_decompress_safe() is found (required). +# LIBLZO_HAS_LZO1X_1_COMPRESS - True if lzo1x_1_compress() is found (required). +# LIBLZO_VERSION_STRING - version number as a string (ex: "5.0.3") #============================================================================= # Copyright 2008 Per Øyvind Karlsen # Copyright 2009 Alexander Neundorf # Copyright 2009 Helio Chissini de Castro # Copyright 2012 Mario Bensi -# Copyright 2012-2014 Konstantin Isakov and ZBackup -# contributors, see CONTRIBUTORS +# Copyright 2012-2014 Konstantin Isakov +# Copyright 2013 Benjamin Koch (from lzma to lzo) +# Copyright 2014 Vladimir Stackov # -# Distributed under the OSI-approved BSD License (the "License"): +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. # -# CMake - Cross Platform Makefile Generator -# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ------------------------------------------------------------------------------ -# -# The above copyright and license notice applies to distributions of -# CMake in source and binary form. Some source files contain additional -# notices of original copyright by their contributors; see each source -# for details. Third-party software packages supplied with CMake under -# compatible licenses provide their own copyright notices documented in -# corresponding subdirectories. -# -# ------------------------------------------------------------------------------ -# -# CMake was initially developed by Kitware with the following sponsorship: -# -# * National Library of Medicine at the National Institutes of Health -# as part of the Insight Segmentation and Registration Toolkit (ITK). -# -# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel -# Visualization Initiative. -# -# * National Alliance for Medical Image Computing (NAMIC) is funded by the -# National Institutes of Health through the NIH Roadmap for Medical Research, -# Grant U54 EB005149. -# -# * Kitware, Inc. +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. #============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) find_path(LIBLZO_INCLUDE_DIR lzo/lzo1x.h ) @@ -93,15 +47,19 @@ endif() # We're just using two functions. if (LIBLZO_LIBRARY) include(CheckLibraryExists) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS(${LIBLZO_LIBRARY} lzo1x_decompress_safe "" LIBLZO_HAS_LZO1X_DECOMPRESS_SAFE) CHECK_LIBRARY_EXISTS(${LIBLZO_LIBRARY} lzo1x_1_compress "" LIBLZO_HAS_LZO1X_1_COMPRESS) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZO DEFAULT_MSG LIBLZO_INCLUDE_DIR - LIBLZO_LIBRARY - LIBLZO_HAS_LZO1X_DECOMPRESS_SAFE - LIBLZO_HAS_LZO1X_1_COMPRESS +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZO REQUIRED_VARS LIBLZO_INCLUDE_DIR + LIBLZO_LIBRARY + LIBLZO_HAS_LZO1X_DECOMPRESS_SAFE + LIBLZO_HAS_LZO1X_1_COMPRESS + VERSION_VAR LIBLZO_VERSION_STRING ) if (LIBLZO_FOUND)