-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
frmts/pdf: Use correct POPPLER_INCLUDE_DIR #5161
Conversation
rather than the not-set POPPLER_INCLUDE_DIRS. Resolves failure to build with poppler on NetBSD.
a bit strange that it makes a difference because POPPLER_INCLUDE_DIRS and POPPLER_INCLUDE_DIR should be aliases with https://github.com/OSGeo/gdal/blob/master/cmake/modules/packages/FindPoppler.cmake#L138 |
Interesting; I didn't see that when trying to figure this out. I searched in the cmake cache file, where I found POPPLER_INCLUDE_DIR but not POPPLER_INCLUDE_DIRS. I'm certainly open to a different fix. egrep returns
and I do see FindPoppler.cmake as you point out. I t hink the problem might be that POPPLER_FOUND isn't getting set (not in cache file). But in that case, I would thing the pdf driver should be disabled (I don't have the other pdf prereqs). |
|
POPPLER_INCLUDE_DIRS is not a cache variable, just a "volatile" one, so it is expected you don't see it in CMakeCache.txt. So are you sure your patch is needed after all ?
The PDF driver can work in write-only mode without Poppler (or one of the other backends needed for read functionality) |
OK on pdf and poppler not being the same thing, but without HAVE_POPPLER we should not be building things in a way that requires poppler includes. I am sure that I got a build failure. I can do this again and capture more info. How do I trace the "volatile" variables? |
you can add "message(WARNING ${THE_VAR})" in any CMake executed file
I don't know. That is apparently the idiomatic way of writing FindXXXX.cmake files. e.g https://github.com/OSGeo/gdal/blob/master/cmake/modules/3.12/FindEXPAT.cmake#L71 that comes from modules packaged in Cmake >= 3.12 (imported here and used when CMake < 3.12) |
@@ -21,7 +21,7 @@ target_include_directories(gdal_PDF PRIVATE ${GDAL_RASTER_FORMAT_SOURCE_DIR}/vrt | |||
${GDAL_VECTOR_FORMAT_SOURCE_DIR}/mem) | |||
|
|||
if (GDAL_USE_POPPLER) | |||
target_include_directories(gdal_PDF PRIVATE ${POPPLER_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS}/../) | |||
target_include_directories(gdal_PDF PRIVATE ${POPPLER_INCLUDE_DIR} ${POPPLER_INCLUDE_DIR}/../) |
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 think this should be fixed in the Find module. Recommended pattern:
<Pkg>_INCLUDE_DIR
is an input variable (for the user).
<Pkg>_INCLUDE_DIRS
is the output variable (for the consuming project).
(And <Pkg>
spelled as in FindPkg.cmake
.)
Reference:
https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
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 think this should be fixed in the Find module.
renaming FindPoppler.cmake to FindPOPPLER.cmake and keeping the use of POPPLER_INCLUDE_DIRS ?
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 see _INCLUDE_DIRS
as a strict requirement.
I am more relaxed about accepting upper case also for FindPoppler.cmake. I don't think we will see a FindPoppler.cmake
from CMake. (But an exported config from Poppler would be nice.)
The coincidence is that I just stumbled over Poppler using an early version of FindFontconfig.cmake
, before Kitware/CMake@a3a1e69. Now I need extra polyfill to make Poppler use the static usage requirements vcpkg would offer through proper Fontconfig_...
variables.
At this point I am having trouble reproducing my original problem, and I am 98% convinced my change is wrong. It seems like we are having useful discussion about the best approach so I won't hit close just yet. |
For the record, even for building poppler it's a mix-match of "dir" and "dirs" and "library" and "libraries", there is unfortunately no 'standard' for this and projects make their own decisions. It's best to become very familiar with the /FindXXX.cmake files inside the project's repository and inside CMake's installed directory (on Windows this is a hidden directory such as |
I'm not against getting familiar with the tools I use. But here it is a waste of productivity if there is diversity without benefit.
There is https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names. At least since CMake 3.0. |
I anticipated the fast correction, but the reality is that in the FOSS4G stack it is a total mix-match of variable names currently. +1 for standards. |
ok closing that PR. I'll do the FindPoppler.cmake to FindPOPPLER.cmake renaming |
actually no. Keeping FindPoppler.cmake but using Poppler_XXXX variables: #5165 |
Thanks - will rebase onto master post #5165 and re-examine. |
rather than the not-set POPPLER_INCLUDE_DIRS. Resolves failure to
build with poppler on NetBSD.
What does this PR do?
This PR fixesan incorrect use of cmake variables that resulted in not using the poppler include directory. Before, the build failed on NetBSD (where poppler is in /usr/pkg, which is not in the default include path).
What are related issues/pull requests?
There are no related issues.
Tasklist
Environment
Failure observed and fix verified on NetBSD 9 amd64 with prerequisites from pkgsrc. However, the problem can be seen by inspection as the variable used is never set.
OS:
NetBSD 9
Compiler:
gcc 7.4.0