[CMake] providing library information, what's the cmake way
Marcel Loose
loose at astron.nl
Thu Nov 25 07:58:49 EST 2010
>>> On 24-11-2010 at 17:34, in message
<ddc068a445e2cc6dcf015e9b84217da0.squirrel at webmail.sf-mail.de>, "Rolf
Eike
Beer" <eike at sf-mail.de> wrote:
>> On Wed, Nov 24, 2010 at 6:57 AM, Rolf Eike Beer <eike at sf-mail.de>
wrote:
>>>> In KDE we have a macro MACRO_WRITE_BASIC_CMAKE_VERSION_FILE()
which
>>>> helps
>>>> with
>>>> creating a basic version-info file which should be installed along
with
>>>> the
>>>> Config-file.
>>>> It consists of MacroWriteBasicCMakeVersionFile.cmake and
>>>> BasicFindPackageVersion.cmake.in which you can find in
>>>> http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/ .
>>>
>>> I wonder why you use
>>>
>>> get_filename_component(_currentListFileDir
${CMAKE_CURRENT_LIST_FILE}
>>> PATH)
>>>
>>> in there instead of CMAKE_CURRENT_LIST_DIR.
>
>> Probably because CMAKE_CURRENT_LIST_DIR was just invented and is
only
>> in CMake 2.8.3... get_filename_component works with several
versions
>> of CMake, and does not require 2.8.3 or later.
>
> So I think it is _really_ necessary to go through all the CMake
> documentation items and add a line about when which feature was
added.
>
> Everyone looks into his local CMake documentation and uses what he
finds
> in there. And then it breaks on older versions. You currently have
no
> chance to know what works but to install all older versions and do a
> binary search in the documentation. That simply does not scale.
>
> Eike
That's what CMAKE_MINIMUM_REQUIRED() is for. If you're developing with
CMake 2.8.2, and you want to make sure that you don't use any features
that are not supported by CMake prior to version 2.8.2, you should put
this at the top of your CMakeLists.txt file:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2)
But you do have a point. It would really help people developing CMake
files to know whether they can use a given command or not if they want
to support, say, CMake 2.6.0. To be honest, the people at Kitware don't
make that an easy job, because almost every patch-release contains new
features :-(
Best regards,
Marcel Loose.
More information about the CMake
mailing list