Merge topic 'java-updates'
cc23f0e9
UseJava: Teach install_jar new DESTINATION and COMPONENT options3d287de4
UseJava: Teach add_jar to support file syntax for sourcese72806fb
FindJava: Add support for idlj and jarsigner tools
This commit is contained in:
commit
fccb3e2dae
|
@ -0,0 +1,13 @@
|
||||||
|
java-updates
|
||||||
|
------------
|
||||||
|
|
||||||
|
* The :module:`FindJava` module learned to optionally find
|
||||||
|
the ``idlj`` and ``jarsigner`` tools.
|
||||||
|
|
||||||
|
* 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.
|
|
@ -8,21 +8,34 @@
|
||||||
# include files and libraries are. The caller may set variable JAVA_HOME
|
# include files and libraries are. The caller may set variable JAVA_HOME
|
||||||
# to specify a Java installation prefix explicitly.
|
# to specify a Java installation prefix explicitly.
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# Specify one or more of the following components as you call this find module. See example below.
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# Runtime = User just want to execute some Java byte-compiled
|
||||||
|
# Development = Development tools (java, javac, javah and javadoc), includes Runtime component
|
||||||
|
# IdlJ = idl compiler for Java
|
||||||
|
# JarSigner = signer tool for jar
|
||||||
|
#
|
||||||
|
#
|
||||||
# This module sets the following result variables:
|
# This module sets the following result variables:
|
||||||
#
|
#
|
||||||
# ::
|
# ::
|
||||||
#
|
#
|
||||||
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
|
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
|
||||||
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
|
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
|
||||||
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
|
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
|
||||||
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
|
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
|
||||||
# Java_JAR_EXECUTABLE = the full path to the Java archiver
|
# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
|
||||||
# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
|
# Java_JAR_EXECUTABLE = the full path to the Java archiver
|
||||||
# Java_VERSION_MAJOR = The major version of the package found.
|
# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
|
||||||
# Java_VERSION_MINOR = The minor version of the package found.
|
# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
|
||||||
# Java_VERSION_PATCH = The patch version of the package found.
|
# Java_VERSION_MAJOR = The major version of the package found.
|
||||||
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
|
# Java_VERSION_MINOR = The minor version of the package found.
|
||||||
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
|
# Java_VERSION_PATCH = The patch version of the package found.
|
||||||
|
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
|
||||||
|
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -184,28 +197,61 @@ find_program(Java_JAVADOC_EXECUTABLE
|
||||||
PATHS ${_JAVA_PATHS}
|
PATHS ${_JAVA_PATHS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_program(Java_IDLJ_EXECUTABLE
|
||||||
|
NAMES idlj
|
||||||
|
HINTS ${_JAVA_HINTS}
|
||||||
|
PATHS ${_JAVA_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_program(Java_JARSIGNER_EXECUTABLE
|
||||||
|
NAMES jarsigner
|
||||||
|
HINTS ${_JAVA_HINTS}
|
||||||
|
PATHS ${_JAVA_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||||
if(Java_FIND_COMPONENTS)
|
if(Java_FIND_COMPONENTS)
|
||||||
|
set(_JAVA_REQUIRED_VARS)
|
||||||
foreach(component ${Java_FIND_COMPONENTS})
|
foreach(component ${Java_FIND_COMPONENTS})
|
||||||
# User just want to execute some Java byte-compiled
|
# User just want to execute some Java byte-compiled
|
||||||
if(component STREQUAL "Runtime")
|
If(component STREQUAL "Runtime")
|
||||||
find_package_handle_standard_args(Java
|
list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE)
|
||||||
REQUIRED_VARS Java_JAVA_EXECUTABLE
|
if(Java_JAVA_EXECUTABLE)
|
||||||
VERSION_VAR Java_VERSION
|
set(Java_Runtime_FOUND TRUE)
|
||||||
)
|
endif()
|
||||||
elseif(component STREQUAL "Development")
|
elseif(component STREQUAL "Development")
|
||||||
find_package_handle_standard_args(Java
|
list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE
|
||||||
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
|
Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
|
||||||
Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
|
if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
|
||||||
VERSION_VAR Java_VERSION
|
AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE)
|
||||||
)
|
set(Java_Development_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
elseif(component STREQUAL "IdlJ")
|
||||||
|
list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE)
|
||||||
|
if(Java_IdlJ_EXECUTABLE)
|
||||||
|
set(Java_Extra_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
elseif(component STREQUAL "JarSigner")
|
||||||
|
list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE)
|
||||||
|
if(Java_IDLJ_EXECUTABLE)
|
||||||
|
set(Java_JarSigner_FOUND TRUE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Comp: ${component} is not handled")
|
message(FATAL_ERROR "Comp: ${component} is not handled")
|
||||||
endif()
|
endif()
|
||||||
set(Java_${component}_FOUND TRUE)
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
list (REMOVE_DUPLICATES _JAVA_REQUIRED_VARS)
|
||||||
|
find_package_handle_standard_args(Java
|
||||||
|
REQUIRED_VARS ${_JAVA_REQUIRED_VARS} HANDLE_COMPONENTS
|
||||||
|
VERSION_VAR Java_VERSION
|
||||||
|
)
|
||||||
|
if(Java_FOUND)
|
||||||
|
foreach(component ${Java_FIND_COMPONENTS})
|
||||||
|
set(Java_${component}_FOUND TRUE)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# Check for everything
|
# Check for Development
|
||||||
find_package_handle_standard_args(Java
|
find_package_handle_standard_args(Java
|
||||||
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
|
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
|
||||||
Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
|
Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
|
||||||
|
@ -220,6 +266,8 @@ mark_as_advanced(
|
||||||
Java_JAVAC_EXECUTABLE
|
Java_JAVAC_EXECUTABLE
|
||||||
Java_JAVAH_EXECUTABLE
|
Java_JAVAH_EXECUTABLE
|
||||||
Java_JAVADOC_EXECUTABLE
|
Java_JAVADOC_EXECUTABLE
|
||||||
|
Java_IDLJ_EXECUTABLE
|
||||||
|
Java_JARSIGNER_EXECUTABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
# LEGACY
|
# LEGACY
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#
|
#
|
||||||
# This command creates a <target_name>.jar. It compiles the given
|
# This command creates a <target_name>.jar. It compiles the given
|
||||||
# source files (source) and adds the given resource files (resource) to
|
# source files (source) and adds the given resource files (resource) to
|
||||||
# the jar file. If only resource files are given then just a jar file
|
# the jar file. Source files can be java files or listing files
|
||||||
|
# (prefixed by '@'). If only resource files are given then just a jar file
|
||||||
# is created. The list of include jars are added to the classpath when
|
# is created. The list of include jars are added to the classpath when
|
||||||
# compiling the java sources and also to the dependencies of the target.
|
# compiling the java sources and also to the dependencies of the target.
|
||||||
# INCLUDE_JARS also accepts other target names created by add_jar. For
|
# INCLUDE_JARS also accepts other target names created by add_jar. For
|
||||||
|
@ -210,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.
|
# 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.
|
# 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
|
# 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
|
# DESTINATION. It should be called in the same scope as add_jar() or it
|
||||||
|
@ -423,6 +426,7 @@ function(add_jar _TARGET_NAME)
|
||||||
|
|
||||||
set(_JAVA_CLASS_FILES)
|
set(_JAVA_CLASS_FILES)
|
||||||
set(_JAVA_COMPILE_FILES)
|
set(_JAVA_COMPILE_FILES)
|
||||||
|
set(_JAVA_COMPILE_FILELISTS)
|
||||||
set(_JAVA_DEPENDS)
|
set(_JAVA_DEPENDS)
|
||||||
set(_JAVA_COMPILE_DEPENDS)
|
set(_JAVA_COMPILE_DEPENDS)
|
||||||
set(_JAVA_RESOURCE_FILES)
|
set(_JAVA_RESOURCE_FILES)
|
||||||
|
@ -433,7 +437,11 @@ function(add_jar _TARGET_NAME)
|
||||||
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
|
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
|
||||||
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
|
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
|
||||||
|
|
||||||
if (_JAVA_EXT MATCHES ".java")
|
if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$")
|
||||||
|
get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE)
|
||||||
|
list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
|
||||||
|
|
||||||
|
elseif (_JAVA_EXT MATCHES ".java")
|
||||||
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
|
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
|
||||||
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
|
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
|
||||||
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
|
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
|
||||||
|
@ -492,11 +500,21 @@ function(add_jar _TARGET_NAME)
|
||||||
file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
|
file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (_JAVA_COMPILE_FILES)
|
if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS)
|
||||||
# Create the list of files to compile.
|
set (_JAVA_SOURCES_FILELISTS)
|
||||||
set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
|
|
||||||
string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
|
if (_JAVA_COMPILE_FILES)
|
||||||
file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING})
|
# Create the list of files to compile.
|
||||||
|
set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
|
||||||
|
string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
|
||||||
|
file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING})
|
||||||
|
list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}")
|
||||||
|
endif()
|
||||||
|
if (_JAVA_COMPILE_FILELISTS)
|
||||||
|
foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS)
|
||||||
|
list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Compile the java files and create a list of class files
|
# Compile the java files and create a list of class files
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -506,9 +524,9 @@ function(add_jar _TARGET_NAME)
|
||||||
${CMAKE_JAVA_COMPILE_FLAGS}
|
${CMAKE_JAVA_COMPILE_FLAGS}
|
||||||
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
|
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
|
||||||
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
|
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
|
||||||
@${_JAVA_SOURCES_FILE}
|
${_JAVA_SOURCES_FILELISTS}
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
|
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
|
||||||
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS}
|
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
|
COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
|
||||||
)
|
)
|
||||||
|
@ -613,7 +631,26 @@ function(add_jar _TARGET_NAME)
|
||||||
|
|
||||||
endfunction()
|
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
|
get_property(__FILES
|
||||||
TARGET
|
TARGET
|
||||||
${_TARGET_NAME}
|
${_TARGET_NAME}
|
||||||
|
@ -627,13 +664,33 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION)
|
||||||
${__FILES}
|
${__FILES}
|
||||||
DESTINATION
|
DESTINATION
|
||||||
${_DESTINATION}
|
${_DESTINATION}
|
||||||
|
${_COMPONENT}
|
||||||
)
|
)
|
||||||
else ()
|
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 ()
|
endif ()
|
||||||
endfunction()
|
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
|
get_property(__SYMLINK
|
||||||
TARGET
|
TARGET
|
||||||
${_TARGET_NAME}
|
${_TARGET_NAME}
|
||||||
|
@ -647,9 +704,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION)
|
||||||
${__SYMLINK}
|
${__SYMLINK}
|
||||||
DESTINATION
|
DESTINATION
|
||||||
${_DESTINATION}
|
${_DESTINATION}
|
||||||
|
${_COMPONENT}
|
||||||
)
|
)
|
||||||
else ()
|
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 ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -3008,17 +3008,30 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
||||||
if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
|
if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
|
||||||
file(READ "${JNI_H}" JNI_FILE)
|
file(READ "${JNI_H}" JNI_FILE)
|
||||||
if("${JNI_FILE}" MATCHES "JDK1_2")
|
if("${JNI_FILE}" MATCHES "JDK1_2")
|
||||||
add_test(Java ${CMAKE_CTEST_COMMAND}
|
add_test(Java.Jar ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/Java"
|
"${CMake_SOURCE_DIR}/Tests/Java"
|
||||||
"${CMake_BINARY_DIR}/Tests/Java"
|
"${CMake_BINARY_DIR}/Tests/JavaJar"
|
||||||
${build_generator_args}
|
${build_generator_args}
|
||||||
--build-project hello
|
--build-project hello
|
||||||
|
--build-target hello
|
||||||
--build-two-config
|
--build-two-config
|
||||||
--build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
|
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/"
|
||||||
--build-options ${build_options}
|
--build-options ${build_options}
|
||||||
--test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
|
--test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
|
||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar")
|
||||||
|
add_test(Java.JarSourceList ${CMAKE_CTEST_COMMAND}
|
||||||
|
--build-and-test
|
||||||
|
"${CMake_SOURCE_DIR}/Tests/Java"
|
||||||
|
"${CMake_BINARY_DIR}/Tests/JavaJarSourceList"
|
||||||
|
${build_generator_args}
|
||||||
|
--build-project hello
|
||||||
|
--build-target hello2
|
||||||
|
--build-two-config
|
||||||
|
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceList/"
|
||||||
|
--build-options ${build_options}
|
||||||
|
--test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
|
||||||
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -7,3 +7,7 @@ find_package(Java COMPONENTS Development)
|
||||||
include (UseJava)
|
include (UseJava)
|
||||||
|
|
||||||
add_jar(hello A.java HelloWorld.java)
|
add_jar(hello A.java HelloWorld.java)
|
||||||
|
|
||||||
|
# use listing file to specify sources
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/java_fileslist "A.java\nHelloWorld.java\n")
|
||||||
|
add_jar(hello2 @${CMAKE_CURRENT_BINARY_DIR}/java_fileslist)
|
||||||
|
|
Loading…
Reference in New Issue