1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMakefile.h,v $
6 Date: $Date: 2009-09-10 20:59:44 $
7 Version: $Revision: 1.259 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
20 #include "cmCacheManager.h"
22 #include "cmExecutionStatus.h"
23 #include "cmListFileCache.h"
24 #include "cmPolicies.h"
25 #include "cmPropertyMap.h"
26 #include "cmSystemTools.h"
30 #if defined(CMAKE_BUILD_WITH_CMAKE)
31 #include "cmSourceGroup.h"
34 #include <cmsys/auto_ptr.hxx>
35 #include <cmsys/RegularExpression.hxx>
37 class cmFunctionBlocker
;
39 class cmInstallGenerator
;
40 class cmLocalGenerator
;
44 class cmTestGenerator
;
45 class cmVariableWatch
;
48 class cmCMakePolicyCommand
;
51 * \brief Process the input CMakeLists.txt file.
53 * Process and store into memory the input CMakeLists.txt file.
54 * Each CMakeLists.txt file is parsed and the commands found there
55 * are added into the build process.
60 cmsys::auto_ptr
<Internals
> Internal
;
63 * Return the major and minor version of the cmake that
64 * was used to write the currently loaded cache, note
65 * this method will not work before the cache is loaded.
67 unsigned int GetCacheMajorVersion();
68 unsigned int GetCacheMinorVersion();
70 /** Return whether compatibility features needed for a version of
71 the cache or lower should be enabled. */
72 bool NeedCacheCompatibility(int major
, int minor
);
75 * Construct an empty makefile.
78 cmMakefile(const cmMakefile
& mf
);
86 * Read and parse a CMakeLists.txt file.
88 bool ReadListFile(const char* listfile
,
89 const char* external
= 0,
90 std::string
* fullPath
= 0,
91 bool noPolicyScope
= true);
94 * Add a function blocker to this makefile
96 void AddFunctionBlocker(cmFunctionBlocker
* fb
);
99 * Remove the function blocker whose scope ends with the given command.
100 * This returns ownership of the function blocker object.
102 cmsys::auto_ptr
<cmFunctionBlocker
>
103 RemoveFunctionBlocker(cmFunctionBlocker
* fb
, const cmListFileFunction
& lff
);
105 /** Push/pop a lexical (function blocker) barrier automatically. */
109 LexicalPushPop(cmMakefile
* mf
);
111 void Quiet() { this->ReportError
= false; }
113 cmMakefile
* Makefile
;
116 friend class LexicalPushPop
;
119 * Try running cmake and building a file. This is used for dynalically
120 * loaded commands, not as part of the usual build process.
122 int TryCompile(const char *srcdir
, const char *bindir
,
123 const char *projectName
, const char *targetName
,
125 const std::vector
<std::string
> *cmakeArgs
,
126 std::string
*output
);
129 * Specify the makefile generator. This is platform/compiler
130 * dependent, although the interface is through a generic
133 void SetLocalGenerator(cmLocalGenerator
*);
135 ///! Get the current makefile generator.
136 cmLocalGenerator
* GetLocalGenerator()
137 { return this->LocalGenerator
;}
140 * Test whether compatibility is set to a given version or lower.
142 bool NeedBackwardsCompatibility(unsigned int major
,
144 unsigned int patch
= 0xFFu
);
147 * Help enforce global target name uniqueness.
149 bool EnforceUniqueName(std::string
const& name
, std::string
& msg
,
150 bool isCustom
= false);
153 * Perform FinalPass, Library dependency analysis etc before output of the
156 void ConfigureFinalPass();
159 * run the final pass on all commands.
164 * Print the object state to std::cout.
168 /** Add a custom command to the build. */
169 void AddCustomCommandToTarget(const char* target
,
170 const std::vector
<std::string
>& depends
,
171 const cmCustomCommandLines
& commandLines
,
172 cmTarget::CustomCommandType type
,
173 const char* comment
, const char* workingDir
,
174 bool escapeOldStyle
= true);
175 void AddCustomCommandToOutput(const std::vector
<std::string
>& outputs
,
176 const std::vector
<std::string
>& depends
,
177 const char* main_dependency
,
178 const cmCustomCommandLines
& commandLines
,
179 const char* comment
, const char* workingDir
,
180 bool replace
= false,
181 bool escapeOldStyle
= true);
182 void AddCustomCommandToOutput(const char* output
,
183 const std::vector
<std::string
>& depends
,
184 const char* main_dependency
,
185 const cmCustomCommandLines
& commandLines
,
186 const char* comment
, const char* workingDir
,
187 bool replace
= false,
188 bool escapeOldStyle
= true);
189 void AddCustomCommandOldStyle(const char* target
,
190 const std::vector
<std::string
>& outputs
,
191 const std::vector
<std::string
>& depends
,
193 const cmCustomCommandLines
& commandLines
,
194 const char* comment
);
197 * Add a define flag to the build.
199 void AddDefineFlag(const char* definition
);
200 void RemoveDefineFlag(const char* definition
);
202 /** Create a new imported target with the name and type given. */
203 cmTarget
* AddImportedTarget(const char* name
, cmTarget::TargetType type
);
205 cmTarget
* AddNewTarget(cmTarget::TargetType type
, const char* name
);
208 * Add an executable to the build.
210 cmTarget
* AddExecutable(const char *exename
,
211 const std::vector
<std::string
> &srcs
,
212 bool excludeFromAll
= false);
215 * Add a utility to the build. A utiltity target is a command that
216 * is run every time the target is built.
218 void AddUtilityCommand(const char* utilityName
, bool excludeFromAll
,
219 const std::vector
<std::string
>& depends
,
220 const char* workingDirectory
,
226 cmTarget
* AddUtilityCommand(const char* utilityName
, bool excludeFromAll
,
227 const char* workingDirectory
,
228 const std::vector
<std::string
>& depends
,
229 const cmCustomCommandLines
& commandLines
,
230 bool escapeOldStyle
= true,
231 const char* comment
= 0);
234 * Add a link library to the build.
236 void AddLinkLibrary(const char*);
237 void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type
);
238 void AddLinkLibraryForTarget(const char *tgt
, const char*,
239 cmTarget::LinkLibraryType type
);
240 void AddLinkDirectoryForTarget(const char *tgt
, const char* d
);
243 * Add a link directory to the build.
245 void AddLinkDirectory(const char*);
248 * Get the list of link directories
250 std::vector
<std::string
>& GetLinkDirectories()
252 return this->LinkDirectories
;
254 const std::vector
<std::string
>& GetLinkDirectories() const
256 return this->LinkDirectories
;
258 void SetLinkDirectories(const std::vector
<std::string
>& vec
)
260 this->LinkDirectories
= vec
;
264 * Add a subdirectory to the build.
266 void AddSubDirectory(const char*, bool excludeFromAll
=false,
267 bool preorder
= false);
268 void AddSubDirectory(const char* fullSrcDir
,const char *fullBinDir
,
269 bool excludeFromAll
, bool preorder
,
273 * Configure a subdirectory
275 void ConfigureSubDirectory(cmLocalGenerator
*);
278 * Add an include directory to the build.
280 void AddIncludeDirectory(const char*, bool before
= false);
283 * Add a variable definition to the build. This variable
284 * can be used in CMake to refer to lists, directories, etc.
286 void AddDefinition(const char* name
, const char* value
);
287 ///! Add a definition to this makefile and the global cmake cache.
288 void AddCacheDefinition(const char* name
, const char* value
,
290 cmCacheManager::CacheEntryType type
,
294 * Update the variable scope to make the cache definition visible.
296 void UseCacheDefinition(cmCacheManager::CacheIterator
const& it
);
299 * Add bool variable definition to the build.
301 void AddDefinition(const char* name
, bool);
304 * Remove a variable definition from the build. This is not valid
305 * for cache entries, and will only affect the current makefile.
307 void RemoveDefinition(const char* name
);
308 ///! Remove a definition from the cache.
309 void RemoveCacheDefinition(const char* name
);
312 * Specify the name of the project for this build.
314 void SetProjectName(const char*);
317 * Get the name of the project for this build.
319 const char* GetProjectName() const
321 return this->ProjectName
.c_str();
325 * Set the name of the library.
327 void AddLibrary(const char *libname
, cmTarget::TargetType type
,
328 const std::vector
<std::string
> &srcs
,
329 bool excludeFromAll
= false);
331 #if defined(CMAKE_BUILD_WITH_CMAKE)
333 * Add a root source group for consideration when adding a new source.
335 void AddSourceGroup(const char* name
, const char* regex
=0);
338 * Add a source group for consideration when adding a new source.
341 void AddSourceGroup(const std::vector
<std::string
>& name
,
342 const char* regex
=0);
348 * Set, Push, Pop policy values for CMake.
350 bool SetPolicy(cmPolicies::PolicyID id
, cmPolicies::PolicyStatus status
);
351 bool SetPolicy(const char *id
, cmPolicies::PolicyStatus status
);
352 cmPolicies::PolicyStatus
GetPolicyStatus(cmPolicies::PolicyID id
);
353 bool SetPolicyVersion(const char *version
);
354 void RecordPolicies(cmPolicies::PolicyMap
& pm
);
357 /** Helper class to push and pop policies automatically. */
361 PolicyPushPop(cmMakefile
* m
,
363 cmPolicies::PolicyMap
const& pm
= cmPolicies::PolicyMap());
365 void Quiet() { this->ReportError
= false; }
367 cmMakefile
* Makefile
;
370 friend class PolicyPushPop
;
373 * Get the Policies Instance
375 cmPolicies
*GetPolicies();
378 * Add an auxiliary directory to the build.
380 void AddExtraDirectory(const char* dir
);
384 * Add an auxiliary directory to the build.
386 void MakeStartDirectoriesCurrent()
388 this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
389 this->cmStartDirectory
.c_str());
390 this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
391 this->StartOutputDirectory
.c_str());
396 * Set/Get the home directory (or output directory) in the project. The
397 * home directory is the top directory of the project. It is where
398 * CMakeSetup or configure was run. Remember that CMake processes
399 * CMakeLists files by recursing up the tree starting at the StartDirectory
400 * and going up until it reaches the HomeDirectory.
402 void SetHomeDirectory(const char* dir
);
403 const char* GetHomeDirectory() const
405 return this->cmHomeDirectory
.c_str();
407 void SetHomeOutputDirectory(const char* lib
);
408 const char* GetHomeOutputDirectory() const
410 return this->HomeOutputDirectory
.c_str();
416 * Set/Get the start directory (or output directory). The start directory
417 * is the directory of the CMakeLists.txt file that started the current
418 * round of processing. Remember that CMake processes CMakeLists files by
419 * recursing up the tree starting at the StartDirectory and going up until
420 * it reaches the HomeDirectory.
422 void SetStartDirectory(const char* dir
)
424 this->cmStartDirectory
= dir
;
425 cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory
);
426 this->cmStartDirectory
=
427 cmSystemTools::CollapseFullPath(this->cmStartDirectory
.c_str());
428 this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
429 this->cmStartDirectory
.c_str());
431 const char* GetStartDirectory() const
433 return this->cmStartDirectory
.c_str();
435 void SetStartOutputDirectory(const char* lib
)
437 this->StartOutputDirectory
= lib
;
438 cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory
);
439 this->StartOutputDirectory
=
440 cmSystemTools::CollapseFullPath(this->StartOutputDirectory
.c_str());
441 cmSystemTools::MakeDirectory(this->StartOutputDirectory
.c_str());
442 this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
443 this->StartOutputDirectory
.c_str());
445 const char* GetStartOutputDirectory() const
447 return this->StartOutputDirectory
.c_str();
451 const char* GetCurrentDirectory() const
453 return this->cmStartDirectory
.c_str();
455 const char* GetCurrentOutputDirectory() const
457 return this->StartOutputDirectory
.c_str();
460 /* Get the current CMakeLists.txt file that is being processed. This
461 * is just used in order to be able to 'branch' from one file to a second
463 const char* GetCurrentListFile() const
465 return this->cmCurrentListFile
.c_str();
471 * Set a regular expression that include files must match
472 * in order to be considered as part of the depend information.
474 void SetIncludeRegularExpression(const char* regex
)
476 this->IncludeFileRegularExpression
= regex
;
478 const char* GetIncludeRegularExpression()
480 return this->IncludeFileRegularExpression
.c_str();
484 * Set a regular expression that include files that are not found
485 * must match in order to be considered a problem.
487 void SetComplainRegularExpression(const char* regex
)
489 this->ComplainFileRegularExpression
= regex
;
491 const char* GetComplainRegularExpression()
493 return this->ComplainFileRegularExpression
.c_str();
497 * Get the list of targets
499 cmTargets
&GetTargets() { return this->Targets
; }
501 * Get the list of targets, const version
503 const cmTargets
&GetTargets() const { return this->Targets
; }
505 cmTarget
* FindTarget(const char* name
);
507 /** Find a target to use in place of the given name. The target
508 returned may be imported or built within the project. */
509 cmTarget
* FindTargetToUse(const char* name
);
512 * Get a list of include directories in the build.
514 std::vector
<std::string
>& GetIncludeDirectories()
516 return this->IncludeDirectories
;
518 const std::vector
<std::string
>& GetIncludeDirectories() const
520 return this->IncludeDirectories
;
522 void SetIncludeDirectories(const std::vector
<std::string
>& vec
)
524 this->IncludeDirectories
= vec
;
528 * Mark include directories as system directories.
530 void AddSystemIncludeDirectory(const char* dir
);
531 bool IsSystemIncludeDirectory(const char* dir
);
533 /** Expand out any arguements in the vector that have ; separated
534 * strings into multiple arguements. A new vector is created
535 * containing the expanded versions of all arguments in argsIn.
536 * This method differes from the one in cmSystemTools in that if
537 * the CmakeLists file is version 1.2 or earlier it will check for
538 * source lists being used without ${} around them
540 void ExpandSourceListArguments(std::vector
<std::string
> const& argsIn
,
541 std::vector
<std::string
>& argsOut
,
542 unsigned int startArgumentIndex
);
544 /** Get a cmSourceFile pointer for a given source name, if the name is
545 * not found, then a null pointer is returned.
547 cmSourceFile
* GetSource(const char* sourceName
);
549 /** Get a cmSourceFile pointer for a given source name, if the name is
550 * not found, then create the source file and return it. generated
551 * indicates if it is a generated file, this is used in determining
552 * how to create the source file instance e.g. name
554 cmSourceFile
* GetOrCreateSource(const char* sourceName
,
555 bool generated
= false);
558 * Obtain a list of auxiliary source directories.
560 std::vector
<std::string
>& GetAuxSourceDirectories()
561 {return this->AuxSourceDirectories
;}
565 * Return a list of extensions associated with source and header
568 const std::vector
<std::string
>& GetSourceExtensions() const
569 {return this->SourceFileExtensions
;}
570 const std::vector
<std::string
>& GetHeaderExtensions() const
571 {return this->HeaderFileExtensions
;}
575 * Given a variable name, return its value (as a string).
576 * If the variable is not found in this makefile instance, the
577 * cache is then queried.
579 const char* GetDefinition(const char*) const;
580 const char* GetSafeDefinition(const char*) const;
581 const char* GetRequiredDefinition(const char* name
) const;
582 bool IsDefinitionSet(const char*) const;
584 * Get the list of all variables in the current space. If argument
585 * cacheonly is specified and is greater than 0, then only cache
586 * variables will be listed.
588 std::vector
<std::string
> GetDefinitions(int cacheonly
=0) const;
590 /** Test a boolean cache entry to see if it is true or false,
591 * returns false if no entry defined.
593 bool IsOn(const char* name
) const;
594 bool IsSet(const char* name
) const;
597 * Get a list of preprocessor define flags.
599 const char* GetDefineFlags()
600 {return this->DefineFlags
.c_str();}
603 * Make sure CMake can write this file
605 bool CanIWriteThisFile(const char* fileName
);
608 * Get the vector of used command instances.
610 const std::vector
<cmCommand
*>& GetUsedCommands() const
611 {return this->UsedCommands
;}
613 #if defined(CMAKE_BUILD_WITH_CMAKE)
615 * Get the vector source groups.
617 const std::vector
<cmSourceGroup
>& GetSourceGroups() const
618 { return this->SourceGroups
; }
621 * Get the source group
623 cmSourceGroup
* GetSourceGroup(const std::vector
<std::string
>&name
);
627 * Get the vector of list files on which this makefile depends
629 const std::vector
<std::string
>& GetListFiles() const
630 { return this->ListFiles
; }
631 ///! When the file changes cmake will be re-run from the build system.
632 void AddCMakeDependFile(const char* file
)
633 { this->ListFiles
.push_back(file
);}
636 * Get the list file stack as a string
638 std::string
GetListFileStack();
641 * Get the current context backtrace.
643 bool GetBacktrace(cmListFileBacktrace
& backtrace
) const;
646 * Get the vector of files created by this makefile
648 const std::vector
<std::string
>& GetOutputFiles() const
649 { return this->OutputFiles
; }
650 void AddCMakeOutputFile(const char* file
)
651 { this->OutputFiles
.push_back(file
);}
654 * Expand all defined variables in the string.
655 * Defined variables come from the this->Definitions map.
656 * They are expanded with ${var} where var is the
657 * entry in the this->Definitions map. Also @var@ is
658 * expanded to match autoconf style expansions.
660 const char *ExpandVariablesInString(std::string
& source
);
661 const char *ExpandVariablesInString(std::string
& source
, bool escapeQuotes
,
664 const char* filename
= 0,
666 bool removeEmpty
= false,
667 bool replaceAt
= true);
670 * Remove any remaining variables in the string. Anything with ${var} or
671 * @var@ will be removed.
673 void RemoveVariablesInString(std::string
& source
,
674 bool atOnly
= false) const;
677 * Expand variables in the makefiles ivars such as link directories etc
679 void ExpandVariables();
682 * Replace variables and #cmakedefine lines in the given string.
683 * See cmConfigureFileCommand for details.
685 void ConfigureString(const std::string
& input
, std::string
& output
,
686 bool atOnly
, bool escapeQuotes
);
689 * Copy file but change lines acording to ConfigureString
691 int ConfigureFile(const char* infile
, const char* outfile
,
692 bool copyonly
, bool atOnly
, bool escapeQuotes
);
694 #if defined(CMAKE_BUILD_WITH_CMAKE)
696 * find what source group this source is in
698 cmSourceGroup
& FindSourceGroup(const char* source
,
699 std::vector
<cmSourceGroup
> &groups
);
702 void RegisterData(cmData
*);
703 void RegisterData(const char*, cmData
*);
704 cmData
* LookupData(const char*) const;
707 * Execute a single CMake command. Returns true if the command
708 * succeeded or false if it failed.
710 bool ExecuteCommand(const cmListFileFunction
& lff
,
711 cmExecutionStatus
&status
);
713 /** Check if a command exists. */
714 bool CommandExists(const char* name
) const;
717 * Add a command to this cmake instance
719 void AddCommand(cmCommand
* );
721 ///! Enable support for named language, if nil then all languages are
723 void EnableLanguage(std::vector
<std::string
>const& languages
, bool optional
);
726 * Set/Get the name of the parent directories CMakeLists file
727 * given a current CMakeLists file name
729 cmCacheManager
*GetCacheManager() const;
732 * Get the variable watch. This is used to determine when certain variables
735 #ifdef CMAKE_BUILD_WITH_CMAKE
736 cmVariableWatch
* GetVariableWatch() const;
739 ///! Display progress or status message.
740 void DisplayStatus(const char*, float);
743 * Expand the given list file arguments into the full set after
744 * variable replacement and list expansion.
746 bool ExpandArguments(std::vector
<cmListFileArgument
> const& inArgs
,
747 std::vector
<std::string
>& outArgs
);
751 cmake
*GetCMakeInstance() const;
754 * Get all the source files this makefile knows about
756 const std::vector
<cmSourceFile
*> &GetSourceFiles() const
757 {return this->SourceFiles
;}
758 std::vector
<cmSourceFile
*> &GetSourceFiles() {return this->SourceFiles
;}
761 * Is there a source file that has the provided source file as an output?
762 * if so then return it
764 cmSourceFile
*GetSourceFileWithOutput(const char *outName
);
767 * Add a macro to the list of macros. The arguments should be name of the
768 * macro and a documentation signature of it
770 void AddMacro(const char* name
, const char* signature
);
772 ///! Add a new cmTest to the list of tests for this makefile.
773 cmTest
* CreateTest(const char* testName
);
775 /** Get a cmTest pointer for a given test name, if the name is
776 * not found, then a null pointer is returned.
778 cmTest
* GetTest(const char* testName
) const;
781 * Get a list of macros as a ; separated string
783 void GetListOfMacros(std::string
& macros
);
786 * Return a location of a file in cmake or custom modules directory
788 std::string
GetModulesFile(const char* name
);
790 ///! Set/Get a property of this directory
791 void SetProperty(const char *prop
, const char *value
);
792 void AppendProperty(const char *prop
, const char *value
);
793 const char *GetProperty(const char *prop
);
794 const char *GetPropertyOrDefinition(const char *prop
);
795 const char *GetProperty(const char *prop
, cmProperty::ScopeType scope
);
796 bool GetPropertyAsBool(const char *prop
);
798 // Get the properties
799 cmPropertyMap
&GetProperties() { return this->Properties
; };
801 ///! Initialize a makefile from its parent
802 void InitializeFromParent();
804 ///! Set/Get the preorder flag
805 void SetPreOrder(bool p
) { this->PreOrder
= p
; }
806 bool GetPreOrder() const { return this->PreOrder
; }
808 void AddInstallGenerator(cmInstallGenerator
* g
)
809 { if(g
) this->InstallGenerators
.push_back(g
); }
810 std::vector
<cmInstallGenerator
*>& GetInstallGenerators()
811 { return this->InstallGenerators
; }
813 void AddTestGenerator(cmTestGenerator
* g
)
814 { if(g
) this->TestGenerators
.push_back(g
); }
815 std::vector
<cmTestGenerator
*>& GetTestGenerators()
816 { return this->TestGenerators
; }
818 // Define the properties
819 static void DefineProperties(cmake
*cm
);
821 // push and pop variable scopes
824 void RaiseScope(const char *var
, const char *value
);
826 /** Helper class to push and pop scopes automatically. */
830 ScopePushPop(cmMakefile
* m
): Makefile(m
) { this->Makefile
->PushScope(); }
831 ~ScopePushPop() { this->Makefile
->PopScope(); }
833 cmMakefile
* Makefile
;
836 void IssueMessage(cmake::MessageType t
,
837 std::string
const& text
) const;
839 /** Set whether or not to report a CMP0000 violation. */
840 void SetCheckCMP0000(bool b
) { this->CheckCMP0000
= b
; }
843 // add link libraries and directories to the target
844 void AddGlobalLinkInformation(const char* name
, cmTarget
& target
);
847 std::vector
<std::string
> AuxSourceDirectories
; //
849 std::string cmStartDirectory
;
850 std::string StartOutputDirectory
;
851 std::string cmHomeDirectory
;
852 std::string HomeOutputDirectory
;
853 std::string cmCurrentListFile
;
855 std::string ProjectName
; // project name
857 // libraries, classes, and executables
859 std::vector
<cmSourceFile
*> SourceFiles
;
862 std::map
<cmStdString
, cmTest
*> Tests
;
864 // The include and link-library paths. These may have order
865 // dependency, so they must be vectors (not set).
866 std::vector
<std::string
> IncludeDirectories
;
867 std::vector
<std::string
> LinkDirectories
;
869 // The set of include directories that are marked as system include
871 std::set
<cmStdString
> SystemIncludeDirectories
;
873 std::vector
<std::string
> ListFiles
; // list of command files loaded
874 std::vector
<std::string
> OutputFiles
; // list of command files loaded
877 cmTarget::LinkLibraryVectorType LinkLibraries
;
879 std::vector
<cmInstallGenerator
*> InstallGenerators
;
880 std::vector
<cmTestGenerator
*> TestGenerators
;
882 std::string IncludeFileRegularExpression
;
883 std::string ComplainFileRegularExpression
;
884 std::vector
<std::string
> SourceFileExtensions
;
885 std::vector
<std::string
> HeaderFileExtensions
;
886 std::string DefineFlags
;
888 // Track the value of the computed DEFINITIONS property.
889 void AddDefineFlag(const char*, std::string
&);
890 void RemoveDefineFlag(const char*, std::string::size_type
, std::string
&);
891 std::string DefineFlagsOrig
;
893 #if defined(CMAKE_BUILD_WITH_CMAKE)
894 std::vector
<cmSourceGroup
> SourceGroups
;
897 std::vector
<cmCommand
*> UsedCommands
;
898 cmLocalGenerator
* LocalGenerator
;
899 bool IsFunctionBlocked(const cmListFileFunction
& lff
,
900 cmExecutionStatus
&status
);
905 bool ParseDefineFlag(std::string
const& definition
, bool remove
);
907 bool EnforceUniqueDir(const char* srcPath
, const char* binPath
);
909 void ReadSources(std::ifstream
& fin
, bool t
);
910 friend class cmMakeDepend
; // make depend needs direct access
911 // to the Sources array
912 void PrintStringVector(const char* s
, const
913 std::vector
<std::pair
<cmStdString
, bool> >& v
) const;
914 void PrintStringVector(const char* s
,
915 const std::vector
<std::string
>& v
) const;
917 void AddDefaultDefinitions();
918 typedef std::vector
<cmFunctionBlocker
*> FunctionBlockersType
;
919 FunctionBlockersType FunctionBlockers
;
920 std::vector
<FunctionBlockersType::size_type
> FunctionBlockerBarriers
;
921 void PushFunctionBlockerBarrier();
922 void PopFunctionBlockerBarrier(bool reportError
= true);
924 typedef std::map
<cmStdString
, cmData
*> DataMapType
;
927 typedef std::map
<cmStdString
, cmStdString
> StringStringMap
;
928 StringStringMap MacrosMap
;
930 std::map
<cmStdString
, bool> SubDirectoryOrder
;
932 cmsys::RegularExpression cmDefineRegex
;
933 cmsys::RegularExpression cmDefine01Regex
;
934 cmsys::RegularExpression cmAtVarRegex
;
936 cmPropertyMap Properties
;
938 // should this makefile be processed before or after processing the parent
941 // stack of list files being read
942 std::deque
<cmStdString
> ListFileStack
;
944 // stack of commands being invoked.
945 struct CallStackEntry
947 cmListFileContext
const* Context
;
948 cmExecutionStatus
* Status
;
950 typedef std::deque
<CallStackEntry
> CallStackType
;
951 CallStackType CallStack
;
952 friend class cmMakefileCall
;
954 cmTarget
* FindBasicTarget(const char* name
);
955 std::vector
<cmTarget
*> ImportedTargetsOwned
;
956 std::map
<cmStdString
, cmTarget
*> ImportedTargets
;
958 // Internal policy stack management.
959 void PushPolicy(bool weak
= false,
960 cmPolicies::PolicyMap
const& pm
= cmPolicies::PolicyMap());
962 void PushPolicyBarrier();
963 void PopPolicyBarrier(bool reportError
= true);
964 friend class cmCMakePolicyCommand
;
966 friend class IncludeScope
;
968 // stack of policy settings
969 struct PolicyStackEntry
: public cmPolicies::PolicyMap
971 typedef cmPolicies::PolicyMap derived
;
972 PolicyStackEntry(bool w
= false): derived(), Weak(w
) {}
973 PolicyStackEntry(derived
const& d
, bool w
= false): derived(d
), Weak(w
) {}
974 PolicyStackEntry(PolicyStackEntry
const& r
): derived(r
), Weak(r
.Weak
) {}
977 typedef std::vector
<PolicyStackEntry
> PolicyStackType
;
978 PolicyStackType PolicyStack
;
979 std::vector
<PolicyStackType::size_type
> PolicyBarriers
;
980 cmPolicies::PolicyStatus
GetPolicyStatusInternal(cmPolicies::PolicyID id
);
984 // Enforce rules about CMakeLists.txt files.
985 void EnforceDirectoryLevelRules();
988 //----------------------------------------------------------------------------
989 // Helper class to make sure the call stack is valid.
993 cmMakefileCall(cmMakefile
* mf
,
994 cmListFileContext
const& lfc
,
995 cmExecutionStatus
& status
): Makefile(mf
)
997 cmMakefile::CallStackEntry entry
= {&lfc
, &status
};
998 this->Makefile
->CallStack
.push_back(entry
);
1002 this->Makefile
->CallStack
.pop_back();
1005 cmMakefile
* Makefile
;