From 709277640b577adc98bd2cead613b3c79a5546dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20St=C3=BCrmer?= Date: Fri, 13 Apr 2018 07:43:09 +0200 Subject: cmExportFileGenerator: set IMPORTED_COMMON_LANGUAGE_RUNTIME for CSharp target --- Source/cmExportFileGenerator.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 8894d44..bf9d341 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -786,9 +786,14 @@ void cmExportFileGenerator::SetImportDetailProperties( std::string propval; if (auto* p = target->GetProperty("COMMON_LANGUAGE_RUNTIME")) { propval = p; + } else if (target->HasLanguage("CSharp", config)) { + // C# projects do not have the /clr flag, so we set the property + // here to mark the target as (only) managed (i.e. no .lib file + // to link to). Otherwise the COMMON_LANGUAGE_RUNTIME target + // property would have to be set manually for C# targets to make + // exporting/importing work. + propval = "CSharp"; } - // TODO: make sure propval is set to non-empty string for - // CSharp targets (i.e. force ManagedType::Managed). properties[prop] = propval; } } -- cgit v0.12