Making writing Config.cmake files easier - updated example
Alexander Neundorf
neundorf at kde.org
Tue Jan 24 19:23:03 UTC 2012
On Tuesday 17 January 2012, Yury G. Kudryashov wrote:
> Alexander Neundorf wrote:
> > On Tuesday 17 January 2012, Yury G. Kudryashov wrote:
> >> Alexander Neundorf wrote:
> >> > On Tuesday 17 January 2012, Yury G. Kudryashov wrote:
> >> >> so we need to ensure (or document?) that the
> >> >> same directory used while writing MyLibConfig.cmake and installing
> >> >> it.
> >> >
> >> > Hmm, I don't understand exactly what you mean, can you please explain
> >> > a bit more ?
> >>
> >> Look at the following code:
> >>
> >> set(CMAKECONFIG_INSTALL_DIR lib/cmake/MyLib)
> >> #MyLibConfig hardcodes $prefix/lib/cmake/MyLib
> >> configure_file(MyLibConfig.cmake.in MyLibConfig.cmake)
> >> #but is actually installed to a different directory
> >> install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MyLibConig.cmake DESTINATION
> >> lib/cmake)
> >>
> >> My points are:
> >> 1. The contents of MyLibConfigVersion.cmake does not depend on the
> >> DESTINATION argument that will be passed to install(FILES).
> >> 2. MyLibConfig.cmake content does.
> >
> > I guess you want to show me that the example above is buggy, i.e.
> > splitting creating and installing can lead to buggy cmake code, while
> > combining it makes this impossible ?
>
> Yes.
>
> >> 3. Writing MyLibConfig.cmake to ${CMAKE_CURRENT_BINARY_DIR} is an
> >> implementation detail, not a part of "public" API. We can hide this file
> >> by placing it to CMakeFiles subdirectory.
> >
> > As I said before, I wouldn't hide this file too much from the user. It
> > should be easy for the developer to have a look at the file, IMO it
> > shouldn't be hidden in a subdirectory.
> >
> >> So, the macro should be called 'install_basic_config_file()'.
> >
> > Before going too far in one direction, please post a proposal to cmake-
> > developers.
>
> The draft mail is opened for about a day. I have to find an hour to think
> about it and write a good proposal.
Any news ?
Alex
More information about the Kde-buildsystem
mailing list