diff options
author | Brad King <brad.king@kitware.com> | 2013-10-07 19:44:43 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-07 19:44:43 (GMT) |
commit | fcfd409ad149de1374e9f6a27032d20465d0cd1d (patch) | |
tree | 96b137ced7da2c9a6741c4469c0f944eb0ce81eb /Modules | |
parent | c76b380181f917bef98b10efa85191d4d201e57f (diff) | |
parent | 69aff17d384e1ebb9afb828ad8ad094d503b9dee (diff) | |
download | CMake-fcfd409ad149de1374e9f6a27032d20465d0cd1d.zip CMake-fcfd409ad149de1374e9f6a27032d20465d0cd1d.tar.gz CMake-fcfd409ad149de1374e9f6a27032d20465d0cd1d.tar.bz2 |
Merge topic 'UseJava-jar-manifest'
69aff17 UseJava: Add support for the jar 'm' (Manifest) option
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/UseJava.cmake | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index c0fd07c..c9635b5 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -49,6 +49,11 @@ # # add_jar(example ENTRY_POINT com/examples/MyProject/Main) # +# To define a custom manifest for the jar, you can set it with the manifest +# named argument: +# +# add_jar(example MANIFEST /path/to/manifest) +# # To add a VERSION to the target output name you can set it using # the VERSION named argument to add_jar. This will create a jar file with the # name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar @@ -246,7 +251,7 @@ function(add_jar _TARGET_NAME) cmake_parse_arguments(_add_jar "" - "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" "SOURCES;INCLUDE_JARS" ${ARGN} ) @@ -262,6 +267,11 @@ function(add_jar _TARGET_NAME) set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) endif () + if (_add_jar_MANIFEST) + set(_MANIFEST_OPTION m) + set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + endif () + if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else () @@ -405,7 +415,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} @@ -425,7 +435,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} |