UseJava: add INCLUDE_MODULES argument to add_jar

Arguments are added to the dependencies list, and to the "--module-path"
passed to javac, which is only generated for adequate JDK versions.
This commit is contained in:
Javier Martín
2025-09-23 22:51:50 +02:00
parent b3365e7c57
commit 343ee5b9ee
15 changed files with 257 additions and 13 deletions

View File

@@ -0,0 +1,13 @@
project(foo Java)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_VERBOSE_MAKEFILE 1)
find_package(Java COMPONENTS Development)
include(UseJava)
add_jar(${PROJECT_NAME} Foo.java module-info.java)
export_jars(
TARGETS ${PROJECT_NAME}
NAMESPACE foo::
FILE JavaBuildExportTestConfig.cmake)

View File

@@ -0,0 +1,13 @@
package org.foo;
public class Foo
{
public Foo()
{
}
public void printName()
{
System.out.println("Foo");
}
}

View File

@@ -0,0 +1,3 @@
module mod_foo {
exports org.foo;
}