keep libarchive from using a system zlib unless cmake uses one

This commit is contained in:
Bill Hoffman 2009-11-09 14:42:23 -05:00
parent b4ed21c305
commit 0106b490de
2 changed files with 8 additions and 2 deletions

View File

@ -253,6 +253,8 @@ MACRO (CMAKE_BUILD_UTILITIES)
ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE) ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE)
SET(HAVE_LIBZ 1) SET(HAVE_LIBZ 1)
SET(HAVE_ZLIB_H 1) SET(HAVE_ZLIB_H 1)
SET(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
SET(ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE) SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE)
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC) ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
SUBDIRS(Utilities/cmlibarchive) SUBDIRS(Utilities/cmlibarchive)

View File

@ -143,7 +143,11 @@ IF(ZLIB_FOUND)
SET(HAVE_LIBZ 1) SET(HAVE_LIBZ 1)
SET(HAVE_ZLIB_H 1) SET(HAVE_ZLIB_H 1)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
# if building inside cmake do not add this lib
# as it will not exist at try compile time
IF(NOT "${ZLIB_LIBRARIES}" MATCHES cmzlib)
LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES})
ENDIF(NOT "${ZLIB_LIBRARIES}" MATCHES cmzlib)
ENDIF(ZLIB_FOUND) ENDIF(ZLIB_FOUND)
MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY)
@ -157,7 +161,7 @@ IF(BZIP2_FOUND)
INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
# if building inside cmake do not add this lib # if building inside cmake do not add this lib
# as it will not exist at try compile time # as it will not exist at try compile time
IF(NOT BUILD_ARCHIVE_WITHIN_CMAKE) IF(NOT "${BZIP2_LIBRARIES}" MATCHES cmbzip2)
LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES})
ENDIF() ENDIF()
ENDIF(BZIP2_FOUND) ENDIF(BZIP2_FOUND)