[CMake] Trouble with Variable in installation

Denis Scherbakov denis_scherbakov at yahoo.com
Fri Jun 5 03:50:55 EDT 2009



> I tried to
> add a target which do the cmake and define the variable like
> that : 
> 
> add_custom_target(MyInstall COMMAND "cmake -DLANG=%LANG%")
> add_dependencies(install MyInstall)
> 
> but I can't add the dependency between the two targets.


I think currently it is not possible to force anything to depend on
"install" target.

> > either: "Use COMPONENT option from INSTALL command"
> I will look forward into this since I don't know how it
> works.


Try

MACRO(ADD_INSTALL_TARGET VAR_NAME VAR_COMPONENT VAR_DEPENDS)
  ADD_CUSTOM_TARGET(${VAR_NAME}
                    COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${VAR_COMPONENT} -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                    COMMENT "Performing component-specific installation"
                    VERBATIM)

  IF ( "${VAR_DEPENDS}" MATCHES "^.+$" )
    ADD_DEPENDENCIES(${VAR_NAME}  "${VAR_DEPENDS}")
  ENDIF ()
ENDMACRO ()

INSTALL( ... COMPONENT COMP_en_US)

ADD_INSTALL_TARGET(install-en_US COMP_en_US "Target1 Target2 Target3")



      


More information about the CMake mailing list