Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to use cmake package configuration file from boost #154

Merged
merged 35 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
24cd58a
Fix path in cmake config modul of boost
Bjoe Jan 22, 2020
2ee27c9
Remove boost config module in hunter
Bjoe Jan 22, 2020
427825a
Increment package id
Bjoe Jan 22, 2020
c98a627
Add Boost_USE_STATIC_LIBS in examples....
Bjoe Jan 22, 2020
3965e72
Fix boost iostream example...
Bjoe Jan 22, 2020
9aff1b9
Fix example, add Boost_USE_STATIC_LIBS
Bjoe Jan 22, 2020
8311a67
Add workaround in example to fix test on travis
Bjoe Jan 23, 2020
289bf11
If an older boost version is used... use BoostConfig from hunter
Bjoe Jan 23, 2020
9e58dbc
Try to fix windows test builds
Bjoe Jan 23, 2020
aa0551c
Add FindBoost.cmake again,
Bjoe Jan 25, 2020
2a4d70c
Fix iOS build, set install target
Bjoe Jan 25, 2020
2f22dbe
Split build and install target on iOS build
Bjoe Jan 25, 2020
37bcbd5
Enable boost debug
Bjoe Feb 1, 2020
33cb8cd
Use Boost::boost because example is build also with older versions
Bjoe Feb 1, 2020
c14fc47
Comment out fix, needs impovement
Bjoe Feb 1, 2020
076b510
Fix mingw/boost 1.64 test build
Bjoe Feb 3, 2020
e2978c8
Fix vs builds
Bjoe Feb 3, 2020
c1752ce
Cleanup boost thread test build
Bjoe Feb 3, 2020
3588138
Fix boost system test on windows
Bjoe Feb 4, 2020
730d526
Improve boost log test
Bjoe Feb 4, 2020
65d3182
Set Boost_USE_STATIC_LIBS when not HUNTER_BUILD_SHARED_LIBS
Bjoe Feb 9, 2020
6e3f71e
Get cmake args for Boost
Bjoe Feb 10, 2020
957ecab
Fix use boost static libs in windows
Bjoe Feb 10, 2020
92ada88
Introduced USE_CONFIG_FROM_BOOST
Bjoe Feb 11, 2020
7b0d370
use boost config if not boost version less then 1.72
Bjoe Feb 11, 2020
54d61b0
If boost version should be 1.72 or greater
Bjoe Feb 11, 2020
42ecac9
if not BOOST_BUILD_DYNAMIC_VSRUNTIME use boost static runtime
Bjoe Feb 12, 2020
30882c2
Fix some review findings
Bjoe Feb 13, 2020
d668ebd
Merge remote-tracking branch 'origin/master' into pr.boost.use-boostc…
Bjoe Feb 13, 2020
14eb85c
Increase PACKAGE_INTERNAL_DEPS_ID
Bjoe Feb 13, 2020
86a74e0
Merge branch 'master' into pr.boost.use-boostconfig
Bjoe Feb 16, 2020
1f1e729
Create boost config from boost if USE_CONFIG_FROM_BOOST is set
Bjoe Feb 16, 2020
b2bd8ae
Use only some examples to use config from boost
Bjoe Feb 24, 2020
8ff9b71
Fix boost log example
Bjoe Feb 25, 2020
4187249
Add USE_CONFIG_FROM_BOOST hint in boost doc
Bjoe Mar 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/projects/Boost/atomic/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
atomic
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/chrono/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
chrono
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/context/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
context
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/contract/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
contract
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/coroutine/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
coroutine
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/date_time/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
date_time
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/exception/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
exception
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/fiber/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
fiber
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/filesystem/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
filesystem
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/graph/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
graph
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/graph_parallel/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
graph_parallel
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
25 changes: 24 additions & 1 deletion cmake/projects/Boost/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,27 @@ endif()

hunter_pick_scheme(DEFAULT url_sha1_boost)
hunter_cacheable(Boost)
hunter_download(PACKAGE_NAME Boost PACKAGE_INTERNAL_DEPS_ID "47")
hunter_download(PACKAGE_NAME Boost PACKAGE_INTERNAL_DEPS_ID "48")


