From ed289e05772529051361fc2ee1cbe6e47c68f2f7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Jul 2018 08:23:44 -0400 Subject: 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 --- Modules/UseSWIG.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b306181..b74ba9f 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -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. -- cgit v0.12