-
Notifications
You must be signed in to change notification settings - Fork 264
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
Add full CMake support #215
Conversation
Changes: - Added a cmake file for the project that can be used to import loguru using all of the following strategies 1. add_subdirectory() # works well with git submodules 2. FetchContent() # works well with external git repos 3. find_package() # works well to share a common install Plans: - Thoroughly test the current file with each of the three methods - Update the README to contain cmake instructions - Add CPack support - Add CTest support
Notes: - Still need to test this on linux - Still need to test the actual behavior of `"CPACK_INCLUDE_TOPLEVEL_DIRECTORY"=0`
Changes: - Only try to install .pdb for shared libraries in debug mode
To me this looks like a great initiative. From what I can see it looks good. But I must say I am not that good with cmake and other build systems. I usually type Maybe @emilk should also take a look. |
If I may chime in - I was interested in using loguru from CMake, thus found this PR and made a local FreeBSD package based on it. Some feedback:
Hope this helps. |
I am also interested in cmake build support for Loguru. I successfully built a shared object with the following command:
One missing feature is pkgconfig definition. Would you accept the pkgconfig in this pull request, EDIT: Note that my branch is just work in progress. |
BTW: the Meson WrapDB version of loguru automatically generates a pkg-config file using Meson's pkgconfig generator: https://github.com/mesonbuild/wrapdb/blob/master/subprojects/packagefiles/emilk-loguru/meson.build The resulting pkg-config file has |
Thanks, I have to take a closer look at the Meson wrap for Loguru. |
Maybe @kcgen knows the answer to that. |
When using Loguru under DOSBox Staging, Both of these issues were PR'd into this repo, https://github.com/emilk/loguru/pulls/kcgen, but have sat for roughly a year now, so in the meantime we've been using our own fork of Loguru as a stopgap until these are merged. We also strive to have zero warnings (at meson level 3), and so those PRs also cleanup some of those too. |
Changes: - The package description variables used by CPack now get their values from top-level cache variables Notes: - This should make it easy to pass descriptions into a pkgconfig file... Plans: - Add support for a configured pkgconfig file
Changes: - Added a `loguru.pc.in` template file - Added cmake support for configuring a basic loguru.pc pkgconfig file - Added cache variable `LOGURU_INSTALL_PKGCONFIGDIR` that can set the install location of the generated .pc file - Change linking logic for the `dl` library (now loguru target only links to `dl` if `LOGURU_STACKTRACES=1`) Notes: - I'm not familiar with pkgconfig, but the .pc file generated by the [meson wrapdb subproject][1] marks the dependencies as Lib.private so I'm just copying what they do! Refs: [1]: <https://github.com/mesonbuild/wrapdb/blob/42afffac0610cc9b0c4cdd333ec7a21f12ecc4dd/subprojects/packagefiles/emilk-loguru/meson.build>
Hey guys, thanks for the feedback! @oturpe, great idea for pkgconfig support and thanks for the reference implementation. If someone could try out my newest changes and see if the generated
Thank you, this was super helpful. |
Ha, good to hear. Since Meson's description is:
... it's good to hear we're succeeding |
It is funny how Kitware uses Loguru extensively in their projects and yet never bothered to get a CMakeLists here. I think this is a very good start too, It would indeed be nice if this was merged. |
@emilk Any chance you could take a look at this for review? |
Adds comprehensive CMake support to the project (requires CMake version 3.10+)
All feedback is welcome, I'm happy to answer any questions you may have.
New Features
You can now import loguru into your CMake projects with any of the following three methods:
add_subdirectory()
# works well with git submodulesFetchContent()
# works well with external git reposfind_package()
# works well to share a common installExample
For a demonstration of exactly how to import loguru into your CMake project, see the included example CMakeLists.txt file
Note about existing Tests
I didn't convert any of the existing CMakeLists.txt files in the project that are used for the tests and examples because that would require bumping their minimum required versions from 2.8 all the way to 3.10.
With that said: version 2.8 is officially deprecated and is no longer supported from CMake 3.21 onward and the only major distribution that still comes with CMake version 2.8 is CentOS 7.
If you like what you see here and are okay with me upping the minimum versions of the tests (and examples), I can integrate all of it into the main CMake build.
Closes
Notes to other users
I will be maintaining this branch on my fork indefinitely regardless of the result of this PR, so feel free to clone from it as needed.