FindJNI: Can't prevent find_package(JNI) from failing if AWT is not available
At least with CMake 3.25 under Linux (Debian 12/Bookworm if it matters), find_package(JNI REQUIRED)
fails if AWT is not available and it seems impossible to prevent it from looking for it even if it's not needed.
E.g. this trivial makefile
cmake_minimum_required(VERSION 3.25)
project(test)
set(JNI_FIND_COMPONENTS JVM)
find_package(JNI REQUIRED)
fails with
CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find JNI (missing: AWT)
Call Stack (most recent call first):
/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.25/Modules/FindJNI.cmake:562 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred!
AWT is indeed not available, but I don't want to install it just to make CMake happy. Is there any way to avoid it?