ENH: add ability to use ; separated lists in SET and expand them for addexecutable and addlibrary
This commit is contained in:
parent
7359c6bd16
commit
dbdb0adce8
@ -18,14 +18,15 @@
|
|||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
// cmExecutableCommand
|
// cmExecutableCommand
|
||||||
bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
{
|
{
|
||||||
if(args.size() < 2 )
|
if(argsIn.size() < 2 )
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> args;
|
||||||
|
cmSystemTools::ExpandListArguments(argsIn, args);
|
||||||
std::vector<std::string>::const_iterator s = args.begin();
|
std::vector<std::string>::const_iterator s = args.begin();
|
||||||
|
|
||||||
std::string exename = *s;
|
std::string exename = *s;
|
||||||
|
@ -18,14 +18,15 @@
|
|||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
// cmLibraryCommand
|
// cmLibraryCommand
|
||||||
bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
{
|
{
|
||||||
if(args.size() < 1 )
|
if(argsIn.size() < 1 )
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> args;
|
||||||
|
cmSystemTools::ExpandListArguments(argsIn, args);
|
||||||
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
|
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
|
||||||
// otherwise it defaults to static library.
|
// otherwise it defaults to static library.
|
||||||
int shared = !cmSystemTools::IsOff(m_Makefile->GetDefinition("BUILD_SHARED_LIBS"));
|
int shared = !cmSystemTools::IsOff(m_Makefile->GetDefinition("BUILD_SHARED_LIBS"));
|
||||||
|
@ -42,6 +42,24 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
|
|||||||
const char* docstring = 0; // required if cache
|
const char* docstring = 0; // required if cache
|
||||||
std::string::size_type cacheStart = 0;
|
std::string::size_type cacheStart = 0;
|
||||||
|
|
||||||
|
// check for SET(VAR v1 v2 ... vn)
|
||||||
|
// and create
|
||||||
|
if(args.size() > 2)
|
||||||
|
{
|
||||||
|
if(args[1] != "CACHE" && args[2] != "CACHE")
|
||||||
|
{
|
||||||
|
value = args[1];
|
||||||
|
for(int i =2; i < args.size(); ++i)
|
||||||
|
{
|
||||||
|
value += ";";
|
||||||
|
value += args[i];
|
||||||
|
}
|
||||||
|
m_Makefile->AddDefinition(variable, value.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(args.size() == 2)
|
if(args.size() == 2)
|
||||||
{
|
{
|
||||||
// SET (VAR value )
|
// SET (VAR value )
|
||||||
|
@ -73,7 +73,9 @@ public:
|
|||||||
" TYPE and DOCSTRING are required. If TYPE is INTERNAL, then the "
|
" TYPE and DOCSTRING are required. If TYPE is INTERNAL, then the "
|
||||||
" VALUE is Always written into the cache, replacing any values "
|
" VALUE is Always written into the cache, replacing any values "
|
||||||
"existing in the cache. If it is not a CACHE VAR, then this always "
|
"existing in the cache. If it is not a CACHE VAR, then this always "
|
||||||
"writes into the current makefile.";
|
"writes into the current makefile.\n"
|
||||||
|
"An optional syntax is SET(VAR VALUE1 ... VALUEN).\n"
|
||||||
|
"In this case VAR is set to a ; separated list of values.";
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTypeMacro(cmSetCommand, cmCommand);
|
cmTypeMacro(cmSetCommand, cmCommand);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user