jbaldwin / libcoro

C++20 coroutine library
Apache License 2.0
565 stars 57 forks source link

Add support for shared library #233

Closed uilianries closed 8 months ago

uilianries commented 8 months ago

Hello!

I would like to understand the reason of supporting only static library libcoro.

https://github.com/jbaldwin/libcoro/blob/main/CMakeLists.txt#L130

add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES})

Could I use it as shared library locally, what should I know?

Regards!

jbaldwin commented 8 months ago

Hi, just nobody has ever asked for it yet as far as I know. The library can add something similar to your other PR like LIBCORO_LIBRARY_SHARED=ON|OFF and it sets STATIC/SHARED on the line add_library line you identified. I think c-ares also needs to be switched to SHARED here https://github.com/jbaldwin/libcoro/blob/main/CMakeLists.txt#L49-L50 otherwise you'll get build errors.

Would you mind opening a PR with this to move it forward?

uilianries commented 8 months ago

Would you mind opening a PR with this to move it forward?

Yes, I can open a PR, totally. Just asked first to be sure in case there was some restriction.

Thank you!