[CMake] providing library information, what's the cmake way

Alexander Neundorf a.neundorf-work at gmx.net
Wed Nov 24 15:46:51 EST 2010


On Wednesday 24 November 2010, David Cole wrote:
> On Wed, Nov 24, 2010 at 11:34 AM, 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
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
> Adding that information in the documentation would be good, I agree.
> (Although quite time consuming and costly for somebody...)
>
> But the best practice should be this:
>
> If you are using CMake 2.8.3 exclusively to develop features in your
> source tree's CMakeLists files (or included .cmake scripts) then you
> need to say "cmake_minimum_required(VERSION 2.8.3)" just to be on the
> safe side.
>
> If you want to support CMake 2.6.4 (or whatever previous version you
> require, for whatever reason), then you should be using *that* version
> for your local development, and have that be the
> cmake_minimum_required version. And use that version to look up
> documentation...

E.g. here: http://www.cmake.org/Wiki/CMake_Released_Versions

Alex


More information about the CMake mailing list