1# Copyright 2018, 2019 Peter Dimov 2# Distributed under the Boost Software License, Version 1.0. 3# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 4 5cmake_minimum_required(VERSION 3.5) 6 7if(POLICY CMP0074) 8 cmake_policy(SET CMP0074 NEW) 9endif() 10 11project(CmakeConfigIostreamsTest LANGUAGES CXX) 12 13include(${CMAKE_CURRENT_LIST_DIR}/../BoostVersion.cmake) 14 15set(BOOST_HINTS) 16 17if(USE_STAGED_BOOST) 18 set(BOOST_HINTS HINTS ../../../../stage) 19endif() 20 21if(USE_BOOST_PACKAGE) 22 23 find_package(Boost ${BOOST_VERSION} EXACT REQUIRED COMPONENTS iostreams ${BOOST_HINTS}) 24 25else() 26 27 find_package(boost_iostreams ${BOOST_VERSION} EXACT CONFIG REQUIRED ${BOOST_HINTS}) 28 29endif() 30 31add_executable(test_gzip test_gzip.cpp) 32target_link_libraries(test_gzip Boost::iostreams) 33 34add_executable(test_bzip2 test_bzip2.cpp) 35target_link_libraries(test_bzip2 Boost::iostreams) 36 37if(NOT WIN32) 38 39 find_package(ZLIB) 40 target_link_libraries(test_gzip ZLIB::ZLIB) 41 42 find_package(BZip2) 43 target_link_libraries(test_bzip2 BZip2::BZip2) 44 45endif() 46 47enable_testing() 48add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) 49 50add_test(NAME test_gzip COMMAND test_gzip WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 51add_test(NAME test_bzip2 COMMAND test_bzip2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 52