From e43453b6141b06b19c07b681e42fcd6ec3161e48 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 25 May 2009 20:58:59 +0000 Subject: [PATCH] - added Hirogen2's patch for using the default BZip2 library under Linux. SVN r1604 (trunk) --- CMakeLists.txt | 13 +++++++++++-- bzip2/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 4 ++-- tools/zipdir/CMakeLists.txt | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60c1cc69d..4de5dbc92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) set( PROFILE CACHE 0 BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) endif( CMAKE_COMPILER_IS_GNUCXX ) +find_package( BZip2 ) find_package( JPEG ) find_package( ZLIB ) @@ -90,10 +91,18 @@ else( JPEG_FOUND ) set( JPEG_LIBRARY jpeg ) endif( JPEG_FOUND ) -set( BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bzip2" ) +if( BZIP2_FOUND ) + message( STATUS "Using system bzip2 library" ) +else( BZIP2_FOUND ) + message( STATUS "Using internal bzip2 library" ) + add_subdirectory( bzip2 ) + set( BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bzip2" ) + set( BZIP2_LIBRARIES bz2 ) + set( BZIP2_LIBRARY bz2 ) +endif( BZIP2_FOUND) + set( LZMA_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lzma/C" ) -add_subdirectory( bzip2 ) add_subdirectory( lzma ) add_subdirectory( tools ) add_subdirectory( snes_spc ) diff --git a/bzip2/CMakeLists.txt b/bzip2/CMakeLists.txt index 54b3849bc..e819f4cde 100644 --- a/bzip2/CMakeLists.txt +++ b/bzip2/CMakeLists.txt @@ -5,7 +5,7 @@ if( CMAKE_COMPILER_IS_GNUC ) endif( CMAKE_COMPILER_IS_GNUC ) add_definitions( -DBZ_NO_STDIO ) -add_library( bzip2 +add_library( bz2 blocksort.c bzlib.c compress.c @@ -13,4 +13,4 @@ add_library( bzip2 decompress.c huffman.c randtable.c ) -target_link_libraries( bzip2 ) +target_link_libraries( bz2 ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b7398f25..a716327cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -381,7 +381,7 @@ add_custom_target( revision_check ALL # Libraries ZDoom needs -set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${FMOD_LIBRARY}" ) +set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${FMOD_LIBRARY}" ) include_directories( "${ZLIB_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${FMOD_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" ) # Start defining source files for ZDoom @@ -724,7 +724,7 @@ add_executable( zdoom WIN32 set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" ) set_source_files_properties( sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" ) -target_link_libraries( zdoom ${ZDOOM_LIBS} snes_spc gdtoa dumb bzip2 lzma ) +target_link_libraries( zdoom ${ZDOOM_LIBS} snes_spc gdtoa dumb lzma ) include_directories( . g_doom g_heretic diff --git a/tools/zipdir/CMakeLists.txt b/tools/zipdir/CMakeLists.txt index 7dd6d63c3..40c4042b9 100644 --- a/tools/zipdir/CMakeLists.txt +++ b/tools/zipdir/CMakeLists.txt @@ -5,4 +5,4 @@ message(STATUS "${LZMA_INCLUDE_DIR}" ) include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" ) add_executable( zipdir zipdir.c ) -target_link_libraries( zipdir ${ZLIB_LIBRARIES} bzip2 lzma ) +target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )