On Monday 23 January 2012, Brad King wrote: > On 1/21/2012 5:58 PM, Alexander Neundorf wrote: > > To get the link line I moved code from > > cmLocalGenerator::OutputLinkLibraries() into a separate function > > GetLinkLine(cmTarget, cmComputeLinkInformation). > > > But before I get there I get a segfault: > [snip] > > > It crashes in cmTarget::ComputeLinkClosure() because > > mTarget::GetLinkImplementation() returns 0 for imported targets. It > > probably should not get there at all, since calling GetLinkerLanguage() > > always leads to that path. > > The OutputLinkLibraries method is in generators so it is meant only for > handling targets that are built in the project. It is not written to > work for imported targets.
I got there because you recommended: "Then the implementation of the command can evaluate the "libs..." arguments in a context where imported targets are known. Loop over each library. For those that this->Makefile->FindTargetToUse() returns a target, verify that it is IMPORTED, and then call target->GetLinkInformation(config), where config is the try-compile's configuration. The return value of that will be a cmComputeLinkInformation object from which you can query the link line." Did I misunderstand what you wrote ? I had a further look, an cmTarget::GetLinkInterface() and cmTarget::ImportedGetFullPath() look liek I could iterate over them and build something from them. But probably that logic is already somewhere. Can you give me some pointers ? Thanks Alex -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers