1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMakefile.h,v $
6 Date: $Date: 2009-03-16 14:40:31 $
7 Version: $Revision: 1.254 $
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.
61 * Return the major and minor version of the cmake that
62 * was used to write the currently loaded cache, note
63 * this method will not work before the cache is loaded.
65 unsigned int GetCacheMajorVersion();
66 unsigned int GetCacheMinorVersion();
68 /** Return whether compatibility features needed for a version of
69 the cache or lower should be enabled. */
70 bool NeedCacheCompatibility(int major
, int minor
);
73 * Construct an empty makefile.
76 cmMakefile(const cmMakefile
& mf
);
84 * Read and parse a CMakeLists.txt file.
86 bool ReadListFile(const char* listfile
,
87 const char* external
= 0,
88 std::string
* fullPath
= 0,
89 bool noPolicyScope
= true);
92 * Add a function blocker to this makefile
94 void AddFunctionBlocker(cmFunctionBlocker
* fb
);
97 * Remove the function blocker whose scope ends with the given command.
98 * This returns ownership of the function blocker object.
100 cmsys::auto_ptr
<cmFunctionBlocker
>
101 RemoveFunctionBlocker(cmFunctionBlocker
* fb
, const cmListFileFunction
& lff
);
103 /** Push/pop a lexical (function blocker) barrier automatically. */
107 LexicalPushPop(cmMakefile
* mf
);
109 void Quiet() { this->ReportError
= false; }
111 cmMakefile
* Makefile
;
114 friend class LexicalPushPop
;
117 * Try running cmake and building a file. This is used for dynalically
118 * loaded commands, not as part of the usual build process.
120 int TryCompile(const char *srcdir
, const char *bindir
,
121 const char *projectName
, const char *targetName
,
122 const std::vector
<std::string
> *cmakeArgs
,
123 std::string
*output
);
126 * Specify the makefile generator. This is platform/compiler
127 * dependent, although the interface is through a generic
130 void SetLocalGenerator(cmLocalGenerator
*);
132 ///! Get the current makefile generator.
133 cmLocalGenerator
* GetLocalGenerator()
134 { return this->LocalGenerator
;}
137 * Test whether compatibility is set to a given version or lower.
139 bool NeedBackwardsCompatibility(unsigned int major
,
141 unsigned int patch
= 0xFFu
);
144 * Help enforce global target name uniqueness.
146 bool EnforceUniqueName(std::string
const& name
, std::string
& msg
,
147 bool isCustom
= false);
150 * Perform FinalPass, Library dependency analysis etc before output of the
153 void ConfigureFinalPass();
156 * run the final pass on all commands.
161 * Print the object state to std::cout.
165 /** Add a custom command to the build. */
166 void AddCustomCommandToTarget(const char* target
,
167 const std::vector
<std::string
>& depends
,
168 const cmCustomCommandLines
& commandLines
,
169 cmTarget::CustomCommandType type
,
170 const char* comment
, const char* workingDir
,
171 bool escapeOldStyle
= true);
172 void AddCustomCommandToOutput(const std::vector
<std::string
>& outputs
,
173 const std::vector
<std::string
>& depends
,
174 const char* main_dependency
,
175 const cmCustomCommandLines
& commandLines
,
176 const char* comment
, const char* workingDir
,
177 bool replace
= false,
178 bool escapeOldStyle
= true);
179 void AddCustomCommandToOutput(const char* output
,
180 const std::vector
<std::string
>& depends
,
181 const char* main_dependency
,
182 const cmCustomCommandLines
& commandLines
,
183 const char* comment
, const char* workingDir
,
184 bool replace
= false,
185 bool escapeOldStyle
= true);
186 void AddCustomCommandOldStyle(const char* target
,
187 const std::vector
<std::string
>& outputs
,
188 const std::vector
<std::string
>& depends
,
190 const cmCustomCommandLines
& commandLines
,
191 const char* comment
);
194 * Add a define flag to the build.
196 void AddDefineFlag(const char* definition
);
197 void RemoveDefineFlag(const char* definition
);
199 /** Create a new imported target with the name and type given. */
200 cmTarget
* AddImportedTarget(const char* name
, cmTarget::TargetType type
);
202 cmTarget
* AddNewTarget(cmTarget::TargetType type
, const char* name
);
205 * Add an executable to the build.
207 cmTarget
* AddExecutable(const char *exename
,
208 const std::vector
<std::string
> &srcs
,
209 bool excludeFromAll
= false);
212 * Add a utility to the build. A utiltity target is a command that
213 * is run every time the target is built.
215 void AddUtilityCommand(const char* utilityName
, bool excludeFromAll
,
216 const std::vector
<std::string
>& depends
,
217 const char* workingDirectory
,
223 cmTarget
* AddUtilityCommand(const char* utilityName
, bool excludeFromAll
,
224 const char* workingDirectory
,
225 const std::vector
<std::string
>& depends
,
226 const cmCustomCommandLines
& commandLines
,
227 bool escapeOldStyle
= true,
228 const char* comment
= 0);
231 * Add a link library to the build.
233 void AddLinkLibrary(const char*);
234 void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type
);
235 void AddLinkLibraryForTarget(const char *tgt
, const char*,
236 cmTarget::LinkLibraryType type
);
237 void AddLinkDirectoryForTarget(const char *tgt
, const char* d
);
240 * Add a link directory to the build.
242 void AddLinkDirectory(const char*);
245 * Get the list of link directories
247 std::vector
<std::string
>& GetLinkDirectories()
249 return this->LinkDirectories
;
251 const std::vector
<std::string
>& GetLinkDirectories() const
253 return this->LinkDirectories
;
255 void SetLinkDirectories(const std::vector
<std::string
>& vec
)
257 this->LinkDirectories
= vec
;
261 * Add a subdirectory to the build.
263 void AddSubDirectory(const char*, bool excludeFromAll
=false,
264 bool preorder
= false);
265 void AddSubDirectory(const char* fullSrcDir
,const char *fullBinDir
,
266 bool excludeFromAll
, bool preorder
,
270 * Configure a subdirectory
272 void ConfigureSubDirectory(cmLocalGenerator
*);
275 * Add an include directory to the build.
277 void AddIncludeDirectory(const char*, bool before
= false);
280 * Add a variable definition to the build. This variable
281 * can be used in CMake to refer to lists, directories, etc.
283 void AddDefinition(const char* name
, const char* value
);
284 ///! Add a definition to this makefile and the global cmake cache.
285 void AddCacheDefinition(const char* name
, const char* value
,
287 cmCacheManager::CacheEntryType type
,
291 * Add bool variable definition to the build.
293 void AddDefinition(const char* name
, bool);
294 ///! Add a definition to this makefile and the global cmake cache.
295 void AddCacheDefinition(const char* name
, bool, const char* doc
);
298 * Remove a variable definition from the build. This is not valid
299 * for cache entries, and will only affect the current makefile.
301 void RemoveDefinition(const char* name
);
302 ///! Remove a definition from the cache.
303 void RemoveCacheDefinition(const char* name
);
306 * Specify the name of the project for this build.
308 void SetProjectName(const char*);
311 * Get the name of the project for this build.
313 const char* GetProjectName() const
315 return this->ProjectName
.c_str();
319 * Set the name of the library.
321 void AddLibrary(const char *libname
, cmTarget::TargetType type
,
322 const std::vector
<std::string
> &srcs
,
323 bool excludeFromAll
= false);
325 #if defined(CMAKE_BUILD_WITH_CMAKE)
327 * Add a root source group for consideration when adding a new source.
329 void AddSourceGroup(const char* name
, const char* regex
=0);
332 * Add a source group for consideration when adding a new source.
335 void AddSourceGroup(const std::vector
<std::string
>& name
,
336 const char* regex
=0);
342 * Set, Push, Pop policy values for CMake.
344 bool SetPolicy(cmPolicies::PolicyID id
, cmPolicies::PolicyStatus status
);
345 bool SetPolicy(const char *id
, cmPolicies::PolicyStatus status
);
346 cmPolicies::PolicyStatus
GetPolicyStatus(cmPolicies::PolicyID id
);
347 bool SetPolicyVersion(const char *version
);
348 void RecordPolicies(cmPolicies::PolicyMap
& pm
);
351 /** Helper class to push and pop policies automatically. */
355 PolicyPushPop(cmMakefile
* m
,
357 cmPolicies::PolicyMap
const& pm
= cmPolicies::PolicyMap());
359 void Quiet() { this->ReportError
= false; }
361 cmMakefile
* Makefile
;
364 friend class PolicyPushPop
;
367 * Get the Policies Instance
369 cmPolicies
*GetPolicies();
372 * Add an auxiliary directory to the build.
374 void AddExtraDirectory(const char* dir
);
378 * Add an auxiliary directory to the build.
380 void MakeStartDirectoriesCurrent()
382 this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
383 this->cmStartDirectory
.c_str());
384 this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
385 this->StartOutputDirectory
.c_str());
390 * Set/Get the home directory (or output directory) in the project. The
391 * home directory is the top directory of the project. It is where
392 * CMakeSetup or configure was run. Remember that CMake processes
393 * CMakeLists files by recursing up the tree starting at the StartDirectory
394 * and going up until it reaches the HomeDirectory.
396 void SetHomeDirectory(const char* dir
);
397 const char* GetHomeDirectory() const
399 return this->cmHomeDirectory
.c_str();
401 void SetHomeOutputDirectory(const char* lib
);
402 const char* GetHomeOutputDirectory() const
404 return this->HomeOutputDirectory
.c_str();
410 * Set/Get the start directory (or output directory). The start directory
411 * is the directory of the CMakeLists.txt file that started the current
412 * round of processing. Remember that CMake processes CMakeLists files by
413 * recursing up the tree starting at the StartDirectory and going up until
414 * it reaches the HomeDirectory.
416 void SetStartDirectory(const char* dir
)
418 this->cmStartDirectory
= dir
;
419 cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory
);
420 this->cmStartDirectory
=
421 cmSystemTools::CollapseFullPath(this->cmStartDirectory
.c_str());
422 this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
423 this->cmStartDirectory
.c_str());
425 const char* GetStartDirectory() const
427 return this->cmStartDirectory
.c_str();
429 void SetStartOutputDirectory(const char* lib
)
431 this->StartOutputDirectory
= lib
;
432 cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory
);
433 this->StartOutputDirectory
=
434 cmSystemTools::CollapseFullPath(this->StartOutputDirectory
.c_str());
435 cmSystemTools::MakeDirectory(this->StartOutputDirectory
.c_str());
436 this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
437 this->StartOutputDirectory
.c_str());
439 const char* GetStartOutputDirectory() const
441 return this->StartOutputDirectory
.c_str();
445 const char* GetCurrentDirectory() const
447 return this->cmStartDirectory
.c_str();
449 const char* GetCurrentOutputDirectory() const
451 return this->StartOutputDirectory
.c_str();
454 /* Get the current CMakeLists.txt file that is being processed. This
455 * is just used in order to be able to 'branch' from one file to a second
457 const char* GetCurrentListFile() const
459 return this->cmCurrentListFile
.c_str();
465 * Set a regular expression that include files must match
466 * in order to be considered as part of the depend information.
468 void SetIncludeRegularExpression(const char* regex
)
470 this->IncludeFileRegularExpression
= regex
;
472 const char* GetIncludeRegularExpression()
474 return this->IncludeFileRegularExpression
.c_str();
478 * Set a regular expression that include files that are not found
479 * must match in order to be considered a problem.
481 void SetComplainRegularExpression(const char* regex
)
483 this->ComplainFileRegularExpression
= regex
;
485 const char* GetComplainRegularExpression()
487 return this->ComplainFileRegularExpression
.c_str();
491 * Get the list of targets
493 cmTargets
&GetTargets() { return this->Targets
; }
495 * Get the list of targets, const version
497 const cmTargets
&GetTargets() const { return this->Targets
; }
499 cmTarget
* FindTarget(const char* name
);
501 /** Find a target to use in place of the given name. The target
502 returned may be imported or built within the project. */
503 cmTarget
* FindTargetToUse(const char* name
);
506 * Get a list of include directories in the build.
508 std::vector
<std::string
>& GetIncludeDirectories()
510 return this->IncludeDirectories
;
512 const std::vector
<std::string
>& GetIncludeDirectories() const
514 return this->IncludeDirectories
;
516 void SetIncludeDirectories(const std::vector
<std::string
>& vec
)
518 this->IncludeDirectories
= vec
;
522 * Mark include directories as system directories.
524 void AddSystemIncludeDirectory(const char* dir
);
525 bool IsSystemIncludeDirectory(const char* dir
);
527 /** Expand out any arguements in the vector that have ; separated
528 * strings into multiple arguements. A new vector is created
529 * containing the expanded versions of all arguments in argsIn.
530 * This method differes from the one in cmSystemTools in that if
531 * the CmakeLists file is version 1.2 or earlier it will check for
532 * source lists being used without ${} around them
534 void ExpandSourceListArguments(std::vector
<std::string
> const& argsIn
,
535 std::vector
<std::string
>& argsOut
,
536 unsigned int startArgumentIndex
);
538 /** Get a cmSourceFile pointer for a given source name, if the name is
539 * not found, then a null pointer is returned.
541 cmSourceFile
* GetSource(const char* sourceName
);
543 /** Get a cmSourceFile pointer for a given source name, if the name is
544 * not found, then create the source file and return it. generated
545 * indicates if it is a generated file, this is used in determining
546 * how to create the source file instance e.g. name
548 cmSourceFile
* GetOrCreateSource(const char* sourceName
,
549 bool generated
= false);
552 * Obtain a list of auxiliary source directories.
554 std::vector
<std::string
>& GetAuxSourceDirectories()
555 {return this->AuxSourceDirectories
;}
559 * Return a list of extensions associated with source and header
562 const std::vector
<std::string
>& GetSourceExtensions() const
563 {return this->SourceFileExtensions
;}
564 const std::vector
<std::string
>& GetHeaderExtensions() const
565 {return this->HeaderFileExtensions
;}
569 * Given a variable name, return its value (as a string).
570 * If the variable is not found in this makefile instance, the
571 * cache is then queried.
573 const char* GetDefinition(const char*) const;
574 const char* GetSafeDefinition(const char*) const;
575 const char* GetRequiredDefinition(const char* name
) const;
576 bool IsDefinitionSet(const char*) const;
578 * Get the list of all variables in the current space. If argument
579 * cacheonly is specified and is greater than 0, then only cache
580 * variables will be listed.
582 std::vector
<std::string
> GetDefinitions(int cacheonly
=0) const;
584 /** Test a boolean cache entry to see if it is true or false,
585 * returns false if no entry defined.
587 bool IsOn(const char* name
) const;
588 bool IsSet(const char* name
) const;
591 * Get a list of preprocessor define flags.
593 const char* GetDefineFlags()
594 {return this->DefineFlags
.c_str();}
597 * Make sure CMake can write this file
599 bool CanIWriteThisFile(const char* fileName
);
602 * Get the vector of used command instances.
604 const std::vector
<cmCommand
*>& GetUsedCommands() const
605 {return this->UsedCommands
;}
607 #if defined(CMAKE_BUILD_WITH_CMAKE)
609 * Get the vector source groups.
611 const std::vector
<cmSourceGroup
>& GetSourceGroups() const
612 { return this->SourceGroups
; }
615 * Get the source group
617 cmSourceGroup
* GetSourceGroup(const std::vector
<std::string
>&name
);
621 * Get the vector of list files on which this makefile depends
623 const std::vector
<std::string
>& GetListFiles() const
624 { return this->ListFiles
; }
625 ///! When the file changes cmake will be re-run from the build system.
626 void AddCMakeDependFile(const char* file
)
627 { this->ListFiles
.push_back(file
);}
630 * Get the list file stack as a string
632 std::string
GetListFileStack();
635 * Get the current context backtrace.
637 bool GetBacktrace(cmListFileBacktrace
& backtrace
) const;
640 * Get the vector of files created by this makefile
642 const std::vector
<std::string
>& GetOutputFiles() const
643 { return this->OutputFiles
; }
644 void AddCMakeOutputFile(const char* file
)
645 { this->OutputFiles
.push_back(file
);}
648 * Expand all defined variables in the string.
649 * Defined variables come from the this->Definitions map.
650 * They are expanded with ${var} where var is the
651 * entry in the this->Definitions map. Also @var@ is
652 * expanded to match autoconf style expansions.
654 const char *ExpandVariablesInString(std::string
& source
);
655 const char *ExpandVariablesInString(std::string
& source
, bool escapeQuotes
,
658 const char* filename
= 0,
660 bool removeEmpty
= false,
661 bool replaceAt
= true);
664 * Remove any remaining variables in the string. Anything with ${var} or
665 * @var@ will be removed.
667 void RemoveVariablesInString(std::string
& source
,
668 bool atOnly
= false) const;
671 * Expand variables in the makefiles ivars such as link directories etc
673 void ExpandVariables();
676 * Replace variables and #cmakedefine lines in the given string.
677 * See cmConfigureFileCommand for details.
679 void ConfigureString(const std::string
& input
, std::string
& output
,
680 bool atOnly
, bool escapeQuotes
);
683 * Copy file but change lines acording to ConfigureString
685 int ConfigureFile(const char* infile
, const char* outfile
,
686 bool copyonly
, bool atOnly
, bool escapeQuotes
);
688 #if defined(CMAKE_BUILD_WITH_CMAKE)
690 * find what source group this source is in
692 cmSourceGroup
& FindSourceGroup(const char* source
,
693 std::vector
<cmSourceGroup
> &groups
);
696 void RegisterData(cmData
*);
697 void RegisterData(const char*, cmData
*);
698 cmData
* LookupData(const char*) const;
701 * Execute a single CMake command. Returns true if the command
702 * succeeded or false if it failed.
704 bool ExecuteCommand(const cmListFileFunction
& lff
,
705 cmExecutionStatus
&status
);
707 /** Check if a command exists. */
708 bool CommandExists(const char* name
) const;
711 * Add a command to this cmake instance
713 void AddCommand(cmCommand
* );
715 ///! Enable support for named language, if nil then all languages are
717 void EnableLanguage(std::vector
<std::string
>const& languages
, bool optional
);
720 * Set/Get the name of the parent directories CMakeLists file
721 * given a current CMakeLists file name
723 cmCacheManager
*GetCacheManager() const;
726 * Get the variable watch. This is used to determine when certain variables
729 #ifdef CMAKE_BUILD_WITH_CMAKE
730 cmVariableWatch
* GetVariableWatch() const;
733 ///! Display progress or status message.
734 void DisplayStatus(const char*, float);
737 * Expand the given list file arguments into the full set after
738 * variable replacement and list expansion.
740 bool ExpandArguments(std::vector
<cmListFileArgument
> const& inArgs
,
741 std::vector
<std::string
>& outArgs
);
745 cmake
*GetCMakeInstance() const;
748 * Get all the source files this makefile knows about
750 const std::vector
<cmSourceFile
*> &GetSourceFiles() const
751 {return this->SourceFiles
;}
752 std::vector
<cmSourceFile
*> &GetSourceFiles() {return this->SourceFiles
;}
755 * Is there a source file that has the provided source file as an output?
756 * if so then return it
758 cmSourceFile
*GetSourceFileWithOutput(const char *outName
);
761 * Add a macro to the list of macros. The arguments should be name of the
762 * macro and a documentation signature of it
764 void AddMacro(const char* name
, const char* signature
);
766 ///! Add a new cmTest to the list of tests for this makefile.
767 cmTest
* CreateTest(const char* testName
);
769 /** Get a cmTest pointer for a given test name, if the name is
770 * not found, then a null pointer is returned.
772 cmTest
* GetTest(const char* testName
) const;
775 * Get a list of macros as a ; separated string
777 void GetListOfMacros(std::string
& macros
);
780 * Return a location of a file in cmake or custom modules directory
782 std::string
GetModulesFile(const char* name
);
784 ///! Set/Get a property of this directory
785 void SetProperty(const char *prop
, const char *value
);
786 void AppendProperty(const char *prop
, const char *value
);
787 const char *GetProperty(const char *prop
);
788 const char *GetPropertyOrDefinition(const char *prop
);
789 const char *GetProperty(const char *prop
, cmProperty::ScopeType scope
);
790 bool GetPropertyAsBool(const char *prop
);
792 // Get the properties
793 cmPropertyMap
&GetProperties() { return this->Properties
; };
795 typedef std::map
<cmStdString
, cmStdString
> DefinitionMap
;
796 ///! Initialize a makefile from its parent
797 void InitializeFromParent();
799 ///! Set/Get the preorder flag
800 void SetPreOrder(bool p
) { this->PreOrder
= p
; }
801 bool GetPreOrder() const { return this->PreOrder
; }
803 void AddInstallGenerator(cmInstallGenerator
* g
)
804 { if(g
) this->InstallGenerators
.push_back(g
); }
805 std::vector
<cmInstallGenerator
*>& GetInstallGenerators()
806 { return this->InstallGenerators
; }
808 void AddTestGenerator(cmTestGenerator
* g
)
809 { if(g
) this->TestGenerators
.push_back(g
); }
810 std::vector
<cmTestGenerator
*>& GetTestGenerators()
811 { return this->TestGenerators
; }
813 // Define the properties
814 static void DefineProperties(cmake
*cm
);
816 // push and pop variable scopes
819 void RaiseScope(const char *var
, const char *value
);
821 /** Helper class to push and pop scopes automatically. */
825 ScopePushPop(cmMakefile
* m
): Makefile(m
) { this->Makefile
->PushScope(); }
826 ~ScopePushPop() { this->Makefile
->PopScope(); }
828 cmMakefile
* Makefile
;
831 void IssueMessage(cmake::MessageType t
,
832 std::string
const& text
) const;
834 /** Set whether or not to report a CMP0000 violation. */
835 void SetCheckCMP0000(bool b
) { this->CheckCMP0000
= b
; }
838 // add link libraries and directories to the target
839 void AddGlobalLinkInformation(const char* name
, cmTarget
& target
);
842 std::vector
<std::string
> AuxSourceDirectories
; //
844 std::string cmStartDirectory
;
845 std::string StartOutputDirectory
;
846 std::string cmHomeDirectory
;
847 std::string HomeOutputDirectory
;
848 std::string cmCurrentListFile
;
850 std::string ProjectName
; // project name
852 // libraries, classes, and executables
854 std::vector
<cmSourceFile
*> SourceFiles
;
857 std::map
<cmStdString
, cmTest
*> Tests
;
859 // The include and link-library paths. These may have order
860 // dependency, so they must be vectors (not set).
861 std::vector
<std::string
> IncludeDirectories
;
862 std::vector
<std::string
> LinkDirectories
;
864 // The set of include directories that are marked as system include
866 std::set
<cmStdString
> SystemIncludeDirectories
;
868 std::vector
<std::string
> ListFiles
; // list of command files loaded
869 std::vector
<std::string
> OutputFiles
; // list of command files loaded
872 cmTarget::LinkLibraryVectorType LinkLibraries
;
874 std::vector
<cmInstallGenerator
*> InstallGenerators
;
875 std::vector
<cmTestGenerator
*> TestGenerators
;
877 std::string IncludeFileRegularExpression
;
878 std::string ComplainFileRegularExpression
;
879 std::vector
<std::string
> SourceFileExtensions
;
880 std::vector
<std::string
> HeaderFileExtensions
;
881 std::string DefineFlags
;
883 // Track the value of the computed DEFINITIONS property.
884 void AddDefineFlag(const char*, std::string
&);
885 void RemoveDefineFlag(const char*, std::string::size_type
, std::string
&);
886 std::string DefineFlagsOrig
;
888 #if defined(CMAKE_BUILD_WITH_CMAKE)
889 std::vector
<cmSourceGroup
> SourceGroups
;
892 std::vector
<DefinitionMap
> DefinitionStack
;
893 std::vector
<cmCommand
*> UsedCommands
;
894 cmLocalGenerator
* LocalGenerator
;
895 bool IsFunctionBlocked(const cmListFileFunction
& lff
,
896 cmExecutionStatus
&status
);
901 bool ParseDefineFlag(std::string
const& definition
, bool remove
);
903 void ReadSources(std::ifstream
& fin
, bool t
);
904 friend class cmMakeDepend
; // make depend needs direct access
905 // to the Sources array
906 void PrintStringVector(const char* s
, const
907 std::vector
<std::pair
<cmStdString
, bool> >& v
) const;
908 void PrintStringVector(const char* s
,
909 const std::vector
<std::string
>& v
) const;
911 void AddDefaultDefinitions();
912 typedef std::vector
<cmFunctionBlocker
*> FunctionBlockersType
;
913 FunctionBlockersType FunctionBlockers
;
914 std::vector
<FunctionBlockersType::size_type
> FunctionBlockerBarriers
;
915 void PushFunctionBlockerBarrier();
916 void PopFunctionBlockerBarrier(bool reportError
= true);
918 typedef std::map
<cmStdString
, cmData
*> DataMapType
;
921 typedef std::map
<cmStdString
, cmStdString
> StringStringMap
;
922 StringStringMap MacrosMap
;
924 std::map
<cmStdString
, bool> SubDirectoryOrder
;
925 // used in AddDefinition for performance improvement
926 DefinitionMap::key_type TemporaryDefinitionKey
;
928 cmsys::RegularExpression cmDefineRegex
;
929 cmsys::RegularExpression cmDefine01Regex
;
930 cmsys::RegularExpression cmAtVarRegex
;
932 cmPropertyMap Properties
;
934 // should this makefile be processed before or after processing the parent
937 // stack of list files being read
938 std::deque
<cmStdString
> ListFileStack
;
940 // stack of commands being invoked.
941 struct CallStackEntry
943 cmListFileContext
const* Context
;
944 cmExecutionStatus
* Status
;
946 typedef std::deque
<CallStackEntry
> CallStackType
;
947 CallStackType CallStack
;
948 friend class cmMakefileCall
;
950 cmTarget
* FindBasicTarget(const char* name
);
951 std::vector
<cmTarget
*> ImportedTargetsOwned
;
952 std::map
<cmStdString
, cmTarget
*> ImportedTargets
;
954 // Internal policy stack management.
955 void PushPolicy(bool weak
= false,
956 cmPolicies::PolicyMap
const& pm
= cmPolicies::PolicyMap());
958 void PushPolicyBarrier();
959 void PopPolicyBarrier(bool reportError
= true);
960 friend class cmCMakePolicyCommand
;
962 friend class IncludeScope
;
964 // stack of policy settings
965 struct PolicyStackEntry
: public cmPolicies::PolicyMap
967 typedef cmPolicies::PolicyMap derived
;
968 PolicyStackEntry(bool w
= false): derived(), Weak(w
) {}
969 PolicyStackEntry(derived
const& d
, bool w
= false): derived(d
), Weak(w
) {}
970 PolicyStackEntry(PolicyStackEntry
const& r
): derived(r
), Weak(r
.Weak
) {}
973 typedef std::vector
<PolicyStackEntry
> PolicyStackType
;
974 PolicyStackType PolicyStack
;
975 std::vector
<PolicyStackType::size_type
> PolicyBarriers
;
976 cmPolicies::PolicyStatus
GetPolicyStatusInternal(cmPolicies::PolicyID id
);
980 // Enforce rules about CMakeLists.txt files.
981 void EnforceDirectoryLevelRules();
984 //----------------------------------------------------------------------------
985 // Helper class to make sure the call stack is valid.
989 cmMakefileCall(cmMakefile
* mf
,
990 cmListFileContext
const& lfc
,
991 cmExecutionStatus
& status
): Makefile(mf
)
993 cmMakefile::CallStackEntry entry
= {&lfc
, &status
};
994 this->Makefile
->CallStack
.push_back(entry
);
998 this->Makefile
->CallStack
.pop_back();
1001 cmMakefile
* Makefile
;