I am currently creating a fairly large application using cmake to create cross-platform build scripts. During this process of creating cmake build scripts, I found pain in glink link line ordering.
The main problems are that the inclusion of static libraries in the wrong order leads to the release of unused libraries, which then cannot be found by subsequent dependent libraries.
Thus, I am in a situation where cmake generates a visual studio building system that compiles just fine, but make unix files generate all kinds of "undefined" errors. I figured out a job for this: in the add_executable command, I include static libraries twice.
I hope there is a more standard / better way to deal with this problem. Being that I am not the only developer, and that most of the regular development is done in windows, I really need an agnostic CMake script. Window developers simply do not address this issue with a serial number. Also, figuring out the correct order will be very difficult - I don't have that kind of information available, and there are many static libraries (70 or so).
After searching the Internet, I found out about -static and -dynamic flags, but turning CMake on to turn them on is not obvious, and gcc complains that it cannot find dynamic libraries.
In any case, I welcome suggestions on how to do the right thing.
source share