if(NOT HUNTER_Boost_VERSION VERSION_LESS 1.72.0)
hunter_get_cmake_args(PACKAGE Boost OUT boost_cmake_args)
string(FIND "${boost_cmake_args}" "BUILD_SHARED_LIBS=ON" boost_shared)
string(FIND "${boost_cmake_args}" "USE_CONFIG_FROM_BOOST=ON" use_boost_config)
string(FIND "${boost_cmake_args}" "BOOST_BUILD_DYNAMIC_VSRUNTIME=NO" boost_static_runtime)
if(use_boost_config GREATER -1)
if(boost_shared LESS 0)
option(Boost_USE_STATIC_LIBS "Use of the static libraries" ON)
else()
option(Boost_USE_STATIC_LIBS "Use of the static libraries" OFF)
endif()

if(MSVC)
if(boost_static_runtime LESS 0)
option(Boost_USE_STATIC_RUNTIME "Use libraries linked statically to the C++ runtime" OFF)
else()
option(Boost_USE_STATIC_RUNTIME "Use libraries linked statically to the C++ runtime" ON)
endif()
endif()
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/projects/Boost/hunter.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
boost_component
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/iostreams/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
iostreams
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/locale/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
locale
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/log/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
log
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/math/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
math
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/mpi/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
mpi
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/program_options/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
program_options
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/python/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
python
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/random/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
random
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/regex/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
regex
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
11 changes: 4 additions & 7 deletions cmake/projects/Boost/schemes/url_sha1_boost.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ configure_file(


set(pass_boost_no_cmake_config )
if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0)
if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0 AND NOT USE_CONFIG_FROM_BOOST)
set(pass_boost_no_cmake_config --no-cmake-config)
endif()

Expand Down Expand Up @@ -154,11 +154,6 @@ ExternalProject_Add(
"@HUNTER_SELF@/scripts/try-copy-license.cmake"

# ineffective on older Boost than 1.72.0 as we resort on --no-cmake-config
COMMAND
"@CMAKE_COMMAND@"
"-Dinstalldir=@HUNTER_PACKAGE_INSTALL_PREFIX@"
-P
"@HUNTER_SELF@/scripts/clean-boost-configs.cmake"

LOG_CONFIGURE ${log_build}
LOG_BUILD ${log_build}
Expand All @@ -170,4 +165,6 @@ set(HUNTER_SELF "@HUNTER_SELF@")
set(HUNTER_PACKAGE_INSTALL_PREFIX "@HUNTER_PACKAGE_INSTALL_PREFIX@")
set(HUNTER_Boost_VERSION "@HUNTER_Boost_VERSION@")

hunter_install_boost_config()
if(NOT USE_CONFIG_FROM_BOOST OR HUNTER_Boost_VERSION VERSION_LESS 1.72.0)
hunter_install_boost_config()
endif()
18 changes: 14 additions & 4 deletions cmake/projects/Boost/schemes/url_sha1_boost_ios_library.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ set(
--user-config="${boost_user_jam}"
)

if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0)
if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0 AND NOT USE_CONFIG_FROM_BOOST)
list(APPEND build_opts --no-cmake-config )
endif()

Expand Down Expand Up @@ -220,7 +220,11 @@ if(has_iphoneos)
BUILD_IN_SOURCE
1
INSTALL_COMMAND
""
./b2
-d0
${build_opts_iphoneos}
install
"--prefix=@HUNTER_PACKAGE_INSTALL_PREFIX@"
)
else()
# Add dummy target
Expand Down Expand Up @@ -273,7 +277,11 @@ if(has_isim)
BUILD_IN_SOURCE
1
INSTALL_COMMAND
""
./b2
-d0
${build_opts_iphonesimulator}
install
"--prefix=@HUNTER_PACKAGE_INSTALL_PREFIX@"
)
else()
# Add dummy target
Expand Down Expand Up @@ -376,4 +384,6 @@ set(HUNTER_SELF "@HUNTER_SELF@")
set(HUNTER_PACKAGE_INSTALL_PREFIX "@HUNTER_PACKAGE_INSTALL_PREFIX@")
set(HUNTER_Boost_VERSION "@HUNTER_Boost_VERSION@")

