[CMake] Running "install" by default, or alternatives?

Paul Smith paul at mad-scientist.net
Fri May 24 11:41:49 EDT 2013


Hi all;

We have a large-ish set of cmake files building our project which
results in various executables, libraries, scripts, etc.  Currently
these are just left lying where they were created, and all our tests
etc. expect to find them there.

Then we then have a subsequent script that we run to collect the build
products into a temporary staging area and create the installation
packages (RPMs, EXEs, etc.)  Then to run our tests on the packages we
have to put them in a mode where they expect to find things in those
"release" locations instead of the "build" location.

This is annoying for many reasons and I want to change it so that the
build installs into the staging area, which has the same layout as the
package installation, then all our tests will use that layout and our
packager can just package up that staging area with little extra work.
I guess that the "install" capabilities of CMake are the right way to go
about it.


One major concern I have is that everyone has scripts, macros, etc.
which just run "make", or use XCode or MSVC with the default target.  If
I make this change, then when people forget and run the default target
instead of the "install" target they'll be running against the results
of a previous build (when they did run the "install" step), not the
results of the current build (where they forgot to run the "install"
step).  Much confusion and swearing will ensue.

It doesn't take hardly any time to do the extra few file copies, so I
just want to ALWAYS install to the staging area after building.

Is there a way to make it so that the "install" step is the default step
selected if you don't provide a different one?

Or is CMake install capability not the right answer for this problem?

Or, is a solution like this one:

http://marc.info/?l=cmake&m=130365717914933&w=2

still the recommended way to handle a situation like this?  Are there
more "official" solutions available?



More information about the CMake mailing list