This works for me:

CMakeLists.txt:
# BOF ----------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(manTest)

find_program(A2X_EXECUTABLE NAMES a2x a2x.py)
set(A2X_OPTS
  -D ${CMAKE_BINARY_DIR}
  -d manpage
  -f manpage
  )

set(MAN_NAMES foo.1 bar.3)
set(MAN_FILES)
foreach(m IN LISTS MAN_NAMES)
  set(mf ${CMAKE_BINARY_DIR}/${m})
  set(ms ${CMAKE_SOURCE_DIR}/${m}.txt)
  add_custom_command(OUTPUT ${mf}
    COMMAND ${A2X_EXECUTABLE} ${A2X_OPTS} ${ms}
    DEPENDS ${ms}
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
    COMMENT "Building manpage ${mf}"
    VERBATIM)
  list(APPEND MAN_FILES ${mf})
endforeach()

add_custom_target(man ALL DEPENDS ${MAN_FILES})

# EOF ----------------

Michael

On 24. Sep, 2010, at 13:43 , Laszlo Papp wrote:

> This did not work either :((( :
> 
> set(ASCIIDOC_MANS
> hacky.8
> akabei-create-db.8
> akabei.conf.5
> akabei.3
> )
> 
> set(A2X_OPTS
> -no-xmllint
> -d manpage
> -f manpage
> --xsltproc-opts='-param man.endnotes.list.enabled 0 -param
> man.endnotes.are.numbered 0'
> )
> 
> foreach(manpage $(ASCIIDOC_MANS))
>  execute_process(COMMAND ${a2x} ${A2X_OPTS}
> --asciidoc-opts="${AKABEI_VERSION_STRING}"
> ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.txt
> --destination-dir=${CMAKE_CURRENT_BINARY_DIR})
> endforeach()
> 
> install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akabei.3.gz DESTINATION
> ${MAN_INSTALL_DIR}/man3/)
> install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akabei.conf.5.gz DESTINATION
> ${MAN_INSTALL_DIR}/man5/)
> install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hacky.8.gz DESTINATION
> ${MAN_INSTALL_DIR}/man8/)
> 
> 
> On Fri, Sep 24, 2010 at 2:04 PM, Michael Wild <them...@gmail.com> wrote:
>> 
>> On 24. Sep, 2010, at 12:36 , Laszlo Papp wrote:
>> 
>>> Hi,
>>> 
>>> What is wrong about the following CMakeLists.txt file ? I would like
>>> to generate manual pages, like this project does with autotools:
>>> http://projects.archlinux.org/pacman.git/tree/doc/Makefile.am
>>> 
>>> Thank you in advance!
>>> 
>>> ========================================================================================
>>> 
>>> set(ASCIIDOC_MANS
>>> hacky.8
>>> akabei-create-db.8
>>> akabei.conf.5
>>> akabei.3
>>> )
>>> 
>>> set(A2X_OPTS
>>> -no-xmllint
>>> -d manpage
>>> -f manpage
>>> --xsltproc-opts='-param man.endnotes.list.enabled 0 -param
>>> man.endnotes.are.numbered 0'
>>> )
>>> 
>>> foreach(manpage ${ASCIIDOC_MANS})
>>> add_custom_command(OUTPUT ${manpage}
>>>                                       COMMAND a2x ${A2X_OPTS}
>>>                                       
>>> --asciidoc-opts="${AKABEI_VERSION_STRING}" ${manpage}.txt
>>>                                       VERBATIM)
>>> endforeach(manpage)
>>> 
>>> # install(FILES akabei.3.gz DESTINATION ${MAN_INSTALL_DIR}/man3/)
>>> # install(FILES akabei.conf.5.gz DESTINATION ${MAN_INSTALL_DIR}/man5/)
>>> # install(FILES hacky.8.gz DESTINATION ${MAN_INSTALL_DIR}/man8/)
>>> 
>>> Best Regards,
>>> Laszlo Papp
>> 
>> You need a top-level target that depends on the individual manpages:
>> 
>> add_custom_target(man ALL
>>  DEPENDS ${ASCIIDOC_MANS})
>> 
>> HTH
>> 
>> Michael
>> 
>> --
>> There is always a well-known solution to every human problem -- neat, 
>> plausible, and wrong.
>> H. L. Mencken
>> 
>> 

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
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://www.cmake.org/mailman/listinfo/cmake

Reply via email to