简体   繁体   中英

How do I write CMake install for a library?

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?

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 eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM