summaryrefslogtreecommitdiffstats
path: root/Modules/UseJava.cmake
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2012-02-07 15:01:28 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2012-02-13 12:28:28 (GMT)
commit18e8d2f0ccfd853425c86b092693ac11db9ab906 (patch)
tree1437c55583885f1b3bea4ac11858f7384cc9bcc2 /Modules/UseJava.cmake
parent525bb92a3d4149aae1b268315ac746a6142d1fec (diff)
downloadCMake-18e8d2f0ccfd853425c86b092693ac11db9ab906.zip
CMake-18e8d2f0ccfd853425c86b092693ac11db9ab906.tar.gz
CMake-18e8d2f0ccfd853425c86b092693ac11db9ab906.tar.bz2
java: Add CMAKE_JAVA_JAR_ENTRY_POINT optional variable.
Thanks to Matthieu Carpentier. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'Modules/UseJava.cmake')
-rw-r--r--Modules/UseJava.cmake13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index c84fc91..1dfa3c0 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -30,6 +30,10 @@
#
# set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
#
+# To define an entry point in your jar you can set it with:
+#
+# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main)
+#
# To add a VERSION to the target output name you can set it using
# CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name
# shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
@@ -207,6 +211,11 @@ function(add_jar _TARGET_NAME)
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+ if (CMAKE_JAVA_JAR_ENTRY_POINT)
+ set(_ENTRY_POINT_OPTION e)
+ set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT})
+ endif (CMAKE_JAVA_JAR_ENTRY_POINT)
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else (LIBRARY_OUTPUT_PATH)
@@ -327,7 +336,7 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf ${_JAVA_JAR_OUTPUT_PATH}
+ -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
@@ -347,7 +356,7 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf ${_JAVA_JAR_OUTPUT_PATH}
+ -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}