[CMake] Controlling what "install" does at make-time ?

Christian Convey christian.convey at gmail.com
Thu Jul 26 12:59:53 EDT 2007


On 7/26/07, Brandon Van Every <bvanevery at gmail.com> wrote:
> On 7/26/07, Christian Convey <christian.convey at gmail.com> wrote:
> > On 7/26/07, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> > > On Thursday 26 July 2007 11:58, Christian Convey wrote:
> > > > Hi Alex,
> > > >
> > > > Wouldn't the command:
> > > > cmake -DCMAKE_INSTALL_COMPONENT=Headers -P cmake_install.cmake
> > > >
> > > > overwrite the very makefiles that are executing that command?  If so,
> > >
> > > No, -P means cmake will just execute the given cmake script, i.e. it will not
> > > generate makefiles or project files etc.
> >
> > OK, so "-P" means that cmake won't produce a new Makefile.
> >
> > But don't I *need* to create a new Makefile?  I thought the goal was
> > to produce a new Makefile whose "install" target has been affected by
> > the "-DCMAKE_INSTALL_COMPONENT=Headers" argument.
> >
> > If "-P" prevents the creation of a new Makefile, it sounds like we're
> > discarding the very Makefile that we're trying to create.
> >
> > Would you mind clarifying?
>
> The CMake generator creates your Makefile and a bunch of other support
> files and scripts, including cmake_install.cmake.  If you choose to
> manually execute cmake_install.cmake via a custom command, you're
> merely using what the generator already created, and invoking it the
> same way the Makefile does.  By default, the script would just install
> everything.  By passing -DCMAKE_INSTALL_COMPONENT=Headers, you're
> getting a different behavior out of it.  Nothing will explode because
> it's all code the generator produced anyways.

Thanks, I didn't realize that the cmake program did any of the work
when running 'make'.  I thought 'cmake' was executed only when
producing (or rebuilding) the Makefiles, and otherwise was completely
out of the picture when the user invokes 'make'.

So Alex provided this command-line:
cmake -DCMAKE_INSTALL_COMPONENT=Headers -P cmake_install.cmake

I've seen "DESTDIR=..." used with "make install".  Can I safely use it
(with the expected results) with the cmake command?  For example:

cmake -DDESTDIR=/some/path/ -DCMAKE_INSTALL_COMPONENT=Headers -P
cmake_install.cmake

And more generally, can I usually assume that any Makefile variable
assignments that work with "make install", such as:
   "make install FOO=BAR"
will have the same effect in this command?
   "cmake -DFOO=BAR -P cmake_install.cmake"

Thanks,
Christian


More information about the CMake mailing list