[CMake] Install of library sub-project prior to building application

Tyler Roscoe tyler at cryptio.net
Wed Jun 17 16:56:38 EDT 2009


On Wed, Jun 17, 2009 at 01:37:14PM -0700, Richard Offer wrote:
> That seems to be the crux.
> 
> Its not unreasonable that its up to the project to define that code, I was
> just hoping that I'd missed that CMake would export a PROJECT/install target
> to make embedding external projects easier.

For projects built by CMake, you may be able to work around the "INSTALL
is not really a target" problem. Denis Scherbakov posted this snippet a
week or two ago. I haven't tested it but it seems like a promising lead:

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")


Maybe this gets you closer to what you want?

tyler


More information about the CMake mailing list