diff options
-rw-r--r-- | Help/release/dev/java-updates.rst | 4 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 54 |
2 files changed, 52 insertions, 6 deletions
diff --git a/Help/release/dev/java-updates.rst b/Help/release/dev/java-updates.rst index 2e5e184..b777807 100644 --- a/Help/release/dev/java-updates.rst +++ b/Help/release/dev/java-updates.rst @@ -7,3 +7,7 @@ java-updates * The :module:`UseJava` module ``add_jar`` function learned to support response files (e.g. ``@srcs.txt``) for source specification. + +* The :module:`UseJava` module ``install_jar`` function learned + new ``DESTINATION`` and ``COMPONENT`` options to specify + the corresponding :command:`install` command options. diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 0add8d2..c61591d 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -211,14 +211,16 @@ # # :: # -# install_jar(TARGET_NAME DESTINATION) +# install_jar(target_name destination) +# install_jar(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME files to the given DESTINATION. # It should be called in the same scope as add_jar() or it will fail. # # :: # -# install_jni_symlink(TARGET_NAME DESTINATION) +# install_jni_symlink(target_name destination) +# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME JNI symlinks to the given # DESTINATION. It should be called in the same scope as add_jar() or it @@ -629,7 +631,26 @@ function(add_jar _TARGET_NAME) endfunction() -function(INSTALL_JAR _TARGET_NAME _DESTINATION) +function(INSTALL_JAR _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jar + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jar_DESTINATION) + set (_DESTINATION ${_install_jar_DESTINATION}) + else() + message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jar_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_COMPONENT}) + endif() + endif() + get_property(__FILES TARGET ${_TARGET_NAME} @@ -643,13 +664,33 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION) ${__FILES} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() -function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) +function(INSTALL_JNI_SYMLINK _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jni_symlink + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jni_symlink_DESTINATION) + set (_DESTINATION ${_install_jni_symlink_DESTINATION}) + else() + message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jni_symlink_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT}) + endif() + endif() + get_property(__SYMLINK TARGET ${_TARGET_NAME} @@ -663,9 +704,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) ${__SYMLINK} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() |