[CMake] Configuration packages & versioning for parallel installations

Robert Dailey rcdailey.lists at gmail.com
Wed Sep 6 17:26:32 EDT 2017


First obvious question is: Should this even be a concern? The
cmake-packages documentation doesn't really touch on versioning, but
there are a couple of concerns I see when you want users to be able to
install (with CMake) multiple versions of the same library
side-by-side:

1. The library files have to use VERSION or SOVERSION properties to
affect their name (this needs to be consistent on all platforms)
2. Debug configurations should alter the name of the library (to
support multi-configuration generators like Visual Studio, for the
most part, but also useful to single-configuration generators)
3. Header file installation: How do you do versioning? How do you have
a foo.h that is version 1.0, and a foo.h that is version 2.0? Does
this even make sense?

One approach I've taken so far is:

1. CMake scripts like config scripts and exported target scripts go
under "share/libraryname-1.0/cmake"
2. Library names follow a format like "libfoo-1.0.0", or
"libfoo-1.0.0-debug" for debug versions of that same library.

I have no answer for include files.


More information about the CMake mailing list