VS: DOTNET_SDK: CMake should not install .NET static library targets by copying entire directory
It seems that CMake installs all the files in the output directory when the installing the static library.
This seems like a bug in installation. Given .NET does not rely on .lib
, the .dll
output should be copied instead. Or don't emit the code to copy the static library altogether.
For example, here is some generated cmake_install.cmake
code:
if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
if(CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE STATIC_LIBRARY OPTIONAL FILES "E:/Development/TestProject/build/src/cs/Debug/")
...
if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
if(CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "E:/Development/TestProject/build/src/cs/Debug/test_target.dll")
As can be seen, the entire directory is copied. This makes it extremely difficult to create good installations when dumping all of the targets into the same directory (for testing). It still makes things difficult even when using separate directories, since a lot of junk gets copied (such as the .pdb and dependencies).
As a workaround, I've found I can set ARCHIVE_OUTPUT_DIRECTORY
to some non-existent directory, but this isn't ideal.