From c006e75d26c08176d336df9ebcf7c915a3e0adb9 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 20 May 2015 02:10:04 +0300 Subject: [PATCH] Return libiberty back --- README.md | 1 + cmake/Modules/FindIberty.cmake | 22 ++++++++++++++++++++++ libgrive/CMakeLists.txt | 8 ++++++++ 3 files changed, 31 insertions(+) create mode 100644 cmake/Modules/FindIberty.cmake diff --git a/README.md b/README.md index 9736430..146828c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ You need the following libraries: There are also some optional dependencies: - CppUnit (for unit tests) - libbfd (for backtrace) +- binutils (for libiberty, required for compilation in OpenSUSE, Ubuntu, Arch and etc) Grive uses cmake to build. Basic install sequence is diff --git a/cmake/Modules/FindIberty.cmake b/cmake/Modules/FindIberty.cmake new file mode 100644 index 0000000..6562419 --- /dev/null +++ b/cmake/Modules/FindIberty.cmake @@ -0,0 +1,22 @@ +# - Find Iberty +# This module finds libiberty. +# +# It sets the following variables: +# IBERTY_LIBRARY - The library to link against. + +FIND_LIBRARY( IBERTY_LIBRARY NAMES iberty ) + +IF (IBERTY_LIBRARY) + + # show which library was found only if not quiet + MESSAGE( STATUS "Found libiberty: ${IBERTY_LIBRARY}") + + SET(IBERTY_FOUND TRUE) + +ELSE (IBERTY_LIBRARY) + + IF ( IBERTY_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find libiberty. try to install binutil-devel?") + ENDIF (IBERTY_FIND_REQUIRED) + +ENDIF (IBERTY_LIBRARY) diff --git a/libgrive/CMakeLists.txt b/libgrive/CMakeLists.txt index 95c1e55..7fadd8d 100644 --- a/libgrive/CMakeLists.txt +++ b/libgrive/CMakeLists.txt @@ -8,6 +8,7 @@ find_package(EXPAT REQUIRED) find_package(Boost 1.40.0 COMPONENTS program_options filesystem unit_test_framework system REQUIRED) find_package(BFD) find_package(CppUnit) +find_package(Iberty) find_package(ZLIB) find_package(PkgConfig) @@ -28,6 +29,12 @@ if ( BFD_FOUND ) endif ( BFD_FOUND ) +if ( IBERTY_FOUND ) + set( OPT_LIBS ${OPT_LIBS} ${IBERTY_LIBRARY} ) +else ( IBERTY_FOUND ) + set( IBERTY_LIBRARY "" ) +endif ( IBERTY_FOUND ) + if ( ZLIB_FOUND ) set( OPT_LIBS ${OPT_LIBS} ${ZLIB_LIBRARIES} ) endif ( ZLIB_FOUND ) @@ -80,6 +87,7 @@ target_link_libraries( grive ${CURL_LIBRARIES} ${LIBGCRYPT_LIBRARIES} ${Boost_LIBRARIES} + ${IBERTY_LIBRARY} ${EXPAT_LIBRARY} ${OPT_LIBS} )