UseSWIG: Fix when Java is enabled as a language

Since commit v3.8.0-rc1~251^2 (UseSWIG: Record generated java files as
custom command outputs, 2016-11-28) the generated `.java` files are
listed as sources in the call to `add_library` by swig_add_library.
They are listed only as the outputs of custom commands and not intended
for compilation as part of the library.

Reported-by: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
This commit is contained in:
Brad King
2017-08-01 16:22:53 -04:00
parent f15cfd891d
commit b4fbf677bb

View File

@@ -125,8 +125,10 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
endif() endif()
foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS}) foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
set(${outfiles} ${${outfiles}} set(extra_file "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}")
"${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}") list(APPEND ${outfiles} ${extra_file})
# Treat extra outputs as plain files regardless of language.
set_property(SOURCE "${extra_file}" PROPERTY LANGUAGE "")
endforeach() endforeach()
endmacro() endmacro()