diff options
author | Brad King <brad.king@kitware.com> | 2006-10-19 19:00:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-10-19 19:00:10 (GMT) |
commit | f91b3c1daaeacd79b36644ce9a2610b31e9d964c (patch) | |
tree | f4d1fb12d71e40359e425cb29fffa783146e45c2 /Utilities/cmtar | |
parent | de007ef199190c84c0f53ac106c282fc190f5df1 (diff) | |
download | CMake-f91b3c1daaeacd79b36644ce9a2610b31e9d964c.zip CMake-f91b3c1daaeacd79b36644ce9a2610b31e9d964c.tar.gz CMake-f91b3c1daaeacd79b36644ce9a2610b31e9d964c.tar.bz2 |
ENH: Add options to build with system utility libraries. Organize inclusion of third party libraries into a single header per library. This addresses bug#3653.
Diffstat (limited to 'Utilities/cmtar')
-rw-r--r-- | Utilities/cmtar/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Utilities/cmtar/config.h.in | 5 | ||||
-rw-r--r-- | Utilities/cmtar/libtar.c | 21 |
3 files changed, 16 insertions, 21 deletions
diff --git a/Utilities/cmtar/CMakeLists.txt b/Utilities/cmtar/CMakeLists.txt index a54e629..4b4ce40 100644 --- a/Utilities/cmtar/CMakeLists.txt +++ b/Utilities/cmtar/CMakeLists.txt @@ -367,11 +367,18 @@ ENDIF(NOT HAVE_FNMATCH) #SET(NEED_GLOB 1) #ENDIF(NOT HAVE_GLOB) +# Setup zlib. +IF(NOT CMTAR_ZLIB_LIBRARIES) + MESSAGE(FATAL_ERROR "Parent project must set CMTAR_ZLIB_LIBRARIES.") +ENDIF(NOT CMTAR_ZLIB_LIBRARIES) +IF(NOT CMTAR_ZLIB_HEADER) + MESSAGE(FATAL_ERROR "Parent project must set CMTAR_ZLIB_HEADER.") +ENDIF(NOT CMTAR_ZLIB_HEADER) +INCLUDE_DIRECTORIES(${CMTAR_ZLIB_INCLUDE_DIRS}) CONFIGURE_FILE(${LIBTAR_SOURCE_DIR}/config.h.in ${LIBTAR_BINARY_DIR}/libtar/config.h) ADD_LIBRARY(cmtar STATIC ${libtar_SRC}) ADD_EXECUTABLE(tartest libtar.c) -TARGET_LINK_LIBRARIES(tartest cmtar ${CMAKE_ZLIB_LIBRARIES}) - +TARGET_LINK_LIBRARIES(tartest cmtar ${CMTAR_ZLIB_LIBRARIES}) diff --git a/Utilities/cmtar/config.h.in b/Utilities/cmtar/config.h.in index 1ab4362..b3b7f5c 100644 --- a/Utilities/cmtar/config.h.in +++ b/Utilities/cmtar/config.h.in @@ -42,9 +42,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine HAVE_LIBZ @HAVE_LIBZ@ -/* Define to 1 if you have the VTK's `z' library */ -#cmakedefine HAVE_VTK_LIBZ @HAVE_VTK_LIBZ@ - /* Define to 1 if the system has the type `major_t'. */ #cmakedefine HAVE_MAJOR_T @HAVE_MAJOR_T@ @@ -209,3 +206,5 @@ /* Define to `long long' if not defined in system header files. */ #cmakedefine uint64_t @uint64_t@ + +#define CMTAR_ZLIB_HEADER "@CMTAR_ZLIB_HEADER@" diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c index c918e24..362c105 100644 --- a/Utilities/cmtar/libtar.c +++ b/Utilities/cmtar/libtar.c @@ -35,18 +35,7 @@ # include <signal.h> #endif -#ifdef HAVE_LIBZ -#ifdef HAVE_VTK_LIBZ -# include <vtkzlib/zlib.h> -# define cm_zlib_gzdopen gzdopen -# define cm_zlib_gzclose gzclose -# define cm_zlib_gzread gzread -# define cm_zlib_gzwrite gzwrite - -#else -# include <cmzlib/zlib.h> -#endif -#endif +#include CMTAR_ZLIB_HEADER #include <libtar/compat.h> @@ -117,7 +106,7 @@ static int libtar_gzopen(void* call_data, const char *pathname, } #endif - gzf->GZFile = cm_zlib_gzdopen(fd, gzoflags); + gzf->GZFile = gzdopen(fd, gzoflags); if (!gzf->GZFile) { errno = ENOMEM; @@ -130,19 +119,19 @@ static int libtar_gzopen(void* call_data, const char *pathname, static int libtar_gzclose(void* call_data) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzclose(gzf->GZFile); + return gzclose(gzf->GZFile); } static ssize_t libtar_gzread(void* call_data, void* buf, size_t count) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzread(gzf->GZFile, buf, count); + return gzread(gzf->GZFile, buf, count); } static ssize_t libtar_gzwrite(void* call_data, const void* buf, size_t count) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzwrite(gzf->GZFile, (void*)buf, count); + return gzwrite(gzf->GZFile, (void*)buf, count); } tartype_t gztype = { |