diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2019-05-14 18:16:03 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <bykoianko@gmail.com> | 2019-06-10 13:50:13 +0300 |
commit | c63e2a5077bff329b63f5954737ecfea0e8fbc50 (patch) | |
tree | e7e9d9dd090ef635f2b292787e37f521bfd789ac /cmake | |
parent | 3946ef2837022d28b9e8db4fa909166c3b2129fa (diff) |
[cmake][boost] Added cmake functions to install boost.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ExternalBoost.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/ExternalBoost.cmake b/cmake/ExternalBoost.cmake new file mode 100644 index 0000000000..a38fd98434 --- /dev/null +++ b/cmake/ExternalBoost.cmake @@ -0,0 +1,24 @@ +function(run_bash_command command) + execute_process(COMMAND bash -c ${command} RESULT_VARIABLE ret) + if (NOT (ret EQUAL "0")) + message(FATAL_ERROR "Сommand ${command} failed with code ${ret}.") + endif() +endfunction() + +function(init_boost) + run_bash_command("cd ${BOOST_ROOT} && ./bootstrap.sh") +endfunction() + +function(install_boost option) + run_bash_command("cd ${BOOST_ROOT} && ./b2 ${option}") +endfunction() + +function(install_boost_headers) + install_boost("headers") +endfunction() + +function(link_boost_lib exe library) + install_boost("link=static --with-${library}") + find_package(Boost ${BOOST_VERSION} COMPONENTS ${library} REQUIRED) + target_link_libraries(${exe} ${Boost_LIBRARIES}) +endfunction() |