[Cmake] Library link line compression (again)
Bill Hoffman
bill . hoffman at kitware . com
Mon, 19 Nov 2001 11:03:06 -0500
This should be done in the CMakeLists.txt files.
I don't think cmake should clean them up.
What if someone needs two copies of a library on the link line?
It does happen in some projects. This is a problem with vxl and
its use of cmake, and not cmake itself.
The include LibCMakeLink.txt is causing most of the grief. I thought that
was going to be removed from VXL anyway? If not, it could be include guarded?
IF(VAR)
LINK_....
ELSE(VAR)
SET(VAR 1)
ENDIF(VAR)
The other issue is that cmake automatically duplicates all the -l stuff to avoid
missing symbols on static links. Perhaps there should be a flag to turn this off?
I think it is done only on the unix side.
-Bill
At 09:59 AM 11/19/2001 +0000, Ian Scott wrote:
>Amitha,
>
>I had a go at doing this. I gave up because it didn't have any noticible
>effect on DevStudio's loading or linking speed. I've lost the code, but the
>algorithm should go something like this
>
>
>
>Add a function StripLinkLibrariesToTreeDependecy, called under the control
>of some cache variable from cmMakeFile::FinalPass
>
>Method cmMakeFile::StripLinkLibrariesToTreeDependecy
> Copy sequence of all linklibraries to LL
> start = Beginning of LL
> Starting from i = End of LL
> --i;
> Get Library L = *i
> j = i;
> While (j!= start)
> j--;
> if *j = *i
> remove *j
> shuffle all previous members (start, j-1) of LL up one
> ++start;
> Until i == start;
> Copy LL back to LinkLibaries.
>End
>
>Alternatively you could put the code in the FinalPass method of a new
>Command StripLinkLibrariesToTreeDependecy
>
>Ian.
>
>> -----Original Message-----
>> From: Amitha Perera [mailto:perera at cs . rpi . edu]
>> Sent: Friday, November 16, 2001 9:40 PM
>> To: cmake at public . kitware . com
>> Cc: chrisc at cs . rpi . edu
>> Subject: [Cmake] Library link line compression (again)
>>
>>
>> Hi all
>>
>> Would anyone object to adding an option to CMake to allow link line
>> compression? In particular, I think that most projects have a tree
>> like library dependency, and it is possible for CMake to automatically
>> eliminate duplicate libraries without causing linking failures. The
>> default mode would be what it is now, which generates a long link line
>> (for vxl, at least).
>>
>> As the message below indicates, this is probably a useful process, and
>> a good step in lieu of a full dependency analysis.
>>
>> Amitha.
>>
>>
>> ----- Forwarded message from "Christopher D. Carothers"
>> <chrisc at cs . rpi . edu> -----
>>
>> To: Amitha Perera <perera at cs . rpi . edu>
>> From: "Christopher D. Carothers" <chrisc at cs . rpi . edu>
>> Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST)
>> Subject: fyi: static linking needs huge swap space!
>>
>> Folks, to link a static version of online tracining under linux
>> (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in
>> addition to 256 MB of RAM. I watched "top" as the final link was being
>> done and you could just see the vast amount of memory being allocated.
>>
>> I think the reason for this because the link line has duplicates
>> of every lib. Amitha, is there anyway we can cut down on
>> these duplicates
>> and still avoid unresolved symbols.
>>
>> My office machine now has 2 GB of swap :-)
>>
>> Happy compiling!
>>
>> Chris
>>
>>
>> ----- End forwarded message -----
>> _______________________________________________
>> Cmake mailing list
>> Cmake at public . kitware . com
>> http://public . kitware . com/mailman/listinfo/cmake
>>
>
>_______________________________________________
>Cmake mailing list
>Cmake at public . kitware . com
>http://public . kitware . com/mailman/listinfo/cmake