diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2015-07-30 09:19:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-08-04 15:19:44 (GMT) |
commit | cc23f0e9d38fe3f880ada549af4e552fc13fc655 (patch) | |
tree | 0373c6f0e67a1d96e2002f03b3391e92880a0da4 | |
parent | 3d287de4ea99718ffe2ac6b855c2786d67946be2 (diff) | |
download | CMake-cc23f0e9d38fe3f880ada549af4e552fc13fc655.zip CMake-cc23f0e9d38fe3f880ada549af4e552fc13fc655.tar.gz CMake-cc23f0e9d38fe3f880ada549af4e552fc13fc655.tar.bz2 |
UseJava: Teach install_jar new DESTINATION and COMPONENT 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() |