diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-08-04 00:47:44 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-08-04 00:47:44 (GMT) |
commit | c7f1198a0062a24edf3166e5f4cfcdcbb8b556f7 (patch) | |
tree | 21c76e21802cf818682bdb187b2152f7e705f16f | |
parent | 32bfe66b5d261bfc6c9f43f045f56651b8f012ea (diff) | |
download | CMake-c7f1198a0062a24edf3166e5f4cfcdcbb8b556f7.zip CMake-c7f1198a0062a24edf3166e5f4cfcdcbb8b556f7.tar.gz CMake-c7f1198a0062a24edf3166e5f4cfcdcbb8b556f7.tar.bz2 |
ENH: Add accessor for the list of commands
-rw-r--r-- | Source/cmGetCMakePropertyCommand.cxx | 16 | ||||
-rw-r--r-- | Source/cmGetCMakePropertyCommand.h | 2 | ||||
-rw-r--r-- | Source/cmake.h | 6 | ||||
-rw-r--r-- | Tests/SystemInformation/CMakeLists.txt | 20 | ||||
-rw-r--r-- | Tests/SystemInformation/DumpInformation.cxx | 1 |
5 files changed, 36 insertions, 9 deletions
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 8788009..0b66b14 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -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]; diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index ffb7c0e..5a2eaf3 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -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); diff --git a/Source/cmake.h b/Source/cmake.h index ccaa409..fc7b4ac 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -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; diff --git a/Tests/SystemInformation/CMakeLists.txt b/Tests/SystemInformation/CMakeLists.txt index 8fbba95..93d93c6 100644 --- a/Tests/SystemInformation/CMakeLists.txt +++ b/Tests/SystemInformation/CMakeLists.txt @@ -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}) diff --git a/Tests/SystemInformation/DumpInformation.cxx b/Tests/SystemInformation/DumpInformation.cxx index 86f4698..30ae400 100644 --- a/Tests/SystemInformation/DumpInformation.cxx +++ b/Tests/SystemInformation/DumpInformation.cxx @@ -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", |