Skip to content

Commit

Permalink
Merge pull request #84 from ctabin/fix-libzip-travis
Browse files Browse the repository at this point in the history
Fixes libzip version in Travis CI
  • Loading branch information
ctabin authored Sep 19, 2020
2 parents aed9b28 + 1531311 commit 5e39957
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ addons:
- valgrind

env:
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Debug BUILD_SHARED_LIBS=OFF
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Release BUILD_SHARED_LIBS=OFF
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Debug BUILD_SHARED_LIBS=ON
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Release BUILD_SHARED_LIBS=ON
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Debug LIBZIPPP_BUILD_SHARED_LIBS=OFF
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Release LIBZIPPP_BUILD_SHARED_LIBS=OFF
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Debug LIBZIPPP_BUILD_SHARED_LIBS=ON
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" BUILD_TYPE=Release LIBZIPPP_BUILD_SHARED_LIBS=ON

jobs:
include:
Expand All @@ -42,7 +42,7 @@ install:
make -j3 install
- |
mkdir -p $THIRD_PARTY/libzip && cd $THIRD_PARTY/libzip
travis_retry wget -O libzip.tar.gz "https://github.com/nih-at/libzip/archive/rel-1-6-1.tar.gz"
travis_retry wget -O libzip.tar.gz "https://github.com/nih-at/libzip/archive/v1.7.3.tar.gz"
tar xzf libzip.tar.gz --strip-components=1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${THIRD_PARTY_PREFIX} -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_PREFIX} -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF
Expand All @@ -51,7 +51,7 @@ install:

script:
- mkdir build && cd build
- cmake .. -DCMAKE_PREFIX_PATH=${THIRD_PARTY_PREFIX} -DCMAKE_INSTALL_PREFIX=$HOME/libzippp -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
- cmake .. -DCMAKE_PREFIX_PATH=${THIRD_PARTY_PREFIX} -DCMAKE_INSTALL_PREFIX=$HOME/libzippp -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$LIBZIPPP_BUILD_SHARED_LIBS
- make -j3 install
- make test
- rm -r *
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ project(libzippp VERSION 3.0.0)
# Do not install or build tests by default when this file is included
# as a sub-project (via add_subdirectory)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(is_root_project ON)
set(is_root_project ON)
else()
set(is_root_project OFF)
set(is_root_project OFF)
endif()

option(LIBZIPPP_INSTALL "Install library" ${is_root_project})
Expand All @@ -26,7 +26,7 @@ target_include_directories(libzippp
$<INSTALL_INTERFACE:include/libzippp>
)
set_target_properties(libzippp PROPERTIES PREFIX "") # Avoid duplicate "lib" prefix
target_link_libraries(libzippp PRIVATE libzip::libzip)
target_link_libraries(libzippp PRIVATE libzip::zip)
if (BUILD_SHARED_LIBS)
target_compile_definitions(libzippp PRIVATE LIBZIPPP_EXPORTS)
else()
Expand All @@ -42,9 +42,9 @@ if(LIBZIPPP_BUILD_TESTS)
add_test(NAME libzippp_tests COMMAND libzippp_test)

if (BUILD_SHARED_LIBS)
set_target_properties(libzippp_test PROPERTIES OUTPUT_NAME "libzippp_shared_test")
set_target_properties(libzippp_test PROPERTIES OUTPUT_NAME "libzippp_shared_test")
else()
set_target_properties(libzippp_test PROPERTIES OUTPUT_NAME "libzippp_static_test")
set_target_properties(libzippp_test PROPERTIES OUTPUT_NAME "libzippp_static_test")
endif()
endif()

Expand Down
8 changes: 4 additions & 4 deletions cmake/FindLIBZIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ find_package_handle_standard_args(
)

if (LIBZIP_FOUND)
if (NOT TARGET libzip::libzip)
add_library(libzip::libzip UNKNOWN IMPORTED)
set_target_properties(libzip::libzip
if (NOT TARGET libzip::zip)
add_library(libzip::zip UNKNOWN IMPORTED)
set_target_properties(libzip::zip
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${LIBZIP_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB
Expand All @@ -35,7 +35,7 @@ if (LIBZIP_FOUND)
file(STRINGS ${_libzip_pkgcfg} _have_bzip2 REGEX Libs)
if(_have_bzip2 MATCHES "-lbz2")
find_package(BZip2 REQUIRED)
set_property(TARGET libzip::libzip APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2)
set_property(TARGET libzip::zip APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2)
endif()
endif()
endif()

0 comments on commit 5e39957

Please sign in to comment.