2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-05-18 23:25:08 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2001-05-18 23:25:08 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2001-05-18 23:25:08 +04:00
|
|
|
|
2004-10-04 20:31:09 +04:00
|
|
|
#ifndef cmake_h
|
|
|
|
#define cmake_h
|
|
|
|
|
2016-04-29 16:40:20 +03:00
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
2015-04-05 01:07:04 +03:00
|
|
|
#include "cmCacheManager.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmInstalledFile.h"
|
|
|
|
#include "cmListFileCache.h"
|
2015-04-07 23:45:54 +03:00
|
|
|
#include "cmState.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmSystemTools.h"
|
2002-09-06 21:06:23 +04:00
|
|
|
|
2012-11-19 18:48:33 +04:00
|
|
|
class cmGlobalGeneratorFactory;
|
2002-09-06 21:06:23 +04:00
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmMakefile;
|
2016-01-29 00:10:27 +03:00
|
|
|
class cmMessenger;
|
2003-01-08 20:59:52 +03:00
|
|
|
class cmVariableWatch;
|
2005-10-12 21:51:15 +04:00
|
|
|
class cmFileTimeComparison;
|
2016-07-20 19:28:39 +03:00
|
|
|
class cmExternalMakefileProjectGeneratorFactory;
|
2007-10-22 20:49:09 +04:00
|
|
|
class cmDocumentationSection;
|
2010-10-31 17:58:18 +03:00
|
|
|
class cmTarget;
|
2010-10-31 19:40:46 +03:00
|
|
|
class cmGeneratedFileStream;
|
2001-05-18 23:25:08 +04:00
|
|
|
|
2012-02-28 16:44:54 +04:00
|
|
|
/** \brief Represents a cmake invocation.
|
|
|
|
*
|
|
|
|
* This class represents a cmake invocation. It is the top level class when
|
2012-11-07 20:13:09 +04:00
|
|
|
* running cmake. Most cmake based GUIs should primarily create an instance
|
2012-02-28 16:44:54 +04:00
|
|
|
* of this class and communicate with it.
|
|
|
|
*
|
|
|
|
* The basic process for a GUI is as follows:
|
|
|
|
*
|
|
|
|
* -# Create a cmake instance
|
2015-04-16 01:52:20 +03:00
|
|
|
* -# Set the Home directories, generator, and cmake command. this
|
2012-02-28 16:44:54 +04:00
|
|
|
* can be done using the Set methods or by using SetArgs and passing in
|
|
|
|
* command line arguments.
|
|
|
|
* -# Load the cache by calling LoadCache (duh)
|
|
|
|
* -# if you are using command line arguments with -D or -C flags then
|
|
|
|
* call SetCacheArgs (or if for some other reason you want to modify the
|
|
|
|
* cache), do it now.
|
|
|
|
* -# Finally call Configure
|
|
|
|
* -# Let the user change values and go back to step 5
|
|
|
|
* -# call Generate
|
|
|
|
|
2015-04-16 01:52:20 +03:00
|
|
|
* If your GUI allows the user to change the home directories then
|
2012-02-28 16:44:54 +04:00
|
|
|
* you must at a minimum redo steps 2 through 7.
|
|
|
|
*/
|
|
|
|
|
2002-08-24 00:13:34 +04:00
|
|
|
class cmake
|
2001-05-18 23:25:08 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
public:
|
2008-03-11 17:29:56 +03:00
|
|
|
enum MessageType
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
AUTHOR_WARNING,
|
2015-12-22 00:39:27 +03:00
|
|
|
AUTHOR_ERROR,
|
2008-03-11 17:29:56 +03:00
|
|
|
FATAL_ERROR,
|
2008-03-13 04:06:32 +03:00
|
|
|
INTERNAL_ERROR,
|
2008-03-11 17:29:56 +03:00
|
|
|
MESSAGE,
|
|
|
|
WARNING,
|
2013-09-17 20:54:34 +04:00
|
|
|
LOG,
|
|
|
|
DEPRECATION_ERROR,
|
|
|
|
DEPRECATION_WARNING
|
2008-03-11 17:29:56 +03:00
|
|
|
};
|
2011-07-13 20:59:51 +04:00
|
|
|
|
2015-11-29 15:39:03 +03:00
|
|
|
enum DiagLevel
|
|
|
|
{
|
|
|
|
DIAG_IGNORE,
|
2015-12-22 00:39:27 +03:00
|
|
|
DIAG_WARN,
|
|
|
|
DIAG_ERROR
|
2015-11-29 15:39:03 +03:00
|
|
|
};
|
2011-07-13 20:59:51 +04:00
|
|
|
|
2012-02-26 02:21:39 +04:00
|
|
|
/** \brief Describes the working modes of cmake */
|
2011-07-13 20:59:51 +04:00
|
|
|
enum WorkingMode
|
|
|
|
{
|
2012-02-26 02:21:39 +04:00
|
|
|
NORMAL_MODE, ///< Cmake runs to create project files
|
2016-05-16 17:34:04 +03:00
|
|
|
/** \brief Script mode (started by using -P).
|
|
|
|
*
|
|
|
|
* In script mode there is no generator and no cache. Also,
|
|
|
|
* languages are not enabled, so add_executable and things do
|
|
|
|
* nothing.
|
|
|
|
*/
|
2011-07-13 20:59:51 +04:00
|
|
|
SCRIPT_MODE,
|
2012-02-26 02:21:39 +04:00
|
|
|
/** \brief A pkg-config like mode
|
|
|
|
*
|
|
|
|
* In this mode cmake just searches for a package and prints the results to
|
|
|
|
* stdout. This is similar to SCRIPT_MODE, but commands like add_library()
|
|
|
|
* work too, since they may be used e.g. in exported target files. Started
|
|
|
|
* via --find-package.
|
|
|
|
*/
|
2011-07-13 20:59:51 +04:00
|
|
|
FIND_PACKAGE_MODE
|
|
|
|
};
|
2015-02-15 22:17:54 +03:00
|
|
|
|
|
|
|
struct GeneratorInfo
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
2015-02-15 22:17:54 +03:00
|
|
|
std::string name;
|
2016-07-21 14:24:11 +03:00
|
|
|
std::string baseName;
|
|
|
|
std::string extraName;
|
2015-02-15 22:17:54 +03:00
|
|
|
bool supportsToolset;
|
2016-07-11 16:44:37 +03:00
|
|
|
bool supportsPlatform;
|
2016-07-20 19:28:39 +03:00
|
|
|
bool isAlias;
|
2016-05-16 17:34:04 +03:00
|
|
|
};
|
2015-02-15 22:17:54 +03:00
|
|
|
|
2014-05-15 21:12:40 +04:00
|
|
|
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
|
2003-08-04 04:47:44 +04:00
|
|
|
|
2012-02-26 02:36:38 +04:00
|
|
|
/// Default constructor
|
2002-09-06 21:06:23 +04:00
|
|
|
cmake();
|
2012-02-26 02:36:38 +04:00
|
|
|
/// Destructor
|
2002-09-06 21:06:23 +04:00
|
|
|
~cmake();
|
2001-05-18 23:25:08 +04:00
|
|
|
|
2016-06-30 16:38:44 +03:00
|
|
|
std::string ReportCapabilities() const;
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; }
|
|
|
|
static const char* GetCMakeFilesDirectoryPostSlash()
|
|
|
|
{
|
|
|
|
return "CMakeFiles/";
|
|
|
|
}
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2002-09-06 21:06:23 +04:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* Set/Get the home directory (or output directory) in the project. The
|
2012-03-20 02:05:21 +04:00
|
|
|
* home directory is the top directory of the project. It is the
|
2015-04-16 01:52:20 +03:00
|
|
|
* path-to-source cmake was run with.
|
2002-09-06 21:06:23 +04:00
|
|
|
*/
|
2014-02-08 00:24:15 +04:00
|
|
|
void SetHomeDirectory(const std::string& dir);
|
2015-04-12 21:10:40 +03:00
|
|
|
const char* GetHomeDirectory() const;
|
2015-04-12 20:32:48 +03:00
|
|
|
void SetHomeOutputDirectory(const std::string& dir);
|
2015-04-12 21:10:40 +03:00
|
|
|
const char* GetHomeOutputDirectory() const;
|
2002-09-06 21:06:23 +04:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle a command line invocation of cmake.
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
int Run(const std::vector<std::string>& args)
|
|
|
|
{
|
|
|
|
return this->Run(args, false);
|
|
|
|
}
|
|
|
|
int Run(const std::vector<std::string>& args, bool noconfigure);
|
2001-05-18 23:25:08 +04:00
|
|
|
|
|
|
|
/**
|
2007-05-28 20:23:32 +04:00
|
|
|
* Run the global generator Generate step.
|
2001-05-18 23:25:08 +04:00
|
|
|
*/
|
2002-09-06 21:06:23 +04:00
|
|
|
int Generate();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure the cmMakefiles. This routine will create a GlobalGenerator if
|
|
|
|
* one has not already been set. It will then Call Configure on the
|
|
|
|
* GlobalGenerator. This in turn will read in an process all the CMakeList
|
|
|
|
* files for the tree. It will not produce any actual Makefiles, or
|
|
|
|
* workspaces. Generate does that. */
|
2002-09-17 21:59:58 +04:00
|
|
|
int Configure();
|
2007-12-13 23:54:29 +03:00
|
|
|
int ActualConfigure();
|
2002-09-17 21:59:58 +04:00
|
|
|
|
2015-04-05 01:07:04 +03:00
|
|
|
///! Break up a line like VAR:type="value" into var, type and value
|
2016-05-16 17:34:04 +03:00
|
|
|
static bool ParseCacheEntry(const std::string& entry, std::string& var,
|
|
|
|
std::string& value,
|
|
|
|
cmState::CacheEntryType& type);
|
2015-04-05 01:07:04 +03:00
|
|
|
|
2002-11-07 17:04:20 +03:00
|
|
|
int LoadCache();
|
2015-04-05 01:07:04 +03:00
|
|
|
bool LoadCache(const std::string& path);
|
|
|
|
bool LoadCache(const std::string& path, bool internal,
|
|
|
|
std::set<std::string>& excludes,
|
|
|
|
std::set<std::string>& includes);
|
|
|
|
bool SaveCache(const std::string& path);
|
|
|
|
bool DeleteCache(const std::string& path);
|
2004-08-17 23:36:08 +04:00
|
|
|
void PreLoadCMakeFiles();
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Create a GlobalGenerator
|
2014-02-25 02:36:27 +04:00
|
|
|
cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Return the global generator assigned to this instance of cmake
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
|
2007-06-15 18:10:24 +04:00
|
|
|
///! Return the global generator assigned to this instance of cmake, const
|
2010-10-31 17:58:18 +03:00
|
|
|
const cmGlobalGenerator* GetGlobalGenerator() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->GlobalGenerator;
|
|
|
|
}
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Return the global generator assigned to this instance of cmake
|
2016-05-16 17:34:04 +03:00
|
|
|
void SetGlobalGenerator(cmGlobalGenerator*);
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Get the names of the current registered generators
|
2016-08-16 20:36:54 +03:00
|
|
|
void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) const;
|
2002-09-06 21:06:23 +04:00
|
|
|
|
2014-09-05 22:25:27 +04:00
|
|
|
///! Set the name of the selected generator-specific platform.
|
|
|
|
void SetGeneratorPlatform(std::string const& ts)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
this->GeneratorPlatform = ts;
|
|
|
|
}
|
2014-09-05 22:25:27 +04:00
|
|
|
|
|
|
|
///! Get the name of the selected generator-specific platform.
|
|
|
|
std::string const& GetGeneratorPlatform() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->GeneratorPlatform;
|
|
|
|
}
|
2014-09-05 22:25:27 +04:00
|
|
|
|
2012-12-10 19:42:33 +04:00
|
|
|
///! Set the name of the selected generator-specific toolset.
|
|
|
|
void SetGeneratorToolset(std::string const& ts)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
this->GeneratorToolset = ts;
|
|
|
|
}
|
2012-12-10 19:42:33 +04:00
|
|
|
|
|
|
|
///! Get the name of the selected generator-specific toolset.
|
|
|
|
std::string const& GetGeneratorToolset() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->GeneratorToolset;
|
|
|
|
}
|
2012-12-10 19:42:33 +04:00
|
|
|
|
2015-10-24 15:58:23 +03:00
|
|
|
const std::vector<std::string>& GetSourceExtensions() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->SourceFileExtensions;
|
|
|
|
}
|
2015-10-24 15:58:23 +03:00
|
|
|
const std::vector<std::string>& GetHeaderExtensions() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->HeaderFileExtensions;
|
|
|
|
}
|
2015-10-24 15:58:23 +03:00
|
|
|
|
2002-09-06 21:06:23 +04:00
|
|
|
/**
|
|
|
|
* Given a variable name, return its value (as a string).
|
|
|
|
*/
|
2014-02-05 01:06:56 +04:00
|
|
|
const char* GetCacheDefinition(const std::string&) const;
|
2002-12-04 18:57:22 +03:00
|
|
|
///! Add an entry into the cache
|
2014-02-05 01:06:56 +04:00
|
|
|
void AddCacheEntry(const std::string& key, const char* value,
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* helpString, int type);
|
2002-06-03 21:08:52 +04:00
|
|
|
|
2010-10-31 17:58:18 +03:00
|
|
|
/**
|
2007-02-27 18:10:10 +03:00
|
|
|
* Get the system information and write it to the file specified
|
|
|
|
*/
|
|
|
|
int GetSystemInformation(std::vector<std::string>&);
|
|
|
|
|
2001-11-21 01:51:03 +03:00
|
|
|
///! Parse command line arguments
|
2010-10-06 23:00:52 +04:00
|
|
|
void SetArgs(const std::vector<std::string>&,
|
|
|
|
bool directoriesSetBefore = false);
|
2002-09-06 21:06:23 +04:00
|
|
|
|
2002-09-12 19:08:06 +04:00
|
|
|
///! Is this cmake running as a result of a TRY_COMPILE command
|
2015-04-11 13:12:14 +03:00
|
|
|
bool GetIsInTryCompile() const;
|
|
|
|
void SetIsInTryCompile(bool b);
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2002-09-17 21:59:58 +04:00
|
|
|
///! Parse command line arguments that might set cache values
|
2003-10-29 17:45:26 +03:00
|
|
|
bool SetCacheArgs(const std::vector<std::string>&);
|
2002-09-13 21:48:14 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
typedef void (*ProgressCallbackType)(const char* msg, float progress, void*);
|
2002-09-26 23:14:20 +04:00
|
|
|
/**
|
2012-11-07 20:13:09 +04:00
|
|
|
* Set the function used by GUIs to receive progress updates
|
2010-10-31 17:58:18 +03:00
|
|
|
* Function gets passed: message as a const char*, a progress
|
2002-09-26 23:14:20 +04:00
|
|
|
* amount ranging from 0 to 1.0 and client data. The progress
|
2010-10-31 17:58:18 +03:00
|
|
|
* number provided may be negative in cases where a message is
|
2002-09-26 23:14:20 +04:00
|
|
|
* to be displayed without any progress percentage.
|
|
|
|
*/
|
2016-06-27 23:44:16 +03:00
|
|
|
void SetProgressCallback(ProgressCallbackType f,
|
|
|
|
void* clientData = CM_NULLPTR);
|
2002-09-26 23:14:20 +04:00
|
|
|
|
|
|
|
///! this is called by generators to update the progress
|
2016-05-16 17:34:04 +03:00
|
|
|
void UpdateProgress(const char* msg, float prog);
|
2002-09-26 23:14:20 +04:00
|
|
|
|
2003-01-08 20:59:52 +03:00
|
|
|
///! Get the variable watch object
|
2006-03-15 19:02:08 +03:00
|
|
|
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
|
2003-01-08 20:59:52 +03:00
|
|
|
|
2003-07-08 05:52:10 +04:00
|
|
|
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
|
2003-05-29 19:14:05 +04:00
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
///! Set/Get a property of this target file
|
2016-05-16 17:34:04 +03:00
|
|
|
void SetProperty(const std::string& prop, const char* value);
|
|
|
|
void AppendProperty(const std::string& prop, const char* value,
|
|
|
|
bool asString = false);
|
|
|
|
const char* GetProperty(const std::string& prop);
|
2013-09-03 00:27:32 +04:00
|
|
|
bool GetPropertyAsBool(const std::string& prop);
|
2006-12-07 17:45:32 +03:00
|
|
|
|
2014-05-15 21:12:40 +04:00
|
|
|
///! Get or create an cmInstalledFile instance and return a pointer to it
|
2016-05-16 17:34:04 +03:00
|
|
|
cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf,
|
|
|
|
const std::string& name);
|
2014-05-15 21:12:40 +04:00
|
|
|
|
|
|
|
cmInstalledFile const* GetInstalledFile(const std::string& name) const;
|
|
|
|
|
|
|
|
InstalledFilesMap const& GetInstalledFiles() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->InstalledFiles;
|
|
|
|
}
|
2014-05-15 21:12:40 +04:00
|
|
|
|
2003-05-29 19:14:05 +04:00
|
|
|
///! Do all the checks before running configure
|
|
|
|
int DoPreConfigureChecks();
|
2003-10-29 17:45:26 +03:00
|
|
|
|
2011-07-13 20:59:51 +04:00
|
|
|
void SetWorkingMode(WorkingMode mode) { this->CurrentWorkingMode = mode; }
|
|
|
|
WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; }
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2012-03-20 02:05:21 +04:00
|
|
|
///! Debug the try compile stuff by not deleting the files
|
2016-05-16 17:34:04 +03:00
|
|
|
bool GetDebugTryCompile() { return this->DebugTryCompile; }
|
|
|
|
void DebugTryCompileOn() { this->DebugTryCompile = true; }
|
2004-04-18 22:41:46 +04:00
|
|
|
|
2005-05-02 23:51:12 +04:00
|
|
|
/**
|
|
|
|
* Generate CMAKE_ROOT and CMAKE_COMMAND cache entries
|
|
|
|
*/
|
2007-12-14 01:56:50 +03:00
|
|
|
int AddCMakePaths();
|
2005-05-02 23:51:12 +04:00
|
|
|
|
2005-10-12 21:51:15 +04:00
|
|
|
/**
|
|
|
|
* Get the file comparison class
|
|
|
|
*/
|
2006-03-15 19:02:08 +03:00
|
|
|
cmFileTimeComparison* GetFileComparison() { return this->FileComparison; }
|
2005-10-12 21:51:15 +04:00
|
|
|
|
2006-10-06 19:11:59 +04:00
|
|
|
// Do we want debug output during the cmake run.
|
|
|
|
bool GetDebugOutput() { return this->DebugOutput; }
|
2016-05-16 17:34:04 +03:00
|
|
|
void SetDebugOutputOn(bool b) { this->DebugOutput = b; }
|
2006-10-30 23:59:54 +03:00
|
|
|
|
2008-07-31 18:33:25 +04:00
|
|
|
// Do we want trace output during the cmake run.
|
2016-05-16 17:34:04 +03:00
|
|
|
bool GetTrace() { return this->Trace; }
|
|
|
|
void SetTrace(bool b) { this->Trace = b; }
|
|
|
|
bool GetTraceExpand() { return this->TraceExpand; }
|
|
|
|
void SetTraceExpand(bool b) { this->TraceExpand = b; }
|
2016-06-13 22:27:58 +03:00
|
|
|
void AddTraceSource(std::string const& file)
|
|
|
|
{
|
|
|
|
this->TraceOnlyThisSources.push_back(file);
|
|
|
|
}
|
|
|
|
std::vector<std::string> const& GetTraceSources() const
|
|
|
|
{
|
|
|
|
return this->TraceOnlyThisSources;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
bool GetWarnUninitialized() { return this->WarnUninitialized; }
|
|
|
|
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
|
|
|
|
bool GetWarnUnused() { return this->WarnUnused; }
|
|
|
|
void SetWarnUnused(bool b) { this->WarnUnused = b; }
|
|
|
|
bool GetWarnUnusedCli() { return this->WarnUnusedCli; }
|
|
|
|
void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
|
|
|
|
bool GetCheckSystemVars() { return this->CheckSystemVars; }
|
|
|
|
void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; }
|
2010-09-01 18:22:08 +04:00
|
|
|
|
|
|
|
void MarkCliAsUsed(const std::string& variable);
|
|
|
|
|
2008-09-05 01:34:25 +04:00
|
|
|
/** Get the list of configurations (in upper case) considered to be
|
|
|
|
debugging configurations.*/
|
2015-04-11 13:04:05 +03:00
|
|
|
std::vector<std::string> GetDebugConfigs();
|
2008-09-05 01:34:25 +04:00
|
|
|
|
2013-11-08 00:30:59 +04:00
|
|
|
void SetCMakeEditCommand(std::string const& s)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
this->CMakeEditCommand = s;
|
|
|
|
}
|
2013-11-12 17:44:08 +04:00
|
|
|
std::string const& GetCMakeEditCommand() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->CMakeEditCommand;
|
|
|
|
}
|
2013-11-12 17:44:08 +04:00
|
|
|
|
2016-01-29 00:10:27 +03:00
|
|
|
cmMessenger* GetMessenger() const;
|
|
|
|
|
2015-11-08 15:59:27 +03:00
|
|
|
/*
|
|
|
|
* Get the state of the suppression of developer (author) warnings.
|
|
|
|
* Returns false, by default, if developer warnings should be shown, true
|
|
|
|
* otherwise.
|
|
|
|
*/
|
2016-06-12 19:38:33 +03:00
|
|
|
bool GetSuppressDevWarnings() const;
|
2015-12-06 15:33:13 +03:00
|
|
|
/*
|
2015-12-06 15:58:24 +03:00
|
|
|
* Set the state of the suppression of developer (author) warnings.
|
2015-12-06 15:33:13 +03:00
|
|
|
*/
|
2015-12-06 15:58:24 +03:00
|
|
|
void SetSuppressDevWarnings(bool v);
|
|
|
|
|
2015-11-29 16:34:07 +03:00
|
|
|
/*
|
|
|
|
* Get the state of the suppression of deprecated warnings.
|
|
|
|
* Returns false, by default, if deprecated warnings should be shown, true
|
|
|
|
* otherwise.
|
|
|
|
*/
|
2016-06-12 19:38:33 +03:00
|
|
|
bool GetSuppressDeprecatedWarnings() const;
|
2015-12-06 15:58:24 +03:00
|
|
|
/*
|
|
|
|
* Set the state of the suppression of deprecated warnings.
|
|
|
|
*/
|
|
|
|
void SetSuppressDeprecatedWarnings(bool v);
|
2015-11-29 16:34:07 +03:00
|
|
|
|
2015-12-22 00:39:27 +03:00
|
|
|
/*
|
|
|
|
* Get the state of treating developer (author) warnings as errors.
|
|
|
|
* Returns false, by default, if warnings should not be treated as errors,
|
|
|
|
* true otherwise.
|
|
|
|
*/
|
2016-06-12 19:38:33 +03:00
|
|
|
bool GetDevWarningsAsErrors() const;
|
2015-12-22 00:39:27 +03:00
|
|
|
/**
|
|
|
|
* Set the state of treating developer (author) warnings as errors.
|
|
|
|
*/
|
|
|
|
void SetDevWarningsAsErrors(bool v);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the state of treating deprecated warnings as errors.
|
|
|
|
* Returns false, by default, if warnings should not be treated as errors,
|
|
|
|
* true otherwise.
|
|
|
|
*/
|
2016-06-12 19:38:33 +03:00
|
|
|
bool GetDeprecatedWarningsAsErrors() const;
|
2015-12-22 00:39:27 +03:00
|
|
|
/**
|
|
|
|
* Set the state of treating developer (author) warnings as errors.
|
|
|
|
*/
|
|
|
|
void SetDeprecatedWarningsAsErrors(bool v);
|
|
|
|
|
2008-03-13 20:48:57 +03:00
|
|
|
/** Display a message to the user. */
|
2016-05-16 17:34:04 +03:00
|
|
|
void IssueMessage(
|
|
|
|
cmake::MessageType t, std::string const& text,
|
2016-06-09 10:57:47 +03:00
|
|
|
cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
|
2015-05-22 01:38:03 +03:00
|
|
|
|
2012-03-20 02:05:21 +04:00
|
|
|
///! run the --build option
|
2016-05-16 17:34:04 +03:00
|
|
|
int Build(const std::string& dir, const std::string& target,
|
2008-10-15 21:56:07 +04:00
|
|
|
const std::string& config,
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::vector<std::string>& nativeOptions, bool clean);
|
2010-09-02 19:29:05 +04:00
|
|
|
|
2014-02-05 01:06:56 +04:00
|
|
|
void UnwatchUnusedCli(const std::string& var);
|
|
|
|
void WatchUnusedCli(const std::string& var);
|
2015-04-04 22:20:12 +03:00
|
|
|
|
|
|
|
cmState* GetState() const { return this->State; }
|
2015-05-24 14:00:20 +03:00
|
|
|
void SetCurrentSnapshot(cmState::Snapshot snapshot)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
this->CurrentSnapshot = snapshot;
|
|
|
|
}
|
2015-05-24 14:00:20 +03:00
|
|
|
cmState::Snapshot GetCurrentSnapshot() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return this->CurrentSnapshot;
|
|
|
|
}
|
2015-04-04 22:20:12 +03:00
|
|
|
|
2009-03-04 23:39:27 +03:00
|
|
|
protected:
|
2011-03-24 16:24:27 +03:00
|
|
|
void RunCheckForUnusedVariables();
|
2008-03-13 00:02:30 +03:00
|
|
|
void InitializeProperties();
|
2014-02-05 01:06:56 +04:00
|
|
|
int HandleDeleteCacheVariables(const std::string& var);
|
2007-06-25 18:34:21 +04:00
|
|
|
|
2012-11-19 19:13:54 +04:00
|
|
|
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
|
|
|
|
RegisteredGeneratorsVector Generators;
|
2016-07-20 19:28:39 +03:00
|
|
|
typedef std::vector<cmExternalMakefileProjectGeneratorFactory*>
|
|
|
|
RegisteredExtraGeneratorsVector;
|
|
|
|
RegisteredExtraGeneratorsVector ExtraGenerators;
|
2002-09-11 00:51:29 +04:00
|
|
|
void AddDefaultCommands();
|
2003-07-08 05:52:10 +04:00
|
|
|
void AddDefaultGenerators();
|
2007-06-08 19:57:16 +04:00
|
|
|
void AddDefaultExtraGenerators();
|
2002-09-11 00:51:29 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalGenerator* GlobalGenerator;
|
2015-11-29 15:39:03 +03:00
|
|
|
std::map<std::string, DiagLevel> DiagLevels;
|
2014-09-05 22:25:27 +04:00
|
|
|
std::string GeneratorPlatform;
|
2012-12-10 19:42:33 +04:00
|
|
|
std::string GeneratorToolset;
|
2004-04-18 22:41:46 +04:00
|
|
|
|
2002-09-06 21:06:23 +04:00
|
|
|
///! read in a cmake list file to initialize the cache
|
2016-05-16 17:34:04 +03:00
|
|
|
void ReadListFile(const std::vector<std::string>& args, const char* path);
|
2011-07-02 19:50:05 +04:00
|
|
|
bool FindPackage(const std::vector<std::string>& args);
|
2005-07-03 06:25:43 +04:00
|
|
|
|
|
|
|
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
|
|
|
|
/// If it is set, truncate it to 50kb
|
|
|
|
void TruncateOutputLog(const char* fname);
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2004-10-30 00:50:46 +04:00
|
|
|
/**
|
|
|
|
* Method called to check build system integrity at build time.
|
|
|
|
* Returns 1 if CMake should rerun and 0 otherwise.
|
|
|
|
*/
|
|
|
|
int CheckBuildSystem();
|
2002-08-28 22:51:10 +04:00
|
|
|
|
2003-08-06 00:36:15 +04:00
|
|
|
void SetDirectoriesFromFile(const char* arg);
|
2005-06-16 22:56:15 +04:00
|
|
|
|
2006-05-12 22:36:39 +04:00
|
|
|
//! Make sure all commands are what they say they are and there is no
|
2012-03-20 02:05:21 +04:00
|
|
|
/// macros.
|
2005-06-16 22:56:15 +04:00
|
|
|
void CleanupCommandsAndMacros();
|
2006-03-03 22:24:31 +03:00
|
|
|
|
2007-06-15 18:10:24 +04:00
|
|
|
void GenerateGraphViz(const char* fileName) const;
|
2006-04-27 05:31:39 +04:00
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
cmVariableWatch* VariableWatch;
|
2010-10-31 17:58:18 +03:00
|
|
|
|
|
|
|
private:
|
2016-05-16 17:34:04 +03:00
|
|
|
cmake(const cmake&); // Not implemented.
|
|
|
|
void operator=(const cmake&); // Not implemented.
|
2006-03-15 19:02:08 +03:00
|
|
|
ProgressCallbackType ProgressCallback;
|
|
|
|
void* ProgressCallbackClientData;
|
|
|
|
bool InTryCompile;
|
2011-07-13 20:59:51 +04:00
|
|
|
WorkingMode CurrentWorkingMode;
|
2006-10-06 19:11:59 +04:00
|
|
|
bool DebugOutput;
|
2008-07-31 18:33:25 +04:00
|
|
|
bool Trace;
|
2015-07-22 00:18:53 +03:00
|
|
|
bool TraceExpand;
|
2010-08-25 20:35:40 +04:00
|
|
|
bool WarnUninitialized;
|
2010-08-25 20:36:21 +04:00
|
|
|
bool WarnUnused;
|
2010-09-01 18:22:08 +04:00
|
|
|
bool WarnUnusedCli;
|
2010-09-01 19:24:20 +04:00
|
|
|
bool CheckSystemVars;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, bool> UsedCliVariables;
|
2008-02-12 17:49:42 +03:00
|
|
|
std::string CMakeEditCommand;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string CXXEnvironment;
|
|
|
|
std::string CCEnvironment;
|
|
|
|
std::string CheckBuildSystemArgument;
|
2007-11-10 16:15:13 +03:00
|
|
|
std::string CheckStampFile;
|
2008-03-12 00:25:49 +03:00
|
|
|
std::string CheckStampList;
|
2007-11-19 21:45:16 +03:00
|
|
|
std::string VSSolutionFile;
|
2015-10-24 15:58:23 +03:00
|
|
|
std::vector<std::string> SourceFileExtensions;
|
|
|
|
std::vector<std::string> HeaderFileExtensions;
|
2006-03-15 19:02:08 +03:00
|
|
|
bool ClearBuildSystem;
|
|
|
|
bool DebugTryCompile;
|
|
|
|
cmFileTimeComparison* FileComparison;
|
|
|
|
std::string GraphVizFile;
|
2014-05-15 21:12:40 +04:00
|
|
|
InstalledFilesMap InstalledFiles;
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2015-04-04 22:20:12 +03:00
|
|
|
cmState* State;
|
2015-05-24 14:00:20 +03:00
|
|
|
cmState::Snapshot CurrentSnapshot;
|
2016-01-29 00:10:27 +03:00
|
|
|
cmMessenger* Messenger;
|
2015-04-04 22:20:12 +03:00
|
|
|
|
2016-06-13 22:27:58 +03:00
|
|
|
std::vector<std::string> TraceOnlyThisSources;
|
|
|
|
|
2004-10-04 20:31:09 +04:00
|
|
|
void UpdateConversionPathTable();
|
2015-03-29 21:28:30 +03:00
|
|
|
|
|
|
|
// Print a list of valid generators to stderr.
|
|
|
|
void PrintGeneratorList();
|
2015-05-22 01:31:52 +03:00
|
|
|
|
2015-12-22 00:39:27 +03:00
|
|
|
/**
|
|
|
|
* Convert a message type between a warning and an error, based on the state
|
|
|
|
* of the error output CMake variables, in the cache.
|
|
|
|
*/
|
2016-01-29 00:10:23 +03:00
|
|
|
cmake::MessageType ConvertMessageType(cmake::MessageType t) const;
|
2015-12-22 00:39:27 +03:00
|
|
|
|
2015-11-08 15:20:47 +03:00
|
|
|
/*
|
|
|
|
* Check if messages of this type should be output, based on the state of the
|
|
|
|
* warning and error output CMake variables, in the cache.
|
|
|
|
*/
|
2016-01-29 00:10:23 +03:00
|
|
|
bool IsMessageTypeVisible(cmake::MessageType t) const;
|
2001-05-18 23:25:08 +04:00
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
#define CMAKE_STANDARD_OPTIONS_TABLE \
|
|
|
|
{ "-C <initial-cache>", "Pre-load a script to populate the cache." }, \
|
|
|
|
{ "-D <var>[:<type>]=<value>", "Create a cmake cache entry." }, \
|
|
|
|
{ "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \
|
|
|
|
{ "-G <generator-name>", "Specify a build system generator." }, \
|
|
|
|
{ "-T <toolset-name>", \
|
|
|
|
"Specify toolset name if supported by generator." }, \
|
|
|
|
{ "-A <platform-name>", \
|
|
|
|
"Specify platform name if supported by generator." }, \
|
|
|
|
{ "-Wdev", "Enable developer warnings." }, \
|
|
|
|
{ "-Wno-dev", "Suppress developer warnings." }, \
|
|
|
|
{ "-Werror=dev", "Make developer warnings errors." }, \
|
|
|
|
{ "-Wno-error=dev", "Make developer warnings not errors." }, \
|
|
|
|
{ "-Wdeprecated", "Enable deprecation warnings." }, \
|
|
|
|
{ "-Wno-deprecated", "Suppress deprecation warnings." }, \
|
|
|
|
{ "-Werror=deprecated", "Make deprecated macro and function warnings " \
|
|
|
|
"errors." }, \
|
|
|
|
{ \
|
|
|
|
"-Wno-error=deprecated", "Make deprecated macro and function warnings " \
|
|
|
|
"not errors." \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FOR_EACH_C_FEATURE(F) \
|
|
|
|
F(c_function_prototypes) \
|
|
|
|
F(c_restrict) \
|
|
|
|
F(c_static_assert) \
|
2013-11-04 04:15:43 +04:00
|
|
|
F(c_variadic_macros)
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
#define FOR_EACH_CXX_FEATURE(F) \
|
|
|
|
F(cxx_aggregate_default_initializers) \
|
|
|
|
F(cxx_alias_templates) \
|
|
|
|
F(cxx_alignas) \
|
|
|
|
F(cxx_alignof) \
|
|
|
|
F(cxx_attributes) \
|
|
|
|
F(cxx_attribute_deprecated) \
|
|
|
|
F(cxx_auto_type) \
|
|
|
|
F(cxx_binary_literals) \
|
|
|
|
F(cxx_constexpr) \
|
|
|
|
F(cxx_contextual_conversions) \
|
|
|
|
F(cxx_decltype) \
|
|
|
|
F(cxx_decltype_auto) \
|
|
|
|
F(cxx_decltype_incomplete_return_types) \
|
|
|
|
F(cxx_default_function_template_args) \
|
|
|
|
F(cxx_defaulted_functions) \
|
|
|
|
F(cxx_defaulted_move_initializers) \
|
|
|
|
F(cxx_delegating_constructors) \
|
|
|
|
F(cxx_deleted_functions) \
|
|
|
|
F(cxx_digit_separators) \
|
|
|
|
F(cxx_enum_forward_declarations) \
|
|
|
|
F(cxx_explicit_conversions) \
|
|
|
|
F(cxx_extended_friend_declarations) \
|
|
|
|
F(cxx_extern_templates) \
|
|
|
|
F(cxx_final) \
|
|
|
|
F(cxx_func_identifier) \
|
|
|
|
F(cxx_generalized_initializers) \
|
|
|
|
F(cxx_generic_lambdas) \
|
|
|
|
F(cxx_inheriting_constructors) \
|
|
|
|
F(cxx_inline_namespaces) \
|
|
|
|
F(cxx_lambdas) \
|
|
|
|
F(cxx_lambda_init_captures) \
|
|
|
|
F(cxx_local_type_template_args) \
|
|
|
|
F(cxx_long_long_type) \
|
|
|
|
F(cxx_noexcept) \
|
|
|
|
F(cxx_nonstatic_member_init) \
|
|
|
|
F(cxx_nullptr) \
|
|
|
|
F(cxx_override) \
|
|
|
|
F(cxx_range_for) \
|
|
|
|
F(cxx_raw_string_literals) \
|
|
|
|
F(cxx_reference_qualified_functions) \
|
|
|
|
F(cxx_relaxed_constexpr) \
|
|
|
|
F(cxx_return_type_deduction) \
|
|
|
|
F(cxx_right_angle_brackets) \
|
|
|
|
F(cxx_rvalue_references) \
|
|
|
|
F(cxx_sizeof_member) \
|
|
|
|
F(cxx_static_assert) \
|
|
|
|
F(cxx_strong_enums) \
|
|
|
|
F(cxx_template_template_parameters) \
|
|
|
|
F(cxx_thread_local) \
|
|
|
|
F(cxx_trailing_return_types) \
|
|
|
|
F(cxx_unicode_literals) \
|
|
|
|
F(cxx_uniform_initialization) \
|
|
|
|
F(cxx_unrestricted_unions) \
|
|
|
|
F(cxx_user_literals) \
|
|
|
|
F(cxx_variable_templates) \
|
|
|
|
F(cxx_variadic_macros) \
|
2014-05-02 12:03:24 +04:00
|
|
|
F(cxx_variadic_templates)
|
|
|
|
|
2003-12-23 23:01:10 +03:00
|
|
|
#endif
|