diff --git a/.travis.yml b/.travis.yml index 2415029..3b557c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -278,14 +278,37 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z - os: linux - compiler: g++ + env: CMAKE_TEST=1 + script: + - mkdir __build__ && cd __build__ + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=bind .. + - ctest --output-on-failure -R boost_bind + + - os: linux env: CMAKE_SUBDIR_TEST=1 + install: + - BOOST_BRANCH=develop + - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi + - git clone -b $BOOST_BRANCH https://github.com/boostorg/assert.git ../assert + - git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config + - git clone -b $BOOST_BRANCH https://github.com/boostorg/core.git ../core script: - cd libs/bind/test/cmake_subdir_test && mkdir __build__ && cd __build__ - cmake .. - cmake --build . - cmake --build . --target check + - os: linux + env: CMAKE_INSTALL_TEST=1 + script: + - mkdir __build__ && cd __build__ + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES="assert;bind;config;core" -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . --target install + - cd ../libs/core/test/cmake_install_test && mkdir __build__ && cd __build__ + - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . + - cmake --build . --target check + install: - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index a8517d2..4c3fc7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,10 @@ -# Copyright 2018 Mike Dev +# Copyright 2018, 2019 Peter Dimov # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -# Partial (add_subdirectory only) and experimental CMake support -# Subject to change; please do not rely on the contents of this file yet +cmake_minimum_required(VERSION 3.5...3.16) -cmake_minimum_required(VERSION 3.5) -project(BoostBind LANGUAGES CXX) +project(boost_bind VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) add_library(boost_bind INTERFACE) add_library(Boost::bind ALIAS boost_bind) @@ -14,7 +12,20 @@ add_library(Boost::bind ALIAS boost_bind) target_include_directories(boost_bind INTERFACE include) target_link_libraries(boost_bind - INTERFACE - Boost::config - Boost::core + INTERFACE + Boost::config + Boost::core ) + +if(BOOST_SUPERPROJECT_VERSION) + + include(BoostInstall) + boost_install(TARGETS boost_bind HEADER_DIRECTORY include/) + +endif() + +if(BUILD_TESTING) + + add_subdirectory(test) + +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..1f8c370 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright 2018, 2019 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) + +if(HAVE_BOOST_TEST) + +boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::bind Boost::core Boost::function Boost::smart_ptr) + +endif() diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt new file mode 100644 index 0000000..f245966 --- /dev/null +++ b/test/cmake_install_test/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright 2018, 2019 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_install_test LANGUAGES CXX) + +find_package(boost_bind REQUIRED) +find_package(boost_core REQUIRED) + +add_executable(quick ../quick.cpp) +target_link_libraries(quick Boost::bind Boost::core) + +enable_testing() +add_test(quick quick) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 8cac315..7b22a37 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.5...3.16) project(cmake_subdir_test LANGUAGES CXX)