Currently, in our project we are suing java files for Android development. But we want to move to Kotlin files. Kotlin is similar to java only. And thus we though add_jar would be able to work fine with kotlin (.kt) files. But it failed with below error
ninja: error: FindFirstFileExA(CMakeFiles/TallyWorldMain_JAR.dir/D:/TW/Workspace/TallyWorld/FoundationalPlatform/TallyWorldMain.Source/TWMainAndroidKernel): The filename, directory name, or volume label syntax is incorrect.
I have .kit files under D:/TW/Workspace/TallyWorld/FoundationalPlatform/TallyWorldMain.Source/TWMainAndroidKernel folder.
Please let me know how to add kt files in our cmake build system. We are using Ninja Multi-Config generator.
So, the source for add_jar is here: CMake/UseJava.cmake at master · Kitware/CMake · GitHub. I assume .kt files need to be compiled with something other than the normal java compiler? Or is it that the same javac can be used for .kt and .java files. I guess add_jar needs to learn how to handle .kt files and treat them like .java files. You could try to edit this line: CMake/UseJava.cmake at master · Kitware/CMake · GitHub. to include .kt and java. That will only work if the javac can compile both .kt and .java.
Then you would need to modify UseJava to recognize .kt files and use the kotlin compiler instead of javac to compile them. And put the result into the jar.