summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-08-05 21:06:10 (GMT)
committerBrad King <brad.king@kitware.com>2010-08-05 21:06:10 (GMT)
commit3296e6ad90865ae618435452e3422eab97ce9a09 (patch)
tree10703ff5ff78475cfb1152c2a461f4b92dc8a48d
parenta602f8718692a5a44a8d582a6b4d7c8e46bf4315 (diff)
downloadCMake-3296e6ad90865ae618435452e3422eab97ce9a09.zip
CMake-3296e6ad90865ae618435452e3422eab97ce9a09.tar.gz
CMake-3296e6ad90865ae618435452e3422eab97ce9a09.tar.bz2
Include headers from chosen libarchive (#10923)
When CMAKE_USE_SYSTEM_LIBARCHIVE is on we must include the system libarchive headers to match the library that will be linked.
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx4
-rw-r--r--Source/cmSystemTools.cxx3
-rw-r--r--Utilities/cmThirdParty.h.in1
-rw-r--r--Utilities/cm_libarchive.h25
4 files changed, 28 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index a52d05e..5981603 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -22,9 +22,7 @@
#include <errno.h>
#include <cmsys/SystemTools.hxx>
-#include <cmlibarchive/libarchive/archive.h>
-#include <cmlibarchive/libarchive/archive_entry.h>
-
+#include <cm_libarchive.h>
//----------------------------------------------------------------------
cmCPackArchiveGenerator::cmCPackArchiveGenerator(CompressType t,
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 0badbba..2364d7e 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -23,8 +23,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/System.h>
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include <cmlibarchive/libarchive/archive.h>
-#include <cmlibarchive/libarchive/archive_entry.h>
+# include <cm_libarchive.h>
# include <cmsys/Terminal.h>
#endif
#include <cmsys/stl/algorithm>
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in
index 6cdd47c..daf8114 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_LIBARCHIVE
#cmakedefine CTEST_USE_XMLRPC
#endif
diff --git a/Utilities/cm_libarchive.h b/Utilities/cm_libarchive.h
new file mode 100644
index 0000000..1469bae
--- /dev/null
+++ b/Utilities/cm_libarchive.h
@@ -0,0 +1,25 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2010 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_libarchive_h
+#define __cm_libarchive_h
+
+/* Use the libarchive configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_LIBARCHIVE
+# include <archive.h>
+# include <archive_entry.h>
+#else
+# include <cmlibarchive/libarchive/archive.h>
+# include <cmlibarchive/libarchive/archive_entry.h>
+#endif
+
+#endif