5

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
cnd
  • 32,616
  • 62
  • 183
  • 313

1 Answers1

4

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
Fraser
  • 74,704
  • 20
  • 238
  • 215
  • 1
    I see, seems like LIB_INSTALL_DIR doesn't work as I want it to – cnd Jun 07 '12 at 08:48
  • 2
    @Sholy `install` should generally just specify a path relative to [`${CMAKE_INSTALL_PREFIX}`](http://www.cmake.org/cmake/help/v2.8.8/cmake.html#variable:CMAKE_INSTALL_PREFIX), so if you set `${LIB_INSTALL_DIR}` to "lib" or "lib64" as appropriate, and leave `${CMAKE_INSTALL_PREFIX}` set to its default, the library will end up in /usr/local/lib or /usr/local/lib64. – Fraser Jun 07 '12 at 10:42
  • @Fraser your comment indicates some deep cmake insights, however I have a few more questions about `${LIB_INSTALL_DIR}`, which I put [here](http://stackoverflow.com/q/36723588/258418). Some further insights would be very much appreciated. – ted Apr 19 '16 at 15:58