[cmake-developers] Integration of manpage installation

Michael Wild themiwi at gmail.com
Tue Jun 7 12:46:33 EDT 2011


On 06/07/2011 05:59 PM, Werner Mahr wrote:
> Michael Wild wrote:
> 
>>> Rename from <appname>.<section> or <appname>.<lang>.<section> to
>>> <appname>
> 
>>> install to $mandir/<section>/<appname>[.gz] or
>>> $mandir/<section>/<lang>/<appname>[.gz]
> 
>> install(FILES cmake.1
>>   DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 COMPONENT doc)
>>
>> If you want gzipping, either leave it to the package generation system
>> (e.g. dh_installman on Debian and cohorts) or add a custom command to
>> do so.
> 
> Gzipping isn't the problem, the problem are these two steps above. With 
> this command no transformation is done.
> 
> amule.1 goes to $mandir/man1/amule.1 instead of $mandir/man1/amule.1
> amule.de.1 goes to $mandir/man1/amule.de.1 $mandir/de/man1/amule.1
> 
> Even worse
> locale.7 would go to $mandir/man1/locale.7 where it definitely not 
> belongs.
> 

foreach(m amule.1 amule.de.1 locale.7)
  get_filename_component(b ${m} NAME_WE)
  get_filename_component(e ${m} EXT)
  if(e MATCHES "(([a-zA-Z_-]+)\\.)?([0-9])")
    set(l "${CMAKE_MATCH_2}")
    set(s "${CMAKE_MATCH_3}")
  else()
    message(SEND_ERROR
      "Failed to parse language and section from manpage name '${m}'")
  endif()
  install(FILES ${m}
    DESTINATION "${CMAKE_INSTALL_MANDIR}/${l}/man${s}" COMPONENT doc
    RENAME ${b}.${s})
endforeach()


Michael



More information about the cmake-developers mailing list