[CMake] Manual page generation

Michael Wild themiwi at gmail.com
Fri Sep 24 08:56:53 EDT 2010


On 24. Sep, 2010, at 14:51 , Laszlo Papp wrote:

> This does not generate files. I have got a separate build directory
> and doc directory in my project root. The main CMakeLists.txt contains
> the doc subdirectory entry.
> 
> set(ASCIIDOC_MANS
> hacky.8
> akabei-create-db.8
> akabei.conf.5
> akabei.3
> )
> 
> find_program(A2X_EXECUTABLE NAMES a2x a2x.py)
> set(A2X_OPTS
> -D ${CMAKE_BINARY_DIR}
> -no-xmllint
> -d manpage
> -f manpage
> --xsltproc-opts='-param man.endnotes.list.enabled 0 -param
> man.endnotes.are.numbered 0'
> )
> 
> set(MAN_NAMES ${ASCIIDOC_MANS})
> set(MAN_FILES)
> foreach(m IN LISTS MAN_NAMES)
> 	message(STATUS ${CMAKE_BINARY_DIR}/${m})
> 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})


If the files are in a sub-directory, use CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR instead.

Also, which version of cmake are you using? The foreach(m IN LISTS ...) syntax is new in version 2.8...

Michael

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100924/75e33fb5/attachment.pgp>


More information about the CMake mailing list