[CMake] cmake version/feature detection

Leif Walsh leif.walsh at gmail.com
Thu Aug 7 14:10:43 EDT 2014


Thanks!


On Thu, Aug 7, 2014 at 7:55 AM, David Cole <dlrdave at aol.com> wrote:

> Specifically, for the OBJECT library feature, I figured out what
> version of CMake introduced it like this:
>
>     gitk -- Tests/ObjectLibrary/CMakeLists.txt
>
> leads to finding this first commit of that file: 69d3d183 [1]
>
>     gitk 69d3d183
>
> leads to b87d7a60 [2] (4 parent commits up) which introduced the
> feature itself. Then,
>
>     git describe --contains b87d7a60
>
> yields:
>
>     v2.8.8~29^2~15
>
> So.... OBJECT libraries were introduced in CMake v2.8.8. Also, in all
> the gitk views for these commits, it tells you "Follows: v2.8.7" and
> "Precedes: v2.8.8".
>
>
> You could therefore write code like:
>
>     if (${CMAKE_VERSION} VERSION_LESS 2.8.8)
>       # avoid OBJECT libraries
>     else()
>       # ok to use OBJECT libraries
>     endif()
>
>
> HTH,
> David C.
>
>
> [1] http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69d3d183
> [2] http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b87d7a60
>
>
>


-- 
Cheers,
Leif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140807/1e589def/attachment-0001.html>


More information about the CMake mailing list