[Cmake] Generating code during the build: Fluid FLTK

Luis Ibanez ibanez at choroid.cs.unc.edu
Mon Dec 3 05:34:16 EST 2001


Hi Franck

Thanks a lot for your indications. They were very useful
for tracking down the problem. As you said, the problem was that
cmake couldn't find the .h as the time of defining dependencies.

I followed your indications about adding the Fluid output
directory to the list of INCLUDE directories and also
created a subdirectory named "GUI" at this output position.
All this is done by FLTKWrapUI command so that users don't
need to write it in their CMakeLists.txt files.

In addition to that, it turned out that our package (Insight)
defined at the top level CMakeList.txt a regular expression
to select the #include files that are considered to be added
in the cmake.depends file. In our case it is:

INCLUDE_REGULAR_EXPRESSION("^(itk|vtk|vnl|vcl|f2c).*$")

So only files starting with : itk, vtk, vnl ...etc
were being included in the dependencies. The file generated
by FLTK had an arbitrary name that didn't match this
regular expression. So I had to extend the expression
in order to accept also this file.

------

I have a remanent question about the code in cmMakeDepend.cxx,
Around lines 188 - 191, when the include file has not been
found directly, cmMakeDepend tries combinations with the
directories in the INCLUDE_DIRECTORY list to see if any of them
match the file that is going to be generated.  However, when
building these paths, the include directories are concatenated
with "path" which in line  124 has been assigned to a full
expanded path, that results (at least for my case) in a lot
of paths of the form:

 "/home/ibanez/include/home/ibanez/include/Insight/...."
   ^^^                 ^^^

Where the root directory was included twice.

Is that due to an error in the way I'm generating the names
for the generated code ?

----


In any case, now the command is working Ok.
It was even possible to remove the "GUI" directory and
cmMakeDepend is still able to recognize that a .h file
will be generated in the output directory and it uses
the name for cmake.depends.




Thanks


Luis


===============================
---



On Thu, 29 Nov 2001, Franck Bettinger wrote:

> Hi Luis,
>
> It appears that the .h file can not be found. As this file does not exist at
> the time of the target creation, I've added a rule in cmMakeDepend.cxx that
> also look if the file will not be generated. Unfortunately there was a
> problem with the matching of the path (since we only know the name of the
> file itself and not its path). I had to guess the path by looking at the
> include directories.
>
> So you have to add an INCLUDE_DIRECTORIES rule in your CMakeLists.txt that
> tells cmake where to look for.
>
> For instance, with the Qt ui wrapper and vxl, I use a rule like this :
>
> INCLUDE_DIRECTORIES( ${allvxl_BINARY_DIR} )
> ...
>     QT_WRAP_UI(drawing
>       drawing_ui_headers
>       drawing_ui_sources
>       drawing_interfaces
>     )
>
> and I include the .h file using :
> #include <programs/drawing/drawing.h>
>
> so that cmMakeDepend.cxx can find that the file
> ${allvxl_BINARY_DIR}/programs/drawing/drawing.h
> is in the target list.
>
> Beware not to use a "/" at the end of your INCLUDE_DIRECTORIES path because
> the algorithm append it automatically and two "/" would cause the matching to
> fail.
>
> I hope it helps.
>
> Franck
>
>
> On Thursday 29 November 2001 07:12, Luis Ibanez wrote:
> > Hi,
> >
> > I'm adding a new command:   cmFLTKWrapUICommand
> [...]
> > There is however a problem with the creation of
> > the customCommand in m_Makefile. The method
> > verifies if the target in question already
> > exists or not.  In this case the targets
> > are the .cxx and .h generated files. A for that
> > reason this new command is inserting directly
> > the .cxx and .h as targets of the built.
> >
> >
> > In order to support these files as a Type of
> > targets was added to cmTarget: "GENERATED_CODE".
> >
> > A residual problem is appearing with the
> > custom rule for the .h file, its rule
> > is missing in the Makefile (under Linux).
> > It seems that somewhere in the process
> > the fils with .h extension are ignored as
> > targets... The Custom rule for .cxx is working
> > ok.
> >
> >
> > Any suggestions ?
> >
> > Thanks,
> >
> > Luis
>
>

-- 
Luis Ibanez                                      CB#:   7060
Research Assistan Professor                      phone: (919) 843 5436
Division of Neurosurgery                         fax:   (919) 966 6627
University of North Carolina at Chapel Hill      email: ibanez at cs.unc.edu
Chapel Hill, NC 27599-7060                       http://www.cs.unc.edu/~ibanez





More information about the CMake mailing list