<div dir="ltr">Thanks Bill and mchinand!<div><br></div><div>Adding the <span style="font-family:arial,sans-serif;font-size:13px">find_package(Qt5Widgets REQUIRED) works without needing the extra syntax inside target_link_libraries, but then of course I have to specify </span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">-DQt5Widgets_DIR:PATH=/home/chris/Projects/qt-5.2.1-install/5.2.1/gcc_64/lib/cmake/Qt5Widgets</font><br></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">which I should not have to do, because VTK already knows where that is. </font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, May 7, 2014 at 12:00 PM, mchinand <span dir="ltr"><<a href="mailto:chinander@gmail.com" target="_blank">chinander@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Christopher Mullins wrote<br>
> *The Problem*<br>
<div class="">><br>
> Now, I want to build a simple example. I'll use DistanceBetweenPoints<br>
> [3].<br>
> When I configure with VTK_DIR:PATH=/home/chris/Projects/VTK-with-qt5<br>
> there<br>
> are no errors. When I build with make I get the following error:<br>
><br>
> /usr/bin/ld: error: cannot find -lQt5::Widgets<br>
><br>
> If I do the same thing, except configuring VTK with<br>
> BUILD_SHARED_LIBS:BOOL=OFF instead, I get this error with 3 additional<br>
> libraries it can't find:<br>
><br>
> /usr/bin/ld: error: cannot find -lQt5::WebKitWidgets<br>
> /usr/bin/ld: error: cannot find -lQt5::OpenGL<br>
> /usr/bin/ld: error: cannot find -lQt5::Widgets<br>
> /usr/bin/ld: error: cannot find -lQt5::Sql<br>
<br>
</div>Try adding:<br>
<br>
find_package(Qt5Widgets REQUIRED)<br>
<br>
to your CMakeLists.txt file and then change the target_link_libraries to:<br>
<br>
target_link_libraries(DistanceBetweenPoints Qt5::Widgets ${VTK_LIBRARIES})<br>
<br>
It should then compile and link. I think the syntax of Qt5::Widgets in<br>
target_link_libaries is only supported in CMake 2.8.11 and up. I was getting<br>
similar errors on Windows using MSVC2012. This is just a workaround though<br>
but I think slightly better than having to specify individually the<br>
necessary VTK modules. This shouldn't be required if the executable doesn't<br>
actually use QT, as in this example. Maybe I just have a similarly bad<br>
configuration as you do.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Qt5-linker-issues-tp5726964p5727015.html" target="_blank">http://vtk.1045678.n5.nabble.com/Qt5-linker-issues-tp5726964p5727015.html</a><br>
Sent from the VTK - Dev mailing list archive at Nabble.com.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Christopher Mullins<div>R&D Engineer</div><div>Kitware Inc.,</div><div>919.869.8871</div>
</div>