-
Notifications
You must be signed in to change notification settings - Fork 167
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
update cmake installation to support VCPKG port #156
Conversation
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.
@remz1337 Hey, thanks for working on this! It is really cool that you are adding/porting Edlib to VCPKG.
So what you did is, you first made installation step optional (although it is still ON by default) and then you enriched it so that additional stuff is created -> version, config and target files. Is that correct?
What I am wondering is -> are these files that are now created somehow specific to VCPKG or are they more general thing? I am getting a feeling that they are not tied just to VCPKG, although it does use them, is that correct? It would be great if you could tell me more about this! Including what is this edlib-config.cmake.in about.
@SoapZA , sorry to bother you, but would you mind also giving a look here? You are the last person to have been making significant changes to Edlib's CMakeLists.txt and you certainly know much more about it than me, so I would love to hear your opinion on this PR!
My knowledge of CMAKE is pretty basic, and
Yes, that's about it! I'm still new to vcpkg too. I followed the basic setup tutorial on vcpkg to port a new lib, but when I tried with just the default config, I had a bunch of error. So I went around and looked at other existing ports to see what wasn't working came up with this solution. I'm sure someone with better knowledge of CMake would be able to improve it, but at least it is working for me right now Thanks for this great library! |
@remz1337 ok got it, and thanks again for the effort! The main thing I would like before we merge this PR though, is having a better understanding of the part that you added, and if it is useful for other stuff, not just vcpkg, and also how exactly it fits with the rest of the CMakeLists. Is this something you could shed some light on, or are there some resources you could point me out to? That is also why I invited @SoapZA to possibly give it a look, but I am not sure if he will have time so I would rather we push on with this in the meantime in any case. |
@Martinsos haven't forgotten about you, I'll take a look now |
CMakeLists.txt
Outdated
install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
endif() | ||
### // |
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.
you're missing the final trailing line.
CMakeLists.txt
Outdated
### Additional config for VCPKG | ||
if(EDLIB_ENABLE_INSTALL) | ||
include(CMakePackageConfigHelpers) | ||
set(EDLIB_CMAKE_DIR "lib/cmake/edlib" CACHE STRING |
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.
this is wrong and should be ${CMAKE_INSTALL_LIBDIR}/cmake/edlib
edlib-config.cmake.in
Outdated
@PACKAGE_INIT@ | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake) | ||
check_required_components(edlib) |
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.
same here, please add the trailing missing line
Thanks for the feedback @SoapZA , I just pushed the changes. i've also updated the package version to reflect the latest release (1.2.5 -> 1.2.6) @Martinsos : I don't fully understand how it works with vcpkg, I've just used the same setup that I saw with other working ports. I've read through the docs of vcpkg but didn't find much explanation. You can have a look here |
@remz1337 thanks for sharing the link, I will take a look when I get some time! My concern here remains the same - I don't like committing code that at least somebody does not understand on level deeper than "it works". @remz1337 I understand that you don't know the details which is completely fine, but in that case I will have to postpone merging the PR a little bit until I find some time to do the research myself. Unless @SoapZA you have some insights / understanding of changes made? |
CMakeLists.txt
Outdated
# Create target 'install' for installing libraries. | ||
install(TARGETS edlib DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
# configure and install pkg-config file | ||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/edlib.pc.in | ||
${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc | ||
@ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |
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.
don't want to put this in your EDLIB_ENABLE_INSTALL
install clause too?
@Martinsos all of the changes are fine. CMake (unfortunately) has promoted a number of anti-patterns, and one of them is their "cmake config files" pattern. The idea being, CMake has its own pseudo-metadata format, akin to pkg-config, but one that only CMake can use (and Meson to some extent). And that's the main reason I don't like them: they only help CMake, and not Autotools, Meson, Makefiles or what have you. That's just my personal take on this idiom. That said, nothing here breaks pkg-config, edlib or anything for users, hence this PR seems fine to me. |
Awesome, thanks so much for this explanation! |
Yes, and please squash all your commits into one, this is one logical change after all. |
@remz1337 Hi, what happened here, I see that you closed the issue and there are no commits? Was that a mistake, I hope all is ok? I thought we were very close to integrating it! |
@Martinsos I had some trouble squashing the commits but not sure why it's closed since my fork is 1 commit ahead. I don't know why this PR isn't seeing my commit. Edit: weird, looks like commenting on the PR allowed me to reopen it. Should be good now |
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.
@remz1337 Approved! Please just add the comment that I mentioned and let me know, I will merge it then.
…for example vcpkg. Also updated the library version and made the installation optional
CMake config file is not specific to vcpkg. They are highly recommended to allow consumers to find and consume the lib in CMake projects with |
Hello, I am porting this library to VCPKG but I had to make some changes to the build process. (Here is the link to the VCPKG PR)
For context, with this patch I can install edlib through vcpkg simply by doing
vcpkg install edlib
and then I add these 2 lines in my project's CMakeList:
find_package(edlib CONFIG REQUIRED)
target_link_libraries(main PRIVATE edlib::edlib)
and voila! I can use your library in my project :)
Thanks