[CMake] output of custom_command ?

Anders Wallin anders.e.e.wallin at gmail.com
Thu Dec 1 09:50:56 EST 2011


Hi all,

I'm building some Lyx documentation with asymptote figures.

I'm generating the figures in EPS format like this:
add_custom_command(
        OUTPUT ${ASYFIG}.eps
        COMMAND asy ${CMAKE_CURRENT_SOURCE_DIR}/${ASYFIG}.asy
        DEPENDS ${ASYFIG}.asy
   )

and the the document in PDF format like this:
add_custom_command(
    OUTPUT manual.pdf
    COMMAND lyx --export pdf ${CMAKE_CURRENT_SOURCE_DIR}/manual.lyx
    DEPENDS manual.lyx
)

I put all .asy source files and .lyx source files in one directory.

When I do an out-of-source build in e.g. /src/bld/ the .eps files
which are produced from the first
custom_command are put in CMAKE_CURRENT_BINARY_DIR

Two questions/problems:

1. the pdf file from the second custom_command gets placed in
CMAKE_CURRENT_SOURCE_DIR.
Why is that happening?

2.
Since the input of the second custom_command, and the .eps files are
now in different directories, lyx is not finding the EPS-files.
How could I have the second custom_command run in
CMAKE_CURRENT_BINARY_DIR so that the figures would be found
and the output pdf would be generated in CMAKE_CURRENT_BINARY_DIR ?


thanks,
Anders


More information about the CMake mailing list