cmLocalVisualStudio6Generator.cxx 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714
  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 "cmGlobalGenerator.h"
  14. #include "cmLocalVisualStudio6Generator.h"
  15. #include "cmMakefile.h"
  16. #include "cmSystemTools.h"
  17. #include "cmSourceFile.h"
  18. #include "cmCacheManager.h"
  19. #include "cmake.h"
  20. #include "cmComputeLinkInformation.h"
  21. #include <cmsys/RegularExpression.hxx>
  22. cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator()
  23. {
  24. }
  25. cmLocalVisualStudio6Generator::~cmLocalVisualStudio6Generator()
  26. {
  27. }
  28. //----------------------------------------------------------------------------
  29. // Helper class to write build events.
  30. class cmLocalVisualStudio6Generator::EventWriter
  31. {
  32. public:
  33. EventWriter(cmLocalVisualStudio6Generator* lg,
  34. const char* config, std::string& code):
  35. LG(lg), Config(config), Code(code), First(true) {}
  36. void Start(const char* event)
  37. {
  38. this->First = true;
  39. this->Event = event;
  40. }
  41. void Finish()
  42. {
  43. this->Code += (this->First? "" : "\n");
  44. }
  45. void Write(std::vector<cmCustomCommand> const& ccs)
  46. {
  47. for(std::vector<cmCustomCommand>::const_iterator ci = ccs.begin();
  48. ci != ccs.end(); ++ci)
  49. {
  50. this->Write(*ci);
  51. }
  52. }
  53. void Write(cmCustomCommand const& cc)
  54. {
  55. if(this->First)
  56. {
  57. this->Code += this->Event + "_Cmds=";
  58. this->First = false;
  59. }
  60. else
  61. {
  62. this->Code += "\\\n\t";
  63. }
  64. this->Code +=
  65. this->LG->ConstructScript(cc.GetCommandLines(),
  66. cc.GetWorkingDirectory(),
  67. this->Config,
  68. cc.GetEscapeOldStyle(),
  69. cc.GetEscapeAllowMakeVars(),
  70. "\\\n\t");
  71. }
  72. private:
  73. cmLocalVisualStudio6Generator* LG;
  74. const char* Config;
  75. std::string& Code;
  76. bool First;
  77. std::string Event;
  78. };
  79. void cmLocalVisualStudio6Generator::AddHelperCommands()
  80. {
  81. std::set<cmStdString> lang;
  82. lang.insert("C");
  83. lang.insert("CXX");
  84. this->CreateCustomTargetsAndCommands(lang);
  85. }
  86. void cmLocalVisualStudio6Generator::Generate()
  87. {
  88. this->OutputDSPFile();
  89. }
  90. void cmLocalVisualStudio6Generator::OutputDSPFile()
  91. {
  92. // If not an in source build, then create the output directory
  93. if(strcmp(this->Makefile->GetStartOutputDirectory(),
  94. this->Makefile->GetHomeDirectory()) != 0)
  95. {
  96. if(!cmSystemTools::MakeDirectory
  97. (this->Makefile->GetStartOutputDirectory()))
  98. {
  99. cmSystemTools::Error("Error creating directory ",
  100. this->Makefile->GetStartOutputDirectory());
  101. }
  102. }
  103. // Setup /I and /LIBPATH options for the resulting DSP file. VS 6
  104. // truncates long include paths so make it as short as possible if
  105. // the length threatens this problem.
  106. unsigned int maxIncludeLength = 3000;
  107. bool useShortPath = false;
  108. for(int j=0; j < 2; ++j)
  109. {
  110. std::vector<std::string> includes;
  111. this->GetIncludeDirectories(includes);
  112. std::vector<std::string>::iterator i;
  113. for(i = includes.begin(); i != includes.end(); ++i)
  114. {
  115. std::string tmp =
  116. this->ConvertToOptionallyRelativeOutputPath(i->c_str());
  117. if(useShortPath)
  118. {
  119. cmSystemTools::GetShortPath(tmp.c_str(), tmp);
  120. }
  121. this->IncludeOptions += " /I ";
  122. // quote if not already quoted
  123. if (tmp[0] != '"')
  124. {
  125. this->IncludeOptions += "\"";
  126. this->IncludeOptions += tmp;
  127. this->IncludeOptions += "\"";
  128. }
  129. else
  130. {
  131. this->IncludeOptions += tmp;
  132. }
  133. }
  134. if(j == 0 && this->IncludeOptions.size() > maxIncludeLength)
  135. {
  136. this->IncludeOptions = "";
  137. useShortPath = true;
  138. }
  139. else
  140. {
  141. break;
  142. }
  143. }
  144. // Create the DSP or set of DSP's for libraries and executables
  145. // clear project names
  146. this->CreatedProjectNames.clear();
  147. cmTargets &tgts = this->Makefile->GetTargets();
  148. for(cmTargets::iterator l = tgts.begin();
  149. l != tgts.end(); l++)
  150. {
  151. // Add a rule to regenerate the build system when the target
  152. // specification source changes.
  153. const char* suppRegenRule =
  154. this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION");
  155. if (!cmSystemTools::IsOn(suppRegenRule))
  156. {
  157. this->AddDSPBuildRule(l->second);
  158. }
  159. }
  160. // build any targets
  161. for(cmTargets::iterator l = tgts.begin();
  162. l != tgts.end(); l++)
  163. {
  164. switch(l->second.GetType())
  165. {
  166. case cmTarget::STATIC_LIBRARY:
  167. this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second);
  168. break;
  169. case cmTarget::SHARED_LIBRARY:
  170. case cmTarget::MODULE_LIBRARY:
  171. this->SetBuildType(DLL, l->first.c_str(), l->second);
  172. break;
  173. case cmTarget::EXECUTABLE:
  174. this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second);
  175. break;
  176. case cmTarget::UTILITY:
  177. case cmTarget::GLOBAL_TARGET:
  178. this->SetBuildType(UTILITY, l->first.c_str(), l->second);
  179. break;
  180. default:
  181. cmSystemTools::Error("Bad target type", l->first.c_str());
  182. break;
  183. }
  184. // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
  185. // so don't build a projectfile for it
  186. if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
  187. {
  188. // check to see if the dsp is going into a sub-directory
  189. std::string::size_type pos = l->first.rfind('/');
  190. if(pos != std::string::npos)
  191. {
  192. std::string dir = this->Makefile->GetStartOutputDirectory();
  193. dir += "/";
  194. dir += l->first.substr(0, pos);
  195. if(!cmSystemTools::MakeDirectory(dir.c_str()))
  196. {
  197. cmSystemTools::Error("Error creating directory ", dir.c_str());
  198. }
  199. }
  200. this->CreateSingleDSP(l->first.c_str(),l->second);
  201. }
  202. }
  203. }
  204. // Utility function to make a valid VS6 *.dsp filename out
  205. // of a CMake target name:
  206. //
  207. extern std::string GetVS6TargetName(const std::string& targetName);
  208. void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname,
  209. cmTarget &target)
  210. {
  211. // add to the list of projects
  212. std::string pname = GetVS6TargetName(lname);
  213. this->CreatedProjectNames.push_back(pname);
  214. // create the dsp.cmake file
  215. std::string fname;
  216. fname = this->Makefile->GetStartOutputDirectory();
  217. fname += "/";
  218. fname += pname;
  219. fname += ".dsp";
  220. // save the name of the real dsp file
  221. std::string realDSP = fname;
  222. fname += ".cmake";
  223. std::ofstream fout(fname.c_str());
  224. if(!fout)
  225. {
  226. cmSystemTools::Error("Error Writing ", fname.c_str());
  227. cmSystemTools::ReportLastSystemError("");
  228. }
  229. this->WriteDSPFile(fout,pname.c_str(),target);
  230. fout.close();
  231. // if the dsp file has changed, then write it.
  232. cmSystemTools::CopyFileIfDifferent(fname.c_str(), realDSP.c_str());
  233. }
  234. void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
  235. {
  236. std::string dspname = GetVS6TargetName(tgt.GetName());
  237. dspname += ".dsp.cmake";
  238. const char* dsprule =
  239. this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
  240. cmCustomCommandLine commandLine;
  241. commandLine.push_back(dsprule);
  242. std::string makefileIn = this->Makefile->GetStartDirectory();
  243. makefileIn += "/";
  244. makefileIn += "CMakeLists.txt";
  245. std::string comment = "Building Custom Rule ";
  246. comment += makefileIn;
  247. std::string args;
  248. args = "-H";
  249. args += this->Convert(this->Makefile->GetHomeDirectory(),
  250. START_OUTPUT, UNCHANGED, true);
  251. commandLine.push_back(args);
  252. args = "-B";
  253. args +=
  254. this->Convert(this->Makefile->GetHomeOutputDirectory(),
  255. START_OUTPUT, UNCHANGED, true);
  256. commandLine.push_back(args);
  257. std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
  258. cmCustomCommandLines commandLines;
  259. commandLines.push_back(commandLine);
  260. const char* no_working_directory = 0;
  261. this->Makefile->AddCustomCommandToOutput(dspname.c_str(), listFiles,
  262. makefileIn.c_str(), commandLines,
  263. comment.c_str(),
  264. no_working_directory, true);
  265. if(cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str()))
  266. {
  267. tgt.AddSourceFile(file);
  268. }
  269. else
  270. {
  271. cmSystemTools::Error("Error adding rule for ", makefileIn.c_str());
  272. }
  273. }
  274. void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
  275. const char *libName,
  276. cmTarget &target)
  277. {
  278. // For utility targets need custom command since pre- and post-
  279. // build does not do anything in Visual Studio 6. In order for the
  280. // rules to run in the correct order as custom commands, we need
  281. // special care for dependencies. The first rule must depend on all
  282. // the dependencies of all the rules. The later rules must each
  283. // depend only on the previous rule.
  284. if ((target.GetType() == cmTarget::UTILITY ||
  285. target.GetType() == cmTarget::GLOBAL_TARGET) &&
  286. (!target.GetPreBuildCommands().empty() ||
  287. !target.GetPostBuildCommands().empty()))
  288. {
  289. // Accumulate the dependencies of all the commands.
  290. std::vector<std::string> depends;
  291. for (std::vector<cmCustomCommand>::const_iterator cr =
  292. target.GetPreBuildCommands().begin();
  293. cr != target.GetPreBuildCommands().end(); ++cr)
  294. {
  295. depends.insert(depends.end(),
  296. cr->GetDepends().begin(), cr->GetDepends().end());
  297. }
  298. for (std::vector<cmCustomCommand>::const_iterator cr =
  299. target.GetPostBuildCommands().begin();
  300. cr != target.GetPostBuildCommands().end(); ++cr)
  301. {
  302. depends.insert(depends.end(),
  303. cr->GetDepends().begin(), cr->GetDepends().end());
  304. }
  305. // Add the pre- and post-build commands in order.
  306. int count = 1;
  307. for (std::vector<cmCustomCommand>::const_iterator cr =
  308. target.GetPreBuildCommands().begin();
  309. cr != target.GetPreBuildCommands().end(); ++cr)
  310. {
  311. this->AddUtilityCommandHack(target, count++, depends, *cr);
  312. }
  313. for (std::vector<cmCustomCommand>::const_iterator cr =
  314. target.GetPostBuildCommands().begin();
  315. cr != target.GetPostBuildCommands().end(); ++cr)
  316. {
  317. this->AddUtilityCommandHack(target, count++, depends, *cr);
  318. }
  319. }
  320. // We may be modifying the source groups temporarily, so make a copy.
  321. std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
  322. // get the classes from the source lists then add them to the groups
  323. std::vector<cmSourceFile*> const & classes = target.GetSourceFiles();
  324. // now all of the source files have been properly assigned to the target
  325. // now stick them into source groups using the reg expressions
  326. for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
  327. i != classes.end(); i++)
  328. {
  329. // Add the file to the list of sources.
  330. std::string source = (*i)->GetFullPath();
  331. cmSourceGroup& sourceGroup =
  332. this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
  333. sourceGroup.AssignSource(*i);
  334. // while we are at it, if it is a .rule file then for visual studio 6 we
  335. // must generate it
  336. if ((*i)->GetExtension() == "rule")
  337. {
  338. if(!cmSystemTools::FileExists(source.c_str()))
  339. {
  340. cmSystemTools::ReplaceString(source, "$(IntDir)/", "");
  341. #if defined(_WIN32) || defined(__CYGWIN__)
  342. std::ofstream fout(source.c_str(),
  343. std::ios::binary | std::ios::out
  344. | std::ios::trunc);
  345. #else
  346. std::ofstream fout(source.c_str(),
  347. std::ios::out | std::ios::trunc);
  348. #endif
  349. if(fout)
  350. {
  351. fout.write("# generated from CMake",22);
  352. fout.flush();
  353. fout.close();
  354. }
  355. }
  356. }
  357. }
  358. // Compute which sources need unique object computation.
  359. this->ComputeObjectNameRequirements(sourceGroups);
  360. // Write the DSP file's header.
  361. this->WriteDSPHeader(fout, libName, target, sourceGroups);
  362. // Loop through every source group.
  363. for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin();
  364. sg != sourceGroups.end(); ++sg)
  365. {
  366. this->WriteGroup(&(*sg), target, fout, libName);
  367. }
  368. // Write the DSP file's footer.
  369. this->WriteDSPFooter(fout);
  370. }
  371. void cmLocalVisualStudio6Generator
  372. ::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
  373. std::ostream &fout, const char *libName)
  374. {
  375. const std::vector<const cmSourceFile *> &sourceFiles =
  376. sg->GetSourceFiles();
  377. // If the group is empty, don't write it at all.
  378. if(sourceFiles.empty() && sg->GetGroupChildren().empty())
  379. {
  380. return;
  381. }
  382. // If the group has a name, write the header.
  383. std::string name = sg->GetName();
  384. if(name != "")
  385. {
  386. this->WriteDSPBeginGroup(fout, name.c_str(), "");
  387. }
  388. // Compute the maximum length configuration name.
  389. std::string config_max;
  390. for(std::vector<std::string>::iterator i = this->Configurations.begin();
  391. i != this->Configurations.end(); ++i)
  392. {
  393. // Strip the subdirectory name out of the configuration name.
  394. std::string config = this->GetConfigName(*i);
  395. if(config.size() > config_max.size())
  396. {
  397. config_max = config;
  398. }
  399. }
  400. // Compute the maximum length full path to the intermediate
  401. // files directory for any configuration. This is used to construct
  402. // object file names that do not produce paths that are too long.
  403. std::string dir_max;
  404. dir_max += this->Makefile->GetCurrentOutputDirectory();
  405. dir_max += "/";
  406. dir_max += config_max;
  407. dir_max += "/";
  408. // Loop through each source in the source group.
  409. for(std::vector<const cmSourceFile *>::const_iterator sf =
  410. sourceFiles.begin(); sf != sourceFiles.end(); ++sf)
  411. {
  412. std::string source = (*sf)->GetFullPath();
  413. const cmCustomCommand *command =
  414. (*sf)->GetCustomCommand();
  415. std::string compileFlags;
  416. std::vector<std::string> depends;
  417. std::string objectNameDir;
  418. if(this->NeedObjectName.find(*sf) != this->NeedObjectName.end())
  419. {
  420. objectNameDir =
  421. cmSystemTools::GetFilenamePath(
  422. this->GetObjectFileNameWithoutTarget(*(*sf), dir_max));
  423. }
  424. // Add per-source file flags.
  425. if(const char* cflags = (*sf)->GetProperty("COMPILE_FLAGS"))
  426. {
  427. compileFlags += cflags;
  428. }
  429. const char* lang = this->GetSourceFileLanguage(*(*sf));
  430. if(lang)
  431. {
  432. if(strcmp(lang, "CXX") == 0)
  433. {
  434. // force a C++ file type
  435. compileFlags += " /TP ";
  436. }
  437. else if(strcmp(lang, "C") == 0)
  438. {
  439. // force to c file type
  440. compileFlags += " /TC ";
  441. }
  442. }
  443. // Add per-source and per-configuration preprocessor definitions.
  444. std::map<cmStdString, cmStdString> cdmap;
  445. this->AppendDefines(compileFlags,
  446. (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang);
  447. if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_DEBUG"))
  448. {
  449. this->AppendDefines(cdmap["DEBUG"], cdefs, lang);
  450. }
  451. if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELEASE"))
  452. {
  453. this->AppendDefines(cdmap["RELEASE"], cdefs, lang);
  454. }
  455. if(const char* cdefs =
  456. (*sf)->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"))
  457. {
  458. this->AppendDefines(cdmap["MINSIZEREL"], cdefs, lang);
  459. }
  460. if(const char* cdefs =
  461. (*sf)->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"))
  462. {
  463. this->AppendDefines(cdmap["RELWITHDEBINFO"], cdefs, lang);
  464. }
  465. bool excludedFromBuild =
  466. (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY"));
  467. // Check for extra object-file dependencies.
  468. const char* dependsValue = (*sf)->GetProperty("OBJECT_DEPENDS");
  469. if(dependsValue)
  470. {
  471. cmSystemTools::ExpandListArgument(dependsValue, depends);
  472. }
  473. if (GetVS6TargetName(source) != libName ||
  474. target.GetType() == cmTarget::UTILITY ||
  475. target.GetType() == cmTarget::GLOBAL_TARGET)
  476. {
  477. fout << "# Begin Source File\n\n";
  478. // Tell MS-Dev what the source is. If the compiler knows how to
  479. // build it, then it will.
  480. fout << "SOURCE=" <<
  481. this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n";
  482. if(!depends.empty())
  483. {
  484. // Write out the dependencies for the rule.
  485. fout << "USERDEP__HACK=";
  486. for(std::vector<std::string>::const_iterator d = depends.begin();
  487. d != depends.end(); ++d)
  488. {
  489. fout << "\\\n\t" <<
  490. this->ConvertToOptionallyRelativeOutputPath(d->c_str());
  491. }
  492. fout << "\n";
  493. }
  494. if (command)
  495. {
  496. const char* flags = compileFlags.size() ? compileFlags.c_str(): 0;
  497. this->WriteCustomRule(fout, source.c_str(), *command, flags);
  498. }
  499. else if(!compileFlags.empty() || !objectNameDir.empty() ||
  500. excludedFromBuild || !cdmap.empty())
  501. {
  502. for(std::vector<std::string>::iterator i
  503. = this->Configurations.begin();
  504. i != this->Configurations.end(); ++i)
  505. {
  506. // Strip the subdirectory name out of the configuration name.
  507. std::string config = this->GetConfigName(*i);
  508. if (i == this->Configurations.begin())
  509. {
  510. fout << "!IF \"$(CFG)\" == " << i->c_str() << std::endl;
  511. }
  512. else
  513. {
  514. fout << "!ELSEIF \"$(CFG)\" == " << i->c_str() << std::endl;
  515. }
  516. if(excludedFromBuild)
  517. {
  518. fout << "# PROP Exclude_From_Build 1\n";
  519. }
  520. if(!compileFlags.empty())
  521. {
  522. fout << "\n# ADD CPP " << compileFlags << "\n\n";
  523. }
  524. std::map<cmStdString, cmStdString>::iterator cdi =
  525. cdmap.find(cmSystemTools::UpperCase(config));
  526. if(cdi != cdmap.end() && !cdi->second.empty())
  527. {
  528. fout << "\n# ADD CPP " << cdi->second << "\n\n";
  529. }
  530. if(!objectNameDir.empty())
  531. {
  532. // Setup an alternate object file directory.
  533. fout << "\n# PROP Intermediate_Dir \""
  534. << config << "/" << objectNameDir << "\"\n\n";
  535. }
  536. }
  537. fout << "!ENDIF\n\n";
  538. }
  539. fout << "# End Source File\n";
  540. }
  541. }
  542. std::vector<cmSourceGroup> const& children = sg->GetGroupChildren();
  543. for(unsigned int i=0;i<children.size();++i)
  544. {
  545. this->WriteGroup(&children[i], target, fout, libName);
  546. }
  547. // If the group has a name, write the footer.
  548. if(name != "")
  549. {
  550. this->WriteDSPEndGroup(fout);
  551. }
  552. }
  553. void
  554. cmLocalVisualStudio6Generator
  555. ::AddUtilityCommandHack(cmTarget& target, int count,
  556. std::vector<std::string>& depends,
  557. const cmCustomCommand& origCommand)
  558. {
  559. // Create a fake output that forces the rule to run.
  560. char* output = new char[(strlen(this->Makefile->GetStartOutputDirectory()) +
  561. strlen(target.GetName()) + 30)];
  562. sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(),
  563. target.GetName(), count);
  564. std::string comment = this->ConstructComment(origCommand, "<hack>");
  565. // Add the rule with the given dependencies and commands.
  566. const char* no_main_dependency = 0;
  567. this->Makefile->AddCustomCommandToOutput(output,
  568. depends,
  569. no_main_dependency,
  570. origCommand.GetCommandLines(),
  571. comment.c_str(),
  572. origCommand.GetWorkingDirectory());
  573. // Replace the dependencies with the output of this rule so that the
  574. // next rule added will run after this one.
  575. depends.clear();
  576. depends.push_back(output);
  577. // Add a source file representing this output to the project.
  578. cmSourceFile* outsf = this->Makefile->GetSourceFileWithOutput(output);
  579. target.AddSourceFile(outsf);
  580. // Free the fake output name.
  581. delete [] output;
  582. }
  583. void
  584. cmLocalVisualStudio6Generator
  585. ::WriteCustomRule(std::ostream& fout,
  586. const char* source,
  587. const cmCustomCommand& command,
  588. const char* flags)
  589. {
  590. std::string comment =
  591. this->ConstructComment(command, "Building Custom Rule $(InputPath)");
  592. if(comment == "<hack>")
  593. {
  594. comment = "";
  595. }
  596. // Write the rule for each configuration.
  597. std::vector<std::string>::iterator i;
  598. for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i)
  599. {
  600. std::string config = this->GetConfigName(*i);
  601. std::string script =
  602. this->ConstructScript(command.GetCommandLines(),
  603. command.GetWorkingDirectory(),
  604. config.c_str(),
  605. command.GetEscapeOldStyle(),
  606. command.GetEscapeAllowMakeVars(),
  607. "\\\n\t");
  608. if (i == this->Configurations.begin())
  609. {
  610. fout << "!IF \"$(CFG)\" == " << i->c_str() << std::endl;
  611. }
  612. else
  613. {
  614. fout << "!ELSEIF \"$(CFG)\" == " << i->c_str() << std::endl;
  615. }
  616. if(flags)
  617. {
  618. fout << "\n# ADD CPP " << flags << "\n\n";
  619. }
  620. // Write out the dependencies for the rule.
  621. fout << "USERDEP__HACK=";
  622. for(std::vector<std::string>::const_iterator d =
  623. command.GetDepends().begin();
  624. d != command.GetDepends().end();
  625. ++d)
  626. {
  627. // Lookup the real name of the dependency in case it is a CMake target.
  628. std::string dep = this->GetRealDependency(d->c_str(),
  629. config.c_str());
  630. fout << "\\\n\t" <<
  631. this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
  632. }
  633. fout << "\n";
  634. fout << "# PROP Ignore_Default_Tool 1\n";
  635. fout << "# Begin Custom Build -";
  636. if(!comment.empty())
  637. {
  638. fout << " " << comment.c_str();
  639. }
  640. fout << "\n\n";
  641. if(command.GetOutputs().empty())
  642. {
  643. fout << source
  644. << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
  645. fout << script.c_str() << "\n\n";
  646. }
  647. else
  648. {
  649. for(std::vector<std::string>::const_iterator o =
  650. command.GetOutputs().begin();
  651. o != command.GetOutputs().end();
  652. ++o)
  653. {
  654. // Write a rule for every output generated by this command.
  655. fout << this->ConvertToOptionallyRelativeOutputPath(o->c_str())
  656. << " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
  657. fout << script.c_str() << "\n\n";
  658. }
  659. }
  660. fout << "# End Custom Build\n\n";
  661. }
  662. fout << "!ENDIF\n\n";
  663. }
  664. void cmLocalVisualStudio6Generator::WriteDSPBeginGroup(std::ostream& fout,
  665. const char* group,
  666. const char* filter)
  667. {
  668. fout << "# Begin Group \"" << group << "\"\n"
  669. "# PROP Default_Filter \"" << filter << "\"\n";
  670. }
  671. void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout)
  672. {
  673. fout << "# End Group\n";
  674. }
  675. void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
  676. const char* libName,
  677. cmTarget& target)
  678. {
  679. std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT");
  680. const char *def=
  681. this->Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
  682. if( def)
  683. {
  684. root = def;
  685. }
  686. else
  687. {
  688. root += "/Templates";
  689. }
  690. switch(b)
  691. {
  692. case STATIC_LIBRARY:
  693. this->DSPHeaderTemplate = root;
  694. this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate";
  695. this->DSPFooterTemplate = root;
  696. this->DSPFooterTemplate += "/staticLibFooter.dsptemplate";
  697. break;
  698. case DLL:
  699. this->DSPHeaderTemplate = root;
  700. this->DSPHeaderTemplate += "/DLLHeader.dsptemplate";
  701. this->DSPFooterTemplate = root;
  702. this->DSPFooterTemplate += "/DLLFooter.dsptemplate";
  703. break;
  704. case EXECUTABLE:
  705. if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") )
  706. {
  707. this->DSPHeaderTemplate = root;
  708. this->DSPHeaderTemplate += "/EXEWinHeader.dsptemplate";
  709. this->DSPFooterTemplate = root;
  710. this->DSPFooterTemplate += "/EXEFooter.dsptemplate";
  711. }
  712. else
  713. {
  714. this->DSPHeaderTemplate = root;
  715. this->DSPHeaderTemplate += "/EXEHeader.dsptemplate";
  716. this->DSPFooterTemplate = root;
  717. this->DSPFooterTemplate += "/EXEFooter.dsptemplate";
  718. }
  719. break;
  720. case UTILITY:
  721. this->DSPHeaderTemplate = root;
  722. this->DSPHeaderTemplate += "/UtilityHeader.dsptemplate";
  723. this->DSPFooterTemplate = root;
  724. this->DSPFooterTemplate += "/UtilityFooter.dsptemplate";
  725. break;
  726. }
  727. // once the build type is set, determine what configurations are
  728. // possible
  729. std::ifstream fin(this->DSPHeaderTemplate.c_str());
  730. cmsys::RegularExpression reg("# Name ");
  731. if(!fin)
  732. {
  733. cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str());
  734. }
  735. // reset this->Configurations
  736. this->Configurations.erase(this->Configurations.begin(),
  737. this->Configurations.end());
  738. // now add all the configurations possible
  739. std::string vs6name = GetVS6TargetName(libName);
  740. std::string line;
  741. while(cmSystemTools::GetLineFromStream(fin, line))
  742. {
  743. cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str());
  744. if (reg.find(line))
  745. {
  746. this->Configurations.push_back(line.substr(reg.end()));
  747. }
  748. }
  749. }
  750. // look for custom rules on a target and collect them together
  751. std::string
  752. cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
  753. const char* configName,
  754. const char * /* libName */)
  755. {
  756. if (target.GetType() >= cmTarget::UTILITY )
  757. {
  758. return "";
  759. }
  760. std::string customRuleCode = "# Begin Special Build Tool\n";
  761. EventWriter event(this, configName, customRuleCode);
  762. // Write the pre-build and pre-link together (VS6 does not support both).
  763. event.Start("PreLink");
  764. event.Write(target.GetPreBuildCommands());
  765. event.Write(target.GetPreLinkCommands());
  766. cmsys::auto_ptr<cmCustomCommand> pcc(
  767. this->MaybeCreateImplibDir(target, configName));
  768. if(pcc.get())
  769. {
  770. event.Write(*pcc);
  771. }
  772. event.Finish();
  773. // Write the post-build rules.
  774. event.Start("PostBuild");
  775. event.Write(target.GetPostBuildCommands());
  776. event.Finish();
  777. customRuleCode += "# End Special Build Tool\n";
  778. return customRuleCode;
  779. }
  780. inline std::string removeQuotes(const std::string& s)
  781. {
  782. if(s[0] == '\"' && s[s.size()-1] == '\"')
  783. {
  784. return s.substr(1, s.size()-2);
  785. }
  786. return s;
  787. }
  788. // Code in blocks surrounded by a test for this definition is needed
  789. // only for compatibility with user project's replacement DSP
  790. // templates. The CMake templates no longer use them.
  791. #define CM_USE_OLD_VS6
  792. void cmLocalVisualStudio6Generator
  793. ::WriteDSPHeader(std::ostream& fout,
  794. const char *libName, cmTarget &target,
  795. std::vector<cmSourceGroup> &)
  796. {
  797. // Lookup the output directory for the target.
  798. std::string outPath = target.GetDirectory();
  799. #ifdef CM_USE_OLD_VS6
  800. // Lookup the library and executable output directories.
  801. std::string libPath;
  802. if(this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
  803. {
  804. libPath = this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
  805. }
  806. std::string exePath;
  807. if(this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
  808. {
  809. exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
  810. }
  811. // Make sure there are trailing slashes.
  812. if(!libPath.empty())
  813. {
  814. if(libPath[libPath.size()-1] != '/')
  815. {
  816. libPath += "/";
  817. }
  818. }
  819. if(!exePath.empty())
  820. {
  821. if(exePath[exePath.size()-1] != '/')
  822. {
  823. exePath += "/";
  824. }
  825. }
  826. std::set<std::string> pathEmitted;
  827. // determine the link directories
  828. std::string libOptions;
  829. std::string libDebugOptions;
  830. std::string libOptimizedOptions;
  831. std::string libMultiLineOptions;
  832. std::string libMultiLineOptionsForDebug;
  833. std::string libMultiLineDebugOptions;
  834. std::string libMultiLineOptimizedOptions;
  835. if(libPath.size())
  836. {
  837. std::string lpath =
  838. this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
  839. if(lpath.size() == 0)
  840. {
  841. lpath = ".";
  842. }
  843. std::string lpathIntDir = libPath + "$(INTDIR)";
  844. lpathIntDir =
  845. this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
  846. if(pathEmitted.insert(lpath).second)
  847. {
  848. libOptions += " /LIBPATH:";
  849. libOptions += lpathIntDir;
  850. libOptions += " ";
  851. libOptions += " /LIBPATH:";
  852. libOptions += lpath;
  853. libOptions += " ";
  854. libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
  855. libMultiLineOptions += lpathIntDir;
  856. libMultiLineOptions += " ";
  857. libMultiLineOptions += " /LIBPATH:";
  858. libMultiLineOptions += lpath;
  859. libMultiLineOptions += " \n";
  860. libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
  861. libMultiLineOptionsForDebug += lpathIntDir;
  862. libMultiLineOptionsForDebug += " ";
  863. libMultiLineOptionsForDebug += " /LIBPATH:";
  864. libMultiLineOptionsForDebug += lpath;
  865. libMultiLineOptionsForDebug += " \n";
  866. }
  867. }
  868. if(exePath.size())
  869. {
  870. std::string lpath =
  871. this->ConvertToOptionallyRelativeOutputPath(exePath.c_str());
  872. if(lpath.size() == 0)
  873. {
  874. lpath = ".";
  875. }
  876. std::string lpathIntDir = exePath + "$(INTDIR)";
  877. lpathIntDir =
  878. this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
  879. if(pathEmitted.insert(lpath).second)
  880. {
  881. libOptions += " /LIBPATH:";
  882. libOptions += lpathIntDir;
  883. libOptions += " ";
  884. libOptions += " /LIBPATH:";
  885. libOptions += lpath;
  886. libOptions += " ";
  887. libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
  888. libMultiLineOptions += lpathIntDir;
  889. libMultiLineOptions += " ";
  890. libMultiLineOptions += " /LIBPATH:";
  891. libMultiLineOptions += lpath;
  892. libMultiLineOptions += " \n";
  893. libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
  894. libMultiLineOptionsForDebug += lpathIntDir;
  895. libMultiLineOptionsForDebug += " ";
  896. libMultiLineOptionsForDebug += " /LIBPATH:";
  897. libMultiLineOptionsForDebug += lpath;
  898. libMultiLineOptionsForDebug += " \n";
  899. }
  900. }
  901. std::vector<std::string>::const_iterator i;
  902. const std::vector<std::string>& libdirs = target.GetLinkDirectories();
  903. for(i = libdirs.begin(); i != libdirs.end(); ++i)
  904. {
  905. std::string path = *i;
  906. if(path[path.size()-1] != '/')
  907. {
  908. path += "/";
  909. }
  910. std::string lpath =
  911. this->ConvertToOptionallyRelativeOutputPath(path.c_str());
  912. if(lpath.size() == 0)
  913. {
  914. lpath = ".";
  915. }
  916. std::string lpathIntDir = path + "$(INTDIR)";
  917. lpathIntDir =
  918. this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
  919. if(pathEmitted.insert(lpath).second)
  920. {
  921. libOptions += " /LIBPATH:";
  922. libOptions += lpathIntDir;
  923. libOptions += " ";
  924. libOptions += " /LIBPATH:";
  925. libOptions += lpath;
  926. libOptions += " ";
  927. libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
  928. libMultiLineOptions += lpathIntDir;
  929. libMultiLineOptions += " ";
  930. libMultiLineOptions += " /LIBPATH:";
  931. libMultiLineOptions += lpath;
  932. libMultiLineOptions += " \n";
  933. libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
  934. libMultiLineOptionsForDebug += lpathIntDir;
  935. libMultiLineOptionsForDebug += " ";
  936. libMultiLineOptionsForDebug += " /LIBPATH:";
  937. libMultiLineOptionsForDebug += lpath;
  938. libMultiLineOptionsForDebug += " \n";
  939. }
  940. }
  941. // find link libraries
  942. const cmTarget::LinkLibraryVectorType& libs = target.GetLinkLibraries();
  943. cmTarget::LinkLibraryVectorType::const_iterator j;
  944. for(j = libs.begin(); j != libs.end(); ++j)
  945. {
  946. // add libraries to executables and dlls (but never include
  947. // a library in a library, bad recursion)
  948. // NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES
  949. if ((target.GetType() != cmTarget::SHARED_LIBRARY
  950. && target.GetType() != cmTarget::STATIC_LIBRARY
  951. && target.GetType() != cmTarget::MODULE_LIBRARY) ||
  952. (target.GetType()==cmTarget::SHARED_LIBRARY
  953. && libName != GetVS6TargetName(j->first)) ||
  954. (target.GetType()==cmTarget::MODULE_LIBRARY
  955. && libName != GetVS6TargetName(j->first)))
  956. {
  957. // Compute the proper name to use to link this library.
  958. std::string lib;
  959. std::string libDebug;
  960. cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str());
  961. if(tgt)
  962. {
  963. lib = cmSystemTools::GetFilenameWithoutExtension
  964. (tgt->GetFullName().c_str());
  965. libDebug = cmSystemTools::GetFilenameWithoutExtension
  966. (tgt->GetFullName("Debug").c_str());
  967. lib += ".lib";
  968. libDebug += ".lib";
  969. }
  970. else
  971. {
  972. lib = j->first.c_str();
  973. libDebug = j->first.c_str();
  974. if(j->first.find(".lib") == std::string::npos)
  975. {
  976. lib += ".lib";
  977. libDebug += ".lib";
  978. }
  979. }
  980. lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str());
  981. libDebug =
  982. this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str());
  983. if (j->second == cmTarget::GENERAL)
  984. {
  985. libOptions += " ";
  986. libOptions += lib;
  987. libMultiLineOptions += "# ADD LINK32 ";
  988. libMultiLineOptions += lib;
  989. libMultiLineOptions += "\n";
  990. libMultiLineOptionsForDebug += "# ADD LINK32 ";
  991. libMultiLineOptionsForDebug += libDebug;
  992. libMultiLineOptionsForDebug += "\n";
  993. }
  994. if (j->second == cmTarget::DEBUG)
  995. {
  996. libDebugOptions += " ";
  997. libDebugOptions += lib;
  998. libMultiLineDebugOptions += "# ADD LINK32 ";
  999. libMultiLineDebugOptions += libDebug;
  1000. libMultiLineDebugOptions += "\n";
  1001. }
  1002. if (j->second == cmTarget::OPTIMIZED)
  1003. {
  1004. libOptimizedOptions += " ";
  1005. libOptimizedOptions += lib;
  1006. libMultiLineOptimizedOptions += "# ADD LINK32 ";
  1007. libMultiLineOptimizedOptions += lib;
  1008. libMultiLineOptimizedOptions += "\n";
  1009. }
  1010. }
  1011. }
  1012. #endif
  1013. // Get extra linker options for this target type.
  1014. std::string extraLinkOptions;
  1015. if(target.GetType() == cmTarget::EXECUTABLE)
  1016. {
  1017. extraLinkOptions =
  1018. this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
  1019. }
  1020. if(target.GetType() == cmTarget::SHARED_LIBRARY)
  1021. {
  1022. extraLinkOptions =
  1023. this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
  1024. }
  1025. if(target.GetType() == cmTarget::MODULE_LIBRARY)
  1026. {
  1027. extraLinkOptions =
  1028. this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
  1029. }
  1030. // Get extra linker options for this target.
  1031. if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"))
  1032. {
  1033. extraLinkOptions += " ";
  1034. extraLinkOptions += targetLinkFlags;
  1035. }
  1036. // Get standard libraries for this language.
  1037. if(target.GetType() >= cmTarget::EXECUTABLE &&
  1038. target.GetType() <= cmTarget::MODULE_LIBRARY)
  1039. {
  1040. // Get the language to use for linking.
  1041. const char* linkLanguage =
  1042. target.GetLinkerLanguage(this->GetGlobalGenerator());
  1043. if(!linkLanguage)
  1044. {
  1045. cmSystemTools::Error
  1046. ("CMake can not determine linker language for target:",
  1047. target.GetName());
  1048. return;
  1049. }
  1050. // Compute the variable name to lookup standard libraries for this
  1051. // language.
  1052. std::string standardLibsVar = "CMAKE_";
  1053. standardLibsVar += linkLanguage;
  1054. standardLibsVar += "_STANDARD_LIBRARIES";
  1055. // Add standard libraries.
  1056. if(const char* stdLibs =
  1057. this->Makefile->GetDefinition(standardLibsVar.c_str()))
  1058. {
  1059. extraLinkOptions += " ";
  1060. extraLinkOptions += stdLibs;
  1061. }
  1062. }
  1063. // Compute version number information.
  1064. std::string targetVersionFlag;
  1065. if(target.GetType() == cmTarget::EXECUTABLE ||
  1066. target.GetType() == cmTarget::SHARED_LIBRARY ||
  1067. target.GetType() == cmTarget::MODULE_LIBRARY)
  1068. {
  1069. int major;
  1070. int minor;
  1071. target.GetTargetVersion(major, minor);
  1072. cmOStringStream targetVersionStream;
  1073. targetVersionStream << "/version:" << major << "." << minor;
  1074. targetVersionFlag = targetVersionStream.str();
  1075. }
  1076. // Compute the real name of the target.
  1077. std::string outputName =
  1078. "(OUTPUT_NAME is for libraries and executables only)";
  1079. std::string outputNameDebug = outputName;
  1080. std::string outputNameRelease = outputName;
  1081. std::string outputNameMinSizeRel = outputName;
  1082. std::string outputNameRelWithDebInfo = outputName;
  1083. if(target.GetType() == cmTarget::EXECUTABLE ||
  1084. target.GetType() == cmTarget::STATIC_LIBRARY ||
  1085. target.GetType() == cmTarget::SHARED_LIBRARY ||
  1086. target.GetType() == cmTarget::MODULE_LIBRARY)
  1087. {
  1088. outputName = target.GetFullName();
  1089. outputNameDebug = target.GetFullName("Debug");
  1090. outputNameRelease = target.GetFullName("Release");
  1091. outputNameMinSizeRel = target.GetFullName("MinSizeRel");
  1092. outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo");
  1093. }
  1094. // Compute the proper link information for the target.
  1095. std::string optionsDebug;
  1096. std::string optionsRelease;
  1097. std::string optionsMinSizeRel;
  1098. std::string optionsRelWithDebInfo;
  1099. if(target.GetType() == cmTarget::EXECUTABLE ||
  1100. target.GetType() == cmTarget::SHARED_LIBRARY ||
  1101. target.GetType() == cmTarget::MODULE_LIBRARY)
  1102. {
  1103. this->ComputeLinkOptions(target, "Debug", extraLinkOptions,
  1104. optionsDebug);
  1105. this->ComputeLinkOptions(target, "Release", extraLinkOptions,
  1106. optionsRelease);
  1107. this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptions,
  1108. optionsMinSizeRel);
  1109. this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptions,
  1110. optionsRelWithDebInfo);
  1111. }
  1112. // Compute the path of the import library.
  1113. std::string targetImplibFlagDebug;
  1114. std::string targetImplibFlagRelease;
  1115. std::string targetImplibFlagMinSizeRel;
  1116. std::string targetImplibFlagRelWithDebInfo;
  1117. if(target.GetType() == cmTarget::SHARED_LIBRARY ||
  1118. target.GetType() == cmTarget::MODULE_LIBRARY ||
  1119. target.GetType() == cmTarget::EXECUTABLE)
  1120. {
  1121. std::string fullPathImpDebug = target.GetDirectory("Debug", true);
  1122. std::string fullPathImpRelease = target.GetDirectory("Release", true);
  1123. std::string fullPathImpMinSizeRel =
  1124. target.GetDirectory("MinSizeRel", true);
  1125. std::string fullPathImpRelWithDebInfo =
  1126. target.GetDirectory("RelWithDebInfo", true);
  1127. fullPathImpDebug += "/";
  1128. fullPathImpRelease += "/";
  1129. fullPathImpMinSizeRel += "/";
  1130. fullPathImpRelWithDebInfo += "/";
  1131. fullPathImpDebug += target.GetFullName("Debug", true);
  1132. fullPathImpRelease += target.GetFullName("Release", true);
  1133. fullPathImpMinSizeRel += target.GetFullName("MinSizeRel", true);
  1134. fullPathImpRelWithDebInfo += target.GetFullName("RelWithDebInfo", true);
  1135. targetImplibFlagDebug = "/implib:";
  1136. targetImplibFlagRelease = "/implib:";
  1137. targetImplibFlagMinSizeRel = "/implib:";
  1138. targetImplibFlagRelWithDebInfo = "/implib:";
  1139. targetImplibFlagDebug +=
  1140. this->ConvertToOptionallyRelativeOutputPath(fullPathImpDebug.c_str());
  1141. targetImplibFlagRelease +=
  1142. this->ConvertToOptionallyRelativeOutputPath(fullPathImpRelease.c_str());
  1143. targetImplibFlagMinSizeRel +=
  1144. this->ConvertToOptionallyRelativeOutputPath(
  1145. fullPathImpMinSizeRel.c_str());
  1146. targetImplibFlagRelWithDebInfo +=
  1147. this->ConvertToOptionallyRelativeOutputPath(
  1148. fullPathImpRelWithDebInfo.c_str());
  1149. }
  1150. #ifdef CM_USE_OLD_VS6
  1151. // Compute link information for the target.
  1152. if(extraLinkOptions.size())
  1153. {
  1154. libOptions += " ";
  1155. libOptions += extraLinkOptions;
  1156. libOptions += " ";
  1157. libMultiLineOptions += "# ADD LINK32 ";
  1158. libMultiLineOptions += extraLinkOptions;
  1159. libMultiLineOptions += " \n";
  1160. libMultiLineOptionsForDebug += "# ADD LINK32 ";
  1161. libMultiLineOptionsForDebug += extraLinkOptions;
  1162. libMultiLineOptionsForDebug += " \n";
  1163. }
  1164. #endif
  1165. // are there any custom rules on the target itself
  1166. // only if the target is a lib or exe
  1167. std::string customRuleCodeRelease
  1168. = this->CreateTargetRules(target, "RELEASE", libName);
  1169. std::string customRuleCodeDebug
  1170. = this->CreateTargetRules(target, "DEBUG", libName);
  1171. std::string customRuleCodeMinSizeRel
  1172. = this->CreateTargetRules(target, "MINSIZEREL", libName);
  1173. std::string customRuleCodeRelWithDebInfo
  1174. = this->CreateTargetRules(target, "RELWITHDEBINFO", libName);
  1175. std::ifstream fin(this->DSPHeaderTemplate.c_str());
  1176. if(!fin)
  1177. {
  1178. cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str());
  1179. }
  1180. std::string staticLibOptions;
  1181. if(target.GetType() == cmTarget::STATIC_LIBRARY )
  1182. {
  1183. if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
  1184. {
  1185. staticLibOptions = libflags;
  1186. }
  1187. }
  1188. // Add the export symbol definition for shared library objects.
  1189. std::string exportSymbol;
  1190. if(const char* exportMacro = target.GetExportMacro())
  1191. {
  1192. exportSymbol = exportMacro;
  1193. }
  1194. std::string line;
  1195. std::string libnameExports;
  1196. if(exportSymbol.size())
  1197. {
  1198. libnameExports = "/D \"";
  1199. libnameExports += exportSymbol;
  1200. libnameExports += "\"";
  1201. }
  1202. while(cmSystemTools::GetLineFromStream(fin, line))
  1203. {
  1204. const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
  1205. if(!mfcFlag)
  1206. {
  1207. mfcFlag = "0";
  1208. }
  1209. cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME_EXPORTS",
  1210. libnameExports.c_str());
  1211. cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG",
  1212. mfcFlag);
  1213. if(target.GetType() == cmTarget::STATIC_LIBRARY )
  1214. {
  1215. cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS",
  1216. staticLibOptions.c_str());
  1217. }
  1218. if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
  1219. {
  1220. cmSystemTools::ReplaceString(line, "/nologo", "");
  1221. }
  1222. #ifdef CM_USE_OLD_VS6
  1223. cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
  1224. libOptions.c_str());
  1225. cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
  1226. libDebugOptions.c_str());
  1227. cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
  1228. libOptimizedOptions.c_str());
  1229. cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES_FOR_DEBUG",
  1230. libMultiLineOptionsForDebug.c_str());
  1231. cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES",
  1232. libMultiLineOptions.c_str());
  1233. cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES",
  1234. libMultiLineDebugOptions.c_str());
  1235. cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES",
  1236. libMultiLineOptimizedOptions.c_str());
  1237. #endif
  1238. // Substitute the rules for custom command. When specifying just the
  1239. // target name for the command the command can be different for
  1240. // different configs
  1241. cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE_RELEASE",
  1242. customRuleCodeRelease.c_str());
  1243. cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE_DEBUG",
  1244. customRuleCodeDebug.c_str());
  1245. cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE_MINSIZEREL",
  1246. customRuleCodeMinSizeRel.c_str());
  1247. cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE_RELWITHDEBINFO",
  1248. customRuleCodeRelWithDebInfo.c_str());
  1249. // Substitute the real output name into the template.
  1250. cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG",
  1251. outputNameDebug.c_str());
  1252. cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE",
  1253. outputNameRelease.c_str());
  1254. cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL",
  1255. outputNameMinSizeRel.c_str());
  1256. cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO",
  1257. outputNameRelWithDebInfo.c_str());
  1258. cmSystemTools::ReplaceString(line, "OUTPUT_NAME", outputName.c_str());
  1259. // Substitute the proper link information into the template.
  1260. cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_DEBUG",
  1261. optionsDebug.c_str());
  1262. cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE",
  1263. optionsRelease.c_str());
  1264. cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL",
  1265. optionsMinSizeRel.c_str());
  1266. cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO",
  1267. optionsRelWithDebInfo.c_str());
  1268. cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
  1269. this->IncludeOptions.c_str());
  1270. cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG",
  1271. targetVersionFlag.c_str());
  1272. cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG",
  1273. targetImplibFlagDebug.c_str());
  1274. cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_RELEASE",
  1275. targetImplibFlagRelease.c_str());
  1276. cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_MINSIZEREL",
  1277. targetImplibFlagMinSizeRel.c_str());
  1278. cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_RELWITHDEBINFO",
  1279. targetImplibFlagRelWithDebInfo.c_str());
  1280. std::string vs6name = GetVS6TargetName(libName);
  1281. cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str());
  1282. #ifdef CM_USE_OLD_VS6
  1283. // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH
  1284. // are already quoted in the template file,
  1285. // we need to remove the quotes here, we still need
  1286. // to convert to output path for unix to win32 conversion
  1287. cmSystemTools::ReplaceString
  1288. (line, "LIBRARY_OUTPUT_PATH",
  1289. removeQuotes(this->ConvertToOptionallyRelativeOutputPath
  1290. (libPath.c_str())).c_str());
  1291. cmSystemTools::ReplaceString
  1292. (line, "EXECUTABLE_OUTPUT_PATH",
  1293. removeQuotes(this->ConvertToOptionallyRelativeOutputPath
  1294. (exePath.c_str())).c_str());
  1295. #endif
  1296. cmSystemTools::ReplaceString
  1297. (line, "OUTPUT_DIRECTORY",
  1298. removeQuotes(this->ConvertToOptionallyRelativeOutputPath
  1299. (outPath.c_str())).c_str());
  1300. cmSystemTools::ReplaceString(line,
  1301. "EXTRA_DEFINES",
  1302. this->Makefile->GetDefineFlags());
  1303. const char* debugPostfix
  1304. = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
  1305. cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
  1306. debugPostfix?debugPostfix:"");
  1307. // store flags for each configuration
  1308. std::string flags = " ";
  1309. std::string flagsRelease = " ";
  1310. std::string flagsMinSize = " ";
  1311. std::string flagsDebug = " ";
  1312. std::string flagsDebugRel = " ";
  1313. if(target.GetType() >= cmTarget::EXECUTABLE &&
  1314. target.GetType() <= cmTarget::MODULE_LIBRARY)
  1315. {
  1316. const char* linkLanguage =
  1317. target.GetLinkerLanguage(this->GetGlobalGenerator());
  1318. if(!linkLanguage)
  1319. {
  1320. cmSystemTools::Error
  1321. ("CMake can not determine linker language for target:",
  1322. target.GetName());
  1323. return;
  1324. }
  1325. // if CXX is on and the target contains cxx code then add the cxx flags
  1326. std::string baseFlagVar = "CMAKE_";
  1327. baseFlagVar += linkLanguage;
  1328. baseFlagVar += "_FLAGS";
  1329. flags = this->Makefile->GetSafeDefinition(baseFlagVar.c_str());
  1330. std::string flagVar = baseFlagVar + "_RELEASE";
  1331. flagsRelease = this->Makefile->GetSafeDefinition(flagVar.c_str());
  1332. flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" ";
  1333. if(const char* targetLinkFlags =
  1334. target.GetProperty("LINK_FLAGS_RELEASE"))
  1335. {
  1336. flagsRelease += targetLinkFlags;
  1337. flagsRelease += " ";
  1338. }
  1339. flagVar = baseFlagVar + "_MINSIZEREL";
  1340. flagsMinSize = this->Makefile->GetSafeDefinition(flagVar.c_str());
  1341. flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" ";
  1342. if(const char* targetLinkFlags =
  1343. target.GetProperty("LINK_FLAGS_MINSIZEREL"))
  1344. {
  1345. flagsMinSize += targetLinkFlags;
  1346. flagsMinSize += " ";
  1347. }
  1348. flagVar = baseFlagVar + "_DEBUG";
  1349. flagsDebug = this->Makefile->GetSafeDefinition(flagVar.c_str());
  1350. flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\" ";
  1351. if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG"))
  1352. {
  1353. flagsDebug += targetLinkFlags;
  1354. flagsDebug += " ";
  1355. }
  1356. flagVar = baseFlagVar + "_RELWITHDEBINFO";
  1357. flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str());
  1358. flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
  1359. if(const char* targetLinkFlags =
  1360. target.GetProperty("LINK_FLAGS_RELWITHDEBINFO"))
  1361. {
  1362. flagsDebugRel += targetLinkFlags;
  1363. flagsDebugRel += " ";
  1364. }
  1365. }
  1366. // if unicode is not found, then add -D_MBCS
  1367. std::string defs = this->Makefile->GetDefineFlags();
  1368. if(flags.find("D_UNICODE") == flags.npos &&
  1369. defs.find("D_UNICODE") == flags.npos)
  1370. {
  1371. flags += " /D \"_MBCS\"";
  1372. }
  1373. // Add per-target flags.
  1374. if(const char* targetFlags = target.GetProperty("COMPILE_FLAGS"))
  1375. {
  1376. flags += " ";
  1377. flags += targetFlags;
  1378. }
  1379. // Add per-target and per-configuration preprocessor definitions.
  1380. std::string defines = " ";
  1381. std::string debugDefines = " ";
  1382. std::string releaseDefines = " ";
  1383. std::string minsizeDefines = " ";
  1384. std::string debugrelDefines = " ";
  1385. this->AppendDefines(
  1386. defines,
  1387. this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0);
  1388. this->AppendDefines(
  1389. debugDefines,
  1390. this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0);
  1391. this->AppendDefines(
  1392. releaseDefines,
  1393. this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0);
  1394. this->AppendDefines(
  1395. minsizeDefines,
  1396. this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0);
  1397. this->AppendDefines(
  1398. debugrelDefines,
  1399. this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0);
  1400. this->AppendDefines(
  1401. defines,
  1402. target.GetProperty("COMPILE_DEFINITIONS"), 0);
  1403. this->AppendDefines(
  1404. debugDefines,
  1405. target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0);
  1406. this->AppendDefines(
  1407. releaseDefines,
  1408. target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0);
  1409. this->AppendDefines(
  1410. minsizeDefines,
  1411. target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0);
  1412. this->AppendDefines(
  1413. debugrelDefines,
  1414. target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0);
  1415. flags += defines;
  1416. flagsDebug += debugDefines;
  1417. flagsRelease += releaseDefines;
  1418. flagsMinSize += minsizeDefines;
  1419. flagsDebugRel += debugrelDefines;
  1420. // The template files have CXX FLAGS in them, that need to be replaced.
  1421. // There are not separate CXX and C template files, so we use the same
  1422. // variable names. The previous code sets up flags* variables to contain
  1423. // the correct C or CXX flags
  1424. cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL",
  1425. flagsMinSize.c_str());
  1426. cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG",
  1427. flagsDebug.c_str());
  1428. cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
  1429. flagsDebugRel.c_str());
  1430. cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE",
  1431. flagsRelease.c_str());
  1432. cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str());
  1433. cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZE",
  1434. minsizeDefines.c_str());
  1435. cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG",
  1436. debugDefines.c_str());
  1437. cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO",
  1438. debugrelDefines.c_str());
  1439. cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE",
  1440. releaseDefines.c_str());
  1441. cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str());
  1442. fout << line.c_str() << std::endl;
  1443. }
  1444. }
  1445. void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
  1446. {
  1447. std::ifstream fin(this->DSPFooterTemplate.c_str());
  1448. if(!fin)
  1449. {
  1450. cmSystemTools::Error("Error Reading ",
  1451. this->DSPFooterTemplate.c_str());
  1452. }
  1453. std::string line;
  1454. while(cmSystemTools::GetLineFromStream(fin, line))
  1455. {
  1456. fout << line << std::endl;
  1457. }
  1458. }
  1459. //----------------------------------------------------------------------------
  1460. void cmLocalVisualStudio6Generator
  1461. ::ComputeLinkOptions(cmTarget& target,
  1462. const char* configName,
  1463. const std::string extraOptions,
  1464. std::string& options)
  1465. {
  1466. // Compute the link information for this configuration.
  1467. cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
  1468. if(!pcli)
  1469. {
  1470. return;
  1471. }
  1472. cmComputeLinkInformation& cli = *pcli;
  1473. typedef cmComputeLinkInformation::ItemVector ItemVector;
  1474. ItemVector const& linkLibs = cli.GetItems();
  1475. std::vector<std::string> const& linkDirs = cli.GetDirectories();
  1476. // Build the link options code.
  1477. for(std::vector<std::string>::const_iterator d = linkDirs.begin();
  1478. d != linkDirs.end(); ++d)
  1479. {
  1480. std::string dir = *d;
  1481. if(!dir.empty())
  1482. {
  1483. if(dir[dir.size()-1] != '/')
  1484. {
  1485. dir += "/";
  1486. }
  1487. dir += "$(IntDir)";
  1488. options += "# ADD LINK32 /LIBPATH:";
  1489. options += this->ConvertToOptionallyRelativeOutputPath(dir.c_str());
  1490. options += " /LIBPATH:";
  1491. options += this->ConvertToOptionallyRelativeOutputPath(d->c_str());
  1492. options += "\n";
  1493. }
  1494. }
  1495. for(ItemVector::const_iterator l = linkLibs.begin();
  1496. l != linkLibs.end(); ++l)
  1497. {
  1498. options += "# ADD LINK32 ";
  1499. if(l->IsPath)
  1500. {
  1501. options +=
  1502. this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str());
  1503. }
  1504. else
  1505. {
  1506. options += l->Value;
  1507. }
  1508. options += "\n";
  1509. }
  1510. // Add extra options if any.
  1511. if(!extraOptions.empty())
  1512. {
  1513. options += "# ADD LINK32 ";
  1514. options += extraOptions;
  1515. options += "\n";
  1516. }
  1517. }
  1518. std::string
  1519. cmLocalVisualStudio6Generator
  1520. ::GetTargetDirectory(cmTarget const&) const
  1521. {
  1522. // No per-target directory for this generator (yet).
  1523. return "";
  1524. }
  1525. void cmLocalVisualStudio6Generator
  1526. ::GetTargetObjectFileDirectories(cmTarget* ,
  1527. std::vector<std::string>&
  1528. dirs)
  1529. {
  1530. std::string dir = this->Makefile->GetCurrentOutputDirectory();
  1531. dir += "/";
  1532. dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory();
  1533. dirs.push_back(dir);
  1534. }
  1535. std::string
  1536. cmLocalVisualStudio6Generator
  1537. ::GetConfigName(std::string const& configuration) const
  1538. {
  1539. // Strip the subdirectory name out of the configuration name.
  1540. std::string config = configuration;
  1541. std::string::size_type pos = config.find_last_of(" ");
  1542. config = config.substr(pos+1, std::string::npos);
  1543. config = config.substr(0, config.size()-1);
  1544. return config;
  1545. }
  1546. //----------------------------------------------------------------------------
  1547. bool
  1548. cmLocalVisualStudio6Generator
  1549. ::CheckDefinition(std::string const& define) const
  1550. {
  1551. // Perform the standard check first.
  1552. if(!this->cmLocalGenerator::CheckDefinition(define))
  1553. {
  1554. return false;
  1555. }
  1556. // Now do the VS6-specific check.
  1557. if(define.find_first_of(" ") != define.npos &&
  1558. define.find_first_of("\"$;") != define.npos)
  1559. {
  1560. cmOStringStream e;
  1561. e << "WARNING: The VS6 IDE does not support preprocessor definition "
  1562. << "values with spaces and '\"', '$', or ';'.\n"
  1563. << "CMake is dropping a preprocessor definition: " << define << "\n"
  1564. << "Consider defining the macro in a (configured) header file.\n";
  1565. cmSystemTools::Message(e.str().c_str());
  1566. return false;
  1567. }
  1568. // Assume it is supported.
  1569. return true;
  1570. }