-
Notifications
You must be signed in to change notification settings - Fork 199
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
cmake: Install cmake files in a more common path #366
Conversation
Install cmake files in prefix/lib/cmake/pcre2 rather than prefix/cmake
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.
there was an unmerged proposal before to change this only for POSIX systems (where it makes more sense as well, as it allows correctly detecting the right bitness for PCRE2 in multilib systems)
CMakeLists.txt
Outdated
@@ -1124,7 +1124,7 @@ configure_file(${PCRE2_CONFIG_IN} ${PCRE2_CONFIG_OUT} @ONLY) | |||
set(PCRE2_CONFIG_VERSION_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcre2-config-version.cmake.in) | |||
set(PCRE2_CONFIG_VERSION_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/pcre2-config-version.cmake) | |||
configure_file(${PCRE2_CONFIG_VERSION_IN} ${PCRE2_CONFIG_VERSION_OUT} @ONLY) | |||
install(FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT} DESTINATION cmake) | |||
install(FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcre2) |
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.
there used to be a time (at least in Linux) when CMAKE_INSTALL_LIBDIR was lib64 for 64bit builds, and I presume avoiding that variance made using a "bitness" agnostic directory, attractive.
I also wonder how that would work in Windows, where the path is usually just "cmake" (usually with some funny case ignoring but preserving variant).
could we check with the rest of the "cmake communitiy" around #115 for advice before merging this backward incompatible change?
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.
https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure suggests that this is viable on both Windows and Unix
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.
agree it is "viable", the point I was making was how to minimize "backward compatibility" issues
ex: currently it "might" fail to allow locatiing the cmake files if ${CMAKE_INSTALL_LIBDIR} is (arguibly incorrectly) set to lib64 and the system is Windows. Making this change ONLY if not Windows would "solve" that and IMHO was simple enough to do as shown by:
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.
I'm not sure what you really want as several have suggested the same thing by now
https://github.com/PCRE2Project/pcre2/pull/260/files#r1225428249
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.
funny enough you linked to my "ask", which was "what can we put in the release notes to make sure whoever might be affected by this change fixes their setup".
I don't maintan any software that uses pcre2 and that would be using this code, so I am not the best person to provide that.
Indeed, I dont't even know how to create an application that could be affected, but assume one running Windows that uses cmake and linking with a PCRE2 that provides this file (meaning it was installed by running cmake --install
instead of the more common way to get PCRE2 installed which is calling make install
as "root" while using a POSIX compatible shell), hence maybe mingw64 bash.
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.
Not sure if this answers your question but vcpkg does this too
https://github.com/microsoft/vcpkg/blob/master/ports/pcre2/portfile.cmake#L54
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.
some of the patches we are discusing were tested with vcpkg
but had to be reverted before 10.43RC1 because they broke autotools bootstrapping.
it doesn't answer though how to document the hopefully small backward incompatibility that they introduce in their current form.
As long as you're making a change like this, you might as well make the path configurable via a cache variable like include(GNUInstallDirs)
set(PCRE2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/pcre2"
CACHE STRING "Relative path to PCRE2's CMake config files from the installation root")
install(
FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT}
DESTINATION "${PCRE2_INSTALL_CMAKEDIR}"
) I go into a lot more detail on CMake packaging on my blog here: https://alexreinking.com/blog/building-a-dual-shared-and-static-library-with-cmake.html |
…#428) Historically, pcre2grep has done minor processing of the patterns that were read through the `-f` option. The end result is that for some patterns there are different results depending if they were provided through `-e`, `-f` or as a parameter in the command line. Add a flag that could be provided to skip that processing so that the same pattern file used with other grep implementations could be used directly for the same result.
Is this still valid/needed? |
Yes, it looks like a change along the lines of my suggestion above would be a good one. Line 1135 in db95416
|
I am curious what your use-case is for "make install". Personally, it would never occur to me to use it for a library. I mean, for a binary perhaps: you might want to check it out, build, and install it to I have never done a "make install" for a library, so I just don't understand the purpose of it. In principle though, I think we'd be happy to go along with any suggestions users have. |
@NWilson - More History! When PCRE was new, the only way to install it was "make install". It was only after it started to get widely used that distros started packaging it. So I guess you have never wanted to install an uncommon library. :-) |
If I were writing an Apache httpd plugin using PCRE (for example), and there wasn't a PCRE2 bundled by the OS, then I'd statically link it in. That probably comes from my background shipping commercial software on Unix platforms. The apps are always shipped with dependencies included, so you don't get support requests from users on different Linux distros. I can see that the open-source way probably would instruct users to fetch and install the library globally, outside of the OS packaging system. Things have moved on maybe. These days, open-source packages for Linux seem to be either bundled by distros, or the upstream project provides an apt/RPM feed of their own, or they provide a build with dependencies statically linked - precisely to avoid the hassle of incompatible library versions on the user's system. |
That is very common in Windows but not so in Linux or the BSD. Note that the OP is the FreeBSD packager for PCRE2, and they had (IMHO) mistakenly moved to use cmake instead of autotools to deploy those system wide. |
Early versions of PCRE were indeed bundled with Exim because PCRE was then an unknown library, but I stopped doing that once other software started to use PCRE and needed a properly installed separate library. |
|
I've added the excellent suggestion from @alexreinking to allow clients to override the new This should address @carenas's concerns, by allowing affected users to go back to how it used to be. I am satisfied with this change, and I think we should merge it for the 10.45-RC1. We can always make changes if there is any feedback. Thank you @diizzyy for raising this! |
Install cmake files in prefix/lib/cmake/pcre2 rather than prefix/cmake