Include bzlib.h consistently across CMake build (#10950)

Use the approach originally used in commit f91b3c1d (Add options to
build with system utility libraries, 2006-10-19) for all other
third-party libraries.  Create a "cm_bzlib.h" header wrapper that
robustly includes the header from the bzip2 library chosen for the CMake
build (either builtin or system version).  Include the header wrapper
anywhere we need the API provided by <bzlib.h>.
This commit is contained in:
Brad King 2012-01-13 14:05:36 -05:00
parent 0020fc4517
commit d4a9e334d3
8 changed files with 30 additions and 6 deletions

View File

@ -16,6 +16,7 @@
#cmakedefine CMAKE_USE_SYSTEM_CURL
#cmakedefine CMAKE_USE_SYSTEM_EXPAT
#cmakedefine CMAKE_USE_SYSTEM_ZLIB
#cmakedefine CMAKE_USE_SYSTEM_BZIP2
#cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE
#cmakedefine CTEST_USE_XMLRPC

23
Utilities/cm_bzlib.h Normal file
View File

@ -0,0 +1,23 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
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.
============================================================================*/
#ifndef __cm_bzlib_h
#define __cm_bzlib_h
/* Use the bzip2 library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_BZIP2
# include <bzlib.h>
#else
# include <cmbzip2/bzlib.h>
#endif
#endif

View File

@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#include "archive.h"

View File

@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#ifdef HAVE_LZMA_H
#include <lzma.h>

View File

@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <expat.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#if HAVE_LZMA_H
#include <lzma.h>

View File

@ -38,7 +38,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_bzip2.c 20
#include <string.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#include "archive.h"

View File

@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
#endif
#include <stdlib.h>
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#if HAVE_LZMA_H
#include <lzma.h>

View File

@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
#include <libxml/xmlwriter.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#include <cm_bzlib.h>
#endif
#if HAVE_LZMA_H
#include <lzma.h>