CMake / NuGet:运行时IDentifier的处理

时间:2019-06-04 13:33:01

标签: cmake nuget

我最近开始使用NuGet/CPack generator,但是我不明白如何转换现有项目以使用此新cpack生成器,尤其是用于Windows RIDs处理。

这是我典型的库+安装规则:

add_library(foo SHARED foo.c)
install(TARGETS foo
  EXPORT ${MY_TARGETS_NAME}
  RUNTIME DESTINATION ${MY_INSTALL_BIN_DIR} COMPONENT Applications
  LIBRARY DESTINATION ${MY_INSTALL_LIB_DIR} COMPONENT Libraries
  INCLUDES DESTINATION ${MY_INSTALL_INCLUDE_DIR}
  ARCHIVE DESTINATION ${MY_INSTALL_LIB_DIR} COMPONENT DebugDevel
)

我曾经拥有过的地方(NSIS和二进制zip):

  1. MY_INSTALL_BIN_DIR ='bin'
  2. MY_INSTALL_LIB_DIR ='lib'
  3. MY_INSTALL_INCLUDE_DIR ='包含'

但是,这似乎与NuGet预期的布局不兼容(并且不由生成器内部处理)。最后,nuget生成器报告:

WARNING: Issue: Assembly outside lib folder.
WARNING: Description: The assembly 'bin\gdcmzlib.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project.
WARNING: Solution: Move it into the 'lib' folder if it should be referenced.

如何编写我的install(TARGETS)规则以保留现有的NSIS安装布局并满足NuGet的要求?


更新:如前所述,问题的全部重点是保持当前的NSIS行为。我喜欢在.dll旁边有原生.exe座位。

0 个答案:

没有答案