[CMake] Java support - install with components

Allen D Byrne byrn at hdfgroup.org
Thu Oct 20 12:59:05 EDT 2011


I've upgraded my Java project to the latest 2.8.6 release. The only thing missing for me is to allow components on the install commands. 
I just did the following:

In UseJava.cmake (same for INSTALL_JNI_SYMLINK):

function(INSTALL_JAR _TARGET_NAME _DESTINATION)
    get_property(__FILES
        TARGET
            ${_TARGET_NAME}
        PROPERTY
            INSTALL_FILES
    )

    if (__FILES)
        install(
            FILES
                ${__FILES}
            DESTINATION
                ${_DESTINATION}
        )
    else (__FILES)
        message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
    endif (__FILES)
endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION)

TO

function(INSTALL_JAR _TARGET_NAME _DESTINATION _COMPONENT)
    get_property(__FILES
        TARGET
            ${_TARGET_NAME}
        PROPERTY
            INSTALL_FILES
    )

    if (__FILES)
        install(
            FILES
                ${__FILES}
            DESTINATION
                ${_DESTINATION}
            COMPONENT
                ${_COMPONENT}
        )
    else (__FILES)
        message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
    endif (__FILES)
endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION _COMPONENT)


Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111020/f15f9f01/attachment.htm>


More information about the CMake mailing list