Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> When you use cmake, if you link against the target foo which is a static library and itself was marked as linking to bar, then your final executable will have -lfoo -lbar.

And that is bad. `-lfoo -lbar` loses important information. It is the linker-editor that needs to have this, and not just the build tooling layered above it. libtool, cmake -- it doesn't matter, they're all broken for static linking as long as static linking is broken in this way.

> Of course this information isn't stored in the .a files, but in cmake's FooConfig.cmake files - who cares as long as it works ?

If the only way to make it work is to adopt a particular build system, then no thanks. But again, it can't actually work -- it can't solve the problems that are in the link-editor itself.



> they're all broken for static linking as long as static linking is broken in this way.

The main app I work on links against

- Qt

- LLVM

- libclang

- ffmpeg

- my app which is itself ~40 libs

- a dozen others

which combined account for multiple hundreds of static libraries on Linux, Mac and Windows and things just work. I could maybe bog my head against theoretical link-time problems which I don't experience or make things better for my end-users and just target_link_libraries(myapp Qt::Core), what do you think is the reasonable option ?


I'm glad that works for you. It's not a general solution.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: