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
|
|
|
|
|
2002-09-06 21:06:23 +04:00
|
|
|
#include "cmSystemTools.h"
|
2006-12-07 17:45:32 +03:00
|
|
|
#include "cmPropertyDefinitionMap.h"
|
|
|
|
#include "cmPropertyMap.h"
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmCacheManager;
|
|
|
|
class cmMakefile;
|
2002-09-11 00:51:29 +04:00
|
|
|
class cmCommand;
|
2003-01-08 20:59:52 +03:00
|
|
|
class cmVariableWatch;
|
2005-10-12 21:51:15 +04:00
|
|
|
class cmFileTimeComparison;
|
2007-06-08 19:57:16 +04:00
|
|
|
class cmExternalMakefileProjectGenerator;
|
2007-10-22 20:49:09 +04:00
|
|
|
class cmDocumentationSection;
|
2008-03-01 23:20:35 +03:00
|
|
|
class cmPolicies;
|
2008-03-13 20:48:57 +03:00
|
|
|
class cmListFileBacktrace;
|
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
|
|
|
|
* running cmake. Most cmake based GUIS should primarily create an instance
|
|
|
|
* of this class and communicate with it.
|
|
|
|
*
|
|
|
|
* The basic process for a GUI is as follows:
|
|
|
|
*
|
|
|
|
* -# Create a cmake instance
|
|
|
|
* -# Set the Home & Start directories, generator, and cmake command. this
|
|
|
|
* 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
|
|
|
|
|
|
|
|
* If your GUI allows the user to change the start & home directories then
|
|
|
|
* 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
|
|
|
{
|
|
|
|
public:
|
2008-03-11 17:29:56 +03:00
|
|
|
enum MessageType
|
|
|
|
{ AUTHOR_WARNING,
|
|
|
|
FATAL_ERROR,
|
2008-03-13 04:06:32 +03:00
|
|
|
INTERNAL_ERROR,
|
2008-03-11 17:29:56 +03:00
|
|
|
MESSAGE,
|
|
|
|
WARNING,
|
|
|
|
LOG
|
|
|
|
};
|
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
|
|
|
|
/** \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
|
|
|
|
};
|
2003-08-04 04:47:44 +04:00
|
|
|
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
|
|
|
|
|
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
|
|
|
|
2006-06-14 20:28:32 +04:00
|
|
|
static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";};
|
2006-06-15 19:51:51 +04:00
|
|
|
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
|
|
|
|
* home directory is the top directory of the project. It is where
|
|
|
|
* cmake was run. Remember that CMake processes
|
|
|
|
* CMakeLists files by recursing up the tree starting at the StartDirectory
|
2010-10-31 17:58:18 +03:00
|
|
|
* and going up until it reaches the HomeDirectory.
|
2002-09-06 21:06:23 +04:00
|
|
|
*/
|
|
|
|
void SetHomeDirectory(const char* dir);
|
|
|
|
const char* GetHomeDirectory() const
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->cmHomeDirectory.c_str();
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
void SetHomeOutputDirectory(const char* lib);
|
|
|
|
const char* GetHomeOutputDirectory() const
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->HomeOutputDirectory.c_str();
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* Set/Get the start directory (or output directory). The start directory
|
|
|
|
* is the directory of the CMakeLists.txt file that started the current
|
|
|
|
* round of processing. Remember that CMake processes CMakeLists files by
|
|
|
|
* recursing up the tree starting at the StartDirectory and going up until
|
2010-10-31 17:58:18 +03:00
|
|
|
* it reaches the HomeDirectory.
|
2002-09-06 21:06:23 +04:00
|
|
|
*/
|
2010-10-31 17:58:18 +03:00
|
|
|
void SetStartDirectory(const char* dir)
|
2002-09-06 21:06:23 +04:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->cmStartDirectory = dir;
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
const char* GetStartDirectory() const
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->cmStartDirectory.c_str();
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
void SetStartOutputDirectory(const char* lib)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->StartOutputDirectory = lib;
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
const char* GetStartOutputDirectory() const
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->StartOutputDirectory.c_str();
|
2002-09-06 21:06:23 +04:00
|
|
|
}
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle a command line invocation of cmake.
|
|
|
|
*/
|
2003-04-29 18:04:05 +04:00
|
|
|
int Run(const std::vector<std::string>&args)
|
2003-04-30 15:32:30 +04:00
|
|
|
{ return this->Run(args, false); }
|
2003-04-29 18:04:05 +04:00
|
|
|
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
|
|
|
|
2002-11-07 17:04:20 +03:00
|
|
|
int LoadCache();
|
2004-08-17 23:36:08 +04:00
|
|
|
void PreLoadCMakeFiles();
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Create a GlobalGenerator
|
|
|
|
cmGlobalGenerator* CreateGlobalGenerator(const char* name);
|
|
|
|
|
|
|
|
///! Return the global generator assigned to this instance of cmake
|
2007-06-15 18:10:24 +04:00
|
|
|
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
|
|
|
|
///! Return the global generator assigned to this instance of cmake, const
|
2010-10-31 17:58:18 +03:00
|
|
|
const cmGlobalGenerator* GetGlobalGenerator() const
|
2007-06-15 18:10:24 +04:00
|
|
|
{ return this->GlobalGenerator; }
|
2002-09-06 21:06:23 +04:00
|
|
|
|
|
|
|
///! Return the global generator assigned to this instance of cmake
|
|
|
|
void SetGlobalGenerator(cmGlobalGenerator *);
|
|
|
|
|
|
|
|
///! Get the names of the current registered generators
|
|
|
|
void GetRegisteredGenerators(std::vector<std::string>& names);
|
|
|
|
|
|
|
|
///! get the cmCachemManager used by this invocation of cmake
|
2006-03-15 19:02:08 +03:00
|
|
|
cmCacheManager *GetCacheManager() { return this->CacheManager; }
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2002-09-17 21:59:58 +04:00
|
|
|
///! set the cmake command this instance of cmake should use
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; }
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2002-09-06 21:06:23 +04:00
|
|
|
/**
|
|
|
|
* Given a variable name, return its value (as a string).
|
|
|
|
*/
|
|
|
|
const char* GetCacheDefinition(const char*) const;
|
2002-12-04 18:57:22 +03:00
|
|
|
///! Add an entry into the cache
|
2010-10-31 17:58:18 +03:00
|
|
|
void AddCacheEntry(const char* key, const char* value,
|
|
|
|
const char* helpString,
|
2002-12-04 18:57:22 +03:00
|
|
|
int type);
|
2010-10-31 17:58:18 +03:00
|
|
|
/**
|
2002-06-03 21:08:52 +04:00
|
|
|
* Execute commands during the build process. Supports options such
|
|
|
|
* as echo, remove file etc.
|
|
|
|
*/
|
2006-03-15 19:02:08 +03:00
|
|
|
static int ExecuteCMakeCommand(std::vector<std::string>&);
|
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>&);
|
|
|
|
|
2002-09-11 00:51:29 +04:00
|
|
|
/**
|
|
|
|
* Add a command to this cmake instance
|
|
|
|
*/
|
|
|
|
void AddCommand(cmCommand* );
|
2005-06-14 20:48:59 +04:00
|
|
|
void RenameCommand(const char* oldName, const char* newName);
|
2007-06-12 18:56:40 +04:00
|
|
|
void RemoveCommand(const char* name);
|
2007-07-27 16:59:59 +04:00
|
|
|
void RemoveUnscriptableCommands();
|
2002-09-11 00:51:29 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a command by its name
|
|
|
|
*/
|
|
|
|
cmCommand *GetCommand(const char *name);
|
|
|
|
|
2003-08-04 04:47:44 +04:00
|
|
|
/** Get list of all commands */
|
2006-03-15 19:02:08 +03:00
|
|
|
RegisteredCommandsMap* GetCommands() { return &this->Commands; }
|
2003-08-04 04:47:44 +04:00
|
|
|
|
2002-09-11 00:51:29 +04:00
|
|
|
/** Check if a command exists. */
|
|
|
|
bool CommandExists(const char* name) const;
|
2010-10-31 17:58:18 +03:00
|
|
|
|
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
|
2006-03-15 19:02:08 +03:00
|
|
|
bool GetIsInTryCompile() { return this->InTryCompile; }
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2002-09-12 19:08:06 +04:00
|
|
|
///! Is this cmake running as a result of a TRY_COMPILE command
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
|
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
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
typedef void (*ProgressCallbackType)
|
|
|
|
(const char*msg, float progress, void *);
|
2002-09-26 23:14:20 +04:00
|
|
|
/**
|
|
|
|
* Set the function used by GUI's 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.
|
|
|
|
*/
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetProgressCallback(ProgressCallbackType f, void* clientData=0);
|
2002-09-26 23:14:20 +04:00
|
|
|
|
|
|
|
///! this is called by generators to update the progress
|
|
|
|
void UpdateProgress(const char *msg, float prog);
|
|
|
|
|
2008-03-01 23:20:35 +03:00
|
|
|
///! get the cmake policies instance
|
|
|
|
cmPolicies *GetPolicies() {return this->Policies;} ;
|
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
|
|
|
|
2007-06-22 16:44:51 +04:00
|
|
|
/** Get the documentation entries for the supported commands.
|
2010-10-31 17:58:18 +03:00
|
|
|
* If withCurrentCommands is true, the documentation for the
|
2007-06-22 16:44:51 +04:00
|
|
|
* recommended set of commands is included.
|
|
|
|
* If withCompatCommands is true, the documentation for discouraged
|
|
|
|
* (compatibility) commands is included.
|
|
|
|
* You probably don't want to set both to false.
|
|
|
|
*/
|
2010-10-31 17:58:18 +03:00
|
|
|
void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
|
|
|
|
bool withCurrentCommands = true,
|
2007-06-22 16:44:51 +04:00
|
|
|
bool withCompatCommands = true) const;
|
2007-10-22 20:49:09 +04:00
|
|
|
void GetPropertiesDocumentation(std::map<std::string,
|
|
|
|
cmDocumentationSection *>&);
|
2003-07-08 05:52:10 +04:00
|
|
|
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
|
2008-03-04 17:16:33 +03:00
|
|
|
void GetPolicyDocumentation(std::vector<cmDocumentationEntry>& entries);
|
2003-05-29 19:14:05 +04:00
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
///! Set/Get a property of this target file
|
|
|
|
void SetProperty(const char *prop, const char *value);
|
2011-07-14 01:14:41 +04:00
|
|
|
void AppendProperty(const char *prop, const char *value,bool asString=false);
|
2006-12-07 17:45:32 +03:00
|
|
|
const char *GetProperty(const char *prop);
|
|
|
|
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
|
|
|
|
bool GetPropertyAsBool(const char *prop);
|
|
|
|
|
|
|
|
// Get the properties
|
|
|
|
cmPropertyMap &GetProperties() { return this->Properties; };
|
|
|
|
|
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
|
|
|
|
2003-12-23 23:01:10 +03:00
|
|
|
///! Debug the try compile stuff by not delelting the files
|
2006-03-15 19:02:08 +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-02-23 18:00:44 +03:00
|
|
|
/**
|
|
|
|
* Get the path to ctest
|
|
|
|
*/
|
|
|
|
const char* GetCTestCommand();
|
|
|
|
const char* GetCPackCommand();
|
2011-08-09 11:18:37 +04:00
|
|
|
const char* GetCMakeCommand();
|
2006-02-23 18:00:44 +03:00
|
|
|
|
2006-10-06 19:11:59 +04:00
|
|
|
// Do we want debug output during the cmake run.
|
|
|
|
bool GetDebugOutput() { return this->DebugOutput; }
|
2008-04-03 01:29:25 +04: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.
|
|
|
|
bool GetTrace() { return this->Trace;}
|
|
|
|
void SetTrace(bool b) { this->Trace = b;}
|
2010-08-25 20:35:40 +04:00
|
|
|
bool GetWarnUninitialized() { return this->WarnUninitialized;}
|
|
|
|
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
|
2010-08-25 20:36:21 +04:00
|
|
|
bool GetWarnUnused() { return this->WarnUnused;}
|
|
|
|
void SetWarnUnused(bool b) { this->WarnUnused = b;}
|
2010-09-01 18:22:08 +04:00
|
|
|
bool GetWarnUnusedCli() { return this->WarnUnusedCli;}
|
|
|
|
void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b;}
|
2010-09-01 19:24:20 +04:00
|
|
|
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);
|
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
// Define a property
|
|
|
|
void DefineProperty(const char *name, cmProperty::ScopeType scope,
|
|
|
|
const char *ShortDescription,
|
|
|
|
const char *FullDescription,
|
2010-10-31 17:58:18 +03:00
|
|
|
bool chain = false,
|
2007-10-22 20:49:09 +04:00
|
|
|
const char *variableGroup = 0);
|
2006-12-07 17:45:32 +03:00
|
|
|
|
2007-10-24 22:43:10 +04:00
|
|
|
// get property definition
|
|
|
|
cmPropertyDefinition *GetPropertyDefinition
|
|
|
|
(const char *name, cmProperty::ScopeType scope);
|
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
// Is a property defined?
|
|
|
|
bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope);
|
|
|
|
bool IsPropertyChained(const char *name, cmProperty::ScopeType scope);
|
|
|
|
|
2008-09-05 01:34:25 +04:00
|
|
|
/** Get the list of configurations (in upper case) considered to be
|
|
|
|
debugging configurations.*/
|
|
|
|
std::vector<std::string> const& GetDebugConfigs();
|
|
|
|
|
2007-11-06 22:16:00 +03:00
|
|
|
// record accesses of properties and variables
|
|
|
|
void RecordPropertyAccess(const char *name, cmProperty::ScopeType scope);
|
|
|
|
void ReportUndefinedPropertyAccesses(const char *filename);
|
|
|
|
|
2007-06-26 21:05:27 +04:00
|
|
|
// Define the properties
|
|
|
|
static void DefineProperties(cmake *cm);
|
|
|
|
|
2008-02-12 17:49:42 +03:00
|
|
|
void SetCMakeEditCommand(const char* s)
|
|
|
|
{
|
|
|
|
this->CMakeEditCommand = s;
|
|
|
|
}
|
2008-03-12 05:50:35 +03:00
|
|
|
void SetSuppressDevWarnings(bool v)
|
|
|
|
{
|
2010-10-31 17:58:18 +03:00
|
|
|
this->SuppressDevWarnings = v;
|
2008-03-29 20:16:02 +03:00
|
|
|
this->DoSuppressDevWarnings = true;
|
2008-03-12 05:50:35 +03:00
|
|
|
}
|
2008-03-13 20:48:57 +03:00
|
|
|
|
|
|
|
/** Display a message to the user. */
|
|
|
|
void IssueMessage(cmake::MessageType t, std::string const& text,
|
|
|
|
cmListFileBacktrace const& backtrace);
|
2008-10-15 21:56:07 +04:00
|
|
|
// * run the --build option
|
|
|
|
int Build(const std::string& dir,
|
|
|
|
const std::string& target,
|
|
|
|
const std::string& config,
|
2009-03-04 23:39:27 +03:00
|
|
|
const std::vector<std::string>& nativeOptions,
|
2011-07-26 11:36:40 +04:00
|
|
|
bool clean,
|
|
|
|
cmSystemTools::OutputOption outputflag);
|
2010-09-02 19:29:05 +04:00
|
|
|
|
2011-01-14 01:58:04 +03:00
|
|
|
void UnwatchUnusedCli(const char* var);
|
2010-09-22 20:42:49 +04:00
|
|
|
void WatchUnusedCli(const char* var);
|
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();
|
2007-12-13 23:54:29 +03:00
|
|
|
int HandleDeleteCacheVariables(const char* var);
|
2006-12-07 17:45:32 +03:00
|
|
|
cmPropertyMap Properties;
|
2007-11-06 22:16:00 +03:00
|
|
|
std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties;
|
2007-06-25 18:34:21 +04:00
|
|
|
|
2010-10-31 17:58:18 +03:00
|
|
|
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
|
2007-06-25 18:34:21 +04:00
|
|
|
PropertyDefinitions;
|
2007-06-08 19:57:16 +04:00
|
|
|
|
2010-10-31 17:58:18 +03:00
|
|
|
typedef
|
2007-06-08 19:57:16 +04:00
|
|
|
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
|
|
|
|
typedef std::map<cmStdString,
|
|
|
|
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
|
|
|
|
|
2003-07-08 05:52:10 +04:00
|
|
|
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
|
2006-03-10 19:13:15 +03:00
|
|
|
typedef std::map<cmStdString,
|
|
|
|
CreateGeneratorFunctionType> RegisteredGeneratorsMap;
|
2006-03-15 19:02:08 +03:00
|
|
|
RegisteredCommandsMap Commands;
|
|
|
|
RegisteredGeneratorsMap Generators;
|
2007-06-08 19:57:16 +04:00
|
|
|
RegisteredExtraGeneratorsMap 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();
|
2010-10-31 17:58:18 +03:00
|
|
|
void AddExtraGenerator(const char* name,
|
2007-07-20 16:36:16 +04:00
|
|
|
CreateExtraGeneratorFunctionType newFunction);
|
2002-09-11 00:51:29 +04:00
|
|
|
|
2010-10-31 17:58:18 +03:00
|
|
|
cmPolicies *Policies;
|
2006-03-15 19:02:08 +03:00
|
|
|
cmGlobalGenerator *GlobalGenerator;
|
|
|
|
cmCacheManager *CacheManager;
|
2010-10-31 17:58:18 +03:00
|
|
|
std::string cmHomeDirectory;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string HomeOutputDirectory;
|
2010-10-31 17:58:18 +03:00
|
|
|
std::string cmStartDirectory;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string StartOutputDirectory;
|
2008-03-12 05:50:35 +03:00
|
|
|
bool SuppressDevWarnings;
|
2008-03-22 17:24:06 +03:00
|
|
|
bool DoSuppressDevWarnings;
|
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
|
2011-02-03 05:17:23 +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
|
|
|
|
//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
|
|
|
|
2009-10-21 21:10:24 +04:00
|
|
|
static int SymlinkLibrary(std::vector<std::string>& args);
|
|
|
|
static int SymlinkExecutable(std::vector<std::string>& args);
|
|
|
|
static bool SymlinkInternal(std::string const& file,
|
|
|
|
std::string const& link);
|
2006-04-27 05:31:39 +04:00
|
|
|
static int ExecuteEchoColor(std::vector<std::string>& args);
|
2006-06-16 00:17:11 +04:00
|
|
|
static int ExecuteLinkScript(std::vector<std::string>& args);
|
2008-01-01 23:13:41 +03:00
|
|
|
static int VisualStudioLink(std::vector<std::string>& args, int type);
|
|
|
|
static int VisualStudioLinkIncremental(std::vector<std::string>& args,
|
2010-10-31 17:58:18 +03:00
|
|
|
int type,
|
2008-01-01 23:13:41 +03:00
|
|
|
bool verbose);
|
|
|
|
static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
|
|
|
|
int type,
|
2008-06-21 00:25:02 +04:00
|
|
|
bool hasManifest,
|
2008-01-01 23:13:41 +03:00
|
|
|
bool verbose);
|
2010-10-31 17:58:18 +03:00
|
|
|
static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
|
|
|
|
std::vector<cmStdString>& command,
|
2008-01-01 23:13:41 +03:00
|
|
|
std::string& targetName);
|
|
|
|
static bool RunCommand(const char* comment,
|
|
|
|
std::vector<cmStdString>& command,
|
|
|
|
bool verbose,
|
|
|
|
int* retCodeOut = 0);
|
2006-03-15 19:02:08 +03:00
|
|
|
cmVariableWatch* VariableWatch;
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2007-06-15 18:10:24 +04:00
|
|
|
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
|
|
|
|
std::string FindCMakeProgram(const char* name) const;
|
2010-10-31 17:58:18 +03:00
|
|
|
private:
|
2008-06-21 00:25:02 +04: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 Verbose;
|
|
|
|
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;
|
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;
|
2011-03-24 16:24:27 +03:00
|
|
|
std::map<cmStdString, bool> UsedCliVariables;
|
2008-02-12 17:49:42 +03:00
|
|
|
std::string CMakeEditCommand;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string CMakeCommand;
|
|
|
|
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;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string CTestCommand;
|
|
|
|
std::string CPackCommand;
|
|
|
|
bool ClearBuildSystem;
|
|
|
|
bool DebugTryCompile;
|
|
|
|
cmFileTimeComparison* FileComparison;
|
|
|
|
std::string GraphVizFile;
|
2008-09-05 01:34:25 +04:00
|
|
|
std::vector<std::string> DebugConfigs;
|
2010-10-31 17:58:18 +03:00
|
|
|
|
2004-10-04 20:31:09 +04:00
|
|
|
void UpdateConversionPathTable();
|
2001-05-18 23:25:08 +04:00
|
|
|
};
|
|
|
|
|
2003-04-03 07:48:12 +04:00
|
|
|
#define CMAKE_STANDARD_OPTIONS_TABLE \
|
2005-09-21 21:31:43 +04:00
|
|
|
{"-C <initial-cache>", "Pre-load a script to populate the cache.", \
|
2003-04-03 07:48:12 +04:00
|
|
|
"When cmake is first run in an empty build tree, it creates a " \
|
|
|
|
"CMakeCache.txt file and populates it with customizable settings " \
|
|
|
|
"for the project. This option may be used to specify a file from " \
|
|
|
|
"which to load cache entries before the first pass through " \
|
|
|
|
"the project's cmake listfiles. The loaded entries take priority " \
|
2005-09-21 21:31:43 +04:00
|
|
|
"over the project's default values. The given file should be a CMake " \
|
|
|
|
"script containing SET commands that use the CACHE option, " \
|
|
|
|
"not a cache-format file."}, \
|
2005-07-20 01:16:23 +04:00
|
|
|
{"-D <var>:<type>=<value>", "Create a cmake cache entry.", \
|
2003-04-03 07:48:12 +04:00
|
|
|
"When cmake is first run in an empty build tree, it creates a " \
|
|
|
|
"CMakeCache.txt file and populates it with customizable settings " \
|
|
|
|
"for the project. This option may be used to specify a setting " \
|
|
|
|
"that takes priority over the project's default value. The option " \
|
|
|
|
"may be repeated for as many cache entries as desired."}, \
|
2007-06-04 21:48:11 +04:00
|
|
|
{"-U <globbing_expr>", "Remove matching entries from CMake cache.", \
|
2007-06-01 22:16:46 +04:00
|
|
|
"This option may be used to remove one or more variables from the " \
|
2007-06-04 21:48:11 +04:00
|
|
|
"CMakeCache.txt file, globbing expressions using * and ? are supported. "\
|
|
|
|
"The option may be repeated for as many cache entries as desired.\n" \
|
|
|
|
"Use with care, you can make your CMakeCache.txt non-working."}, \
|
2005-07-20 01:16:23 +04:00
|
|
|
{"-G <generator-name>", "Specify a makefile generator.", \
|
2003-04-03 07:48:12 +04:00
|
|
|
"CMake may support multiple native build systems on certain platforms. " \
|
|
|
|
"A makefile generator is responsible for generating a particular build " \
|
2003-07-11 07:22:09 +04:00
|
|
|
"system. Possible generator names are specified in the Generators " \
|
2008-03-11 23:02:10 +03:00
|
|
|
"section."},\
|
|
|
|
{"-Wno-dev", "Suppress developer warnings.",\
|
|
|
|
"Suppress warnings that are meant for the author"\
|
|
|
|
" of the CMakeLists.txt files."},\
|
|
|
|
{"-Wdev", "Enable developer warnings.",\
|
|
|
|
"Enable warnings that are meant for the author"\
|
|
|
|
" of the CMakeLists.txt files."}
|
|
|
|
|
2003-07-11 07:14:49 +04:00
|
|
|
|
|
|
|
#define CMAKE_STANDARD_INTRODUCTION \
|
2007-10-09 22:35:25 +04:00
|
|
|
{0, \
|
2003-07-11 07:14:49 +04:00
|
|
|
"CMake is a cross-platform build system generator. Projects " \
|
|
|
|
"specify their build process with platform-independent CMake listfiles " \
|
2006-05-12 22:36:39 +04:00
|
|
|
"included in each directory of a source tree with the name " \
|
|
|
|
"CMakeLists.txt. " \
|
2003-07-11 07:14:49 +04:00
|
|
|
"Users build a project by using CMake to generate a build system " \
|
2007-10-09 22:35:25 +04:00
|
|
|
"for a native tool on their platform.", 0}
|
2003-12-23 23:01:10 +03:00
|
|
|
#endif
|