On 11/6/2011 6:12 AM, Stephen Kelly wrote:
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.
See below for an idea that may solve cases 2 and 3 together.
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()
We've done the following before:
if(EXISTS ${CMAKE_ROOT}/Modules/FindBlub.cmake)
include(${CMAKE_ROOT}/Modules/FindBlub.cmake)
return()
endif()
That way you don't need to know when the module is added. It is also
forward-compatible for any module not yet in CMake but may be later.
OTOH the version of the module added to CMake may provide a slightly
different interface than the original version. That leads to the
unfortunate situation that a newer CMake breaks an existing build,
which looks like CMake's fault but isn't.
Another option is to provide a function that generates forwarding
modules. Instead of ecm_copy_modules, create a similar API that
generates short modules that include either the ECM version or the
CMake version depending on some conditions. Do the inclusion by
full path so that the actual ECM module dir does not need to be in
the CMAKE_MODULE_PATH.
-Brad
--
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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers