[CMake] How to find a specific version of a library?

Nils Gladitz nilsgladitz at gmail.com
Sun Jul 19 08:54:45 EDT 2015


On 19.07.2015 14:02, Yaron Cohen-Tal wrote:
> Ok, I get it. But I still don't understand (and this has nothing to do 
> with CMake) why is it so that "By convention only one version within 
> that prefix may be available for development at a time". If I want to 
> develop one project that uses GLFW 2 and one project that uses GLFW 3, 
> I need to have both installed. I could just link one project with 
> "libglfw.so.2" and the other with "libglfw.so.3". But my system 
> (Debian) doesn't let me do that, as the development packages of GLFW 2 
> and GLFW 3 conflict (they both contain the symlink "libglfw.so"). Do u 
> have any idea why it's like that, and if it has a workaround? (Other 
> than building from source)

Having multiple versions of a library available for development at the 
same time within the same installation prefix requires disambiguation 
for the library names and include files at the filesystem level.

Library developers might allow for this by adding a version number to 
the library name (before the suffix) and include directory (e.g. Qt, 
GTK, SDL, Python).

Most often this is limited to major releases where porting from one 
version to the next is non-trivial.
This isn't something that distributions can (or rather should) add if it 
hasn't been part of the library's design.

It is in the interest of library developers and distributions to 
minimize the number of versions and permutations to maintain.

You can work around this somewhat by installing custom versions into 
isolated distinct (version specific) installation prefixes.

Nils





More information about the CMake mailing list