UseJava: Teach install_jar new DESTINATION and COMPONENT options

This commit is contained in:
Marc Chevrier 2015-07-30 11:19:24 +02:00 committed by Brad King
parent 3d287de4ea
commit cc23f0e9d3
2 changed files with 52 additions and 6 deletions

View File

@ -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.

View File

@ -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()