[CMake] Can I build targets during all but NOT during install?

Paul Smith paul at mad-scientist.net
Mon Jan 1 18:12:24 EST 2018


I have (what I thought was) a common environment where my build creates
both programs to be installed and also test programs etc. that aren't
installed.

What I hoped is for the default build with no targets specified to
build everything ("all"), but if I invoke the build with the "install"
target it builds only the things that are to be installed, not the test
programs.

Unfortunately it doesn't seem like this is possible; at least when I
examine the Makefiles generated by the CMake Unix Makefiles generator,
the install target depends on the preinstall target which depends on
all.  Is this true in general or is there something in my CMake setup
that causes it?

I find this very limiting: it seems clear to me that a default "all"
build might create all sort of other things that aren't installed via
the "install" target... I should be able to build "install" to only
build those things not "all" the things.

Any ideas for this?


More information about the CMake mailing list