[CMake] Install command incorrectly installing archive libraries

Stephen Torri stephen.torri at gmail.com
Fri Nov 18 22:54:37 EST 2011


On Fri, 2011-11-18 at 22:49 +0100, Michael Wild wrote:
> Sorry, I misread the documentation myself. You need multiple install()
> commands, for each configuration one, but after each DESTINATION option
> you also need the COMPONENTS option. So, this would be something like this:
> 
> install(TARGETS first
>   ARCHIVE DESTINATION lib/release CONFIGURATIONS Release
>   LIBRARY DESTINATION lib/release CONFIGURATIONS Release
>   RUNTIME DESTINATION lib/release CONFIGURATIONS Release)
> 
> install(TARGETS first
>   ARCHIVE DESTINATION lib/debug CONFIGURATIONS Debug
>   LIBRARY DESTINATION lib/debug CONFIGURATIONS Debug
>   RUNTIME DESTINATION lib/debug CONFIGURATIONS Debug)
> 
> HTH
> 
> Michael

So with the COMPONENTS option add into them I would have:

(Contents of CMakeLists.txt in first source directory)
install(TARGETS first
   ARCHIVE DESTINATION lib/release CONFIGURATIONS Release COMPONENT libraries
   LIBRARY DESTINATION lib/release CONFIGURATIONS Release COMPONENT libraries
   RUNTIME DESTINATION lib/release CONFIGURATIONS Release COMPONENT libraries)

install(TARGETS first
   ARCHIVE DESTINATION lib/debug CONFIGURATIONS Debug COMPONENT libraries
   LIBRARY DESTINATION lib/debug CONFIGURATIONS Debug COMPONENT libraries
   RUNTIME DESTINATION lib/debug CONFIGURATIONS Debug COMPONENT libraries)

(Contents of main CMakeLists.txt)

set (CPACK_COMPONENTS_ALL libraries)
set (CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set (CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Shared libraries used to build programs with libFirst")
set (CPACK_COMPONENT_LIBRARIES_GROUP "Development")
set (CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "All the tools you need to develop software with libFirst")
set (CPACK_ALL_INSTALL_TYPES Developer Full)
set (CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)

Is this what you are thinking?

Stephen



More information about the CMake mailing list