Check whether INSTALL target exists

Context: I am writing a CMake library for use by a number of my colleagues. Any of their projects may generate a number of executables and libraries, not all of which they want to install, so I make them set CMake variables to denote which ones they want installed and which ones they don’t want installed. Sometimes they forget to set any at all, and are then surprised when there is no INSTALL target for them to select in Visual studio. I’d like to be able to generate a warning message, and remind them of what they need to do.

My question, then…

Is it possible to tell whether a project has an INSTALL target?

I know that there’s an “if (TARGET <target-name>)” command, but this doesn’t work. According to the documentation,

True if the given name is an existing logical target name created by 
a call to the add_executable(), add_library(), or add_custom_target() 
command that has already been invoked (in any directory).

…but this isn’t applicable for standard targets that CMake generates itself.

I had another idea, which was to have my batch script that invokes CMake check whether a “cmake_install.cmake” file was generated in the binaries directory, but it looks like one is created even if there is nothing for it to install.

I don’t think there’s a way to know if a target has any associated install() rules (and if so, what bits are installed). We might need to make EXPORT “objects” that can be queried for this.

Thank you; I’ll try to find a workaround, or just make sure that the documentation covers this eventuality.