Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add add_executable_jar function.

Do the same thing as the add_jar function,
but just set the jar entry point.
  • Loading branch information...
commit 36b223e34f5d48339da39e833a2f5e7df2866e87 1 parent 6eb2d79
Matthieu Carpentier authored

Showing 1 changed file with 20 additions and 2 deletions. Show diff stats Hide diff stats

  1. +20 2 Modules/UseJava.cmake
22 Modules/UseJava.cmake
@@ -195,6 +195,22 @@ endfunction (__java_copy_file src dest comment)
195 195 set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
196 196 set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
197 197
  198 +function(add_executable_jar _TARGET_NAME _ENTRY_POINT)
  199 + set(_JAVA_ENTRY_POINT_OPTION e)
  200 + set(_JAVA_ENTRY_POINT_VALUE ${_ENTRY_POINT})
  201 +
  202 + add_jar(${_TARGET_NAME} ${ARGN})
  203 +
  204 + # Just to avoid unwanted vars reuse in such case:
  205 + # add_executable_jar(hello.jar, com.hello.Main,
  206 + # com/hello/Main.java,
  207 + # com/hello/Hello.java)
  208 + # add_jar(hello.jar,
  209 + # com/hello/Hello.java)
  210 + unset(_JAVA_ENTRY_POINT_OPTION)
  211 + unset(_JAVA_ENTRY_POINT_VALUE)
  212 +endfunction(add_executable_jar)
  213 +
198 214 function(add_jar _TARGET_NAME)
199 215 set(_JAVA_SOURCE_FILES ${ARGN})
200 216
@@ -316,7 +332,8 @@ function(add_jar _TARGET_NAME)
316 332 add_custom_command(
317 333 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
318 334 COMMAND ${Java_JAR_EXECUTABLE}
319   - -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
  335 + -cf${_JAVA_ENTRY_POINT_OPTION} ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
  336 + ${_JAVA_ENTRY_POINT_VALUE}
320 337 ${_JAVA_RESOURCE_FILES} @java_class_filelist
321 338 COMMAND ${CMAKE_COMMAND}
322 339 -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}
@@ -336,7 +353,8 @@ function(add_jar _TARGET_NAME)
336 353 add_custom_command(
337 354 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
338 355 COMMAND ${Java_JAR_EXECUTABLE}
339   - -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
  356 + -cf${_JAVA_ENTRY_POINT_OPTION} ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}
  357 + ${_JAVA_ENTRY_POINT_VALUE}
340 358 ${_JAVA_RESOURCE_FILES} @java_class_filelist
341 359 COMMAND ${CMAKE_COMMAND}
342 360 -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}

0 comments on commit 36b223e

Please sign in to comment.
Something went wrong with that request. Please try again.