How do I write CMake install for a library?

…衆ロ難τιáo~ 提交于 2019-12-23 12:46:02

问题


Here is my try:

IF (NOT WIN32)
  #INSTALL_TARGETS(${LIB_INSTALL_DIR} ${tinyscheme-nix_BINARY_DIR}/libtinyscheme.so)
  #INSTALL(TARGETS ${tinyscheme-nix_BINARY_DIR}/libtinyscheme.so DESTINATION ${LIB_INSTALL_DIR})
ENDIF()

Both variants are wrong. I want to move libtinyscheme.so from ${tinyscheme-nix_BINARY_DIR} to /lib or /lib64. Basically, I think ${LIB_INSTALL_DIR} handles it.

How can I make it? Where is my mistake?


回答1:


You probably want the FILES version of install here instead of the TARGETS version.

The TARGETS version of install is used for actual CMake targets which have been added using e.g. add_library. In this case, you would refer to the target by its name assigned during the add_library command, rather than its full path.

So replacing TARGETS with FILES in your second command would be the way to go here I think.

For full details on the install command, run:

cmake --help-command install


来源:https://stackoverflow.com/questions/10926139/how-do-i-write-cmake-install-for-a-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!