diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-03-06 16:20:26 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-03-06 16:20:26 (GMT) |
commit | 814b8856a0966a5d396583dcb36bbc8a225371af (patch) | |
tree | aefa3a421a34471d25558e0f749ee531a9ee5d8a /Source/cmGetCMakePropertyCommand.cxx | |
parent | ce750180baec52f1bb64fbd1afe7c1aff1338c5c (diff) | |
download | CMake-814b8856a0966a5d396583dcb36bbc8a225371af.zip CMake-814b8856a0966a5d396583dcb36bbc8a225371af.tar.gz CMake-814b8856a0966a5d396583dcb36bbc8a225371af.tar.bz2 |
Add command for accessing cmake properties. At this point the only properties are VARIABLES and CACHE_VARIABLES. Also add test for this feature
Diffstat (limited to 'Source/cmGetCMakePropertyCommand.cxx')
-rw-r--r-- | Source/cmGetCMakePropertyCommand.cxx | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx new file mode 100644 index 0000000..dc24d49 --- /dev/null +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -0,0 +1,60 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmGetCMakePropertyCommand.h" + +// cmGetCMakePropertyCommand +bool cmGetCMakePropertyCommand::InitialPass( + std::vector<std::string> const& args) +{ + if(args.size() < 2 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + int cc; + std::string variable = args[0]; + std::string output = ""; + + if ( args[1] == "VARIABLES" || args[1] == "CACHE_VARIABLES" ) + { + int cacheonly = 0; + if ( args[1] == "CACHE_VARIABLES" ) + { + cacheonly = 1; + } + std::vector<std::string> vars = m_Makefile->GetDefinitions(cacheonly); + for ( cc = 0; cc < vars.size(); cc ++ ) + { + if ( cc > 0 ) + { + output += ";"; + } + output += vars[cc]; + } + } + else + { + std::string emsg = "Unknown CMake property: " + args[1]; + this->SetError(emsg.c_str()); + return false; + } + m_Makefile->AddDefinition(variable.c_str(), output.c_str()); + + return true; +} + |