cmCPackGenericGenerator.cxx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCPackGenericGenerator.h"
  14. #include "cmMakefile.h"
  15. #include "cmCPackLog.h"
  16. #include "cmake.h"
  17. #include "cmGlobalGenerator.h"
  18. #include "cmLocalGenerator.h"
  19. #include "cmGeneratedFileStream.h"
  20. #include <cmsys/SystemTools.hxx>
  21. #include <cmsys/Glob.hxx>
  22. #include <memory> // auto_ptr
  23. //----------------------------------------------------------------------
  24. cmCPackGenericGenerator::cmCPackGenericGenerator()
  25. {
  26. m_GeneratorVerbose = false;
  27. m_MakefileMap = 0;
  28. m_Logger = 0;
  29. }
  30. //----------------------------------------------------------------------
  31. cmCPackGenericGenerator::~cmCPackGenericGenerator()
  32. {
  33. m_MakefileMap = 0;
  34. }
  35. //----------------------------------------------------------------------
  36. int cmCPackGenericGenerator::PrepareNames()
  37. {
  38. this->SetOption("CPACK_GENERATOR", m_Name.c_str());
  39. std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
  40. tempDirectory += "/_CPack_Packages/";
  41. tempDirectory += this->GetOption("CPACK_GENERATOR");
  42. std::string topDirectory = tempDirectory;
  43. std::string outName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
  44. tempDirectory += "/" + outName;
  45. outName += ".";
  46. outName += this->GetOutputExtension();
  47. std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
  48. destFile += "/" + outName;
  49. std::string outFile = topDirectory + "/" + outName;
  50. std::string installPrefix = tempDirectory + this->GetInstallPrefix();
  51. this->SetOption("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
  52. this->SetOption("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
  53. this->SetOption("CPACK_OUTPUT_FILE_NAME", outName.c_str());
  54. this->SetOption("CPACK_OUTPUT_FILE_PATH", destFile.c_str());
  55. this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", outFile.c_str());
  56. this->SetOption("CPACK_INSTALL_DIRECTORY", this->GetInstallPath());
  57. this->SetOption("CPACK_NATIVE_INSTALL_DIRECTORY",
  58. cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath()).c_str());
  59. this->SetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY", installPrefix.c_str());
  60. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for: CPACK_PACKAGE_DESCRIPTION_FILE" << std::endl);
  61. const char* descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE");
  62. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for: " << descFileName << std::endl);
  63. if ( descFileName )
  64. {
  65. if ( !cmSystemTools::FileExists(descFileName) )
  66. {
  67. cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find description file name: " << descFileName << std::endl);
  68. return 0;
  69. }
  70. std::ifstream ifs(descFileName);
  71. if ( !ifs )
  72. {
  73. cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot open description file name: " << descFileName << std::endl);
  74. return 0;
  75. }
  76. cmOStringStream ostr;
  77. std::string line;
  78. cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Read description file: " << descFileName << std::endl);
  79. while ( ifs && cmSystemTools::GetLineFromStream(ifs, line) )
  80. {
  81. ostr << cmSystemTools::MakeXMLSafe(line.c_str()) << std::endl;
  82. }
  83. this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str().c_str());
  84. }
  85. if ( !this->GetOption("CPACK_PACKAGE_DESCRIPTION") )
  86. {
  87. cmCPackLogger(cmCPackLog::LOG_ERROR,
  88. "Project description not specified. Please specify CPACK_PACKAGE_DESCRIPTION or CPACK_PACKAGE_DESCRIPTION_FILE_NAME."
  89. << std::endl);
  90. return 0;
  91. }
  92. return 1;
  93. }
  94. //----------------------------------------------------------------------
  95. int cmCPackGenericGenerator::InstallProject()
  96. {
  97. cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install project" << std::endl);
  98. const char* tempInstallDirectory = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
  99. int res = 1;
  100. if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
  101. {
  102. cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating temporary directory: " << tempInstallDirectory << std::endl);
  103. return 0;
  104. }
  105. bool movable = true;
  106. if ( movable )
  107. {
  108. // Make sure there is no destdir
  109. cmSystemTools::PutEnv("DESTDIR=");
  110. }
  111. else
  112. {
  113. std::string destDir = "DESTDIR=";
  114. destDir += tempInstallDirectory;
  115. cmSystemTools::PutEnv(destDir.c_str());
  116. }
  117. const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
  118. if ( installCommands )
  119. {
  120. std::vector<std::string> installCommandsVector;
  121. cmSystemTools::ExpandListArgument(installCommands,installCommandsVector);
  122. std::vector<std::string>::iterator it;
  123. for ( it = installCommandsVector.begin(); it != installCommandsVector.end();
  124. ++it )
  125. {
  126. cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << it->c_str() << std::endl);
  127. std::string output;
  128. int retVal = 1;
  129. bool resB = cmSystemTools::RunSingleCommand(it->c_str(), &output, &retVal, 0, m_GeneratorVerbose, 0);
  130. if ( !resB || retVal )
  131. {
  132. std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
  133. tmpFile += "/InstallOutput.log";
  134. cmGeneratedFileStream ofs(tmpFile.c_str());
  135. ofs << "# Run command: " << it->c_str() << std::endl
  136. << "# Output:" << std::endl
  137. << output.c_str() << std::endl;
  138. cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running install command: " << it->c_str() << std::endl
  139. << "Please check " << tmpFile.c_str() << " for errors" << std::endl);
  140. res = 0;
  141. break;
  142. }
  143. }
  144. }
  145. const char* installDirectories = this->GetOption("CPACK_INSTALLED_DIRECTORIES");
  146. if ( installDirectories )
  147. {
  148. std::vector<std::string> installDirectoriesVector;
  149. cmSystemTools::ExpandListArgument(installDirectories,installDirectoriesVector);
  150. if ( installDirectoriesVector.size() % 2 != 0 )
  151. {
  152. cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_INSTALLED_DIRECTORIES should contain pairs of <directory> and <subdirectory>. The <subdirectory> can be '.' to be installed in the toplevel directory of installation." << std::endl);
  153. return 0;
  154. }
  155. std::vector<std::string>::iterator it;
  156. const char* tempDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
  157. for ( it = installDirectoriesVector.begin(); it != installDirectoriesVector.end();
  158. ++it )
  159. {
  160. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
  161. cmsys::Glob gl;
  162. std::string toplevel = it->c_str();
  163. it ++;
  164. std::string subdir = it->c_str();
  165. std::string findExpr = toplevel;
  166. findExpr += "/*";
  167. gl.RecurseOn();
  168. if ( !gl.FindFiles(findExpr) )
  169. {
  170. cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" << std::endl);
  171. return 0;
  172. }
  173. std::vector<std::string>& files = gl.GetFiles();
  174. std::vector<std::string>::iterator gfit;
  175. for ( gfit = files.begin(); gfit != files.end(); ++ gfit )
  176. {
  177. std::string filePath = tempDir;
  178. filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(toplevel.c_str(), gfit->c_str());
  179. std::string &inFile = *gfit;
  180. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl);
  181. if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), filePath.c_str()) )
  182. {
  183. cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl);
  184. }
  185. }
  186. }
  187. }
  188. const char* binaryDir = this->GetOption("CPACK_BINARY_DIR");
  189. if ( binaryDir )
  190. {
  191. std::string installFile = binaryDir;
  192. installFile += "/cmake_install.cmake";
  193. cmake cm;
  194. cmGlobalGenerator gg;
  195. gg.SetCMakeInstance(&cm);
  196. std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
  197. lg->SetGlobalGenerator(&gg);
  198. cmMakefile *mf = lg->GetMakefile();
  199. if ( movable )
  200. {
  201. mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
  202. }
  203. const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
  204. if ( buildConfig && *buildConfig )
  205. {
  206. mf->AddDefinition("BUILD_TYPE", buildConfig);
  207. }
  208. res = mf->ReadListFile(0, installFile.c_str());
  209. if ( cmSystemTools::GetErrorOccuredFlag() )
  210. {
  211. res = 0;
  212. }
  213. }
  214. if ( !movable )
  215. {
  216. cmSystemTools::PutEnv("DESTDIR=");
  217. }
  218. return res;
  219. }
  220. //----------------------------------------------------------------------
  221. void cmCPackGenericGenerator::SetOption(const char* op, const char* value)
  222. {
  223. if ( !op )
  224. {
  225. return;
  226. }
  227. if ( !value )
  228. {
  229. m_MakefileMap->RemoveDefinition(op);
  230. return;
  231. }
  232. cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass() << "::SetOption(" << op << ", " << value << ")" << std::endl);
  233. m_MakefileMap->AddDefinition(op, value);
  234. }
  235. //----------------------------------------------------------------------
  236. int cmCPackGenericGenerator::ProcessGenerator()
  237. {
  238. if ( !this->PrepareNames() )
  239. {
  240. return 0;
  241. }
  242. if ( !this->InstallProject() )
  243. {
  244. return 0;
  245. }
  246. const char* tempPackageFileName = this->GetOption(
  247. "CPACK_TEMPORARY_PACKAGE_FILE_NAME");
  248. const char* packageFileName = this->GetOption("CPACK_OUTPUT_FILE_PATH");
  249. const char* tempDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
  250. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
  251. cmsys::Glob gl;
  252. std::string findExpr = tempDirectory;
  253. findExpr += "/*";
  254. gl.RecurseOn();
  255. if ( !gl.FindFiles(findExpr) )
  256. {
  257. cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the packaging tree" << std::endl);
  258. return 0;
  259. }
  260. cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Compress package" << std::endl);
  261. cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress files to: " << tempPackageFileName << std::endl);
  262. if ( cmSystemTools::FileExists(tempPackageFileName) )
  263. {
  264. cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove old package file" << std::endl);
  265. cmSystemTools::RemoveFile(tempPackageFileName);
  266. }
  267. if ( !this->CompressFiles(tempPackageFileName,
  268. tempDirectory, gl.GetFiles()) )
  269. {
  270. cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory" << std::endl);
  271. return 0;
  272. }
  273. cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Finalize package" << std::endl);
  274. cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Copy final package: " << tempPackageFileName << " to " << packageFileName << std::endl);
  275. if ( !cmSystemTools::CopyFileIfDifferent(tempPackageFileName, packageFileName) )
  276. {
  277. cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the package: " << tempPackageFileName << " to " << packageFileName << std::endl);
  278. return 0;
  279. }
  280. cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Package " << packageFileName << " generated." << std::endl);
  281. return 1;
  282. }
  283. //----------------------------------------------------------------------
  284. int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf)
  285. {
  286. m_MakefileMap = mf;
  287. m_Name = name;
  288. return 1;
  289. }
  290. //----------------------------------------------------------------------
  291. const char* cmCPackGenericGenerator::GetOption(const char* op)
  292. {
  293. return m_MakefileMap->GetDefinition(op);
  294. }
  295. //----------------------------------------------------------------------
  296. int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
  297. {
  298. int found = 0;
  299. // Find our own executable.
  300. std::vector<cmStdString> failures;
  301. m_CPackSelf = arg0;
  302. cmSystemTools::ConvertToUnixSlashes(m_CPackSelf);
  303. failures.push_back(m_CPackSelf);
  304. m_CPackSelf = cmSystemTools::FindProgram(m_CPackSelf.c_str());
  305. if(!cmSystemTools::FileExists(m_CPackSelf.c_str()))
  306. {
  307. failures.push_back(m_CPackSelf);
  308. m_CPackSelf = "/usr/local/bin/ctest";
  309. }
  310. if(!cmSystemTools::FileExists(m_CPackSelf.c_str()))
  311. {
  312. failures.push_back(m_CPackSelf);
  313. cmOStringStream msg;
  314. msg << "CTEST can not find the command line program ctest.\n";
  315. msg << " argv[0] = \"" << arg0 << "\"\n";
  316. msg << " Attempted paths:\n";
  317. std::vector<cmStdString>::iterator i;
  318. for(i=failures.begin(); i != failures.end(); ++i)
  319. {
  320. msg << " \"" << i->c_str() << "\"\n";
  321. }
  322. cmSystemTools::Error(msg.str().c_str());
  323. }
  324. std::string dir;
  325. std::string file;
  326. if(cmSystemTools::SplitProgramPath(m_CPackSelf.c_str(),
  327. dir, file, true))
  328. {
  329. m_CMakeSelf = dir += "/cmake";
  330. m_CMakeSelf += cmSystemTools::GetExecutableExtension();
  331. if(cmSystemTools::FileExists(m_CMakeSelf.c_str()))
  332. {
  333. found = 1;
  334. }
  335. }
  336. if ( !found )
  337. {
  338. failures.push_back(m_CMakeSelf);
  339. #ifdef CMAKE_BUILD_DIR
  340. std::string intdir = ".";
  341. #ifdef CMAKE_INTDIR
  342. intdir = CMAKE_INTDIR;
  343. #endif
  344. m_CMakeSelf = CMAKE_BUILD_DIR;
  345. m_CMakeSelf += "/bin/";
  346. m_CMakeSelf += intdir;
  347. m_CMakeSelf += "/cmake";
  348. m_CMakeSelf += cmSystemTools::GetExecutableExtension();
  349. #endif
  350. if(!cmSystemTools::FileExists(m_CMakeSelf.c_str()))
  351. {
  352. failures.push_back(m_CMakeSelf);
  353. cmOStringStream msg;
  354. msg << "CTEST can not find the command line program cmake.\n";
  355. msg << " argv[0] = \"" << arg0 << "\"\n";
  356. msg << " Attempted paths:\n";
  357. std::vector<cmStdString>::iterator i;
  358. for(i=failures.begin(); i != failures.end(); ++i)
  359. {
  360. msg << " \"" << i->c_str() << "\"\n";
  361. }
  362. cmSystemTools::Error(msg.str().c_str());
  363. }
  364. }
  365. // do CMAKE_ROOT, look for the environment variable first
  366. std::string cMakeRoot;
  367. std::string modules;
  368. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT" << std::endl);
  369. if (getenv("CMAKE_ROOT"))
  370. {
  371. cMakeRoot = getenv("CMAKE_ROOT");
  372. modules = cMakeRoot + "/Modules/CMake.cmake";
  373. }
  374. if(modules.empty() || !cmSystemTools::FileExists(modules.c_str()))
  375. {
  376. // next try exe/..
  377. cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
  378. std::string::size_type slashPos = cMakeRoot.rfind("/");
  379. if(slashPos != std::string::npos)
  380. {
  381. cMakeRoot = cMakeRoot.substr(0, slashPos);
  382. }
  383. // is there no Modules direcory there?
  384. modules = cMakeRoot + "/Modules/CMake.cmake";
  385. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  386. }
  387. if (!cmSystemTools::FileExists(modules.c_str()))
  388. {
  389. // try exe/../share/cmake
  390. cMakeRoot += CMAKE_DATA_DIR;
  391. modules = cMakeRoot + "/Modules/CMake.cmake";
  392. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  393. }
  394. #ifdef CMAKE_ROOT_DIR
  395. if (!cmSystemTools::FileExists(modules.c_str()))
  396. {
  397. // try compiled in root directory
  398. cMakeRoot = CMAKE_ROOT_DIR;
  399. modules = cMakeRoot + "/Modules/CMake.cmake";
  400. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  401. }
  402. #endif
  403. #ifdef CMAKE_PREFIX
  404. if (!cmSystemTools::FileExists(modules.c_str()))
  405. {
  406. // try compiled in install prefix
  407. cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR;
  408. modules = cMakeRoot + "/Modules/CMake.cmake";
  409. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  410. }
  411. #endif
  412. if (!cmSystemTools::FileExists(modules.c_str()))
  413. {
  414. // try
  415. cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
  416. cMakeRoot += CMAKE_DATA_DIR;
  417. modules = cMakeRoot + "/Modules/CMake.cmake";
  418. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  419. }
  420. if(!cmSystemTools::FileExists(modules.c_str()))
  421. {
  422. // next try exe
  423. cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
  424. // is there no Modules direcory there?
  425. modules = cMakeRoot + "/Modules/CMake.cmake";
  426. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
  427. }
  428. if (!cmSystemTools::FileExists(modules.c_str()))
  429. {
  430. // couldn't find modules
  431. cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n"
  432. "CMake has most likely not been installed correctly.\n"
  433. "Modules directory not found in\n",
  434. cMakeRoot.c_str());
  435. return 0;
  436. }
  437. m_CMakeRoot = cMakeRoot;
  438. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << m_CMakeRoot.c_str() << std::endl);
  439. this->SetOption("CMAKE_ROOT", m_CMakeRoot.c_str());
  440. return 1;
  441. }
  442. //----------------------------------------------------------------------
  443. int cmCPackGenericGenerator::CompressFiles(const char* outFileName, const char* toplevel,
  444. const std::vector<std::string>& files)
  445. {
  446. (void)outFileName;
  447. (void)toplevel;
  448. (void)files;
  449. return 0;
  450. }
  451. //----------------------------------------------------------------------
  452. const char* cmCPackGenericGenerator::GetInstallPath()
  453. {
  454. if ( !m_InstallPath.empty() )
  455. {
  456. return m_InstallPath.c_str();
  457. }
  458. #if defined(_WIN32) && !defined(__CYGWIN__)
  459. const char* prgfiles = cmsys::SystemTools::GetEnv("ProgramFiles");
  460. const char* sysDrive = cmsys::SystemTools::GetEnv("SystemDrive");
  461. if ( prgfiles )
  462. {
  463. m_InstallPath = prgfiles;
  464. }
  465. else if ( sysDrive )
  466. {
  467. m_InstallPath = sysDrive;
  468. m_InstallPath += "/Program Files";
  469. }
  470. else
  471. {
  472. m_InstallPath = "c:/Program Files";
  473. }
  474. m_InstallPath += "/";
  475. m_InstallPath += this->GetOption("CPACK_PACKAGE_NAME");
  476. m_InstallPath += "-";
  477. m_InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
  478. #else
  479. m_InstallPath = "/usr/local/";
  480. #endif
  481. return m_InstallPath.c_str();
  482. }
  483. //----------------------------------------------------------------------
  484. std::string cmCPackGenericGenerator::FindTemplate(const char* name)
  485. {
  486. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: " << name << std::endl);
  487. std::string ffile = m_MakefileMap->GetModulesFile(name);
  488. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " << ffile.c_str() << std::endl);
  489. return ffile;
  490. }
  491. //----------------------------------------------------------------------
  492. bool cmCPackGenericGenerator::ConfigureFile(const char* inName, const char* outName)
  493. {
  494. return m_MakefileMap->ConfigureFile(inName, outName, false, true, false) == 1;
  495. }