summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt83
1 files changed, 46 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4a577c..b8a635f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -366,31 +366,55 @@ macro (CMAKE_BUILD_UTILITIES)
set(CMAKE_COMPRESS_LIBRARIES "cmcompress")
add_subdirectory(Utilities/cmcompress)
CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
- if(CMAKE_USE_SYSTEM_BZIP2)
- find_package(BZip2)
+
+ #---------------------------------------------------------------------
+ # Build expat library for CMake, CTest, and libarchive.
+ if(CMAKE_USE_SYSTEM_EXPAT)
+ find_package(EXPAT)
+ if(NOT EXPAT_FOUND)
+ message(FATAL_ERROR
+ "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
+ endif()
+ set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
+ set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
else()
- set(BZIP2_INCLUDE_DIR
- "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
- set(BZIP2_LIBRARIES cmbzip2)
- add_subdirectory(Utilities/cmbzip2)
- CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
+ set(CMAKE_EXPAT_INCLUDES)
+ set(CMAKE_EXPAT_LIBRARIES cmexpat)
+ add_subdirectory(Utilities/cmexpat)
+ CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
+ endif()
+
+ #---------------------------------------------------------------------
+ # Build or use system libbz2 for libarchive.
+ if(NOT CMAKE_USE_SYSTEM_LIBARCHIVE)
+ if(CMAKE_USE_SYSTEM_BZIP2)
+ find_package(BZip2)
+ else()
+ set(BZIP2_INCLUDE_DIR
+ "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
+ set(BZIP2_LIBRARIES cmbzip2)
+ add_subdirectory(Utilities/cmbzip2)
+ CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
+ endif()
endif()
#---------------------------------------------------------------------
# Build or use system liblzma for libarchive.
- if(CMAKE_USE_SYSTEM_LIBLZMA)
- find_package(LibLZMA)
- if(NOT LIBLZMA_FOUND)
- message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
+ if(NOT CMAKE_USE_SYSTEM_LIBARCHIVE)
+ if(CMAKE_USE_SYSTEM_LIBLZMA)
+ find_package(LibLZMA)
+ if(NOT LIBLZMA_FOUND)
+ message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
+ endif()
+ set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
+ set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
+ else()
+ add_subdirectory(Utilities/cmliblzma)
+ CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
+ set(LZMA_INCLUDE_DIR
+ "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
+ set(LZMA_LIBRARY cmliblzma)
endif()
- set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
- set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
- else()
- add_subdirectory(Utilities/cmliblzma)
- CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
- set(LZMA_INCLUDE_DIR
- "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
- set(LZMA_LIBRARY cmliblzma)
endif()
#---------------------------------------------------------------------
@@ -403,6 +427,8 @@ macro (CMAKE_BUILD_UTILITIES)
set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS})
set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES})
else()
+ set(EXPAT_INCLUDE_DIR ${CMAKE_EXPAT_INCLUDES})
+ set(EXPAT_LIBRARY ${CMAKE_EXPAT_LIBRARIES})
set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
add_definitions(-DLIBARCHIVE_STATIC)
@@ -412,7 +438,7 @@ macro (CMAKE_BUILD_UTILITIES)
set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system found libxml2 library if found")
- set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
+ set(ENABLE_EXPAT ON CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found")
set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found")
set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
@@ -425,23 +451,6 @@ macro (CMAKE_BUILD_UTILITIES)
endif()
#---------------------------------------------------------------------
- # Build expat library for CMake and CTest.
- if(CMAKE_USE_SYSTEM_EXPAT)
- find_package(EXPAT)
- if(NOT EXPAT_FOUND)
- message(FATAL_ERROR
- "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
- endif()
- set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
- set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
- else()
- set(CMAKE_EXPAT_INCLUDES)
- set(CMAKE_EXPAT_LIBRARIES cmexpat)
- add_subdirectory(Utilities/cmexpat)
- CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
- endif()
-
- #---------------------------------------------------------------------
# Build jsoncpp library.
if(CMAKE_USE_SYSTEM_JSONCPP)
if(NOT CMAKE_VERSION VERSION_LESS 3.0)