cmMakefile.h 25 KB

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