How to provide modules in extra-cmake-modules ?

Alexander Neundorf neundorf at kde.org
Sun Jul 10 19:02:44 CEST 2011


Hi,

when somebody will use e-c-m, he will do a 

find_package(extra-cmake-modules)


What should that do except finding the location where they are ?

1) It could change CMAKE_MODULE_PATH.
I think I'm not in favour of this. In general, such a call should not modify 
the settings, but just provide variables etc. We did that with 
FindKDE4Internal.cmake and I'm not too happy about it.

2) It could set a ECM_MODULE_DIR variable, which points to the modules/ 
directory of e-c-m.
Then the user is free to do 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_DIR})
or not.

3) We could recommend to use 
include(${ECM_MODULE_PATH}/ECMOptionalAddSubdirectory.cmake)


I think I'm in favour of option 2).

Related to that, if a user adds this directory to his CMAKE_MODULE_PATH, 
should we provide two directories ?
One for modules which override modules which are present in cmake, and another 
one (modules/) which adds modules which are not present in cmake.
But maybe then we also have to handle this differently for different cmake 
versions, some modules might make it into a later cmake version...

Alex


More information about the Kde-buildsystem mailing list