Commit ed289e05 authored by Brad King's avatar Brad King

UseSWIG: Use CSharp language only if it is enabled

In commit v3.12.0-rc1~2^2 (UseSWIG: Add CSHARP variant for wrapper
files, 2018-06-08) we explicitly marked swig-generated `.cs` files as
`LANGUAGE` CSharp so that the resulting sources can be compiled.
However, this works only when the CSharp language has been enabled.

Fixes: #18184
parent c3ea50ed
......@@ -294,7 +294,7 @@ function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
endif()
foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
set(extra_file "${generatedpath}/${module_basename}${it}")
if (extra_file MATCHES "\\.cs$")
if (extra_file MATCHES "\\.cs$" AND CMAKE_CSharp_COMPILER_LOADED)
set_source_files_properties(${extra_file} PROPERTIES LANGUAGE "CSharp")
else()
# Treat extra outputs as plain files regardless of language.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment