Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Document Boost::math oddities #1099

Merged
merged 4 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions docs/packages/pkg/Boost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Examples:
- `Boost-system <https://github.com/ruslo/hunter/blob/master/examples/Boost-system/CMakeLists.txt>`__
- `Boost-iostreams <https://github.com/ruslo/hunter/blob/master/examples/Boost-iostreams/CMakeLists.txt>`__
- `Boost-filesystem <https://github.com/ruslo/hunter/blob/master/examples/Boost-filesystem/CMakeLists.txt>`__
- `Boost-math <https://github.com/ruslo/hunter/blob/master/examples/Boost-math/CMakeLists.txt>`__

List of components (other libraries are header-only):

Expand Down Expand Up @@ -89,6 +90,32 @@ For example:
- `boost.iostreams
options <http://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/index.html?path=7>`__

Math
-----------

When using Boost Math you will need to link in the libraries, however these are not named ``math`` but
rather are individual based on what you need to link it, the easiest of which is to link in all parts:

.. code-block:: cmake

hunter_add_package(Boost COMPONENTS math)
find_package(Boost CONFIG REQUIRED math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
target_link_libraries(...
Boost::math_c99
Boost::math_c99f
Boost::math_c99l
Boost::math_tr1
Boost::math_tr1f
Boost::math_tr1l
)

If you are using only the header-only parts of Boost::Math then the libraries can be ignored:

.. code-block:: cmake

hunter_add_package(Boost COMPONENTS math)
find_package(Boost CONFIG REQUIRED)

Bugs
----

Expand Down
28 changes: 28 additions & 0 deletions examples/Boost-math/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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)

# download boost
hunter_add_package(Boost COMPONENTS math)

# now boost::math_* targets
# link in all the parts of boost math, or leave out unneeded parts
find_package(Boost CONFIG REQUIRED math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
add_executable(foo foo.cpp)
# link in the libraries as well for whatever is found above in find_package
target_link_libraries(foo
Boost::math_c99
Boost::math_c99f
Boost::math_c99l
Boost::math_tr1
Boost::math_tr1f
Boost::math_tr1l
)

5 changes: 5 additions & 0 deletions examples/Boost-math/foo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <boost/math/tr1.hpp>

int main() {
}