Use cmGeneratorTarget for property access.

This commit is contained in:
Stephen Kelly
2015-10-10 15:51:21 +02:00
parent b857f0d84b
commit cfb2f7508a
8 changed files with 81 additions and 70 deletions
+59 -50
View File
@@ -270,7 +270,7 @@ void cmVisualStudio10TargetGenerator::Generate()
{
// do not generate external ms projects
if(this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY
|| this->Target->GetProperty("EXTERNAL_MSPROJECT"))
|| this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT"))
{
return;
}
@@ -368,7 +368,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
const char* vsProjectTypes =
this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES");
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if(vsProjectTypes)
{
this->WriteString("<ProjectTypes>", 2);
@@ -376,9 +376,12 @@ void cmVisualStudio10TargetGenerator::Generate()
"</ProjectTypes>\n";
}
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
const char* vsProjectName =
this->GeneratorTarget->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalPath =
this->GeneratorTarget->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider =
this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER");
if( vsProjectName && vsLocalPath && vsProvider )
{
@@ -392,7 +395,8 @@ void cmVisualStudio10TargetGenerator::Generate()
(*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
"</SccProvider>\n";
const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH");
const char* vsAuxPath =
this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH");
if( vsAuxPath )
{
this->WriteString("<SccAuxPath>", 2);
@@ -401,13 +405,13 @@ void cmVisualStudio10TargetGenerator::Generate()
}
}
if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT"))
if(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT"))
{
this->WriteString("<WinMDAssembly>true</WinMDAssembly>\n", 2);
}
const char* vsGlobalKeyword =
this->Target->GetProperty("VS_GLOBAL_KEYWORD");
this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD");
if(!vsGlobalKeyword)
{
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
@@ -420,7 +424,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
const char* vsGlobalRootNamespace =
this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
if(vsGlobalRootNamespace)
{
this->WriteString("<RootNamespace>", 2);
@@ -431,14 +435,14 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
<< "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
const char* projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL");
if(!projLabel)
{
projLabel = this->Name.c_str();
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n";
if(const char* targetFrameworkVersion = this->Target->GetProperty(
if(const char* targetFrameworkVersion = this->GeneratorTarget->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
this->WriteString("<TargetFrameworkVersion>", 2);
@@ -497,7 +501,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{
std::vector<std::string> references;
if(const char* vsDotNetReferences =
this->Target->GetProperty("VS_DOTNET_REFERENCES"))
this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES"))
{
cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
}
@@ -543,7 +547,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
i != this->Configurations.end(); ++i)
{
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
if(this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
if(this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
{
(*this->BuildFileStream ) << "$(RootNamespace).";
}
@@ -610,7 +614,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
{
std::vector<std::string> references;
if(const char* vsWinRTReferences =
this->Target->GetProperty("VS_WINRT_REFERENCES"))
this->GeneratorTarget->GetProperty("VS_WINRT_REFERENCES"))
{
cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
}
@@ -679,7 +683,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
break;
case cmState::EXECUTABLE:
if(this->NsightTegra &&
!this->Target->GetPropertyAsBool("ANDROID_GUI"))
!this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI"))
{
// Android executables are .so too.
configType += "DynamicLibrary";
@@ -746,10 +750,10 @@ void cmVisualStudio10TargetGenerator
if((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY &&
this->ClOptions[config]->UsingUnicode()) ||
this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -769,8 +773,8 @@ void cmVisualStudio10TargetGenerator
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
if(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
@@ -788,27 +792,29 @@ void cmVisualStudio10TargetGenerator
ntv += toolset? toolset : "Default";
ntv += "</NdkToolchainVersion>\n";
this->WriteString(ntv.c_str(), 2);
if(const char* minApi = this->Target->GetProperty("ANDROID_API_MIN"))
if(const char* minApi =
this->GeneratorTarget->GetProperty("ANDROID_API_MIN"))
{
this->WriteString("<AndroidMinAPI>", 2);
(*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(minApi) << "</AndroidMinAPI>\n";
}
if(const char* api = this->Target->GetProperty("ANDROID_API"))
if(const char* api = this->GeneratorTarget->GetProperty("ANDROID_API"))
{
this->WriteString("<AndroidTargetAPI>", 2);
(*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n";
}
if(const char* cpuArch = this->Target->GetProperty("ANDROID_ARCH"))
if(const char* cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH"))
{
this->WriteString("<AndroidArch>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) <<
"</AndroidArch>\n";
}
if(const char* stlType = this->Target->GetProperty("ANDROID_STL_TYPE"))
if(const char* stlType =
this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE"))
{
this->WriteString("<AndroidStlType>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(stlType) <<
@@ -1963,7 +1969,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (this->MSTools)
{
// If we have the VS_WINRT_COMPONENT set then force Compile as WinRT.
if (this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT"))
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT"))
{
clOptions.AddFlag("CompileAsWinRT", "true");
// For WinRT components, add the _WINRT_DLL define to produce a lib
@@ -2012,7 +2018,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
if(this->NsightTegra)
{
if(const char* processMax =
this->Target->GetProperty("ANDROID_PROCESS_MAX"))
this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX"))
{
this->WriteString("<ProcessMax>", 3);
*this->BuildFileStream << cmVS10EscapeXML(processMax) <<
@@ -2270,18 +2276,18 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n";
}
if (this->Target->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP"))
if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP"))
{
this->WriteString("<SkipAntStep>true</SkipAntStep>\n", 3);
}
if (this->Target->GetPropertyAsBool("ANDROID_PROGUARD"))
if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_PROGUARD"))
{
this->WriteString("<EnableProGuard>true</EnableProGuard>\n", 3);
}
if (const char* proGuardConfigLocation =
this->Target->GetProperty("ANDROID_PROGUARD_CONFIG_PATH"))
this->GeneratorTarget->GetProperty("ANDROID_PROGUARD_CONFIG_PATH"))
{
this->WriteString("<ProGuardConfigLocation>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) <<
@@ -2289,7 +2295,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* securePropertiesLocation =
this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH"))
this->GeneratorTarget->GetProperty("ANDROID_SECURE_PROPS_PATH"))
{
this->WriteString("<SecurePropertiesLocation>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) <<
@@ -2297,7 +2303,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* nativeLibDirectoriesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES"))
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -2310,7 +2316,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* nativeLibDependenciesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES"))
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -2323,7 +2329,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* javaSourceDir =
this->Target->GetProperty("ANDROID_JAVA_SOURCE_DIR"))
this->GeneratorTarget->GetProperty("ANDROID_JAVA_SOURCE_DIR"))
{
this->WriteString("<JavaSourceDir>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) <<
@@ -2331,7 +2337,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* jarDirectoriesExpression =
this->Target->GetProperty("ANDROID_JAR_DIRECTORIES"))
this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES"))
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -2344,7 +2350,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* jarDeps =
this->Target->GetProperty("ANDROID_JAR_DEPENDENCIES"))
this->GeneratorTarget->GetProperty("ANDROID_JAR_DEPENDENCIES"))
{
this->WriteString("<JarDependencies>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) <<
@@ -2352,7 +2358,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* assetsDirectories =
this->Target->GetProperty("ANDROID_ASSETS_DIRECTORIES"))
this->GeneratorTarget->GetProperty("ANDROID_ASSETS_DIRECTORIES"))
{
this->WriteString("<AssetsDirectories>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) <<
@@ -2368,7 +2374,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
if (const char* antAdditionalOptions =
this->Target->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS"))
this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS"))
{
this->WriteString("<AdditionalOptions>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) <<
@@ -2439,7 +2445,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
flags += " ";
flags += this->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS");
const char* targetLinkFlags =
this->GeneratorTarget->GetProperty("LINK_FLAGS");
if(targetLinkFlags)
{
flags += " ";
@@ -2447,7 +2454,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
}
std::string flagsProp = "LINK_FLAGS_";
flagsProp += CONFIG;
if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str()))
if(const char* flagsConfig =
this->GeneratorTarget->GetProperty(flagsProp.c_str()))
{
flags += " ";
flags += flagsConfig;
@@ -2525,7 +2533,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
{
linkOptions.AddFlag("Version", "");
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
if ( this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE") )
{
if (this->GlobalGenerator->TargetsWindowsCE())
{
@@ -2597,7 +2605,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
// A Windows Runtime component uses internal .NET metadata,
// so does not have an import library.
if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
if(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
this->GeneratorTarget->GetType() != cmState::EXECUTABLE)
{
linkOptions.AddFlag("GenerateWindowsMetadata", "true");
@@ -2639,7 +2647,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{
if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
if (this->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{
linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def");
}
@@ -2783,7 +2791,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
this->WriteManifestOptions(*i);
if(this->NsightTegra &&
this->GeneratorTarget->GetType() == cmState::EXECUTABLE &&
this->Target->GetPropertyAsBool("ANDROID_GUI"))
this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI"))
{
this->WriteAntBuildOptions(*i);
}
@@ -2798,7 +2806,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{
if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
if (this->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{
addedPrelink = true;
std::vector<cmCustomCommand> commands =
@@ -2911,14 +2919,14 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions()
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0"))
{
const char* desktopExtensionsVersion =
this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
if (desktopExtensionsVersion)
{
this->WriteSinglePlatformExtension("WindowsDesktop",
desktopExtensionsVersion);
}
const char* mobileExtensionsVersion =
this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
if (mobileExtensionsVersion)
{
this->WriteSinglePlatformExtension("WindowsMobile",
@@ -2958,11 +2966,11 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0"))
{
const char* desktopExtensionsVersion =
this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
const char* mobileExtensionsVersion =
this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
const char* iotExtensionsVersion =
this->Target->GetProperty("VS_IOT_EXTENSIONS_VERSION");
this->GeneratorTarget->GetProperty("VS_IOT_EXTENSIONS_VERSION");
if(desktopExtensionsVersion || mobileExtensionsVersion ||
iotExtensionsVersion)
@@ -3194,7 +3202,8 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
"</WindowsTargetPlatformVersion>\n";
}
const char* targetPlatformMinVersion =
this->Target->GetProperty("VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
this->GeneratorTarget
->GetProperty("VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
if(targetPlatformMinVersion)
{
this->WriteString("<WindowsTargetPlatformMinVersion>", 2);
@@ -3213,7 +3222,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
}
// Added IoT Startup Task support
if(this->Target->GetPropertyAsBool("VS_IOT_STARTUP_TASK"))
if(this->GeneratorTarget->GetPropertyAsBool("VS_IOT_STARTUP_TASK"))
{
this->WriteString("<ContainsStartupTask>true</ContainsStartupTask>\n", 2);
}