<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
I'm new to CMake to I'm not sure what I'm doing.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
I'm using poppler as a library via CMake for my application. I've imported it as a submodule.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
If I include popper in my top-level CMake file using<span> </span><code style="margin:0px; padding:2px 4px; font-size:13px; border-radius:3px">add_subdirectory(...)</code>, it gets the following errors</p>
<pre class="x_lang-sh x_s-code-block" style="margin-top:0px; padding:12px; line-height:1.30769; font-size:13px; width:auto; max-height:600px; overflow:auto; border-radius:5px; text-align:left"><code class="x_hljs x_language-bash" style="margin:0px">[cmake] CMake Error at external/poppler/CMakeLists.txt:7 (include):
[cmake]   include could not find requested file:
[cmake] 
[cmake]     PopplerDefaults
[cmake] 
[cmake] 
[cmake] CMake Error at external/poppler/CMakeLists.txt:8 (include):
</code></pre>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
This is most likely because the<span> </span><code style="margin:0px; padding:2px 4px; font-size:13px; border-radius:3px">CMAKE_MODULE_PATH</code><span> </span>is incorrect.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
After some digging, it looks like poppler is setting the module path instead of appending to it.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<a href="https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/CMakeLists.txt#L5" rel="nofollow noreferrer" style="margin:0px; text-decoration:underline">https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/CMakeLists.txt#L5</a></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
So I can't really override it.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
My (probably overly complicated) setup is here, which the poppler line commented out.<span> </span><a href="https://github.com/bdurrani/cmake-test/blob/master/CMakeLists.txt#L69" rel="nofollow noreferrer" style="margin:0px; text-decoration:underline">https://github.com/bdurrani/cmake-test/blob/master/CMakeLists.txt#L69</a></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; font-size:15px; clear:both; color:rgb(35,38,41); text-align:left; background-color:rgb(255,255,255)">
This works fine if I run cmake from within the poppler folder.</p>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Are there any examples of consuming the poppler build from another CMake project?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I did tweak the CMake file to use <code>list APPEND</code>​ instead of set, but that triggers other path issues</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
```</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
[cmake] CMake Error at external/poppler/utils/CMakeLists.txt:39 (add_executable):
<div>[cmake]   Cannot find source file:</div>
<div>[cmake] </div>
<div>[cmake]     /home/bdurrani/deletethis/cmake-test/poppler/CairoFontEngine.cc</div>
<div>[cmake] </div>
<div>[cmake]   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h</div>
[cmake]   .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
```</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks for your help!</div>
</div>
</div>
</body>
</html>