ENH: Add accessor for the list of commands
This commit is contained in:
parent
32bfe66b5d
commit
c7f1198a00
|
@ -47,6 +47,22 @@ bool cmGetCMakePropertyCommand::InitialPass(
|
|||
output += vars[cc];
|
||||
}
|
||||
}
|
||||
else if ( args[1] == "COMMANDS" )
|
||||
{
|
||||
cmake::RegisteredCommandsMap::iterator cmds
|
||||
= m_Makefile->GetCMakeInstance()->GetCommands()->begin();
|
||||
for (cc=0 ;
|
||||
cmds != m_Makefile->GetCMakeInstance()->GetCommands()->end();
|
||||
++ cmds )
|
||||
{
|
||||
if ( cc > 0 )
|
||||
{
|
||||
output += ";";
|
||||
}
|
||||
output += cmds->first.c_str();
|
||||
cc++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string emsg = "Unknown CMake property: " + args[1];
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
"Get a property from the CMake. The value of the property is"
|
||||
"stored in the variable VAR. If the property is not found,"
|
||||
"CMake will report an error. The properties include: VARIABLES, "
|
||||
"CACHE_VARIABLES.";
|
||||
"CACHE_VARIABLES, COMMANDS.";
|
||||
}
|
||||
|
||||
cmTypeMacro(cmGetCMakePropertyCommand, cmCommand);
|
||||
|
|
|
@ -50,6 +50,8 @@ class cmVariableWatch;
|
|||
class cmake
|
||||
{
|
||||
public:
|
||||
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
|
||||
|
||||
///! construct an instance of cmake
|
||||
cmake();
|
||||
///! destruct an instance of cmake
|
||||
|
@ -193,6 +195,9 @@ class cmake
|
|||
*/
|
||||
cmCommand *GetCommand(const char *name);
|
||||
|
||||
/** Get list of all commands */
|
||||
RegisteredCommandsMap* GetCommands() { return &m_Commands; }
|
||||
|
||||
/** Check if a command exists. */
|
||||
bool CommandExists(const char* name) const;
|
||||
|
||||
|
@ -242,7 +247,6 @@ class cmake
|
|||
|
||||
protected:
|
||||
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
|
||||
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
|
||||
typedef std::map<cmStdString, CreateGeneratorFunctionType> RegisteredGeneratorsMap;
|
||||
RegisteredCommandsMap m_Commands;
|
||||
RegisteredGeneratorsMap m_Generators;
|
||||
|
|
|
@ -6,11 +6,17 @@ CONFIGURE_FILE(${DumpInformation_SOURCE_DIR}/DumpInformation.h.in
|
|||
${DumpInformation_BINARY_DIR}/DumpInformation.h)
|
||||
ADD_EXECUTABLE(DumpInformation DumpInformation.cxx)
|
||||
|
||||
WRITE_FILE(${DumpInformation_BINARY_DIR}/AllVariables.txt "")
|
||||
GET_CMAKE_PROPERTY(VARS VARIABLES)
|
||||
FOREACH(var ${VARS})
|
||||
WRITE_FILE(${DumpInformation_BINARY_DIR}/AllVariables.txt
|
||||
"${var} \"${${var}}\"" APPEND)
|
||||
#MESSAGE(STATUS "Variable ${var} \"${${var}}\"")
|
||||
ENDFOREACH(var ${VARS})
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt "")
|
||||
GET_CMAKE_PROPERTY(res VARIABLES)
|
||||
FOREACH(var ${res})
|
||||
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt
|
||||
"${var} \"${${var}}\"\n")
|
||||
ENDFOREACH(var ${res})
|
||||
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt "")
|
||||
GET_CMAKE_PROPERTY(res COMMANDS)
|
||||
FOREACH(var ${res})
|
||||
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt
|
||||
"${var}\n")
|
||||
ENDFOREACH(var ${res})
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ int main(int,char *[])
|
|||
{
|
||||
DumpInformation_BINARY_DIR "/SystemInformation.out",
|
||||
DumpInformation_BINARY_DIR "/AllVariables.txt",
|
||||
DumpInformation_BINARY_DIR "/AllCommands.txt",
|
||||
DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h",
|
||||
DumpInformation_BINARY_DIR "/../../CMakeCache.txt",
|
||||
DumpInformation_BINARY_DIR "/../../CMakeOutput.log",
|
||||
|
|
Loading…
Reference in New Issue