hunter_install_boost_config()
if(NOT USE_CONFIG_FROM_BOOST OR HUNTER_Boost_VERSION VERSION_LESS 1.72.0)
hunter_install_boost_config()
endif()
13 changes: 9 additions & 4 deletions cmake/projects/Boost/schemes/url_sha1_boost_library.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ if(has_toolset_version)
endif()

set(boost_user_jam "@HUNTER_PACKAGE_BUILD_DIR@/boost.user.jam")
# TODO file(TO_NATIVE_PATH "${boost_user_jam}" boost_user_jam_native_path)
# Escape --user-config=C:\projects\hunter-tdmm2\_testing\Hunter\_Base\5398c9d\30f4075\2d24521\Build\Boost\__filesystem\Build\boost.user.jam
# Error -> Invalid character escape '\p'.
set(
build_opts
-a
Expand All @@ -230,7 +233,7 @@ set(
--with-@HUNTER_PACKAGE_COMPONENT@
)

if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0)
if (@HUNTER_Boost_VERSION@ VERSION_GREATER_EQUAL 1.72.0 AND NOT USE_CONFIG_FROM_BOOST)
list(APPEND build_opts --no-cmake-config )
endif()

Expand Down Expand Up @@ -533,8 +536,8 @@ ExternalProject_Add(
${b2_cmd}
-d0
${build_opts}
stage # install only libraries, headers installed in `url_sha1_boost`
"--stagedir=@HUNTER_PACKAGE_INSTALL_PREFIX@"
install
"--prefix=@HUNTER_PACKAGE_INSTALL_PREFIX@"
--ignore-site-config # Ignore Gentoo specific optimization "none" in site config that only the patched bjam of Gentoo can understand.
LOG_CONFIGURE ${log_build}
LOG_BUILD ${log_build}
Expand All @@ -546,4 +549,6 @@ set(HUNTER_SELF "@HUNTER_SELF@")
set(HUNTER_PACKAGE_INSTALL_PREFIX "@HUNTER_PACKAGE_INSTALL_PREFIX@")
set(HUNTER_Boost_VERSION "@HUNTER_Boost_VERSION@")

hunter_install_boost_config()
if(NOT USE_CONFIG_FROM_BOOST OR HUNTER_Boost_VERSION VERSION_LESS 1.72.0)
hunter_install_boost_config()
endif()
2 changes: 1 addition & 1 deletion cmake/projects/Boost/serialization/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
serialization
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/signals/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
signals
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/stacktrace/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
stacktrace
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/system/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
system
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/test/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
test
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/thread/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
thread
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/timer/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
timer
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/wave/hunter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
wave
PACKAGE_INTERNAL_DEPS_ID "47"
PACKAGE_INTERNAL_DEPS_ID "48"
)
9 changes: 9 additions & 0 deletions docs/packages/pkg/Boost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ config file (``boost/config/user.hpp``):
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_LIST_SIZE 3
- Option ``USE_CONFIG_FROM_BOOST=ON`` use the package configuration file provided
by the boost project.
Since boost version 1.70.0, the boost project provide a well maintained package
configuration file for use with find_package's config mode.
See the difference between following example:
- `Boost-log <https://github.com/cpp-pm/hunter/blob/master/examples/Boost-log/CMakeLists.txt>`__
- `Boost-log-usingBoostConfig <https://github.com/cpp-pm/hunter/blob/master/examples/Boost-log-usingBoostConfig/CMakeLists.txt>`__


Python
------

Expand Down
23 changes: 23 additions & 0 deletions examples/Boost-chrono-1-64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2013, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-boost)

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
)
6 changes: 6 additions & 0 deletions examples/Boost-chrono-1-64/foo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <boost/chrono/system_clocks.hpp>

int main() {
boost::chrono::system_clock::now();
return 0;
}
Loading