summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-10-19 19:00:10 (GMT)
committerBrad King <brad.king@kitware.com>2006-10-19 19:00:10 (GMT)
commitf91b3c1daaeacd79b36644ce9a2610b31e9d964c (patch)
treef4d1fb12d71e40359e425cb29fffa783146e45c2 /Utilities
parentde007ef199190c84c0f53ac106c282fc190f5df1 (diff)
downloadCMake-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')
-rw-r--r--Utilities/cmThirdParty.h.in26
-rw-r--r--Utilities/cm_curl.h28
-rw-r--r--Utilities/cm_expat.h28
-rw-r--r--Utilities/cm_xmlrpc.h30
-rw-r--r--Utilities/cm_zlib.h28
-rw-r--r--Utilities/cmtar/CMakeLists.txt11
-rw-r--r--Utilities/cmtar/config.h.in5
-rw-r--r--Utilities/cmtar/libtar.c21
-rw-r--r--Utilities/cmxmlrpc/xmlrpc.h4
-rw-r--r--Utilities/cmxmlrpc/xmlrpc_expat.c2
10 files changed, 159 insertions, 24 deletions
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in
new file mode 100644
index 0000000..845a1bd
--- /dev/null
+++ b/Utilities/cmThirdParty.h.in
@@ -0,0 +1,26 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __cmThirdParty_h
+#define __cmThirdParty_h
+
+/* Whether CMake is using its own utility libraries. */
+#cmakedefine CMAKE_USE_SYSTEM_CURL
+#cmakedefine CMAKE_USE_SYSTEM_EXPAT
+#cmakedefine CMAKE_USE_SYSTEM_XMLRPC
+#cmakedefine CMAKE_USE_SYSTEM_ZLIB
+
+#endif
diff --git a/Utilities/cm_curl.h b/Utilities/cm_curl.h
new file mode 100644
index 0000000..0fcb5c5
--- /dev/null
+++ b/Utilities/cm_curl.h
@@ -0,0 +1,28 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __cm_curl_h
+#define __cm_curl_h
+
+/* Use the curl library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_CURL
+# include <curl/curl.h>
+#else
+# include <cmcurl/curl/curl.h>
+#endif
+
+#endif
diff --git a/Utilities/cm_expat.h b/Utilities/cm_expat.h
new file mode 100644
index 0000000..f152abb
--- /dev/null
+++ b/Utilities/cm_expat.h
@@ -0,0 +1,28 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __cm_expat_h
+#define __cm_expat_h
+
+/* Use the expat library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_EXPAT
+# include <expat.h>
+#else
+# include <cmexpat/expat.h>
+#endif
+
+#endif
diff --git a/Utilities/cm_xmlrpc.h b/Utilities/cm_xmlrpc.h
new file mode 100644
index 0000000..95655bf
--- /dev/null
+++ b/Utilities/cm_xmlrpc.h
@@ -0,0 +1,30 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __cm_xmlrpc_h
+#define __cm_xmlrpc_h
+
+/* Use the xmlrpc library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_XMLRPC
+# include <xmlrpc.h>
+# include <xmlrpc_client.h>
+#else
+# include <cmxmlrpc/xmlrpc.h>
+# include <cmxmlrpc/xmlrpc_client.h>
+#endif
+
+#endif
diff --git a/Utilities/cm_zlib.h b/Utilities/cm_zlib.h
new file mode 100644
index 0000000..a5bb52a
--- /dev/null
+++ b/Utilities/cm_zlib.h
@@ -0,0 +1,28 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __cm_zlib_h
+#define __cm_zlib_h
+
+/* Use the zlib library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_ZLIB
+# include <zlib.h>
+#else
+# include <cmzlib/zlib.h>
+#endif
+
+#endif
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 = {
diff --git a/Utilities/cmxmlrpc/xmlrpc.h b/Utilities/cmxmlrpc/xmlrpc.h
index 69160a2..30b8384 100644
--- a/Utilities/cmxmlrpc/xmlrpc.h
+++ b/Utilities/cmxmlrpc/xmlrpc.h
@@ -29,7 +29,7 @@
#include <stddef.h>
#include <stdarg.h>
-#include <xmlrpc_config.h>
+#include <cmxmlrpc/xmlrpc_config.h>
#ifdef HAVE_UNICODE_WCHAR
#include <wchar.h>
@@ -778,7 +778,7 @@ char *xmlrpc_authcookie(void);
in here. For backward compatibility, we need to include it here, even
though it really isn't logical to do so.
*/
-#include <xmlrpc_server.h>
+#include <cmxmlrpc/xmlrpc_server.h>
#endif
diff --git a/Utilities/cmxmlrpc/xmlrpc_expat.c b/Utilities/cmxmlrpc/xmlrpc_expat.c
index cb467d1..d7b6e19 100644
--- a/Utilities/cmxmlrpc/xmlrpc_expat.c
+++ b/Utilities/cmxmlrpc/xmlrpc_expat.c
@@ -28,7 +28,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <expat.h>
+#include <cm_expat.h>
#include "xmlrpc.h"
#include "xmlrpc_int.h"