[CMake] Howto define build order

Matthias Fechner idefix at fechner.net
Fri Aug 24 07:58:46 EDT 2007


Hi Eric,

Eric Noulard wrote:
> Did you try add
> ADD_DEPENDENCIES(pdf GNUPLOTs)

I tried with Jack together several combinations but we had problems at
the time we moved some of the maindir into a subdir.
I reduced the problem now to a very simple one, everyone can try it.
Create a directory, touch foo.tex and create the CMakeLists.txt:
PROJECT(FOO NONE)
LIST(APPEND CMAKE_MODULE_PATH "${FOO_SOURCE_DIR}")

INCLUDE(UseLATEX)
SET(LATEX_OUTPUT_PATH build)

ADD_LATEX_DOCUMENT(foo.tex DEFAULT_PDF)

ADD_CUSTOM_TARGET(bar.tex
  bash -c "echo hi>${FOO_BINARY_DIR}/bar.tex"
  VERBATIM)

#Formats as needed, I guess.
ADD_DEPENDENCIES(pdf bar.tex)

Thats works perfectly.
Now I want to move my ADD_CUSTOM_TARGET to a subfolder called dir.
I tried it with the 2 following files without success.
PROJECT(FOO NONE)
LIST(APPEND CMAKE_MODULE_PATH "${FOO_SOURCE_DIR}")
INCLUDE(UseLATEX)

SET(LATEX_OUTPUT_PATH build)

ADD_SUBDIRECTORY(dir)

ADD_LATEX_DOCUMENT(foo.tex DEFAULT_PDF)

#Formats as needed, I guess.
ADD_DEPENDENCIES(pdf dir/bar.tex)
ADD_DEPENDENCIES(dvi dir/bar.tex)

and:
ADD_CUSTOM_TARGET(bar.tex
  bash -c "echo hi>${FOO_BINARY_DIR}/diro/bar.tex"
  VERBATIM)

I'm sure that is is a problem with defining the directories but I have
no idea how to do it. Any suggestions are very welcome.

Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook


More information about the CMake mailing list