[CMake] Component group specific installation with Makefile

Yann Cointepas yann at sapetnioc.org
Thu Aug 7 06:24:47 EDT 2008


Thank you for your answers. I have been able to create macros (see below) to
replace cpack_add_component_group and cpack_add_component. These macros call
the corresponding cpack macro and create install-${group-component} and
install-${group} targets with appropriate dependencies.

      Yann

macro( SOMA_ADD_COMPONENT_GROUP _group )
  set( _readVariable )
  set( _parentGroup )
  foreach( _i ${ARGN} )
    if( _readVariable )
      set( ${_readVariable} "${_i}" )
      break()
    else( _readVariable )
      if( "${_i}" STREQUAL PARENT_GROUP )
        set( _readVariable _parentGroup )
      endif( "${_i}" STREQUAL PARENT_GROUP )
    endif( _readVariable )
  endforeach( _i ${ARGN} )

  cpack_add_component_group( ${_group} ${ARGN} )
  add_custom_target( install-${_group} )
  if( _parentGroup )
    add_dependencies( install-${_parentGroup} install-${_group} )
  endif( _parentGroup )
endmacro(( SOMA_ADD_COMPONENT_GROUP _group )


macro( SOMA_ADD_COMPONENT _component )
  set( _readVariable )
  set( _group )
  foreach( _i ${ARGN} )
    if( _readVariable )
      set( ${_readVariable} "${_i}" )
      break()
    else( _readVariable )
      if( "${_i}" STREQUAL GROUP )
        set( _readVariable _group )
      endif( "${_i}" STREQUAL GROUP )
    endif( _readVariable )
  endforeach( _i ${ARGN} )

  cpack_add_component( ${_component} ${ARGN} )
  add_custom_target( install-${_component}
                     COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_component} -P
"${CMAKE_BINARY_DIR}/cmake_install.cmake" )
  add_dependencies( install-${_group} install-${_component} )
endmacro( SOMA_ADD_COMPONENT _component _group )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080807/dd93a952/attachment-0001.htm>


More information about the CMake mailing list