MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteClOptions

Method WriteClOptions

Source/cmVisualStudio10TargetGenerator.cxx:3731–3808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3729}
3730
3731void cmVisualStudio10TargetGenerator::WriteClOptions(
3732 Elem& e1, std::string const& configName)
3733{
3734 Options& clOptions = *(this->ClOptions[configName]);
3735 if (this->ProjectType == VsProjectType::csproj) {
3736 return;
3737 }
3738 Elem e2(e1, "ClCompile");
3739 OptionsHelper oh(clOptions, e2);
3740 oh.PrependInheritedString("AdditionalOptions");
3741 oh.OutputAdditionalIncludeDirectories(this->LangForClCompile);
3742 oh.OutputFlagMap();
3743 oh.OutputPreprocessorDefinitions(this->LangForClCompile);
3744
3745 if (this->NsightTegra) {
3746 if (cmValue processMax =
3747 this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX")) {
3748 e2.Element("ProcessMax", *processMax);
3749 }
3750 }
3751
3752 if (this->Android) {
3753 e2.Element("ObjectFileName", "$(IntDir)%(filename).o");
3754 } else if (this->MSTools) {
3755 cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*");
3756 char const* toolset = this->GlobalGenerator->GetPlatformToolset();
3757 cmValue noCompileBatching =
3758 this->GeneratorTarget->GetProperty("VS_NO_COMPILE_BATCHING");
3759 if (noCompileBatching.IsOn() || (toolset && clangToolset.find(toolset))) {
3760 e2.Element("ObjectFileName", "$(IntDir)%(filename).obj");
3761 } else {
3762 e2.Element("ObjectFileName", "$(IntDir)");
3763 }
3764
3765 // If not in debug mode, write the DebugInformationFormat field
3766 // without value so PDBs don't get generated uselessly. Each tag
3767 // goes on its own line because Visual Studio corrects it this
3768 // way when saving the project after CMake generates it.
3769 if (!clOptions.UsingDebugInfo()) {
3770 Elem e3(e2, "DebugInformationFormat");
3771 e3.SetHasElements();
3772 }
3773
3774 // Specify the compiler program database file if configured.
3775 std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName);
3776 if (!pdb.empty() && !cmHasSuffix(pdb, '/') && !cmHasSuffix(pdb, '\\')) {
3777 if (this->GlobalGenerator->IsCudaEnabled()) {
3778 // CUDA does not quote paths with spaces correctly when forwarding
3779 // this to the host compiler. Use a relative path to avoid spaces.
3780 // FIXME: We can likely do this even when CUDA is not involved,
3781 // but for now we will make a minimal change.
3782 pdb = this->ConvertPath(pdb, true);
3783 }
3784 ConvertToWindowsSlash(pdb);
3785 e2.Element("ProgramDataBaseFileName", pdb);
3786 }
3787
3788 // add AdditionalUsingDirectories

Callers 1

Calls 15

ConvertPathMethod · 0.95
cmHasSuffixFunction · 0.85
ConvertToWindowsSlashFunction · 0.85
GetPlatformToolsetMethod · 0.80
UsingDebugInfoMethod · 0.80
SetHasElementsMethod · 0.80
GetCompilePDBPathMethod · 0.80
IsCudaEnabledMethod · 0.80
appendMethod · 0.80
OutputFlagMapMethod · 0.45

Tested by

no test coverage detected