[CMake] RE: UseLATEX.cmake macros

Moreland, Kenneth kmorel at sandia.gov
Wed Apr 19 09:33:41 EDT 2006


> > > And UseLATEX.cmake build dvi. I don't know how to tell 
> him to don't 
> > > build dvi files.
> >
> > Build the pdf target (make pdf).  That will use pdflatex.
> 
> It doesn't work here.
> 
> ~/tmp/PFE % make pdf
> Building image files for ps documents.
> -- Check for working C compiler: gcc
> -- Check for working C compiler: gcc -- works <snip>
> 
> I got the same if I do make.

Oops.  I forgot that the pdf target depends on the dvi.  I had my
reasons for doing it this way, but I see how it can be a problem.  Let
me take a look and try to change it to remove that dependency so that
make pdf will work for you.

> > > Also, why is it neccessary to build in another directory 
> than source 
> > > directory ?
> >
> > Because UseLATEX.cmake will run configure on your .tex files.  That 
> > is, it will replace all occurrences of the form @VARIABLE@ with the 
> > CMake variable VARIABLE.  If this causes problems, you can 
> turn this 
> > feature off.  Anyway, UseLATEX.cmake forces you to build in another 
> > directory to ensure that UseLATEX.cmake does not 
> accidentally clobber your files.
> 
> How could I do that (tell cmake to build if source is the 
> same directory as build one) ?

This is not a CMake issue.  CMake usually lets you make the source and
build directories the same, although now this is considered bad style.
It's UseLATEX.cmake that forces you to make the source and build
directories differently because the targets it generates will not work
correctly otherwise.  There is no way to get around that when you are
using UseLATEX.cmake.

In general, whenever you use CMake it is better to have the build happen
somewhere other than the source directory (a so-called "out-of-source"
build).  It makes it easy to wipe out a build to start over or to have
multiple builds with different options against the same source.  To make
building easier, I usually add a little script called "makeme" to the
source directory that simply runs make in the build directory.  In fact,
I make this so much I have another script that builds the makeme
scripts.

-Ken



More information about the CMake mailing list