cmMakefile.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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. #ifndef cmMakefile_h
  14. #define cmMakefile_h
  15. #include "cmData.h"
  16. #include "cmSystemTools.h"
  17. #include "cmTarget.h"
  18. #include "cmListFileCache.h"
  19. #include "cmCacheManager.h"
  20. #if defined(CMAKE_BUILD_WITH_CMAKE)
  21. #include "cmSourceGroup.h"
  22. #endif
  23. #include <cmsys/RegularExpression.hxx>
  24. class cmFunctionBlocker;
  25. class cmCommand;
  26. class cmInstallGenerator;
  27. class cmLocalGenerator;
  28. class cmMakeDepend;
  29. class cmSourceFile;
  30. class cmTest;
  31. class cmVariableWatch;
  32. class cmake;
  33. /** \class cmMakefile
  34. * \brief Process the input CMakeLists.txt file.
  35. *
  36. * Process and store into memory the input CMakeLists.txt file.
  37. * Each CMakeLists.txt file is parsed and the commands found there
  38. * are added into the build process.
  39. */
  40. class cmMakefile
  41. {
  42. public:
  43. /**
  44. * Return major and minor version numbers for cmake.
  45. */
  46. static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
  47. static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
  48. static unsigned int GetPatchVersion() { return CMake_VERSION_PATCH; }
  49. static const char* GetReleaseVersion();
  50. /**
  51. * Return the major and minor version of the cmake that
  52. * was used to write the currently loaded cache, note
  53. * this method will not work before the cache is loaded.
  54. */
  55. unsigned int GetCacheMajorVersion();
  56. unsigned int GetCacheMinorVersion();
  57. /**
  58. * Construct an empty makefile.
  59. */
  60. cmMakefile();
  61. cmMakefile(const cmMakefile& mf);
  62. /**
  63. * Destructor.
  64. */
  65. ~cmMakefile();
  66. /**
  67. * Read and parse a CMakeLists.txt file.
  68. */
  69. bool ReadListFile(const char* listfile, const char* external= 0);
  70. /**
  71. * Add a function blocker to this makefile
  72. */
  73. void AddFunctionBlocker(cmFunctionBlocker *fb)
  74. { this->FunctionBlockers.push_back(fb);}
  75. void RemoveFunctionBlocker(cmFunctionBlocker *fb)
  76. { this->FunctionBlockers.remove(fb);}
  77. void RemoveFunctionBlocker(const cmListFileFunction& lff);
  78. /**
  79. * Add file to the written file list. These file should not be in the list
  80. * of dependencies because they cause infinite loops.
  81. */
  82. void AddWrittenFile(const char* file);
  83. bool HasWrittenFile(const char* file);
  84. /**
  85. * Check if there are any infinite loops
  86. */
  87. bool CheckInfiniteLoops();
  88. /**
  89. * Try running cmake and building a file. This is used for dynalically
  90. * loaded commands, not as part of the usual build process.
  91. */
  92. int TryCompile(const char *srcdir, const char *bindir,
  93. const char *projectName, const char *targetName,
  94. const std::vector<std::string> *cmakeArgs,
  95. std::string *output);
  96. /**
  97. * Specify the makefile generator. This is platform/compiler
  98. * dependent, although the interface is through a generic
  99. * superclass.
  100. */
  101. void SetLocalGenerator(cmLocalGenerator*);
  102. ///! Get the current makefile generator.
  103. cmLocalGenerator* GetLocalGenerator()
  104. { return this->LocalGenerator;}
  105. /**
  106. * Perform FinalPass, Library dependency analysis etc before output of the
  107. * makefile.
  108. */
  109. void ConfigureFinalPass();
  110. /**
  111. * run the final pass on all commands.
  112. */
  113. void FinalPass();
  114. /**
  115. * Print the object state to std::cout.
  116. */
  117. void Print();
  118. /** Add a custom command to the build. */
  119. void AddCustomCommandToTarget(const char* target,
  120. const std::vector<std::string>& depends,
  121. const cmCustomCommandLines& commandLines,
  122. cmTarget::CustomCommandType type,
  123. const char* comment, const char* workingDir);
  124. void AddCustomCommandToOutput(const std::vector<std::string>& outputs,
  125. const std::vector<std::string>& depends,
  126. const char* main_dependency,
  127. const cmCustomCommandLines& commandLines,
  128. const char* comment, const char* workingDir,
  129. bool replace = false);
  130. void AddCustomCommandToOutput(const char* output,
  131. const std::vector<std::string>& depends,
  132. const char* main_dependency,
  133. const cmCustomCommandLines& commandLines,
  134. const char* comment, const char* workingDir,
  135. bool replace = false);
  136. void AddCustomCommandOldStyle(const char* target,
  137. const std::vector<std::string>& outputs,
  138. const std::vector<std::string>& depends,
  139. const char* source,
  140. const cmCustomCommandLines& commandLines,
  141. const char* comment);
  142. /**
  143. * Add a define flag to the build.
  144. */
  145. void AddDefineFlag(const char* definition);
  146. void RemoveDefineFlag(const char* definition);
  147. /**
  148. * Add an executable to the build.
  149. */
  150. cmTarget* AddExecutable(const char *exename,
  151. const std::vector<std::string> &srcs);
  152. /**
  153. * Add a utility to the build. A utiltity target is a command that
  154. * is run every time the target is built.
  155. */
  156. void AddUtilityCommand(const char* utilityName, bool all,
  157. const char* output,
  158. const std::vector<std::string>& depends,
  159. const char* workingDirectory,
  160. const char* command,
  161. const char* arg1=0,
  162. const char* arg2=0,
  163. const char* arg3=0,
  164. const char* arg4=0);
  165. void AddUtilityCommand(const char* utilityName, bool all,
  166. const char* output,
  167. const char* workingDirectory,
  168. const std::vector<std::string>& depends,
  169. const cmCustomCommandLines& commandLines);
  170. /**
  171. * Add a link library to the build.
  172. */
  173. void AddLinkLibrary(const char*);
  174. void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type);
  175. void AddLinkLibraryForTarget(const char *tgt, const char*,
  176. cmTarget::LinkLibraryType type);
  177. void AddLinkDirectoryForTarget(const char *tgt, const char* d);
  178. /**
  179. * Add a link directory to the build.
  180. */
  181. void AddLinkDirectory(const char*);
  182. /**
  183. * Get the list of link directories
  184. */
  185. std::vector<std::string>& GetLinkDirectories()
  186. {
  187. return this->LinkDirectories;
  188. }
  189. const std::vector<std::string>& GetLinkDirectories() const
  190. {
  191. return this->LinkDirectories;
  192. }
  193. void SetLinkDirectories(const std::vector<std::string>& vec)
  194. {
  195. this->LinkDirectories = vec;
  196. }
  197. /**
  198. * Add a subdirectory to the build.
  199. */
  200. void AddSubDirectory(const char*, bool includeTopLevel=true,
  201. bool preorder = false);
  202. void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir,
  203. bool includeTopLevel, bool preorder,
  204. bool immediate);
  205. /**
  206. * Configure a subdirectory
  207. */
  208. void ConfigureSubDirectory(cmLocalGenerator *);
  209. /**
  210. * Add an include directory to the build.
  211. */
  212. void AddIncludeDirectory(const char*, bool before = false);
  213. /**
  214. * Add a variable definition to the build. This variable
  215. * can be used in CMake to refer to lists, directories, etc.
  216. */
  217. void AddDefinition(const char* name, const char* value);
  218. ///! Add a definition to this makefile and the global cmake cache.
  219. void AddCacheDefinition(const char* name, const char* value,
  220. const char* doc,
  221. cmCacheManager::CacheEntryType type);
  222. /**
  223. * Add bool variable definition to the build.
  224. */
  225. void AddDefinition(const char* name, bool);
  226. ///! Add a definition to this makefile and the global cmake cache.
  227. void AddCacheDefinition(const char* name, bool, const char* doc);
  228. /**
  229. * Remove a variable definition from the build. This is not valid
  230. * for cache entries, and will only affect the current makefile.
  231. */
  232. void RemoveDefinition(const char* name);
  233. /**
  234. * Specify the name of the project for this build.
  235. */
  236. void SetProjectName(const char*);
  237. /**
  238. * Get the name of the project for this build.
  239. */
  240. const char* GetProjectName()
  241. {
  242. return this->ProjectName.c_str();
  243. }
  244. /**
  245. * Set the name of the library.
  246. */
  247. void AddLibrary(const char *libname, int shared,
  248. const std::vector<std::string> &srcs);
  249. #if defined(CMAKE_BUILD_WITH_CMAKE)
  250. /**
  251. * Add a source group for consideration when adding a new source.
  252. */
  253. void AddSourceGroup(const char* name, const char* regex=0,
  254. const char* parent=0);
  255. #endif
  256. /**
  257. * Add an auxiliary directory to the build.
  258. */
  259. void AddExtraDirectory(const char* dir);
  260. /**
  261. * Add an auxiliary directory to the build.
  262. */
  263. void MakeStartDirectoriesCurrent()
  264. {
  265. this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
  266. this->cmStartDirectory.c_str());
  267. this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
  268. this->StartOutputDirectory.c_str());
  269. }
  270. //@{
  271. /**
  272. * Set/Get the home directory (or output directory) in the project. The
  273. * home directory is the top directory of the project. It is where
  274. * CMakeSetup or configure was run. Remember that CMake processes
  275. * CMakeLists files by recursing up the tree starting at the StartDirectory
  276. * and going up until it reaches the HomeDirectory.
  277. */
  278. void SetHomeDirectory(const char* dir);
  279. const char* GetHomeDirectory() const
  280. {
  281. return this->cmHomeDirectory.c_str();
  282. }
  283. void SetHomeOutputDirectory(const char* lib);
  284. const char* GetHomeOutputDirectory() const
  285. {
  286. return this->HomeOutputDirectory.c_str();
  287. }
  288. //@}
  289. //@{
  290. /**
  291. * Set/Get the start directory (or output directory). The start directory
  292. * is the directory of the CMakeLists.txt file that started the current
  293. * round of processing. Remember that CMake processes CMakeLists files by
  294. * recursing up the tree starting at the StartDirectory and going up until
  295. * it reaches the HomeDirectory.
  296. */
  297. void SetStartDirectory(const char* dir)
  298. {
  299. this->cmStartDirectory = dir;
  300. cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
  301. this->cmStartDirectory =
  302. cmSystemTools::CollapseFullPath(this->cmStartDirectory.c_str());
  303. this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
  304. this->cmStartDirectory.c_str());
  305. }
  306. const char* GetStartDirectory() const
  307. {
  308. return this->cmStartDirectory.c_str();
  309. }
  310. void SetStartOutputDirectory(const char* lib)
  311. {
  312. this->StartOutputDirectory = lib;
  313. cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
  314. this->StartOutputDirectory =
  315. cmSystemTools::CollapseFullPath(this->StartOutputDirectory.c_str());
  316. cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str());
  317. this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
  318. this->StartOutputDirectory.c_str());
  319. }
  320. const char* GetStartOutputDirectory() const
  321. {
  322. return this->StartOutputDirectory.c_str();
  323. }
  324. //@}
  325. const char* GetCurrentDirectory() const
  326. {
  327. return this->cmStartDirectory.c_str();
  328. }
  329. const char* GetCurrentOutputDirectory() const
  330. {
  331. return this->StartOutputDirectory.c_str();
  332. }
  333. /* Get the current CMakeLists.txt file that is being processed. This
  334. * is just used in order to be able to 'branch' from one file to a second
  335. * transparently */
  336. const char* GetCurrentListFile() const
  337. {
  338. return this->cmCurrentListFile.c_str();
  339. }
  340. //@}
  341. /**
  342. * Set a regular expression that include files must match
  343. * in order to be considered as part of the depend information.
  344. */
  345. void SetIncludeRegularExpression(const char* regex)
  346. {
  347. this->IncludeFileRegularExpression = regex;
  348. }
  349. const char* GetIncludeRegularExpression()
  350. {
  351. return this->IncludeFileRegularExpression.c_str();
  352. }
  353. /**
  354. * Set a regular expression that include files that are not found
  355. * must match in order to be considered a problem.
  356. */
  357. void SetComplainRegularExpression(const char* regex)
  358. {
  359. this->ComplainFileRegularExpression = regex;
  360. }
  361. const char* GetComplainRegularExpression()
  362. {
  363. return this->ComplainFileRegularExpression.c_str();
  364. }
  365. /**
  366. * Get the list of targets
  367. */
  368. cmTargets &GetTargets() { return this->Targets; }
  369. cmTarget* FindTarget(const char* name);
  370. /**
  371. * Get a list of include directories in the build.
  372. */
  373. std::vector<std::string>& GetIncludeDirectories()
  374. {
  375. return this->IncludeDirectories;
  376. }
  377. const std::vector<std::string>& GetIncludeDirectories() const
  378. {
  379. return this->IncludeDirectories;
  380. }
  381. void SetIncludeDirectories(const std::vector<std::string>& vec)
  382. {
  383. this->IncludeDirectories = vec;
  384. }
  385. /** Expand out any arguements in the vector that have ; separated
  386. * strings into multiple arguements. A new vector is created
  387. * containing the expanded versions of all arguments in argsIn.
  388. * This method differes from the one in cmSystemTools in that if
  389. * the CmakeLists file is version 1.2 or earlier it will check for
  390. * source lists being used without ${} around them
  391. */
  392. void ExpandSourceListArguments(std::vector<std::string> const& argsIn,
  393. std::vector<std::string>& argsOut,
  394. unsigned int startArgumentIndex);
  395. /** Get a cmSourceFile pointer for a given source name, if the name is
  396. * not found, then a null pointer is returned.
  397. */
  398. cmSourceFile* GetSource(const char* sourceName) const;
  399. ///! Add a new cmSourceFile to the list of sources for this makefile.
  400. cmSourceFile* AddSource(cmSourceFile const&);
  401. /** Get a cmSourceFile pointer for a given source name, if the name is
  402. * not found, then create the source file and return it. generated
  403. * indicates if it is a generated file, this is used in determining
  404. * how to create the source file instance e.g. name
  405. */
  406. cmSourceFile* GetOrCreateSource(const char* sourceName,
  407. bool generated = false);
  408. /**
  409. * Obtain a list of auxiliary source directories.
  410. */
  411. std::vector<std::string>& GetAuxSourceDirectories()
  412. {return this->AuxSourceDirectories;}
  413. //@{
  414. /**
  415. * Return a list of extensions associated with source and header
  416. * files
  417. */
  418. const std::vector<std::string>& GetSourceExtensions() const
  419. {return this->SourceFileExtensions;}
  420. const std::vector<std::string>& GetHeaderExtensions() const
  421. {return this->HeaderFileExtensions;}
  422. //@}
  423. /**
  424. * Given a variable name, return its value (as a string).
  425. * If the variable is not found in this makefile instance, the
  426. * cache is then queried.
  427. */
  428. const char* GetDefinition(const char*) const;
  429. const char* GetSafeDefinition(const char*) const;
  430. const char* GetRequiredDefinition(const char* name) const;
  431. /**
  432. * Get the list of all variables in the current space. If argument
  433. * cacheonly is specified and is greater than 0, then only cache
  434. * variables will be listed.
  435. */
  436. std::vector<std::string> GetDefinitions(int cacheonly=0) const;
  437. /** Test a boolean cache entry to see if it is true or false,
  438. * returns false if no entry defined.
  439. */
  440. bool IsOn(const char* name) const;
  441. bool IsSet(const char* name) const;
  442. /**
  443. * Get a list of preprocessor define flags.
  444. */
  445. const char* GetDefineFlags()
  446. {return this->DefineFlags.c_str();}
  447. /**
  448. * Make sure CMake can write this file
  449. */
  450. bool CanIWriteThisFile(const char* fileName);
  451. /**
  452. * Get the vector of used command instances.
  453. */
  454. const std::vector<cmCommand*>& GetUsedCommands() const
  455. {return this->UsedCommands;}
  456. #if defined(CMAKE_BUILD_WITH_CMAKE)
  457. /**
  458. * Get the vector source groups.
  459. */
  460. const std::vector<cmSourceGroup>& GetSourceGroups() const
  461. { return this->SourceGroups; }
  462. /**
  463. * Get the source group
  464. */
  465. cmSourceGroup* GetSourceGroup(const char* name);
  466. #endif
  467. /**
  468. * Get the vector of list files on which this makefile depends
  469. */
  470. const std::vector<std::string>& GetListFiles() const
  471. { return this->ListFiles; }
  472. ///! When the file changes cmake will be re-run from the build system.
  473. void AddCMakeDependFile(const char* file)
  474. { this->ListFiles.push_back(file);}
  475. /**
  476. * Get the list file stack as a string
  477. */
  478. std::string GetListFileStack();
  479. /**
  480. * Get the vector of files created by this makefile
  481. */
  482. const std::vector<std::string>& GetOutputFiles() const
  483. { return this->OutputFiles; }
  484. void AddCMakeOutputFile(const char* file)
  485. { this->OutputFiles.push_back(file);}
  486. /**
  487. * Expand all defined variables in the string.
  488. * Defined variables come from the this->Definitions map.
  489. * They are expanded with ${var} where var is the
  490. * entry in the this->Definitions map. Also @var@ is
  491. * expanded to match autoconf style expansions.
  492. */
  493. const char *ExpandVariablesInString(std::string& source) const;
  494. const char *ExpandVariablesInString(std::string& source, bool escapeQuotes,
  495. bool noEscapes,
  496. bool atOnly = false,
  497. const char* filename = 0,
  498. long line = -1,
  499. bool removeEmpty = false) const;
  500. /**
  501. * Remove any remaining variables in the string. Anything with ${var} or
  502. * @var@ will be removed.
  503. */
  504. void RemoveVariablesInString(std::string& source,
  505. bool atOnly = false) const;
  506. /**
  507. * Expand variables in the makefiles ivars such as link directories etc
  508. */
  509. void ExpandVariables();
  510. /**
  511. * Replace variables and #cmakedefine lines in the given string.
  512. * See cmConfigureFileCommand for details.
  513. */
  514. void ConfigureString(const std::string& input, std::string& output,
  515. bool atOnly, bool escapeQuotes);
  516. /**
  517. * Copy file but change lines acording to ConfigureString
  518. */
  519. int ConfigureFile(const char* infile, const char* outfile,
  520. bool copyonly, bool atOnly, bool escapeQuotes);
  521. #if defined(CMAKE_BUILD_WITH_CMAKE)
  522. /**
  523. * find what source group this source is in
  524. */
  525. cmSourceGroup& FindSourceGroup(const char* source,
  526. std::vector<cmSourceGroup> &groups);
  527. #endif
  528. void RegisterData(cmData*);
  529. void RegisterData(const char*, cmData*);
  530. cmData* LookupData(const char*) const;
  531. /**
  532. * Execute a single CMake command. Returns true if the command
  533. * succeeded or false if it failed.
  534. */
  535. bool ExecuteCommand(const cmListFileFunction& lff);
  536. /** Check if a command exists. */
  537. bool CommandExists(const char* name) const;
  538. /**
  539. * Add a command to this cmake instance
  540. */
  541. void AddCommand(cmCommand* );
  542. ///! Enable support for named language, if nil then all languages are
  543. ///enabled.
  544. void EnableLanguage(std::vector<std::string>const& languages);
  545. /**
  546. * Set/Get the name of the parent directories CMakeLists file
  547. * given a current CMakeLists file name
  548. */
  549. cmCacheManager *GetCacheManager() const;
  550. /**
  551. * Get the variable watch. This is used to determine when certain variables
  552. * are accessed.
  553. */
  554. #ifdef CMAKE_BUILD_WITH_CMAKE
  555. cmVariableWatch* GetVariableWatch() const;
  556. #endif
  557. ///! Display progress or status message.
  558. void DisplayStatus(const char*, float);
  559. /**
  560. * Expand the given list file arguments into the full set after
  561. * variable replacement and list expansion.
  562. */
  563. void ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
  564. std::vector<std::string>& outArgs);
  565. /**
  566. * Get the instance
  567. */
  568. cmake *GetCMakeInstance() const;
  569. /**
  570. * Get all the source files this makefile knows about
  571. */
  572. const std::vector<cmSourceFile*> &GetSourceFiles() const
  573. {return this->SourceFiles;}
  574. std::vector<cmSourceFile*> &GetSourceFiles() {return this->SourceFiles;}
  575. /**
  576. * Is there a source file that has the provided source file as an output?
  577. * if so then return it
  578. */
  579. cmSourceFile *GetSourceFileWithOutput(const char *outName);
  580. /**
  581. * Add a macro to the list of macros. The arguments should be name of the
  582. * macro and a documentation signature of it
  583. */
  584. void AddMacro(const char* name, const char* signature);
  585. ///! Add a new cmTest to the list of tests for this makefile.
  586. cmTest* CreateTest(const char* testName);
  587. /** Get a cmTest pointer for a given test name, if the name is
  588. * not found, then a null pointer is returned.
  589. */
  590. cmTest* GetTest(const char* testName) const;
  591. const std::vector<cmTest*> *GetTests() const;
  592. std::vector<cmTest*> *GetTests();
  593. /**
  594. * Get a list of macros as a ; separated string
  595. */
  596. void GetListOfMacros(std::string& macros);
  597. /**
  598. * Return a location of a file in cmake or custom modules directory
  599. */
  600. std::string GetModulesFile(const char* name);
  601. ///! Set/Get a property of this directory
  602. void SetProperty(const char *prop, const char *value);
  603. const char *GetProperty(const char *prop);
  604. bool GetPropertyAsBool(const char *prop) const;
  605. typedef std::map<cmStdString, cmStdString> DefinitionMap;
  606. ///! Initialize a makefile from its parent
  607. void InitializeFromParent();
  608. ///! Set/Get the preorder flag
  609. void SetPreOrder(bool p) { this->PreOrder = p; }
  610. bool GetPreOrder() { return this->PreOrder; }
  611. void AddInstallGenerator(cmInstallGenerator* g)
  612. { this->InstallGenerators.push_back(g); }
  613. std::vector<cmInstallGenerator*>& GetInstallGenerators()
  614. { return this->InstallGenerators; }
  615. protected:
  616. // add link libraries and directories to the target
  617. void AddGlobalLinkInformation(const char* name, cmTarget& target);
  618. std::string Prefix;
  619. std::vector<std::string> AuxSourceDirectories; //
  620. std::string cmStartDirectory;
  621. std::string StartOutputDirectory;
  622. std::string cmHomeDirectory;
  623. std::string HomeOutputDirectory;
  624. std::string cmCurrentListFile;
  625. std::string ProjectName; // project name
  626. // libraries, classes, and executables
  627. cmTargets Targets;
  628. std::vector<cmSourceFile*> SourceFiles;
  629. // Tests
  630. std::vector<cmTest*> Tests;
  631. // The include and link-library paths. These may have order
  632. // dependency, so they must be vectors (not set).
  633. std::vector<std::string> IncludeDirectories;
  634. std::vector<std::string> LinkDirectories;
  635. std::vector<std::string> ListFiles; // list of command files loaded
  636. std::vector<std::string> OutputFiles; // list of command files loaded
  637. cmTarget::LinkLibraryVectorType LinkLibraries;
  638. std::vector<cmInstallGenerator*> InstallGenerators;
  639. std::string IncludeFileRegularExpression;
  640. std::string ComplainFileRegularExpression;
  641. std::vector<std::string> SourceFileExtensions;
  642. std::vector<std::string> HeaderFileExtensions;
  643. std::string DefineFlags;
  644. #if defined(CMAKE_BUILD_WITH_CMAKE)
  645. std::vector<cmSourceGroup> SourceGroups;
  646. #endif
  647. DefinitionMap Definitions;
  648. std::vector<cmCommand*> UsedCommands;
  649. cmLocalGenerator* LocalGenerator;
  650. bool IsFunctionBlocked(const cmListFileFunction& lff);
  651. private:
  652. void ReadSources(std::ifstream& fin, bool t);
  653. friend class cmMakeDepend; // make depend needs direct access
  654. // to the Sources array
  655. void PrintStringVector(const char* s, const
  656. std::vector<std::pair<cmStdString, bool> >& v) const;
  657. void PrintStringVector(const char* s,
  658. const std::vector<std::string>& v) const;
  659. void AddDefaultDefinitions();
  660. std::list<cmFunctionBlocker *> FunctionBlockers;
  661. typedef std::map<cmStdString, cmData*> DataMapType;
  662. DataMapType DataMap;
  663. typedef std::map<cmStdString, cmStdString> StringStringMap;
  664. StringStringMap MacrosMap;
  665. std::map<cmStdString, bool> SubDirectoryOrder;
  666. // used in AddDefinition for performance improvement
  667. DefinitionMap::key_type TemporaryDefinitionKey;
  668. cmsys::RegularExpression cmDefineRegex;
  669. cmsys::RegularExpression cmDefine01Regex;
  670. std::map<cmStdString,cmStdString> Properties;
  671. // should this makefile be processed before or after processing the parent
  672. bool PreOrder;
  673. // stack of list files being read
  674. std::deque<cmStdString> ListFileStack;
  675. };
  676. #endif