install(TARGETS): Regression in installation of individual artifacts
EDIT: It turns out that the special case in #20326 (closed) is the entirety of this issue and that the regression from CMake 3.13's behavior in non-error cases is not as general as discussed here.
Original Description
Prior to CMake 3.14, a call to install(TARGETS)
would only install the artifacts for which an explicit DESTINATION
was given. For example, specifying LIBRARY DESTINATION lib
would install only shared library .so
files and module library files. No other .exe
, .lib
, or .dll
files would be installed.
Since CMake 3.14 (via !2558 (merged)), calls to install(TARGETS)
always install almost all the artifacts. Those for which no explicit destination is given are now installed (where they may not have been before) and placed in a default destination. This behavior change has gone largely unnoticed, probably because most existing code had explicit destinations for everything already, and uses of the new feature leave out explicit destinations altogether and expect everything to be installed. However, it has come up in #20326 (closed), which is a special case of this issue.
Furthermore, it is no longer possible to install only a subset of the artifacts without explicitly specifying destinations and separate components for all of them. We need some new way to enable/disable all artifact kinds or specific kinds in a way that is independent of specifying an explicit destionation. It should be possible to say "install just the LIBRARY artifacts, but do so to the default destination".