From d4a9e334d3d65b2d65097e7c202db52b4a9c0509 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 13 Jan 2012 14:05:36 -0500 Subject: [PATCH] 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 . --- Utilities/cmThirdParty.h.in | 1 + Utilities/cm_bzlib.h | 23 +++++++++++++++++++ .../archive_read_support_filter_bzip2.c | 2 +- .../archive_read_support_format_7zip.c | 2 +- .../archive_read_support_format_xar.c | 2 +- .../archive_write_add_filter_bzip2.c | 2 +- .../archive_write_set_format_7zip.c | 2 +- .../libarchive/archive_write_set_format_xar.c | 2 +- 8 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 Utilities/cm_bzlib.h diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index daf811412..c8240850e 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 000000000..d1fffa1aa --- /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 +#else +# include +#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 8d5bd1c4a..af618b09a 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 #endif #ifdef HAVE_BZLIB_H -#include +#include #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 1580c9245..2be226726 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 #endif #ifdef HAVE_BZLIB_H -#include +#include #endif #ifdef HAVE_LZMA_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c index 00f283d7c..0834e6fc3 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 #endif #ifdef HAVE_BZLIB_H -#include +#include #endif #if HAVE_LZMA_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c index e0d07a9ff..096a6a4c7 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 #endif #ifdef HAVE_BZLIB_H -#include +#include #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 ce3298b4c..5bb248c55 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 #ifdef HAVE_BZLIB_H -#include +#include #endif #if HAVE_LZMA_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c index 0f003a847..96b7b2f92 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 #endif #ifdef HAVE_BZLIB_H -#include +#include #endif #if HAVE_LZMA_H #include