[Cmake] Trouble at'Mill

Ken Martin ken.martin at kitware.com
Mon Aug 5 09:50:57 EDT 2002


Hello John,

The correct syntax should be

REMOVE(Common_SRCS vtkInstantiator.cxx)

I believe there was a bug where if Common_SRCS had not been set before
the REMOVE command was called it would crash. I'll check in a fix for
this, but... Common_SRCS should be defined before you call REMOVE so
that may not be your problem.


> I had to update several of my own custom commands and
>
> for (std::vector<std::string>::iterator j =
> (sources.begin() + 1); j != sources.end(); ++j) {
>   cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
>
> returns NULL for all non-abstract files ????
>
> for example, AbstractMapper is returned ok, but Actor2D
> fails and returns NULL. I copied code from the wrap_tcl
> command and it gives me problems.

Nothing guaratees that m_Makefile->GetSource(arg) will return
anything. The sources in the Makefile are created on an as needed
basis. If you look at some of the other wrapping commands they will
check the return value of GetSource and just use the name if the
Source isn't defined yet, or they will create the SourceFile. So the
general rule is:

1) use the name passed in to your command if you can
2) if you need a cmSourceFile, get it from the makefile, and if it
isn't in the makefile you must create it and add it to the Makefile

In CMake 1.6 on of the biggest new features will be support for
dynamic loaded commands that use a C interface (sort of like a
plugin). The current VTK commands in CMake will be removed and
converted to this approach.

Thanks
Ken




More information about the CMake mailing list