Can I build targets during all but NOT during install?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I build targets during all but NOT during install?

Paul Smith
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?
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Can I build targets during all but NOT during install?

Paul Smith
On Mon, 2018-01-01 at 18:12 -0500, Paul Smith wrote:

> 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 my 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?

FYI I'm using CMake 3.11.3 on GNU/Linux, MacOS, and Windows with Visual
Studio.

Thanks to Oleksii Vilchanskyi <[hidden email]> for
pointing me to CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.

This appears (not tested completely yet) to do half of what I'd like,
by keeping the "install" target from depending on "all".


The other half is that I want to have the "all" target depend on
"install", instead: all should build all the installation targets AND
also build all the extra testing stuff that is not needed during
install.

I can't seem to figure out how to do that; add_dependencies()
explicitly says that I can't use it with "install" and I don't see any
other way to add dependencies to a target.

Is this possible?  Or do I need to go around to all my "all"
dependencies and explicitly add them to "install" as well?


Then the next step after that is I'd like my "install" target to have
dependencies which are built during installation but don't actually
copy any files anywhere: they are just built and left as-is when I run
the "install" rule (e.g., "make install" or whatever).

I can't come up with a way to modify the dependencies of the "install"
target without using the install() rule.

The manual says that the DESTINATION option in install() is optional,
but if I leave it out I get errors.

Is that possible?
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake