<div dir="ltr">Thanks for your answer, <div><br></div><div>The thing is that, since the Python dependency comes from VTK, I checked in the VTK install directory all the CMake configuration files (In particulare the UseVTK.cmake) file to see if they keep the Python path somewhere. <br><br>And it happens that yes, they do. <br>If I run: `grep -e 'python2.7' -r <PATH_TO_VTK/lib/cmake/vtk-7.1>`, I actually get that in the file `VTKTargets.cmake`and in the `Modules/vtkPython.cmake` they actually keep the path of the python used to compile VTK.<br><br>For example in VTKTargets.cmake, you find:</div><div><br></div><div><div>set_target_properties(vtkWrappingPythonCore PROPERTIES</div><div>  INTERFACE_LINK_LIBRARIES "vtkCommonCore;/home2/softmassot/eb/Compiler/GCCcore/7.2.0/Python/2.7.14-bare/lib/<a href="http://libpython2.7.so">libpython2.7.so</a>;vtksys"</div><div>)<br><br>So when I link my test target to ${VTK_LIBRARIES}, shouldn't it also be able to retrieve the right python library from the target properties?</div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 2, 2018 at 9:56 PM Roger Leigh <<a href="mailto:rleigh@codelibre.net">rleigh@codelibre.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's the quick and easy way to do it.<br>
<br>
However, I'd suggest looking at getting CMake to use the proper path <br>
without it.  Can you use any module-specific variables like <br>
PYTHON_LIBRARY to override the search.  Or even just add to <br>
CMAKE_PREFIX_PATH.  (Does VTK support imported targets?)<br>
<br>
Regards,<br>
Roger<br>
<br>
On 02/08/18 20:43, Ruben Di Battista wrote:<br>
> Hi Roger,<br>
> so I explicitly passing the LDFLAGS is the way to go?<br>
> <br>
> On Thu, Aug 2, 2018 at 9:41 PM Roger Leigh <<a href="mailto:rleigh@codelibre.net" target="_blank">rleigh@codelibre.net</a> <br>
> <mailto:<a href="mailto:rleigh@codelibre.net" target="_blank">rleigh@codelibre.net</a>>> wrote:<br>
> <br>
>     On 02/08/18 20:03, Ruben Di Battista wrote:<br>
> <br>
>      > I'm running cmake on a system where I have module-loaded software<br>
>     such<br>
>      > that `LD_LIBRARY_PATH` gets populated by the module (actually I'm<br>
>     using<br>
>      > Lmod) function.<br>
> <br>
>     LD_LIBRARY_PATH is used by the *runtime* linker, ld.so.  It is not used<br>
>     when linking at *build* time, with ld.<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font face="monospace, monospace">          _  </font></div><div><font face="monospace, monospace">-.     .´  |∞∞∞∞</font></div><div><font face="monospace, monospace">  ',  ;    |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace">    ˜˜     |∞∞∞∞∞∞∞∞∞ RdB </font></div><div><font face="monospace, monospace">    ,.,    |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace">  .'   '.  |∞∞∞∞</font></div><div><font face="monospace, monospace">-'       `'</font></div><div><font face="monospace, monospace"><a href="http://rdb.is" target="_blank">https://rdb.is</a></font></div><div><br></div></div></div></div></div>