[cmake-developers] UseSWIG and enable_language(Java)
Brad King
brad.king at kitware.com
Tue Aug 1 16:29:39 EDT 2017
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()
More information about the cmake-developers
mailing list