2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 13:21:34 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 11:26:52 +00:00
|
|
|
|
2020-09-11 17:28:01 +00:00
|
|
|
# This function can be used to compile java sources into a jar package.
|
|
|
|
|
|
|
|
function(qt_internal_add_jar target)
|
2023-09-08 07:43:12 +00:00
|
|
|
set(options)
|
|
|
|
set(oneValueArgs OUTPUT_DIR)
|
|
|
|
set(multiValueArgs INCLUDE_JARS SOURCES)
|
|
|
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
2020-09-11 17:28:01 +00:00
|
|
|
|
|
|
|
set(javac_target_version "${QT_ANDROID_JAVAC_TARGET}")
|
|
|
|
if (NOT javac_target_version)
|
|
|
|
set(javac_target_version "8")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(javac_source_version "${QT_ANDROID_JAVAC_SOURCE}")
|
|
|
|
if (NOT javac_source_version)
|
|
|
|
set(javac_source_version "8")
|
|
|
|
endif()
|
|
|
|
|
2023-11-16 18:18:49 +00:00
|
|
|
set(CMAKE_JAVA_COMPILE_FLAGS -source "${javac_source_version}" -target "${javac_target_version}"
|
2024-11-13 14:29:37 +00:00
|
|
|
-Xlint:all -Xdoclint:all,-missing -classpath "${QT_ANDROID_JAR}"
|
2024-10-27 22:50:20 +00:00
|
|
|
)
|
2024-11-13 15:25:13 +00:00
|
|
|
|
|
|
|
set(absolute_sources "")
|
|
|
|
foreach(path IN LISTS arg_SOURCES)
|
|
|
|
get_filename_component(absolute_path "${path}" ABSOLUTE)
|
|
|
|
list(APPEND absolute_sources "${absolute_path}")
|
|
|
|
endforeach()
|
2025-03-28 08:00:01 +00:00
|
|
|
set_property(DIRECTORY APPEND PROPERTY _qt_jar_sources "${absolute_sources}")
|
2024-11-13 15:25:13 +00:00
|
|
|
|
|
|
|
add_jar(${target} SOURCES ${absolute_sources} ${ARGV})
|
2020-09-11 17:28:01 +00:00
|
|
|
|
2023-09-08 07:43:12 +00:00
|
|
|
foreach(f IN LISTS arg_SOURCES)
|
|
|
|
_qt_internal_expose_source_file_to_ide(${target} "${f}")
|
|
|
|
endforeach()
|
|
|
|
|
2020-09-11 17:28:01 +00:00
|
|
|
endfunction()
|