[cmake-developers] [CMake 0015528]: Enhance find_library to specify which library kind we are looking for

Mantis Bug Tracker mantis at public.kitware.com
Wed Apr 22 09:06:12 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15528 
====================================================================== 
Reported By:                marc.chevrier
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15528
Category:                   CMake
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-04-22 09:06 EDT
Last Modified:              2015-04-22 09:06 EDT
====================================================================== 
Summary:                    Enhance find_library to specify which library kind
we are looking for
Description: 

Currently, it is not possible, in an easy way, to specify which kind of library
we are looking for when calling find_library.
So if we are searching a static library, and a shared library is also available,
this is the shared one which will be found.

Today, to work-around this problem, the following pattern must be used:
set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library (...)
set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})

which is a bit painful.

I suggest to add a new parameter to specify which kind of library we are looking
for.
For example, parameter TYPE which can have values LINK, STATIC or RUNTIME
* LINK: extension .so (Unix) or .lib (Windows) will be used
* STATIC: extension .a (Unix) or .lib (Windows) will be used
* RUNTIME: extension .so (Unix) or .dll (Windows) will be used. This latest case
can be useful to locate shared runtime libraries rather than link ones

Whithout this parameter, find_library has same behavior as today.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-04-22 09:06 marc.chevrier  New Issue                                    
======================================================================



More information about the cmake-developers mailing list