qt5base-lts/cmake/QtJavaHelpers.cmake
Assam Boudjelthia b9c85d6b0e CMake: build add flags for building QtAndroid.jar
Adds -source, -target, -Xlint:unchecked, -bootclasspath flags.

Setting default javac build source and target versions to 8.

Allow setting custom values for javac build versions via
-DQT_ANDROID_JAVAC_SOURCE, and -DQT_ANDROID_JAVAC_TARGET.

Task-number: QTBUG-86282
Change-Id: I98f4f193ac96016dc722d178594d7fd401202f68
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-16 20:55:16 +03:00

19 lines
589 B
CMake

# This function can be used to compile java sources into a jar package.
function(qt_internal_add_jar target)
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()
set(CMAKE_JAVA_COMPILE_FLAGS -source "${javac_source_version}" -target "${javac_target_version}" -Xlint:unchecked -bootclasspath "${QT_ANDROID_JAR}")
add_jar(${ARGV})
endfunction()