diff options
author | Brad King <brad.king@kitware.com> | 2012-01-13 19:05:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-01-13 19:05:36 (GMT) |
commit | d4a9e334d3d65b2d65097e7c202db52b4a9c0509 (patch) | |
tree | c412c8c5edc0a3f90c59edfcb6261bb4041a879d | |
parent | 0020fc45171c2d8b954492ea76c3b3940ebf53f3 (diff) | |
download | CMake-d4a9e334d3d65b2d65097e7c202db52b4a9c0509.zip CMake-d4a9e334d3d65b2d65097e7c202db52b4a9c0509.tar.gz CMake-d4a9e334d3d65b2d65097e7c202db52b4a9c0509.tar.bz2 |
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>.
8 files changed, 30 insertions, 6 deletions
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index daf8114..c824085 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -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 diff --git a/Utilities/cm_bzlib.h b/Utilities/cm_bzlib.h new file mode 100644 index 0000000..d1fffa1 --- /dev/null +++ b/Utilities/cm_bzlib.h @@ -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 diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c index 8d5bd1c..af618b0 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c @@ -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" diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c index 1580c92..2be2267 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c @@ -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> diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c index 00f283d..0834e6f 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c @@ -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> diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c index e0d07a9..096a6a4 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c @@ -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" diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c index ce3298b..5bb248c 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c @@ -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> diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c index 0f003a8..96b7b2f 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c @@ -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> |