MantisBT - CMake
View Issue Details
0008396CMakeCMakepublic2009-01-19 02:062016-06-10 14:30
Philip Lowman 
Bill Hoffman 
normalfeatureN/A
closedmoved 
 
 
0008396: FIND_LIBRARY with version specification
FIND_LIBRARY could use support for searching for filenames with version numbers encoded in them. As more and more CMake find modules seek to implement version checking this is going to become a more important feature. Let's face it, library version encoding into filenames isn't going away anytime soon and defining every possible version that you're looking for in CMake script kinda sucks.

Here is an idea on syntax:

FIND_LIBRARY(<NAME>
    VNAMES <regex> | VPATH_SUFFIXES <regex>
    VERSION_EQUAL | VERSION_GREATER | VERSION_LESS | VERSION_GREATER_OR_EQUAL | VERSION LESS_OR_EQUAL <version>
)

Here are a couple of examples:

Take the following use cases:
libfoo34.a
libbar3_5.a
/usr/include/foo-1.8/foo.h
    
FIND_LIBRARY(FOO_LIBRARY
    VNAMES foo([0-9])([0-9])
    VERSION_EQUAL 3.4
)
FIND_LIBRARY(BAR_LIBRARY
    VNAMES bar([0-9]+)_([0-9]+)
    VERSION_GREATER 3.4
)
FIND_PATH(FOO_INCLUDE_DIR
    NAMES foo.h
    VPATH_SUFFIXES foo-([0-9]+)\.([0-9]+)
    VERSION_GREATER 1.6
)
No tags attached.
related to 0003666closed Bill Hoffman FIND_LIBRARY with wildcards 
parent of 0011445closed Philip Lowman Eliminate the need for Boost_ADDITIONAL_VERSIONS 
has duplicate 0010856closed Bill Hoffman Wild-cards or REGEX for FIND_XXX would be helpful 
Issue History
2009-01-19 02:06Philip LowmanNew Issue
2009-01-19 02:07Philip LowmanRelationship addedrelated to 0003666
2009-02-02 15:06Bill HoffmanStatusnew => assigned
2009-02-02 15:06Bill HoffmanAssigned To => Bill Hoffman
2009-02-02 22:25Philip LowmanNote Added: 0014762
2010-11-10 12:50David ColeTarget Version => CMake 2.8.4
2010-11-10 13:41James BiglerRelationship addedhas duplicate 0010856
2010-11-10 13:45James BiglerNote Added: 0023144
2010-11-18 23:08Philip LowmanRelationship addedparent of 0011445
2010-12-08 15:50David ColeNote Added: 0023819
2010-12-08 15:50David ColeTarget VersionCMake 2.8.4 =>
2016-06-10 14:27Kitware RobotNote Added: 0041494
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0014762)
Philip Lowman   
2009-02-02 22:25   
I've done some preliminary work on a patch for this without the VNAMES / VPATH_SUFFIXES mumbo jumbo. My thought here was that if VERSION_XXX is specified then if there is a grouping specified ( ) it could automatically be treated as a regular expression. NAMES, PATHS, HINTS, and PATH_SUFFIXES would seem to be logical places to support the feature.

I think it would be a lot easier to implement (at least for the first cut), if grouping expressions were limited to one per complete path + one per complete filename. In other words, you couldn't specify a grouping expression in both PATHS and PATH_SUFFIXES or HINTS and PATH_SUFFIXES. I doubt there would be a use case for this either. Also a regular expression where the versions were split by folders would be a bad idea: /usr/local/foo([0-9])/bar([0-9])

Also for VERSION_XXX I'm thinking VERSION_GREQUAL or some other shortened form would be a better call.
(0023144)
James Bigler   
2010-11-10 13:45   
I added a feature request for REGEXP in the FIND_XXX commands. Since this is being tracked for 2.8.4, I added my bug here.
(0023819)
David Cole   
2010-12-08 15:50   
Deferred. Discussed at the CMake 2.8.4 bug triage meeting, Dec. 8, 2010.
(0041494)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.