MantisBT - CMake
View Issue Details
0001643CMakeCMakepublic2005-03-05 10:082008-02-06 15:29
David Somers 
Brad King 
normalminoralways
closedfixed 
 
 
0001643: FIND_LIBRARY needs to distinguish between shared and static libraries
At present, FIND_LIBRARY has a preference for pickup up shared libraries over static libraries.

How about changing the signature from:

FIND_LIBRARY(<var> NAMES name1 [name2 ...] ....

to

FIND_LIBRARY(<var> SHARED name1 [name2 ...] ....
FIND_LIBRARY(<var> DYNAMIC name1 [name2 ...] ....

The old signature should still be supported (to maintain compatability) and should explicity default to SHARED mode.
No tags attached.
has duplicate 0006250closed  find_library should support to search for static libs 
Issue History
2007-08-28 00:11Philip LowmanNote Added: 0008695
2008-02-06 15:19Brad KingRelationship addedhas duplicate 0006250
2008-02-06 15:29Brad KingStatusassigned => closed
2008-02-06 15:29Brad KingNote Added: 0010404
2008-02-06 15:29Brad KingResolutionopen => fixed

Notes
(0004923)
Brad King   
2006-09-15 14:13   
Bug 0001644 is related to this bug. Now that it is fixed the results of fixing this bug will actually work.
(0008695)
Philip Lowman   
2007-08-28 00:11   
This was brought up on the mailing list, again.

There has to be a way to determine if a ".lib" file in Windows is shared or static. Even if there's not, VS could just be a noop when coming across the SHARED/STATIC keywords.
(0010404)
Brad King   
2008-02-06 15:29   
We cannot easily determine whether a library is static or shared on windows. I suspect in most cases people want to use this to create static binaries on UNIX anyway. Instead of trying to create a documented signature that makes people think the command can find STATIC libraries on all platforms, I've taken a simpler approach.

When searching for a library the command now tries the name given by the user as an explicit file name before trying prefixes and suffixes. One may now write

  find_library(MATH_LIBRARY NAMES libm.a)

and end up with something like "/usr/lib/libm.a". This solution should be sufficient because static library names are very predictable.

/cvsroot/CMake/CMake/Source/cmFindLibraryCommand.cxx,v <-- cmFindLibraryCommand.cxx
new revision: 1.56; previous revision: 1.55