From b2bd8aec97e9ef3c6aa1808ebd2ec5188eb1cdaa Mon Sep 17 00:00:00 2001 From: Joerg-Christian Boehme Date: Mon, 24 Feb 2020 06:56:29 +0100 Subject: [PATCH] Use only some examples to use config from boost --- .../CMakeLists.txt | 23 +++++++ .../config.cmake | 0 examples/Boost-chrono-useBoostConfig/foo.cpp | 6 ++ examples/Boost-chrono/CMakeLists.txt | 8 ++- examples/Boost-contract/CMakeLists.txt | 3 +- examples/Boost-fiber/CMakeLists.txt | 7 +- .../CMakeLists.txt | 66 +++++++++++++++++++ .../config.cmake | 0 .../Boost-filesystem-useBoostConfig/foo.cpp | 7 ++ .../foo_android.cpp | 21 ++++++ examples/Boost-filesystem/CMakeLists.txt | 8 ++- .../CMakeLists.txt | 23 +++++++ .../config.cmake | 0 .../Boost-iostreams-useBoostConfig/foo.cpp | 66 +++++++++++++++++++ examples/Boost-iostreams/CMakeLists.txt | 7 +- examples/Boost-log-shared/CMakeLists.txt | 12 +++- examples/Boost-log-shared/config.cmake | 4 -- .../Boost-log-useBoostConfig/CMakeLists.txt | 19 ++++++ .../config.cmake | 0 examples/Boost-log-useBoostConfig/foo.cpp | 12 ++++ examples/Boost-log/CMakeLists.txt | 12 +++- examples/Boost-log/config.cmake | 4 -- examples/Boost-math/CMakeLists.txt | 1 - examples/Boost-math/config.cmake | 4 -- examples/Boost-program-options/CMakeLists.txt | 1 - examples/Boost-program-options/config.cmake | 4 -- examples/Boost-python-numpy/config.cmake | 2 +- examples/Boost-python/config.cmake | 2 +- examples/Boost-random/CMakeLists.txt | 1 - examples/Boost-random/config.cmake | 4 -- examples/Boost-serialization/CMakeLists.txt | 1 - examples/Boost-serialization/config.cmake | 4 -- examples/Boost-stacktrace/CMakeLists.txt | 1 - examples/Boost-stacktrace/config.cmake | 4 -- examples/Boost-system/CMakeLists.txt | 1 - examples/Boost-system/config.cmake | 4 -- examples/Boost-test/CMakeLists.txt | 1 - examples/Boost-test/config.cmake | 4 -- examples/Boost-thread/CMakeLists.txt | 7 +- examples/Boost-thread/config.cmake | 4 -- examples/Boost-useBoostConfig/CMakeLists.txt | 48 ++++++++++++++ .../config.cmake | 0 examples/Boost-useBoostConfig/foo.cpp | 4 ++ examples/Boost-uuid/CMakeLists.txt | 1 - examples/Boost-uuid/config.cmake | 4 -- examples/Boost/CMakeLists.txt | 1 - examples/Boost/config.cmake | 4 -- 47 files changed, 335 insertions(+), 85 deletions(-) create mode 100644 examples/Boost-chrono-useBoostConfig/CMakeLists.txt rename examples/{Boost-chrono => Boost-chrono-useBoostConfig}/config.cmake (100%) create mode 100644 examples/Boost-chrono-useBoostConfig/foo.cpp create mode 100644 examples/Boost-filesystem-useBoostConfig/CMakeLists.txt rename examples/{Boost-contract => Boost-filesystem-useBoostConfig}/config.cmake (100%) create mode 100644 examples/Boost-filesystem-useBoostConfig/foo.cpp create mode 100644 examples/Boost-filesystem-useBoostConfig/foo_android.cpp create mode 100644 examples/Boost-iostreams-useBoostConfig/CMakeLists.txt rename examples/{Boost-fiber => Boost-iostreams-useBoostConfig}/config.cmake (100%) create mode 100644 examples/Boost-iostreams-useBoostConfig/foo.cpp delete mode 100644 examples/Boost-log-shared/config.cmake create mode 100644 examples/Boost-log-useBoostConfig/CMakeLists.txt rename examples/{Boost-filesystem => Boost-log-useBoostConfig}/config.cmake (100%) create mode 100644 examples/Boost-log-useBoostConfig/foo.cpp delete mode 100644 examples/Boost-log/config.cmake delete mode 100644 examples/Boost-math/config.cmake delete mode 100644 examples/Boost-program-options/config.cmake delete mode 100644 examples/Boost-random/config.cmake delete mode 100644 examples/Boost-serialization/config.cmake delete mode 100644 examples/Boost-stacktrace/config.cmake delete mode 100644 examples/Boost-system/config.cmake delete mode 100644 examples/Boost-test/config.cmake delete mode 100644 examples/Boost-thread/config.cmake create mode 100644 examples/Boost-useBoostConfig/CMakeLists.txt rename examples/{Boost-iostreams => Boost-useBoostConfig}/config.cmake (100%) create mode 100644 examples/Boost-useBoostConfig/foo.cpp delete mode 100644 examples/Boost-uuid/config.cmake delete mode 100644 examples/Boost/config.cmake diff --git a/examples/Boost-chrono-useBoostConfig/CMakeLists.txt b/examples/Boost-chrono-useBoostConfig/CMakeLists.txt new file mode 100644 index 0000000000..6ba8ec001b --- /dev/null +++ b/examples/Boost-chrono-useBoostConfig/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (c) 2013, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.0) + +set(Boost_DEBUG ON CACHE BOOLEAN "") +set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-boost) + +hunter_add_package(Boost COMPONENTS chrono) +find_package(Boost CONFIG REQUIRED chrono) + +add_executable(foo foo.cpp) +target_link_libraries( + foo + PUBLIC + Boost::chrono +) diff --git a/examples/Boost-chrono/config.cmake b/examples/Boost-chrono-useBoostConfig/config.cmake similarity index 100% rename from examples/Boost-chrono/config.cmake rename to examples/Boost-chrono-useBoostConfig/config.cmake diff --git a/examples/Boost-chrono-useBoostConfig/foo.cpp b/examples/Boost-chrono-useBoostConfig/foo.cpp new file mode 100644 index 0000000000..33c0516210 --- /dev/null +++ b/examples/Boost-chrono-useBoostConfig/foo.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + boost::chrono::system_clock::now(); + return 0; +} diff --git a/examples/Boost-chrono/CMakeLists.txt b/examples/Boost-chrono/CMakeLists.txt index 6ba8ec001b..8152a6e319 100644 --- a/examples/Boost-chrono/CMakeLists.txt +++ b/examples/Boost-chrono/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -12,12 +11,15 @@ include("../common.cmake") project(download-boost) -hunter_add_package(Boost COMPONENTS chrono) -find_package(Boost CONFIG REQUIRED chrono) +hunter_add_package(Boost COMPONENTS system chrono) +find_package(Boost CONFIG REQUIRED system chrono) add_executable(foo foo.cpp) target_link_libraries( foo PUBLIC Boost::chrono + Boost::system # Should be last + # Boost 1.66.0, Linux, Clang with -stdlib=libstdc++: + # * https://travis-ci.org/ingenue/hunter/jobs/318140468#L2651 ) diff --git a/examples/Boost-contract/CMakeLists.txt b/examples/Boost-contract/CMakeLists.txt index 7c7acc0c03..c70258414d 100644 --- a/examples/Boost-contract/CMakeLists.txt +++ b/examples/Boost-contract/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -16,4 +15,4 @@ hunter_add_package(Boost COMPONENTS system contract) find_package(Boost CONFIG REQUIRED system contract) add_executable(foo foo.cpp) -target_link_libraries(foo PUBLIC Boost::contract) +target_link_libraries(foo PUBLIC Boost::system Boost::contract) diff --git a/examples/Boost-fiber/CMakeLists.txt b/examples/Boost-fiber/CMakeLists.txt index 765aad205e..401f7332d8 100644 --- a/examples/Boost-fiber/CMakeLists.txt +++ b/examples/Boost-fiber/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -12,8 +11,8 @@ include("../common.cmake") project(download-boost) -hunter_add_package(Boost COMPONENTS fiber) -find_package(Boost CONFIG REQUIRED fiber) +hunter_add_package(Boost COMPONENTS context fiber) +find_package(Boost CONFIG REQUIRED context fiber) add_executable(foo foo.cpp) -target_link_libraries(foo PUBLIC Boost::fiber) +target_link_libraries(foo PUBLIC Boost::context Boost::fiber) diff --git a/examples/Boost-filesystem-useBoostConfig/CMakeLists.txt b/examples/Boost-filesystem-useBoostConfig/CMakeLists.txt new file mode 100644 index 0000000000..9bb5b74ced --- /dev/null +++ b/examples/Boost-filesystem-useBoostConfig/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright (c) 2013-2015, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.0) + +set(Boost_DEBUG ON CACHE BOOLEAN "") +set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-boost) + +# download boost +hunter_add_package(Boost COMPONENTS filesystem) + +# now boost can be used +find_package(Boost CONFIG REQUIRED filesystem) + +if(ANDROID) + string(COMPARE EQUAL "${CMAKE_ANDROID_NDK}" "" is_empty) + if(is_empty) + message(FATAL_ERROR "CMAKE_ANDROID_NDK is empty") + endif() + add_library( + foo + SHARED + foo_android.cpp + "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c" + ) +else() + add_executable(foo foo.cpp) +endif() + +target_link_libraries( + foo + Boost::filesystem +) + +if(ANDROID) + target_link_libraries(foo log android) + target_include_directories( + foo PUBLIC "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue" + ) + + if(NOT "$ENV{TRAVIS}") + # Travis CI failed builds: + # * https://travis-ci.org/ingenue/hunter/jobs/106905844 + # * https://travis-ci.org/ingenue/hunter/jobs/106905851 + hunter_add_package(Android-Apk) + list(APPEND CMAKE_MODULE_PATH "${ANDROID-APK_ROOT}") + include(AndroidApk) + + hunter_add_package(Android-SDK) + message("Path to `android`: ${ANDROID-SDK_ROOT}/android-sdk/tools/android") + message("Path to `emulator`: ${ANDROID-SDK_ROOT}/android-sdk/tools/emulator") + message("Path to `adb`: ${ANDROID-SDK_ROOT}/android-sdk/platform-tools/adb") + + android_create_apk( + BASE_TARGET foo + LAUNCH_TARGET foo-launch + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/apk" + ) + endif() +endif() diff --git a/examples/Boost-contract/config.cmake b/examples/Boost-filesystem-useBoostConfig/config.cmake similarity index 100% rename from examples/Boost-contract/config.cmake rename to examples/Boost-filesystem-useBoostConfig/config.cmake diff --git a/examples/Boost-filesystem-useBoostConfig/foo.cpp b/examples/Boost-filesystem-useBoostConfig/foo.cpp new file mode 100644 index 0000000000..13f5f90676 --- /dev/null +++ b/examples/Boost-filesystem-useBoostConfig/foo.cpp @@ -0,0 +1,7 @@ +#include +#include // std::cout + +int main() { + namespace fs = boost::filesystem; + std::cout << "Current path: " << fs::current_path() << std::endl; +} diff --git a/examples/Boost-filesystem-useBoostConfig/foo_android.cpp b/examples/Boost-filesystem-useBoostConfig/foo_android.cpp new file mode 100644 index 0000000000..b86604683d --- /dev/null +++ b/examples/Boost-filesystem-useBoostConfig/foo_android.cpp @@ -0,0 +1,21 @@ +// Copyright (c) 2015, Ruslan Baratov +// All rights reserved. + +#include + +#include +#include + +void android_main(struct android_app* state) { + app_dummy(); // Make sure glue isn't stripped + + namespace fs = boost::filesystem; + + __android_log_print( + ANDROID_LOG_INFO, + "BoostFilesystemExample", + fs::current_path().c_str() + ); + + ANativeActivity_finish(state->activity); +} diff --git a/examples/Boost-filesystem/CMakeLists.txt b/examples/Boost-filesystem/CMakeLists.txt index 9bb5b74ced..1ae09d42a0 100644 --- a/examples/Boost-filesystem/CMakeLists.txt +++ b/examples/Boost-filesystem/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -13,10 +12,10 @@ include("../common.cmake") project(download-boost) # download boost -hunter_add_package(Boost COMPONENTS filesystem) +hunter_add_package(Boost COMPONENTS system filesystem) # now boost can be used -find_package(Boost CONFIG REQUIRED filesystem) +find_package(Boost CONFIG REQUIRED system filesystem) if(ANDROID) string(COMPARE EQUAL "${CMAKE_ANDROID_NDK}" "" is_empty) @@ -36,6 +35,9 @@ endif() target_link_libraries( foo Boost::filesystem + Boost::system # Should be last + # Boost 1.66.0, Linux, Clang with -stdlib=libstdc++: + # * https://travis-ci.org/ingenue/hunter/jobs/318140416#L2674 ) if(ANDROID) diff --git a/examples/Boost-iostreams-useBoostConfig/CMakeLists.txt b/examples/Boost-iostreams-useBoostConfig/CMakeLists.txt new file mode 100644 index 0000000000..f817e0c1ee --- /dev/null +++ b/examples/Boost-iostreams-useBoostConfig/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (c) 2015, Aaditya Kalsi +# All rights reserved. + +cmake_minimum_required(VERSION 3.0) + +set(Boost_DEBUG ON CACHE BOOLEAN "") +set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(boost_iostreams) + +hunter_add_package(Boost COMPONENTS iostreams serialization) +# If you use boost/iostreams/filter/gzip.hpp then you should add ZLIB +find_package(ZLIB CONFIG REQUIRED) +# If you use boost/iostreams/filter/bzip2.hpp then you should add BZip2 +find_package(BZip2 CONFIG REQUIRED) +find_package(Boost CONFIG REQUIRED iostreams serialization) + +add_executable(foo foo.cpp) +target_link_libraries(foo PUBLIC Boost::iostreams Boost::serialization ZLIB::zlib BZip2::bz2) diff --git a/examples/Boost-fiber/config.cmake b/examples/Boost-iostreams-useBoostConfig/config.cmake similarity index 100% rename from examples/Boost-fiber/config.cmake rename to examples/Boost-iostreams-useBoostConfig/config.cmake diff --git a/examples/Boost-iostreams-useBoostConfig/foo.cpp b/examples/Boost-iostreams-useBoostConfig/foo.cpp new file mode 100644 index 0000000000..f49eb2a8fb --- /dev/null +++ b/examples/Boost-iostreams-useBoostConfig/foo.cpp @@ -0,0 +1,66 @@ +// Copyright (c) 2015, David Hirvonen +// All rights reserved. + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +struct Record +{ + Record() {} + Record(int age, const std::string &name) : age(age), name(name) {} + + int age; + std::string name; + + // Boost serialization: + //friend class boost::serialization::access; + template void serialize(Archive & ar, const unsigned int version) + { + ar & age; + ar & name; + } +}; + +int main(int argc, char **argv) +{ + std::string filename = "/tmp/record.dat"; + + typedef boost::iostreams::zlib_compressor Compressor; + typedef boost::iostreams::zlib_decompressor Decompressor; + + { // Dump the record: + Record record(1, "kermit"); + std::ofstream ofs(filename, std::ios_base::out | std::ios_base::binary); + if(ofs) + { + boost::iostreams::filtering_stream buffer; + buffer.push(Compressor()); + buffer.push(ofs); + boost::archive::binary_oarchive oa(buffer); + oa << record; + } + } + + { // Load the record + Record record; + std::ifstream ifs(filename, std::ios_base::in | std::ios_base::binary); + if(ifs) + { + boost::iostreams::filtering_streambuf buffer; + buffer.push(Decompressor()); + buffer.push(ifs); + boost::archive::binary_iarchive ia(buffer); // (ifs); + ia >> record; + } + } +} + diff --git a/examples/Boost-iostreams/CMakeLists.txt b/examples/Boost-iostreams/CMakeLists.txt index f817e0c1ee..8edd8b2399 100644 --- a/examples/Boost-iostreams/CMakeLists.txt +++ b/examples/Boost-iostreams/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -13,11 +12,7 @@ include("../common.cmake") project(boost_iostreams) hunter_add_package(Boost COMPONENTS iostreams serialization) -# If you use boost/iostreams/filter/gzip.hpp then you should add ZLIB -find_package(ZLIB CONFIG REQUIRED) -# If you use boost/iostreams/filter/bzip2.hpp then you should add BZip2 -find_package(BZip2 CONFIG REQUIRED) find_package(Boost CONFIG REQUIRED iostreams serialization) add_executable(foo foo.cpp) -target_link_libraries(foo PUBLIC Boost::iostreams Boost::serialization ZLIB::zlib BZip2::bz2) +target_link_libraries(foo PUBLIC Boost::iostreams Boost::serialization) diff --git a/examples/Boost-log-shared/CMakeLists.txt b/examples/Boost-log-shared/CMakeLists.txt index de9f397e4d..82b3df15b1 100644 --- a/examples/Boost-log-shared/CMakeLists.txt +++ b/examples/Boost-log-shared/CMakeLists.txt @@ -12,11 +12,19 @@ include("../common.cmake") project(download-boost) -hunter_add_package(Boost COMPONENTS log) -find_package(Boost CONFIG REQUIRED log) +hunter_add_package(Boost COMPONENTS log filesystem system chrono thread regex date_time atomic) +find_package(Boost CONFIG REQUIRED log filesystem system chrono thread regex date_time atomic) add_executable(foo foo.cpp) target_link_libraries(foo PUBLIC Boost::log + Boost::filesystem + Boost::system + Boost::chrono + Boost::thread + Boost::regex + Boost::date_time + Boost::atomic + Boost::boost ) diff --git a/examples/Boost-log-shared/config.cmake b/examples/Boost-log-shared/config.cmake deleted file mode 100644 index f9ab533253..0000000000 --- a/examples/Boost-log-shared/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS BUILD_SHARED_LIBS=ON USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-log-useBoostConfig/CMakeLists.txt b/examples/Boost-log-useBoostConfig/CMakeLists.txt new file mode 100644 index 0000000000..82bfb43ee5 --- /dev/null +++ b/examples/Boost-log-useBoostConfig/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2013-2017, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.0) + +set(Boost_DEBUG ON CACHE BOOLEAN "") +set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-boost) + +hunter_add_package(Boost COMPONENTS log) +find_package(Boost CONFIG REQUIRED log) + +add_executable(foo foo.cpp) +target_link_libraries(foo PUBLIC Boost::log) diff --git a/examples/Boost-filesystem/config.cmake b/examples/Boost-log-useBoostConfig/config.cmake similarity index 100% rename from examples/Boost-filesystem/config.cmake rename to examples/Boost-log-useBoostConfig/config.cmake diff --git a/examples/Boost-log-useBoostConfig/foo.cpp b/examples/Boost-log-useBoostConfig/foo.cpp new file mode 100644 index 0000000000..1f56b3f693 --- /dev/null +++ b/examples/Boost-log-useBoostConfig/foo.cpp @@ -0,0 +1,12 @@ +#include + +int main() { + BOOST_LOG_TRIVIAL(trace) << "A trace severity message"; + BOOST_LOG_TRIVIAL(debug) << "A debug severity message"; + BOOST_LOG_TRIVIAL(info) << "An informational severity message"; + BOOST_LOG_TRIVIAL(warning) << "A warning severity message"; + BOOST_LOG_TRIVIAL(error) << "An error severity message"; + BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message"; + + return 0; +} diff --git a/examples/Boost-log/CMakeLists.txt b/examples/Boost-log/CMakeLists.txt index 82bfb43ee5..0bc1521a6c 100644 --- a/examples/Boost-log/CMakeLists.txt +++ b/examples/Boost-log/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -16,4 +15,13 @@ hunter_add_package(Boost COMPONENTS log) find_package(Boost CONFIG REQUIRED log) add_executable(foo foo.cpp) -target_link_libraries(foo PUBLIC Boost::log) +target_link_libraries(foo PUBLIC Boost::log + Boost::filesystem + Boost::chrono + Boost::thread + Boost::regex + Boost::date_time + Boost::atomic + Boost::system + Boost::boost +) diff --git a/examples/Boost-log/config.cmake b/examples/Boost-log/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-log/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-math/CMakeLists.txt b/examples/Boost-math/CMakeLists.txt index 15f15e1a02..fd4340f8e6 100644 --- a/examples/Boost-math/CMakeLists.txt +++ b/examples/Boost-math/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-math/config.cmake b/examples/Boost-math/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-math/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-program-options/CMakeLists.txt b/examples/Boost-program-options/CMakeLists.txt index bd1453e390..c8375c594e 100644 --- a/examples/Boost-program-options/CMakeLists.txt +++ b/examples/Boost-program-options/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-program-options/config.cmake b/examples/Boost-program-options/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-program-options/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-python-numpy/config.cmake b/examples/Boost-python-numpy/config.cmake index 9fbef33c61..dbc2733f06 100644 --- a/examples/Boost-python-numpy/config.cmake +++ b/examples/Boost-python-numpy/config.cmake @@ -1,4 +1,4 @@ # Note: PYTHON_VERSION is optional. Refer to Boost package documentation on how # and when to use it: https://cpp-pm-hunter.readthedocs.io/en/latest/packages/pkg/Boost.html#cmake-options -hunter_config(Boost VERSION ${HUNTER_Boost_VERSION} CMAKE_ARGS PYTHON_VERSION=${PYTHON_VERSION} HUNTER_ENABLE_BOOST_PYTHON_NUMPY=True USE_CONFIG_FROM_BOOST=ON) +hunter_config(Boost VERSION ${HUNTER_Boost_VERSION} CMAKE_ARGS PYTHON_VERSION=${PYTHON_VERSION} HUNTER_ENABLE_BOOST_PYTHON_NUMPY=True) hunter_config(hunter_venv VERSION ${HUNTER_hunter_venv_VERSION} CMAKE_ARGS HUNTER_VENV_PYTHON_VERSION=${PYTHON_VERSION}) diff --git a/examples/Boost-python/config.cmake b/examples/Boost-python/config.cmake index d02dee4459..fa638c3ec9 100644 --- a/examples/Boost-python/config.cmake +++ b/examples/Boost-python/config.cmake @@ -1,3 +1,3 @@ # Note: PYTHON_VERSION is optional. Refer to Boost package documentation on how # and when to use it: https://hunter.readthedocs.io/en/latest/packages/pkg/Boost.html#cmake-options -hunter_config(Boost VERSION ${HUNTER_Boost_VERSION} CMAKE_ARGS PYTHON_VERSION=${PYTHON_VERSION} USE_CONFIG_FROM_BOOST=ON) +hunter_config(Boost VERSION ${HUNTER_Boost_VERSION} CMAKE_ARGS PYTHON_VERSION=${PYTHON_VERSION}) diff --git a/examples/Boost-random/CMakeLists.txt b/examples/Boost-random/CMakeLists.txt index 485c608aac..70b56b530a 100644 --- a/examples/Boost-random/CMakeLists.txt +++ b/examples/Boost-random/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-random/config.cmake b/examples/Boost-random/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-random/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-serialization/CMakeLists.txt b/examples/Boost-serialization/CMakeLists.txt index c691919149..e73204d557 100644 --- a/examples/Boost-serialization/CMakeLists.txt +++ b/examples/Boost-serialization/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-serialization/config.cmake b/examples/Boost-serialization/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-serialization/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-stacktrace/CMakeLists.txt b/examples/Boost-stacktrace/CMakeLists.txt index 37aab3759b..0bcace8efe 100644 --- a/examples/Boost-stacktrace/CMakeLists.txt +++ b/examples/Boost-stacktrace/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.2) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-stacktrace/config.cmake b/examples/Boost-stacktrace/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-stacktrace/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-system/CMakeLists.txt b/examples/Boost-system/CMakeLists.txt index 1256892eb5..2e125023bf 100644 --- a/examples/Boost-system/CMakeLists.txt +++ b/examples/Boost-system/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-system/config.cmake b/examples/Boost-system/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-system/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-test/CMakeLists.txt b/examples/Boost-test/CMakeLists.txt index a342f07083..3fa14ce10d 100644 --- a/examples/Boost-test/CMakeLists.txt +++ b/examples/Boost-test/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-test/config.cmake b/examples/Boost-test/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-test/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-thread/CMakeLists.txt b/examples/Boost-thread/CMakeLists.txt index 5dd678befe..0595070c47 100644 --- a/examples/Boost-thread/CMakeLists.txt +++ b/examples/Boost-thread/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate @@ -12,8 +11,8 @@ include("../common.cmake") project(download-boost) -hunter_add_package(Boost COMPONENTS thread) -find_package(Boost CONFIG REQUIRED thread) +hunter_add_package(Boost COMPONENTS system thread) +find_package(Boost CONFIG REQUIRED system thread) add_executable(foo foo.cpp) -target_link_libraries(foo PUBLIC Boost::thread) +target_link_libraries(foo PUBLIC Boost::system Boost::thread) diff --git a/examples/Boost-thread/config.cmake b/examples/Boost-thread/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-thread/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost-useBoostConfig/CMakeLists.txt b/examples/Boost-useBoostConfig/CMakeLists.txt new file mode 100644 index 0000000000..b261ad51d3 --- /dev/null +++ b/examples/Boost-useBoostConfig/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (c) 2013, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.0) + +set(Boost_DEBUG ON CACHE BOOLEAN "") +set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-boost) + +hunter_add_package(Boost) +find_package(Boost CONFIG REQUIRED) + +add_executable(foo foo.cpp) +target_link_libraries(foo PUBLIC Boost::headers) # Since boost 1.70 you should use Boost::headers as target + +set(project_license "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") +file( + WRITE + "${project_license}" + "Some info about this project license.\n\n" +) + +string(COMPARE EQUAL "${Boost_LICENSES}" "" is_empty) +if(is_empty) + message(FATAL_ERROR "No licenses") +endif() + +file(APPEND "${project_license}" "== 3rd party licenses ==\n\n") + +foreach(x ${Boost_LICENSES}) + file(READ "${x}" content) + get_filename_component(license_name "${x}" NAME) + file(APPEND "${project_license}" "== Boost (${license_name}) ==\n\n") + file(APPEND "${project_license}" "${content}") +endforeach() + +message("Project license: ${project_license}") + +file(GLOB_RECURSE boost_configs "${BOOST_ROOT}/*/BoostConfig.cmake") +list(LENGTH boost_configs len) +if(NOT len EQUAL "1") + message(FATAL_ERROR "More than one *Config: ${boost_configs}") +endif() diff --git a/examples/Boost-iostreams/config.cmake b/examples/Boost-useBoostConfig/config.cmake similarity index 100% rename from examples/Boost-iostreams/config.cmake rename to examples/Boost-useBoostConfig/config.cmake diff --git a/examples/Boost-useBoostConfig/foo.cpp b/examples/Boost-useBoostConfig/foo.cpp new file mode 100644 index 0000000000..28f9a77ef2 --- /dev/null +++ b/examples/Boost-useBoostConfig/foo.cpp @@ -0,0 +1,4 @@ +#include + +int main() { +} diff --git a/examples/Boost-uuid/CMakeLists.txt b/examples/Boost-uuid/CMakeLists.txt index 0e20b6cffc..fb131a17dc 100644 --- a/examples/Boost-uuid/CMakeLists.txt +++ b/examples/Boost-uuid/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost-uuid/config.cmake b/examples/Boost-uuid/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost-uuid/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -) diff --git a/examples/Boost/CMakeLists.txt b/examples/Boost/CMakeLists.txt index 3af1246604..4b30e30889 100644 --- a/examples/Boost/CMakeLists.txt +++ b/examples/Boost/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) set(Boost_DEBUG ON CACHE BOOLEAN "") -set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) # Emulate HunterGate: # * https://github.com/hunter-packages/gate diff --git a/examples/Boost/config.cmake b/examples/Boost/config.cmake deleted file mode 100644 index 9daa4a1d95..0000000000 --- a/examples/Boost/config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_config(Boost - VERSION ${HUNTER_Boost_VERSION} - CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON -)