[CMake] Inconsistency with INSTALL(TARGETS) destinations...

Hendrik Sattler post at hendrik-sattler.de
Tue Mar 10 19:02:49 EDT 2015



Am 10. März 2015 23:33:41 MEZ, schrieb J Decker <d3ck0r at gmail.com>:
>I recently added cmakelists to a library that didn't support cmake.
>It started with a simple make system, and was easy to create and use
>simple
>cmake support.
>
>I was building using visual studio, and this was my install command
>   install( TARGETS MatrixSSL
>            LIBRARY DESTINATION bin
>            ARCHIVE DESTINATION lib )
>
>that put the .DLL in bin and .lib in lib.
>
>Then I had to change to using watcom to build, and the .DLL went
>nowhere...
>so I modified the line to...
>
>   install( TARGETS MatrixSSL
>            RUNTIME DESTINATION bin
>            LIBRARY DESTINATION bin
>            ARCHIVE DESTINATION lib )
>
>... then the DLL was installed into bin.

A bug, then. Dll files should always be installed to the RUNTIME destination.

>I'm not sure which way is intended... or maybe it's something in each
>of
>the build environments that requires it to be different?
>
>
>and just commentary...
>Installing libraries is kind of a pain... (and this is probably
>incomplete)
>
>
>if( WIN32 )
> install( TARGETS MatrixSSL RUNTIME DESTINATION bin LIBRARY DESTINATION
>bin ARCHIVE DESTINATION lib )
>else( WIN32 )
>   if( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
>      install( TARGETS MatrixSSL DESTINATION lib64 )
>   else( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
>      install( TARGETS MatrixSSL DESTINATION lib )
>   endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
>endif( WIN32 )

And it's mostly wrong, e.g. lib64 is not correct for many systems. If you want Unix like subdirectories, use the GnuIntallDirs module. 

HS




More information about the CMake mailing list