| 1412 | } |
| 1413 | |
| 1414 | void cmCoreTryCompile::FindOutputFile(std::string const& targetName) |
| 1415 | { |
| 1416 | this->FindErrorMessage.clear(); |
| 1417 | this->OutputFile.clear(); |
| 1418 | std::string tmpOutputFile = "/"; |
| 1419 | tmpOutputFile += targetName; |
| 1420 | |
| 1421 | if (this->Makefile->GetGlobalGenerator()->IsMultiConfig()) { |
| 1422 | std::string const tcConfig = |
| 1423 | this->Makefile->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); |
| 1424 | std::string const cfg = !tcConfig.empty() |
| 1425 | ? cmSystemTools::UpperCase(tcConfig) |
| 1426 | : TryCompileDefaultConfig; |
| 1427 | tmpOutputFile = cmStrCat(tmpOutputFile, '_', cfg); |
| 1428 | } |
| 1429 | tmpOutputFile += "_loc"; |
| 1430 | |
| 1431 | std::string command = cmStrCat(this->BinaryDirectory, tmpOutputFile); |
| 1432 | if (!cmSystemTools::FileExists(command)) { |
| 1433 | std::ostringstream emsg; |
| 1434 | emsg << "Unable to find the recorded try_compile output location:\n"; |
| 1435 | emsg << cmStrCat(" ", command, '\n'); |
| 1436 | this->FindErrorMessage = emsg.str(); |
| 1437 | return; |
| 1438 | } |
| 1439 | |
| 1440 | std::string outputFileLocation; |
| 1441 | cmsys::ifstream ifs(command.c_str()); |
| 1442 | cmSystemTools::GetLineFromStream(ifs, outputFileLocation); |
| 1443 | if (!cmSystemTools::FileExists(outputFileLocation)) { |
| 1444 | std::ostringstream emsg; |
| 1445 | emsg << "Recorded try_compile output location doesn't exist:\n"; |
| 1446 | emsg << cmStrCat(" ", outputFileLocation, '\n'); |
| 1447 | this->FindErrorMessage = emsg.str(); |
| 1448 | return; |
| 1449 | } |
| 1450 | |
| 1451 | this->OutputFile = cmSystemTools::CollapseFullPath(outputFileLocation); |
| 1452 | } |
| 1453 | |
| 1454 | std::string cmCoreTryCompile::WriteSource(std::string const& filename, |
| 1455 | std::string const& content, |
no test coverage detected