QtRuby install targets

Alexander Neundorf neundorf at kde.org
Mon Mar 9 21:22:21 CET 2009


On Monday 09 March 2009, David Palacio wrote:
> On MS Windows cmake configuration fails at
> ruby/qtruby/src/CMakeLists.txt:41 with the following error
>
> install Library TARGETS given no DESTINATION!
>
> but it configures fine on GNU. If I remove "LIBRARY" from line 41:
> install(TARGETS qtruby4shared LIBRARY DESTINATION
> ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )

The thing is, cmake separates between "ARCHIVE", "LIBRARY" and "RUNTIME" 
components of targets.
On Windows, the dll-file is considered a "RUNTIME" component, since it should 
go into the same directory as the executable, and the .lib file is considered 
an ARCHIVE component. On UNIX the .so file is a LIBRARY target, a .a file is 
(obviously) an ARCHIVE target.
So if you say 
install(TARGETS mylib LIBRARY DESTINATION lib)
under Windows then you didn't specifiy the destination directories for the dll 
and the lib file, that's why cmake complains.
So you should do:
install(TARGETS mylib LIBRARY DESTINATION lib${LIB_SUFFIX}
                      ARCHIVE DESTINATION lib${LIB_SUFFIX}
                      RUNTIME DESTINATION bin )

Then it will do the right thing both on Windows and UNIX. If it's inside a KDE 
project, you can also use
install(TARGETS mylib ${INSTALL_TARGETS_DEFAULT_ARGS} )
which is a variable set in FindKDE4Internal.cmake, which basically contains 
just these settings.

The simple way would be 
install(TARGETS mylib DESTINATION lib)
but then Windows users may complain, because the dll won't be in the same 
directory as executables, so they'll have top adjust the PATH to make the 
executables run.

Alex



More information about the Kde-windows mailing list