On 07/26/2017 06:02 AM, Alan W. Irwin wrote:
> enable_language(Java)

FWIW this language support is quite limited, is not well tested,
and has long been superseded by `UseJava.cmake`.  I suggest porting
away from it in PLplot.  That will fix this too.

> 62c4cb4b6f0cdb2be2729362133f850d6fe96c20 is the first bad commit
>    UseSWIG: Record generated java files as custom command outputs

Hmm.  That causes swig_add_library's call to add_library to include
the generated .java source file as a source (since it is the
output of a custom command we want to run).

However, with `enable_language(Java)` CMake thinks it is supposed
to compile the .java file as part of the (module) library.  That's
why it looks for CMAKE_Java_CREATE_SHARED_MODULE.

Please try the patch below.

-Brad


diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 456a6bd63d..48d6a5b4af 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -121,8 +121,9 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles 
generatedpath infile)

   endif()
   foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
-    set(${outfiles} ${${outfiles}}
-      "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}")
+    set(extra_file 
"${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}")
+    list(APPEND ${outfiles} ${extra_file})
+    set_property(SOURCE "${extra_file}" PROPERTY LANGUAGE "")
   endforeach()
 endmacro()
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to