From 84c711bbe8048a20f492393e67cc28f0b0541406 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 18 Sep 2018 13:19:15 +0200 Subject: [PATCH 1/3] [CMake] Generate cmake target that other libraries can use ... to express their dependency on this library and retrieve any configuration information such as the include directory, binary to link to (if any), transitive dependencies, necessary compiler options or the required c++ standards level. --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..84ebd13 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright 2018 Mike Dev +# 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) +project(BoostBind LANGUAGES CXX) + +add_library(boost_bind INTERFACE) +add_library(Boost::bind ALIAS boost_bind) + +target_include_directories(boost_bind INTERFACE include) + +target_link_libraries(boost_bind + INTERFACE + Boost::config + Boost::core +) + From 6a6f61f847cc5722cda2e32e1d4d86053acdab32 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 4 Dec 2018 15:17:32 +0100 Subject: [PATCH 2/3] [CMake] Add self-test for cmake script --- .travis.yml | 14 ++++++++++++++ test/test_cmake/CMakeLists.txt | 20 ++++++++++++++++++++ test/test_cmake/main.cpp | 5 +++++ 3 files changed, 39 insertions(+) create mode 100644 test/test_cmake/CMakeLists.txt create mode 100644 test/test_cmake/main.cpp diff --git a/.travis.yml b/.travis.yml index 1398d31..5b40fb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,20 @@ matrix: - env: BOGUS_JOB=true include: + + # cmake self-test + - os: linux + env: TEST_CMAKE=TRUE #Only for easier identification in travis web gui + install: + - git clone --depth 1 https://github.com/boostorg/config.git ../config + - git clone --depth 1 https://github.com/boostorg/core.git ../core + - git clone --depth 1 https://github.com/boostorg/assert.git ../assert + + script: + - mkdir __build__ && cd __build__ + - cmake ../test/test_cmake + - cmake --build . + - os: linux compiler: g++ env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt new file mode 100644 index 0000000..c9ed602 --- /dev/null +++ b/test/test_cmake/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2018 Mike Dev +# 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 +# +# NOTE: This does NOT run the unit tests for Boost.Bind. +# It only tests, if the CMakeLists.txt file in it's root works as expected + +cmake_minimum_required( VERSION 3.5 ) + +project( BoostBindCMakeSelfTest ) + +add_subdirectory( ../../../config ${CMAKE_CURRENT_BINARY_DIR}/libs/config ) +add_subdirectory( ../../../core ${CMAKE_CURRENT_BINARY_DIR}/libs/core ) +add_subdirectory( ../../../assert ${CMAKE_CURRENT_BINARY_DIR}/libs/assert ) + +add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/boost_bind ) + +add_executable( boost_bind_cmake_self_test main.cpp ) +target_link_libraries( boost_bind_cmake_self_test Boost::bind ) + diff --git a/test/test_cmake/main.cpp b/test/test_cmake/main.cpp new file mode 100644 index 0000000..7cdfe2a --- /dev/null +++ b/test/test_cmake/main.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + +} \ No newline at end of file From e2cf9f696a749123ae5bd8016ecf490b28aa7c25 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Wed, 5 Dec 2018 12:13:32 +0100 Subject: [PATCH 3/3] [CMake] Add note about experimental status --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ebd13..9f9acc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ # Copyright 2018 Mike Dev # 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 +# +# NOTE: CMake support for Boost.Bind is currently experimental at best +# and the interface is likely to change in the future cmake_minimum_required(VERSION 3.5) project(BoostBind LANGUAGES CXX) @@ -15,4 +18,3 @@ target_link_libraries(boost_bind Boost::config Boost::core ) -