cygwin cmake failing with windows-style path names not found

I’ve got a multi-language project building both C++ and Java executables. I’ve managed to get this working on a really old Linux (CentOS 7.9) system, and now am trying to build on Windows using Cygwin (this is a code that was originally developed for Linux, so Cygwin is the easiest way to get there). I had a makefile that worked, but was specific to NetBeans. I wanted to bring the build system up to something modern, so am using CMake. But I’m getting an error:

$ cmake --build ../WASP_build
[  1%] Building Java objects for trax_commons.jar
error: file not found: \cygdrive\c\Users\<me>\WASP_build\Trax_Commons\CMakeFiles\trax_commons.dir\java_sources
make[2]: *** [Trax_Commons/CMakeFiles/trax_commons.dir/build.make:388: Trax_Commons/CMakeFiles/trax_commons.dir/java_compiled_trax_commons] Error 3
make[1]: *** [CMakeFiles/Makefile2:404: Trax_Commons/CMakeFiles/trax_commons.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I don’t know why it’s putting backslashes instead of regular slashes into the path, and when I look for the file at a Cygwin bash prompt, it finds things properly if I replace the backslash with a forward slash.

Version info:

$ cmake --version
cmake version 3.28.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Here’s my top-level CMakeLists.txt file:

cmake_minimum_required(VERSION 3.10)
project(BlueWASP LANGUAGES CXX C Java)
add_subdirectory(Trax_Commons)

Here’s the bulk of the Trax_Commons/CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(Trax_Commons LANGUAGES Java)

# Enable Java language support in CMake
find_package(Java 1.8 REQUIRED)
include(UseJava)

# Set up Java compiler flags to warn items we care about and ignore others
set(CMAKE_JAVA_COMPILE_FLAGS

    # Invalid UTF-8 characters in our source code, so use ISO-8859-1
    -encoding ISO-8859-1

    # -sunapi flag to Xlint suppresses Sun internal API warnings
    -Xlint:-sunapi -XDenableSunApiLintControl

    # Javac suggests unchecked for seeing a class of warnings usually not reported
    # -Xlint:unchecked

    # Increase maximum warnings so all are displayed
    -Xmaxwarns 10000)

find_jar(PREFUSE NAMES prefuse PATHS ../../COTS_libs/java_lib/prefuse-beta-2009)
find_jar(NUX NAMES nux-1.6 PATHS ../../COTS_libs/java_lib/nux-1.6)
find_jar(XOM NAMES XOM PATHS ../../COTS_libs/java_lib/xom_1.5.0)

set(CMAKE_JAVA_INCLUDE_PATH ${PREFUSE}:${NUX}:${XOM})

add_jar(trax_commons
    INCLUDE_JARS ${PREFUSE} ${NUX} ${XOM}
    MANIFEST manifest.txt
    SOURCES
        src/com/ng/trax/commons/collections/bplustree/ThinBPlusNode.java
        src/com/ng/trax/commons/collections/bplustree/BPlusDuplicateContainer.java
        src/com/ng/trax/commons/collections/bplustree/BPlusNode.java
        ,,,
)

This error actually appears to come from the Java compiler installed in Cygwin. When I ran cmake --build <build_dir> -v, I see the invocation of javac using regular Cygwin paths, but the error message using the backslash paths. Perhaps the fault is the JDK I’ve got installed in Cygwin. I did point to a v8/v1.8 JDK available on my system (JAVA_HOME=“C:\Program Files\Amazon Correto\jdk1.8.0_292”), but it seems to be ignored in favor of /cygdrive/c/jdk-15.0.2/bin/java, which I never point to.

Further info: The Java compiler isn’t a Cygwin compiler; it’s a Windows compiler. So the Cygwin path to the file to be compiled is unrecognized. Now that I understand the problem, perhaps there’s a better solution.