You are not expressing any dependency between the custom commands, so
they may run in parallel, or in any order... If they are connected and
the running of one depends on the output of the other, you need to
express that.

 add_custom_command(
        OUTPUT ${ASYFIG}.eps
        COMMAND asy ${CMAKE_CURRENT_SOURCE_DIR}/${ASYFIG}.asy
        DEPENDS ${ASYFIG}.asy
   )

 add_custom_command(
    OUTPUT manual.pdf
    COMMAND lyx --export pdf ${CMAKE_CURRENT_SOURCE_DIR}/manual.lyx
    DEPENDS manual.lyx
        ${ASYFIG}.eps # <------ this is what's missing, I think...
 )

Also, if you are running an older version of CMake (which one are you
running?), you may need to use full path names for OUTPUT and DEPENDS
clauses. (Explicitly say "${CMAKE_CURRENT_BINARY_DIR}/filename" if
that's where the files are...)


HTH,
David


On Thu, Dec 1, 2011 at 9:50 AM, Anders Wallin
<anders.e.e.wal...@gmail.com> wrote:
> 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
> --
>
> 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
--

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