[CMake] Building a DLL and test driver EXE using CMake -- error by design?

Michael Hertling mhertling at online.de
Thu Mar 24 01:59:54 EDT 2011


On 03/23/2011 05:26 PM, Chris Volpe ARA/SED wrote:
> Jc-
> 
> Thanks for the suggestions, but it's not clear if your suggestions are general suggestions, or if they actually address the problem I'm experiencing. Moreover, the problems that your suggestions claim to solve seem to be problems that I am not experiencing.

[...]

> Also:
> Moreover, in your example, it seems the command "LINK_DIRECTORIES" is missing. Indeed, you should add the following command before calling ADD_LIBRARY(FeatureViewer ...):
> 
> LINK_DIRECTORIES(${VTK_LIBRARY_DIRS})
> What problem does "LINK_DIRECTORIES" solve? Note that I have no problem building FeatureViewer: It finds the VTK libraries just fine without LINK_DIRECTORIES. Again, the TestDriver application builds and runs just fine if I manually remove the references to vtk*.lib in its project settings.

LINK_DIRECTORIES() can be subtly dangerous, see [1], so it should not
be used if it's avoidable. AFAICS, VTK uses imported targets for its
libraries, i.e. with full paths in the libraries' IMPORTED_LOCATION
properties, so there shouldn't be a need to use LINK_DIRECTORIES()
w.r.t. VTK.

Regards,

Michael

[1] http://www.mail-archive.com/cmake@cmake.org/msg33519.html


More information about the CMake mailing list