Re-sending. -------- Original Message -------- Subject: How to handle different cmake versions in extra-cmake-modules ? Date: Sat, 5 Nov 2011 16:45:44 +0100 From: Alexander Neundorf <neund...@kde.org> Reply-To: neund...@kde.org To: cmake-developers@cmake.org CC: Stephen Kelly <steve...@gmail.com>
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
-- 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