-
Notifications
You must be signed in to change notification settings - Fork 802
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
Use GNUInstallDirs for cmake install locations #3150
Conversation
There are some issues generating a |
Thanks @mwtoews |
Ah apparently not. The problem for the Linux build seems to be moving the include directory somewhere else. I will explore /~https://github.com/nektos/act to be able to run the Github actions locally instead of pushing and waiting for it to fail. |
I suppose the issue is around here: Lines 156 to 162 in b1d2fcb
this assumes there is only one |
The macOS failure because the executables are installed to:
due to |
Ok I have wrapped the variable setting inside that condition. No Mac to test on, but hopefully the Mac build Github action is 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.
This looks excellent, and I can't see any obvious issues. Anyone else have a chance to review? Otherwise I'll merge this in a few days. Note that this should not be backported.
cmake/project-config.cmake.in
Outdated
set (@PROJECT_VARIANT_NAME@_INCLUDE_DIRS ${CMAKE_INSTALL_INCLUDEDIR}) | ||
set (@PROJECT_VARIANT_NAME@_LIBRARY_DIRS ${CMAKE_INSTALL_LIBDIR}) | ||
set (@PROJECT_VARIANT_NAME@_BINARY_DIRS ${CMAKE_INSTALL_BINDIR}) |
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 believe this should rather be:
set (@PROJECT_VARIANT_NAME@_INCLUDE_DIRS ${CMAKE_INSTALL_INCLUDEDIR}) | |
set (@PROJECT_VARIANT_NAME@_LIBRARY_DIRS ${CMAKE_INSTALL_LIBDIR}) | |
set (@PROJECT_VARIANT_NAME@_BINARY_DIRS ${CMAKE_INSTALL_BINDIR}) | |
set (@PROJECT_VARIANT_NAME@_INCLUDE_DIRS "${_ROOT}/@CMAKE_INSTALL_INCLUDEDIR@") | |
set (@PROJECT_VARIANT_NAME@_LIBRARY_DIRS "${_ROOT}/@CMAKE_INSTALL_LIBDIR@") | |
set (@PROJECT_VARIANT_NAME@_BINARY_DIRS "${_ROOT}/@CMAKE_INSTALL_BINDIR@") |
as _ROOT must remain referenced
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.
CMAKE_INSTALL_<dir>
are relative paths, meant to be used with install( ... DESTINATION ...)
.
For absolute paths, there is CMAKE_INSTALL_FULL_<dir>
. This takes into account CMAKE_INSTALL_PREFIX
(but breaks CMAKE_STAGING_PREFIX
).
Now what is _ROOT
?
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.
Which do we think it should be? I think it is wrong the way it is, too.
If these variables should be the include, library, and binary directories of install, then the FULL
variables from GNUInstallDirs
will do fine as @dg0yt says I think
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.
Now what is _ROOT?
As far as I can see, this is a way to figure out the (actual) installation prefix from where the CMake config file is located.
If these variables should be the include, library, and binary directories of install, then the
FULL
variables fromGNUInstallDirs
will do fine
yeah that was my first thought too. But it seems the existing logic in the file was to make it possibly relocatable. And I hope that what I proposed would make it still possible
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.
Sorry, I missed part of the context. Basically @rouault is right, and I see where _ROOT
comes from now.
I will test the PR in the next days.
@@ -101,5 +101,5 @@ set(ALL_DATA_FILE | |||
) | |||
install( | |||
FILES ${ALL_DATA_FILE} | |||
DESTINATION ${DATADIR} | |||
DESTINATION ${PROJ_LIB_PATH} |
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.
... but this looks strange.
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.
it's after PROJ_LIB
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.
The naming isn't straightforward. In the context of cmake, this implies the library install path I think, though we know what PROJ_LIB
means outside of cmake (the link above was what I was thinking of when I named it). What's the best name for this? DATADIR
isn't too clear either
set(CMAKECONFIGDIR "${DEFAULT_CMAKEDIR}" | ||
CACHE PATH "Parent of the directory to install cmake config files into.") | ||
include(GNUInstallDirs) | ||
set(PROJ_LIB_PATH "${CMAKE_INSTALL_FULL_DATADIR}/proj") |
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.
Maybe that's not the best name for data.
Just wanted to say thanks for this! |
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 a PROJ developer but I am a maintainer of it downstream (in Gentoo) and occasional contributor. Also used to doing GNUInstallDirs ports. Looks great, thanks!
Thanks again @ErixenCruz for putting this together! |
Changes to the CMAKE build system to use
GNUInstallDirs
for installation locations. I only tested this on Ubuntu. Would someone verify that this is fine on Windows and Mac, too?