overriding CMAKE_MODULE_PATH

Andreas Pakulat apaku at gmx.de
Mon Aug 16 12:42:04 CEST 2010


On 16.08.10 12:16:41, Yury G. Kudryashov wrote:
> Andreas Pakulat wrote:
> 
> > On 16.08.10 00:59:20, Yury G. Kudryashov wrote:
> >> Andreas Pakulat wrote:
> >> 
> >> > On 16.08.10 00:09:41, Yury G. Kudryashov wrote:
> >> >> Alexander Neundorf wrote:
> >> >> > On Sunday 15 August 2010, Yury G. Kudryashov wrote:
> >> >> >> Many (all?) KDE modules have the following string in the beginning
> >> >> >> of CMakeLists.txt:
> >> >> >>
> >> >> >> set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
> >> >> >>
> >> >> >> What do you think about replacing this string with the following?
> >> >> >>
> >> >> >> set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules
> >> >> >> ${CMAKE_MODULE_PATH})
> >> >> >>
> >> >> >> This would allow user to say, e.g.,
> >> >> >>
> >> >> >> cmake ${kdenetowrk_src_dir} -
> >> >> >> DCMAKE_MODULE_PATH=${libktorrent_prefix}/share/apps/cmake/modules
> >> >> > 
> >> >> > Why would you want to do that ?
> >> >> > I think this shouldn't be necessary, and might break more stuff than
> >> >> > it helps.
> >> >> Because I have libktorrent installed into a different prefix (not
> >> >> CMAKE_INSTALL_PREFIX), and kdenetwork fails to find it.
> >> > 
> >> > Then either specify CMAKE_PREFIX_PATH for fix the FindKTorrent.cmake
> >> > module.
> >> Cmake looks for FindKTorrent in CMAKE_MODULE_PATH, not CMAKE_PREFIX_PATH.
> > 
> > Right. So where is the problem? FindKTorrent.cmake should either be part
> > of cmake itself, part of kdelibs or be part of kdenetwork. Anything else
> > is a bug (ktorrent shouldn't install a FindKTorrent.cmake that doesn't
> > make any sense). As far as I can neither of the three is a case, so I
> > suggest to add a proper FindKTorrent.cmake to kdenetwork/cmake/modules/.
> Why you don't like the current situation? libktorrent installs FindKTorrent 
> into <prefix>/share/apps/cmake/modules. If it is installed, kdenetwork 
> should find it (if we add CMAKE_PREFIX_PATH -> CMAKE_MODULE_PATH map), else 
> it doesn't find. What's wrong?

Whats wrong is that if ktorrent is not installed there's no way to give the
user a useful error message. All you get is a 'no xxxConfig.cmake found'
error from cmake, becuase no FindKTorrent.cmake is found (and no
KTorrentConfig.cmake either). The point of doing a find_package(KTorrent)
is to find out wether its installed or not, if its not installed you're
supposed to give your users a useful message, preferably telling them where
to get it. When the FindKTorrent.cmake is only installed if ktorrent is
installed you're making that impossible.

Andreas

-- 
You will be recognized and honored as a community leader.


More information about the Kde-buildsystem mailing list