<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Re-sending.<br>
    <br>
    -------- Original Message --------
    <table class="moz-email-headers-table" border="0" cellpadding="0"
      cellspacing="0">
      <tbody>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject: </th>
          <td>How to handle different cmake versions in
            extra-cmake-modules ?</td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
          <td>Sat, 5 Nov 2011 16:45:44 +0100</td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
          <td>Alexander Neundorf <a class="moz-txt-link-rfc2396E" href="mailto:neundorf@kde.org"><neundorf@kde.org></a></td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Reply-To:
          </th>
          <td><a class="moz-txt-link-abbreviated" href="mailto:neundorf@kde.org">neundorf@kde.org</a></td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
          <td><a class="moz-txt-link-abbreviated" href="mailto:cmake-developers@cmake.org">cmake-developers@cmake.org</a></td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">CC: </th>
          <td>Stephen Kelly <a class="moz-txt-link-rfc2396E" href="mailto:steveire@gmail.com"><steveire@gmail.com></a></td>
        </tr>
      </tbody>
    </table>
    <br>
    <br>
    <pre>Hi,

we (in KDE) are working on setting up a package/project "extra-cmake-modules" 
which will provide additional cmake modules for other cmake-using projects, 
mostly find-modules.

I don't really have a plan yet how to handle different cmake versions, etc.

I see at least the following three cases:

1) we may include modules, which do not exist in cmake.

2) we may include modules, which differ from versions in cmake. Using projects 
should be able to decide whether they want to use the version from cmake or 
from e-c-m on a file-by-file basis.

3) we may include modules, which do not exist in cmake up to some version, but 
then they were added to cmake. Users of such a newer cmake version should get 
the version from cmake.


I assume that a directory which contains the modules from e-c-m is added to 
CMAKE_MODULE_PATH, something like:

find_package(extra-cmake-modules REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}  ${ECM_MODULE_DIRECTORY} )

Case 1 is simple. The using project uses the module or not.



Case 2 is not so simple. One idea I have is to have the using project specify 
explicitely which files they need, e.g. something like

find_package(extra-cmake-modules REQUIRED)

ecm_copy_modules(${CMAKE_BINARY_DIR}/modules FindFoo.cmake
                                             FindBlub.cmake
                                             ECMDoSomething.cmake)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}  ${CMAKE_BINARY_DIR}/modules} )

This macro would copy just these needed files into the given directory, which 
can then be added to CMAKE_MODULE_PATH.



Case 3. I don't really have an idea yet. Add some code at the top of each file 
which include()s the file from cmake if the version is bigger than some 
specified version ?

Something like:
FindBlub.cmake:

if(CMAKE_VERSION > 2.8.12)
  include(${CMAKE_ROOT}/Modules/FindBlub.cmake)
  return()
endif()


Ideas, comments, etc. ?

Thanks
Alex
</pre>
  </body>
</html>