| 893 | } |
| 894 | |
| 895 | bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) |
| 896 | { |
| 897 | // Skip this in special cases within our own test suite. |
| 898 | if (this->GetPlatformName() == "Test Platform"_s || |
| 899 | this->GetPlatformToolsetString() == "Test Toolset"_s) { |
| 900 | return true; |
| 901 | } |
| 902 | |
| 903 | std::string wd; |
| 904 | if (!this->ConfiguredFilesPath.empty()) { |
| 905 | // In a try-compile we are given the outer CMakeFiles directory. |
| 906 | wd = this->ConfiguredFilesPath; |
| 907 | } else { |
| 908 | wd = cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(), |
| 909 | "/CMakeFiles"); |
| 910 | } |
| 911 | wd += '/'; |
| 912 | wd += cmVersion::GetCMakeVersion(); |
| 913 | |
| 914 | // We record the result persistently in a file. |
| 915 | std::string const txt = cmStrCat(wd, "/VCTargetsPath.txt"); |
| 916 | |
| 917 | // If we have a recorded result, use it. |
| 918 | { |
| 919 | cmsys::ifstream fin(txt.c_str()); |
| 920 | if (fin && cmSystemTools::GetLineFromStream(fin, this->VCTargetsPath) && |
| 921 | cmSystemTools::FileIsDirectory(this->VCTargetsPath)) { |
| 922 | cmSystemTools::ConvertToUnixSlashes(this->VCTargetsPath); |
| 923 | return true; |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | // Prepare the work directory. |
| 928 | if (!cmSystemTools::MakeDirectory(wd)) { |
| 929 | mf->IssueMessage(MessageType::FATAL_ERROR, |
| 930 | cmStrCat("Failed to make directory:\n ", wd)); |
| 931 | cmSystemTools::SetFatalErrorOccurred(); |
| 932 | return false; |
| 933 | } |
| 934 | |
| 935 | // Generate a project file for MSBuild to tell us the VCTargetsPath value. |
| 936 | std::string const vcxproj = "VCTargetsPath.vcxproj"; |
| 937 | { |
| 938 | std::string const vcxprojAbs = cmStrCat(wd, '/', vcxproj); |
| 939 | cmsys::ofstream fout(vcxprojAbs.c_str()); |
| 940 | cmXMLWriter xw(fout); |
| 941 | |
| 942 | cmXMLDocument doc(xw); |
| 943 | cmXMLElement eprj(doc, "Project"); |
| 944 | eprj.Attribute("DefaultTargets", "Build"); |
| 945 | eprj.Attribute("ToolsVersion", "4.0"); |
| 946 | eprj.Attribute("xmlns", |
| 947 | "http://schemas.microsoft.com/developer/msbuild/2003"); |
| 948 | if (this->IsNsightTegra()) { |
| 949 | cmXMLElement epg(eprj, "PropertyGroup"); |
| 950 | epg.Attribute("Label", "NsightTegraProject"); |
| 951 | cmXMLElement(epg, "NsightTegraProjectRevisionNumber").Content("6"); |
| 952 | } |
no test coverage detected