olivierldff / asio.cmake Goto Github PK
View Code? Open in Web Editor NEWSmall CMake wrapper to add asio with a simple FetchContent.
License: MIT License
Small CMake wrapper to add asio with a simple FetchContent.
License: MIT License
Hello,
Thanks for adding the CMake support here since it seems the core asio
team does not want any CMake code in their repo.
Have you considered adding support for consuming asio
in a CMake based project with a call to find_package(asio MODULE REQUIRED)
? To do that, one would need to add a FindAsio.cmake
script to this repo, perhaps in the existing cmake
folder.
Although CMake module scripts aren't as good as config scripts, it still meets the use case that one as asio
installed in their system headers. For example, on Ubuntu 22.04, I can install libasio-dev
, use fetchContent
to get this repo, add the cmake
folder to CMAKE_MODULE_PATH
. This provides the advantage of my source tree only getting to use one version of asio - the one installed in the system headers. Tools like FetchContent and CPM enable you to fetch different versions of the same library in multiple different libraries, which can be problematic.
Furthermore, the CMake module script could support version checking, through a simple re-use of the version parsing you have already implemented. For example, this can guarantee that the located version of asio is exactly 1.18.1
.
find_package(ASIO 1.18.1 EXACT MODULE REQUIRED)
A contrived example: https://github.com/ros-drivers/transport_drivers/blob/main/asio_cmake_module/cmake/Modules/FindASIO.cmake
Would you be willing to accept a PR that adds this capability?
Best,
Ryan
https://stackoverflow.com/a/58365352
The first method is working. But in windows for mingw need to add link_libraries(ws2_32 wsock32) after include_directories(${asio_SOURCE_DIR}/asio/include/). In linux need add:SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASIO_STANDALONE -pthread").
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.