-
Notifications
You must be signed in to change notification settings - Fork 28
Added target export capabilities and solidified installation procedure #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rent CMake versions
Can you elaborate? I didn't have any issues with libusb-cmake and FetchContent so far |
|
Sure, i'l start with the context that helped me discover the "issue" and then elaborate on the enhancement: I'm currently trying to reform the st-link open source toolset into a c++ library. originally, this project relies on libusb-1.0, but the approach back then was "let's download the pre-compiled library for windows, while only supporting mingw builds". By researching libusb project, I noticed this repo which was god-sent for windows builds (the project maintainers preffered the default On my C++ Implementation, i leverage The approach in this PR allows
As for the |
|
Thanks for clarification. Now I get why you might need to introduce the Just to clarify: does you c++ implementation uses libusb-1.0 as a public dependency? I.e. does your API uses some parts of libusb API as its own / addition?
Hm... The thing is:
We should be just fine with only: |
No, that's not the case! So, if i build
If |
|
Do you intend to build your library as a static library or a shared library (or both depending on an option)? |
I intend to build my library as a shared library (and use |
|
Not necessary, I totally get the issue. As for your particular case, it should be enough to have libusb as a build-only dependency, e.g.: |
This was an eye-opener -i thought Other than that, I'm glad this PR is helpfull to the project. If you need me to update parts of it, I'm happy to revisit them. |
|
My comments still stands - try to remove all explicit changes related to |
Youw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently we do need to include GNUInstallDirs explicitly, to initialize corresponding CMake variables - that's fine I guess.
I don't believe this is complete - there still has to be libusb-config.cmake generated, but that is to be done separately, since I don't have enough time to do it myself right now.
This pull request modifies the necessary sections of CMake to export LIBUSB Targets, allowing it to operate better with
fetchContenton targets that use target exporting.Additionally,
GNUInstallDirsis now used to provide better heurestics on the correct installation directories, and the right (shared) library installation directory is selected, based on whether the project is built using MSVC (so, windows) or not.