install(TARGETS) for csharp library also installs entire archive folder
When I install a C# library using
install(TARGETS) on Windows, it also installs the entire archive folder with any .lib files that are there, whether related to the C# library or not. In the generated cmake_install.cmake file, you see an
install(FILES) command with the folder name of the archive folder. This install command shouldn't be there. In a large project, this can easily add many megabytes to your CPack archives.
I'm guessing this
install command was supposed to contain the import lib file. However, a C# library doesn't have an import library, even if it is declared with
add_library(libname SHARED), unlike a C++ SHARED library. It looks to me like an empty string was appended to the folder path, resulting in the entire folder getting installed.
Might be related to #19353.
I've attached a minimal example that reproduces the problem. CmakeLists.txt