From dd44e1eea58576d94581f159ece10ed640e3a248 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Mon, 17 Sep 2018 11:20:51 +0200 Subject: [PATCH 1/5] [CMake] Add minimal cmake file Generate cmake target that can be used by other libraries to express their dependency on this library and retrieve any configuration information such as the include directory. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7375f9d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +# 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(BoostPreprocessor LANGUAGES CXX) + +add_library(boost_preprocessor INTERFACE) +add_library(Boost::preprocessor ALIAS boost_preprocessor) + +target_include_directories(boost_preprocessor INTERFACE include) From ee5ed2510d501dc9115b90d434ed621f7bf0989c Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 16 Oct 2018 18:44:57 +0200 Subject: [PATCH 2/5] [CMake] Add self-test for cmake file to travis --- .travis.yml | 9 +++++++++ CMakeLists.txt | 1 + test/CMakeLists.txt | 18 ++++++++++++++++++ test/cmake_self_test.cpp | 3 +++ 4 files changed, 31 insertions(+) create mode 100644 test/CMakeLists.txt create mode 100644 test/cmake_self_test.cpp diff --git a/.travis.yml b/.travis.yml index 92c2ee7..dd85603 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,15 @@ branches: - master - develop +matrix: + include: + - install: true + script: + - mkdir __build__ && cd __build__ + - cmake ../test + - cmake --build . + + install: - cd .. - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root diff --git a/CMakeLists.txt b/CMakeLists.txt index 7375f9d..c0f41f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,3 +9,4 @@ add_library(boost_preprocessor INTERFACE) add_library(Boost::preprocessor ALIAS boost_preprocessor) target_include_directories(boost_preprocessor INTERFACE include) + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..4008930 --- /dev/null +++ b/test/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 +# +# NOTE: This does not run the UNIT-TESTS for Boost.PReprocessor. +# It only tests, if the CMakeLists.txt file works as expected + +cmake_minimum_required( VERSION 3.5 ) + +project( TestBoostPreprocessorCMakeSelfTest ) + +add_subdirectory( .. ${CMAKE_CURRENT_BINARY_DIR}/boost_preprocessor ) + +# arithmetic.cpp is a randomly chosen source file +# that is compilable on it's own. +add_executable( boost_preprocessor_self_test cmake_self_test.cpp ) +target_link_libraries( boost_preprocessor_self_test Boost::preprocessor ) + diff --git a/test/cmake_self_test.cpp b/test/cmake_self_test.cpp new file mode 100644 index 0000000..2d7b167 --- /dev/null +++ b/test/cmake_self_test.cpp @@ -0,0 +1,3 @@ +#include + +int main() {} From a4e304ca8738c5c67b9c402a520ce5bfdb6720f3 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Wed, 17 Oct 2018 10:56:06 +0200 Subject: [PATCH 3/5] [CMake/CI] Add cmake self test to appveyor --- appveyor.yml | 57 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1fefc07..f3853c0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,6 +6,10 @@ version: 1.0.{build}-{branch} shallow_clone: true +configuration: + - boost_test + - cmake_self_test + branches: only: - master @@ -18,19 +22,44 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 TOOLSET: msvc-14.1 -install: - - cd .. - - git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root - - cd boost-root - - git submodule update --init tools/build - - git submodule update --init libs/config - - git submodule update --init tools/boostdep - - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\preprocessor - - python tools/boostdep/depinst/depinst.py preprocessor - - bootstrap - - b2 headers - build: off -test_script: - - b2 libs/preprocessor/test toolset=%TOOLSET% +for: +- + matrix: + only: + - configuration: cmake_self_test + + build: off + test_script: + - mkdir __build__ + - cd __build__ + - cmake ../test + - cmake --build . + +- + matrix: + only: + - configuration: boost_test + install: + - cd .. + - git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init tools/build + - git submodule update --init libs/config + - git submodule update --init tools/boostdep + - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\preprocessor + - python tools/boostdep/depinst/depinst.py preprocessor + - bootstrap + - b2 headers + + build: off + + test_script: + - b2 libs/preprocessor/test toolset=%TOOLSET% + - cd ../preprocessor/test + + + + + From 31653b34c9a30c046c4d03688c66c40297dcf668 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Wed, 17 Oct 2018 11:41:42 +0200 Subject: [PATCH 4/5] [CMake/CI] Some cleanup --- appveyor.yml | 9 ++------- test/CMakeLists.txt | 10 ++++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f3853c0..3d07613 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,5 @@ # Copyright 2017 Edward Diener +# Copyright 2018 Mike Dev # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) @@ -30,7 +31,6 @@ for: only: - configuration: cmake_self_test - build: off test_script: - mkdir __build__ - cd __build__ @@ -41,6 +41,7 @@ for: matrix: only: - configuration: boost_test + install: - cd .. - git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root @@ -53,13 +54,7 @@ for: - bootstrap - b2 headers - build: off - test_script: - b2 libs/preprocessor/test toolset=%TOOLSET% - cd ../preprocessor/test - - - - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4008930..2ec107e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,17 +2,15 @@ # 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.PReprocessor. +# NOTE: This does NOT run the unit tests for Boost.Preprocessor (yet). # It only tests, if the CMakeLists.txt file works as expected cmake_minimum_required( VERSION 3.5 ) -project( TestBoostPreprocessorCMakeSelfTest ) +project( BoostPreprocessorCMakeSelfTest ) add_subdirectory( .. ${CMAKE_CURRENT_BINARY_DIR}/boost_preprocessor ) -# arithmetic.cpp is a randomly chosen source file -# that is compilable on it's own. -add_executable( boost_preprocessor_self_test cmake_self_test.cpp ) -target_link_libraries( boost_preprocessor_self_test Boost::preprocessor ) +add_executable( boost_preprocessor_cmake_self_test cmake_self_test.cpp ) +target_link_libraries( boost_preprocessor_cmake_self_test Boost::preprocessor ) From 344ce6abf9584a5e082e3851bf073b911ac08acf Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Wed, 17 Oct 2018 12:13:45 +0200 Subject: [PATCH 5/5] [CMake/CI] Use config_info.cpp for cmake self test --- test/CMakeLists.txt | 2 +- test/cmake_self_test.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 test/cmake_self_test.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ec107e..b56c870 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,6 +11,6 @@ project( BoostPreprocessorCMakeSelfTest ) add_subdirectory( .. ${CMAKE_CURRENT_BINARY_DIR}/boost_preprocessor ) -add_executable( boost_preprocessor_cmake_self_test cmake_self_test.cpp ) +add_executable( boost_preprocessor_cmake_self_test config_info.cpp ) target_link_libraries( boost_preprocessor_cmake_self_test Boost::preprocessor ) diff --git a/test/cmake_self_test.cpp b/test/cmake_self_test.cpp deleted file mode 100644 index 2d7b167..0000000 --- a/test/cmake_self_test.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int main() {}