summaryrefslogtreecommitdiffstats
path: root/Modules/UseSWIG.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-18 12:23:44 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-18 12:53:32 (GMT)
commited289e05772529051361fc2ee1cbe6e47c68f2f7 (patch)
treed6cec05573c808cd23db99ac651cb6fc9a47333c /Modules/UseSWIG.cmake
parentc3ea50ede143d6a29f5d92745cd3a1964581a652 (diff)
downloadCMake-ed289e05772529051361fc2ee1cbe6e47c68f2f7.zip
CMake-ed289e05772529051361fc2ee1cbe6e47c68f2f7.tar.gz
CMake-ed289e05772529051361fc2ee1cbe6e47c68f2f7.tar.bz2
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
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r--Modules/UseSWIG.cmake2
1 files changed, 1 insertions, 1 deletions
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.