[CMake] Yet another install() vs. exclude_from_all thread

Michael Hertling mhertling at online.de
Tue Apr 27 08:42:18 EDT 2010


On 04/27/2010 10:31 AM, Daniel Hornung wrote:
> On 2010-04-27 9:24, Daniel Hornung wrote:
>> And indeed "make install
>> ${some_name}" compiles those targets fine but does not install them.
> 
> Addendum: I just found that those targets are only installed if they exist
> already when the "all" target is being installed (which is usually before they
> are built).  So doing "make install ${some_name}" twice may be a workaround,
> albeit an undefined one.

Are you sure this behaviour isn't the expected one?

"make install" w.r.t. targets means:

1) Build any target that "install" depends on, especially "all",
   but right not the excluded-from-all targets, and afterwards,
2) install any target which is scheduled for installation by
   INSTALL(TARGET ...) *and* already built; see "OPTIONAL".

Thus, "make install" neither compiles nor installs "${some_name}",
unless the latter has been built afore and scheduled by INSTALL().

"make install ${some_name}" w.r.t. targets means:

1) Attend to target "install" in the above-mentioned manner, and
2) *subsequently*, attend to target "${some_name}", i.e. build it.

Again, "${some_name}" isn't installed, but that's completely correct.

Just say "make ${some_name} install". Here, "${some_name}" is already
built when make attends to the "install" target, and as "${some_name}"
has been scheduled for installation you probably "hit your target".

Note that, for make, "install" is a target as any other, no command
or the like, and it processes its targets from the command line in
sequence; indeed, "make a b" is quite the same as "make a; make b".
Btw, this is why issuing "make install ${some_name}" twice works.

'hope this helps.

Regards,

Michael


More information about the CMake mailing list