2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2009-07-29 19:29: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.
|
2009-07-29 19:29: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.
|
|
|
|
============================================================================*/
|
2009-07-29 19:29:08 +04:00
|
|
|
#ifndef cmIDEOptions_h
|
|
|
|
#define cmIDEOptions_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2009-07-29 19:29:08 +04:00
|
|
|
#include "cmIDEFlagTable.h"
|
|
|
|
|
|
|
|
/** \class cmIDEOptions
|
|
|
|
* \brief Superclass for IDE option processing
|
|
|
|
*/
|
|
|
|
class cmIDEOptions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmIDEOptions();
|
|
|
|
virtual ~cmIDEOptions();
|
|
|
|
|
|
|
|
// Store definitions and flags.
|
|
|
|
void AddDefine(const std::string& define);
|
|
|
|
void AddDefines(const char* defines);
|
2013-07-10 17:22:59 +04:00
|
|
|
void AddDefines(const std::vector<std::string> &defines);
|
2009-07-29 19:29:08 +04:00
|
|
|
void AddFlag(const char* flag, const char* value);
|
2014-07-23 19:13:13 +04:00
|
|
|
void AddFlag(const char* flag, std::vector<std::string> const& value);
|
2014-07-31 22:02:03 +04:00
|
|
|
void AppendFlag(std::string const& flag, std::string const& value);
|
2014-08-13 21:39:35 +04:00
|
|
|
void AppendFlag(std::string const& flag,
|
|
|
|
std::vector<std::string> const& value);
|
2011-02-09 20:59:09 +03:00
|
|
|
void RemoveFlag(const char* flag);
|
2014-08-13 22:07:07 +04:00
|
|
|
bool HasFlag(std::string const& flag) const;
|
2012-10-26 18:16:45 +04:00
|
|
|
const char* GetFlag(const char* flag);
|
2009-07-29 19:29:08 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// create a map of xml tags to the values they should have in the output
|
|
|
|
// for example, "BufferSecurityCheck" = "TRUE"
|
|
|
|
// first fill this table with the values for the configuration
|
|
|
|
// Debug, Release, etc,
|
|
|
|
// Then parse the command line flags specified in CMAKE_CXX_FLAGS
|
|
|
|
// and CMAKE_C_FLAGS
|
|
|
|
// and overwrite or add new values to this map
|
2014-07-23 19:13:13 +04:00
|
|
|
class FlagValue: public std::vector<std::string>
|
|
|
|
{
|
|
|
|
typedef std::vector<std::string> derived;
|
|
|
|
public:
|
|
|
|
FlagValue& operator=(std::string const& r)
|
|
|
|
{
|
|
|
|
this->resize(1);
|
|
|
|
this->operator[](0) = r;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
FlagValue& operator=(std::vector<std::string> const& r)
|
|
|
|
{
|
|
|
|
this->derived::operator=(r);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
std::map<std::string, FlagValue > FlagMap;
|
2009-07-29 19:29:08 +04:00
|
|
|
|
|
|
|
// Preprocessor definitions.
|
|
|
|
std::vector<std::string> Defines;
|
|
|
|
|
|
|
|
// Unrecognized flags that get no special handling.
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string FlagString;
|
2009-07-29 19:29:08 +04:00
|
|
|
|
|
|
|
bool DoingDefine;
|
|
|
|
bool AllowDefine;
|
|
|
|
bool AllowSlash;
|
2014-04-01 22:56:08 +04:00
|
|
|
cmIDEFlagTable const* DoingFollowing;
|
2009-07-29 19:29:08 +04:00
|
|
|
enum { FlagTableCount = 16 };
|
|
|
|
cmIDEFlagTable const* FlagTable[FlagTableCount];
|
|
|
|
void HandleFlag(const char* flag);
|
|
|
|
bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag,
|
|
|
|
bool& flag_handled);
|
2014-04-01 22:54:28 +04:00
|
|
|
void FlagMapUpdate(cmIDEFlagTable const* entry, const char* new_value);
|
2009-07-29 19:29:08 +04:00
|
|
|
virtual void StoreUnknownFlag(const char* flag) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|