Added module for Boost detection and automatic build-up
This commit is contained in:
committed by
Roberto Di Remigio
parent
ea694c0bdd
commit
1780e4a189
19
test/boost_libs/cmake/autocmake.cfg
Normal file
19
test/boost_libs/cmake/autocmake.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
[project]
|
||||
name: example
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[custom]
|
||||
source: custom/boost_version-components.cmake
|
||||
|
||||
[boost]
|
||||
source: ../../../modules/boost/boost.cmake
|
||||
fetch: http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.zip
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
@ -0,0 +1,2 @@
|
||||
set(BOOST_MINIMUM_REQUIRED 1.59.0)
|
||||
list(APPEND BOOST_COMPONENTS_REQUIRED chrono timer system)
|
5
test/boost_libs/src/CMakeLists.txt
Normal file
5
test/boost_libs/src/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(example example.cpp)
|
||||
if(BUILD_CUSTOM_BOOST)
|
||||
add_dependencies(example custom_boost)
|
||||
endif()
|
||||
target_link_libraries(example ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
28
test/boost_libs/src/example.cpp
Normal file
28
test/boost_libs/src/example.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::timer::auto_cpu_timer t;
|
||||
|
||||
std::cout << "Boost version: "
|
||||
<< BOOST_VERSION / 100000
|
||||
<< "."
|
||||
<< BOOST_VERSION / 100 % 1000
|
||||
<< "."
|
||||
<< BOOST_VERSION % 100
|
||||
<< std::endl;
|
||||
|
||||
|
||||
std::cout << "Measuring some timings..." << std::endl;
|
||||
for (long i = 0; i < 100000000; ++i)
|
||||
std::sqrt(123.456L); // burn some time
|
||||
|
||||
std::cout << "PASSED" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user