VS: Fix crash on CSharp sources in a custom target

The target generator does not compute ClOptions for custom targets,
so we should not use them either.

Fixes: #18377, #18485
This commit is contained in:
Brad King
2018-10-23 10:55:12 -04:00
parent fd02538974
commit d004d8c59a
4 changed files with 7 additions and 0 deletions

View File

@@ -1130,6 +1130,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
Elem& e1, std::string const& config)
{
if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
return;
}
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
Options& o = *(this->ClOptions[config]);

View File

@@ -8,3 +8,6 @@ add_library(lib2 SHARED lib2.cs)
add_executable(CSharpOnly csharponly.cs)
target_link_libraries(CSharpOnly lib1 lib2)
add_custom_target(CSharpCustom SOURCES empty.cs)
add_custom_target(custom.cs DEPENDS empty.txt)

View File

View File