diff options
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 105 |
1 files changed, 38 insertions, 67 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 40344ce..9d9e90a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -5,36 +5,28 @@ #include <cmConfigure.h> +#include <cmsys/RegularExpression.hxx> +#include <map> +#include <set> +#include <stack> +#include <string> +#include <vector> + #include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmNewLineStyle.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateSnapshot.h" +#include "cmStateTypes.h" #include "cmTarget.h" -#include "cmTargetLinkLibraryType.h" +#include "cm_auto_ptr.hxx" +#include "cm_unordered_map.hxx" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" #endif -#include <cm_auto_ptr.hxx> -#include <cmsys/RegularExpression.hxx> - -#include <map> -#include <set> -#include <stack> -#include <string> -#include <vector> - -#if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX_UNORDERED_MAP -#include <unordered_map> -#else -#include <cmsys/hash_map.hxx> -#endif -#endif - class cmCommand; class cmCompiledGeneratorExpression; class cmCustomCommandLines; @@ -47,6 +39,7 @@ class cmGlobalGenerator; class cmInstallGenerator; class cmMessenger; class cmSourceFile; +class cmState; class cmTest; class cmTestGenerator; class cmVariableWatch; @@ -70,7 +63,7 @@ public: * Construct an empty makefile. */ cmMakefile(cmGlobalGenerator* globalGenerator, - const cmState::Snapshot& snapshot); + const cmStateSnapshot& snapshot); /** * Destructor. @@ -132,7 +125,8 @@ public: const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, const char* comment, const char* workingDir, bool escapeOldStyle = true, - bool uses_terminal = false, const std::string& depfile = ""); + bool uses_terminal = false, const std::string& depfile = "", + bool command_expand_lists = false); cmSourceFile* AddCustomCommandToOutput( const std::vector<std::string>& outputs, const std::vector<std::string>& byproducts, @@ -140,13 +134,15 @@ public: const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, bool escapeOldStyle = true, - bool uses_terminal = false, const std::string& depfile = ""); + bool uses_terminal = false, bool command_expand_lists = false, + const std::string& depfile = ""); cmSourceFile* AddCustomCommandToOutput( const std::string& output, const std::vector<std::string>& depends, const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, bool escapeOldStyle = true, - bool uses_terminal = false, const std::string& depfile = ""); + bool uses_terminal = false, bool command_expand_lists = false, + const std::string& depfile = ""); void AddCustomCommandOldStyle(const std::string& target, const std::vector<std::string>& outputs, const std::vector<std::string>& depends, @@ -163,9 +159,10 @@ public: /** Create a new imported target with the name and type given. */ cmTarget* AddImportedTarget(const std::string& name, - cmState::TargetType type, bool global); + cmStateEnums::TargetType type, bool global); - cmTarget* AddNewTarget(cmState::TargetType type, const std::string& name); + cmTarget* AddNewTarget(cmStateEnums::TargetType type, + const std::string& name); /** * Add an executable to the build. @@ -188,22 +185,15 @@ public: const std::string& utilityName, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle = true, - const char* comment = CM_NULLPTR, bool uses_terminal = false); + const char* comment = CM_NULLPTR, bool uses_terminal = false, + bool command_expand_lists = false); cmTarget* AddUtilityCommand( const std::string& utilityName, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle = true, - const char* comment = CM_NULLPTR, bool uses_terminal = false); - - /** - * Add a link library to the build. - */ - void AddLinkLibrary(const std::string&); - void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); - void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, - cmTargetLinkLibraryType type); - void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); + const char* comment = CM_NULLPTR, bool uses_terminal = false, + bool command_expand_lists = false); /** * Add a subdirectory to the build. @@ -232,7 +222,7 @@ public: void AddDefinition(const std::string& name, const char* value); ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, - const char* doc, cmState::CacheEntryType type, + const char* doc, cmStateEnums::CacheEntryType type, bool force = false); /** @@ -260,7 +250,8 @@ public: /** * Set the name of the library. */ - cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type, + cmTarget* AddLibrary(const std::string& libname, + cmStateEnums::TargetType type, const std::vector<std::string>& srcs, bool excludeFromAll = false); void AddAlias(const std::string& libname, const std::string& tgt); @@ -447,7 +438,7 @@ public: /** * Get a list of preprocessor define flags. */ - const char* GetDefineFlags() const { return this->DefineFlags.c_str(); } + std::string GetDefineFlags() const { return this->DefineFlags; } /** * Make sure CMake can write this file @@ -760,7 +751,7 @@ public: void ClearMatches(); void StoreMatches(cmsys::RegularExpression& re); - cmState::Snapshot GetStateSnapshot() const; + cmStateSnapshot GetStateSnapshot() const; const char* GetDefineFlagsCMP0059() const; @@ -781,7 +772,7 @@ public: protected: // add link libraries and directories to the target - void AddGlobalLinkInformation(const std::string& name, cmTarget& target); + void AddGlobalLinkInformation(cmTarget& target); // Check for a an unused variable void LogUnused(const char* reason, const std::string& name) const; @@ -790,24 +781,12 @@ protected: // libraries, classes, and executables mutable cmTargets Targets; -#if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX_UNORDERED_MAP - typedef std::unordered_map<std::string, cmTarget*> TargetMap; -#else - typedef cmsys::hash_map<std::string, cmTarget*> TargetMap; -#endif -#else - typedef std::map<std::string, cmTarget*> TargetMap; -#endif std::map<std::string, std::string> AliasTargets; std::vector<cmSourceFile*> SourceFiles; // Tests std::map<std::string, cmTest*> Tests; - // The link-library paths. Order matters, use std::vector (not std::set). - std::vector<std::string> LinkDirectories; - // The set of include directories that are marked as system include // directories. std::set<std::string> SystemIncludeDirectories; @@ -815,8 +794,6 @@ protected: std::vector<std::string> ListFiles; std::vector<std::string> OutputFiles; - cmTarget::LinkLibraryVectorType LinkLibraries; - std::vector<cmInstallGenerator*> InstallGenerators; std::vector<cmTestGenerator*> TestGenerators; @@ -841,7 +818,7 @@ private: cmMakefile(const cmMakefile& mf); cmMakefile& operator=(const cmMakefile& mf); - cmState::Snapshot StateSnapshot; + cmStateSnapshot StateSnapshot; cmListFileBacktrace Backtrace; void ReadListFile(cmListFile const& listFile, @@ -875,6 +852,7 @@ private: friend class cmParseFileScope; std::vector<cmTarget*> ImportedTargetsOwned; + typedef CM_UNORDERED_MAP<std::string, cmTarget*> TargetMap; TargetMap ImportedTargets; // Internal policy stack management. @@ -911,16 +889,8 @@ private: */ cmSourceFile* LinearGetSourceFileWithOutput(const std::string& cname) const; -// A map for fast output to input look up. -#if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX_UNORDERED_MAP - typedef std::unordered_map<std::string, cmSourceFile*> OutputToSourceMap; -#else - typedef cmsys::hash_map<std::string, cmSourceFile*> OutputToSourceMap; -#endif -#else - typedef std::map<std::string, cmSourceFile*> OutputToSourceMap; -#endif + // A map for fast output to input look up. + typedef CM_UNORDERED_MAP<std::string, cmSourceFile*> OutputToSourceMap; OutputToSourceMap OutputToSource; void UpdateOutputToSourceMap(std::vector<std::string> const& outputs, @@ -940,7 +910,8 @@ private: void CheckNeededCLanguage(const std::string& feature, bool& needC90, bool& needC99, bool& needC11) const; void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, - bool& needCxx11, bool& needCxx14) const; + bool& needCxx11, bool& needCxx14, + bool& needCxx17) const; bool HaveCStandardAvailable(cmTarget const* target, const std::string& feature) const; |