mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2026-02-06 14:55:57 +08:00
Add boost example (#70)
* add unit tests * added boost * cleanup * add pthread * Update README.md
This commit is contained in:
11
README.md
11
README.md
@@ -130,6 +130,17 @@ CPMAddPackage(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### [Boost (via boost-cmake)](https://github.com/Orphis/boost-cmake)
|
||||||
|
|
||||||
|
```CMake
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME boost-cmake
|
||||||
|
GITHUB_REPOSITORY Orphis/boost-cmake
|
||||||
|
VERSION 1.67.0
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
### [google/benchmark](https://github.com/google/benchmark)
|
### [google/benchmark](https://github.com/google/benchmark)
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
|
|||||||
18
examples/boost/CMakeLists.txt
Normal file
18
examples/boost/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||||
|
|
||||||
|
# ---- Create binary ----
|
||||||
|
|
||||||
|
add_executable(CPMExampleBoost main.cpp)
|
||||||
|
set_target_properties(CPMExampleBoost PROPERTIES CXX_STANDARD 17)
|
||||||
|
|
||||||
|
# ---- Dependencies ----
|
||||||
|
|
||||||
|
include(../../cmake/CPM.cmake)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME boost
|
||||||
|
GITHUB_REPOSITORY Orphis/boost-cmake
|
||||||
|
VERSION 1.67.0
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(CPMExampleBoost PRIVATE Boost::system pthread)
|
||||||
30
examples/boost/main.cpp
Normal file
30
examples/boost/main.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// timer.cpp
|
||||||
|
// ~~~~~~~~~
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
|
void print(const boost::system::error_code& /*e*/)
|
||||||
|
{
|
||||||
|
std::cout << "Hello, world!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::asio::io_service io;
|
||||||
|
|
||||||
|
boost::asio::deadline_timer t(io, boost::posix_time::seconds(1));
|
||||||
|
t.async_wait(&print);
|
||||||
|
|
||||||
|
io.run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -10,5 +10,4 @@ foreach(test ${tests})
|
|||||||
NAME ${test}
|
NAME ${test}
|
||||||
COMMAND ${CMAKE_COMMAND} -DCPM_PATH=${CMAKE_CURRENT_SOURCE_DIR}/../cmake -P "${test}"
|
COMMAND ${CMAKE_COMMAND} -DCPM_PATH=${CMAKE_CURRENT_SOURCE_DIR}/../cmake -P "${test}"
|
||||||
)
|
)
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
Reference in New Issue
Block a user