diff options
author | Brad King <brad.king@kitware.com> | 2010-07-29 14:12:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-07-29 14:13:55 (GMT) |
commit | a602f8718692a5a44a8d582a6b4d7c8e46bf4315 (patch) | |
tree | 14bea9ff407a769fdd8f88d7a74232001d6f96b0 /CMakeLists.txt | |
parent | 9e903b9f0e3c12d940e62775afa49daae56db9a6 (diff) | |
download | CMake-a602f8718692a5a44a8d582a6b4d7c8e46bf4315.zip CMake-a602f8718692a5a44a8d582a6b4d7c8e46bf4315.tar.gz CMake-a602f8718692a5a44a8d582a6b4d7c8e46bf4315.tar.bz2 |
Add option CMAKE_USE_SYSTEM_LIBARCHIVE (#10923)
Finish the implementation of the option from the skeleton left by the
initial addition of libarchive.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b25f694..b318a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,19 +71,23 @@ MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES) CACHE BOOL "Use system-installed zlib" FORCE) SET(CMAKE_USE_SYSTEM_BZIP2 "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed bzip2" FORCE) + SET(CMAKE_USE_SYSTEM_LIBARCHIVE "${CMAKE_USE_SYSTEM_LIBRARIES}" + CACHE BOOL "Use system-installed libarchive" FORCE) ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER) # Optionally use system utility libraries. + OPTION(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" ${CMAKE_USE_SYSTEM_LIBRARIES}) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" - ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON) - OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" OFF) + ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) + CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" + ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) # Mention to the user what system libraries are being used. - FOREACH(util BZIP2 CURL EXPAT ZLIB) + FOREACH(util BZIP2 CURL EXPAT LIBARCHIVE ZLIB) IF(CMAKE_USE_SYSTEM_${util}) MESSAGE(STATUS "Using system-installed ${util}") ENDIF(CMAKE_USE_SYSTEM_${util}) @@ -266,9 +270,20 @@ MACRO (CMAKE_BUILD_UTILITIES) SET(BZIP2_LIBRARIES cmbzip2) ADD_SUBDIRECTORY(Utilities/cmbzip2) ENDIF() + + #--------------------------------------------------------------------- + # Build or use system libarchive for CMake and CTest. IF(CMAKE_USE_SYSTEM_LIBARCHIVE) - FIND_PACKAGE(libarchive) - SET(CMAKE_TAR_LIBRARIES libarchive) + IF(EXISTS ${CMAKE_ROOT}/Modules/FindLibArchive.cmake) + FIND_PACKAGE(LibArchive) + ELSE() + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) + INCLUDE(${CMake_SOURCE_DIR}/Modules/FindLibArchive.cmake) + ENDIF() + IF(NOT LibArchive_FOUND) + MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") + ENDIF() + SET(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES}) ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE) SET(HAVE_LIBZ 1) SET(HAVE_ZLIB_H 1) |