cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.19k stars 472 forks source link

Export CMake Targets #573

Closed SE2Dev closed 2 years ago

SE2Dev commented 2 years ago

The lack of any properly exported CMake target makes it somewhat difficult for libraries like libdatachannel to have a proper cmake configuration for consuming libSRTP.

This pull request effectively allows developers to consume libSRTP as seen here:

find_library(libSRTP REQUIRED)
# ...
target_link_libraries(server PRIVATE libSRTP::srtp2)
pabuhler commented 2 years ago

Awesome thanks, will follow up soon

NancyLi1013 commented 2 years ago

Hi @pabuhler

I'm the maintainer of vcpkg. Could you please help confirm when this PR will be accepted and merged?

Thanks

LilyWangLL commented 2 years ago

Ping @pabuhler for response.

pabuhler commented 2 years ago

@LilyWangLL I did a small change that was needed for me to get this to work with a test project. Did the change make sense to you?

Also I am no cmake guru but this looks like alot more than I would have expected in order to make it work with find_package. I am guess you know what you are doing ?

LilyWangLL commented 2 years ago

@LilyWangLL I did a small change that was needed for me to get this to work with a test project. Did the change make sense to you?

Also I am no cmake guru but this looks like alot more than I would have expected in order to make it work with find_package. I am guess you know what you are doing ?

Thanks for your reply. Thanks for @SE2Dev's work. I test this PR locally and suggest some changes. If this PR merged, we can use find_package to use libsrtp susseed in CMake project.

pabuhler commented 2 years ago

I will try out the suggestions locally.

pabuhler commented 2 years ago

@LilyWangLL Is there a way to test suggestions locally without first committing or having to manually edit ? this is more a GitHub question but since you added them I wounder if you know how to use them? I do not like the idea of committing things I cant tests.

SE2Dev commented 2 years ago

@LilyWangLL Is there a way to test suggestions locally without first committing or having to manually edit ? this is more a GitHub question but since you added them I wounder if you know how to use them? I do not like the idea of committing things I cant tests.

Personally, I usually just use VSCode and set up a devcontainer locally, and ran the CMake "install" target inside the devcontainer so that the files wouldn't be littered all over my system when testing.

pabuhler commented 2 years ago

I have merged the changes as is, it seams to work for me in most cases I have tested, @LilyWangLL If you have a good argument for using the "share" folder for installing then please make a new PR.