2001-06-22 17:58:13 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-06-22 17:58:13 +04:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2001-06-22 17:58:13 +04:00
|
|
|
|
2002-01-21 23:30:43 +03:00
|
|
|
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.
|
2001-06-22 17:58:13 +04:00
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmSourceFilesRemoveCommand.h"
|
|
|
|
|
|
|
|
// cmSourceFilesRemoveCommand
|
2002-06-27 23:57:09 +04:00
|
|
|
bool cmSourceFilesRemoveCommand::InitialPass(std::vector<std::string> const& args)
|
2001-06-22 17:58:13 +04:00
|
|
|
{
|
2002-04-26 17:11:53 +04:00
|
|
|
const char* versionValue
|
|
|
|
= m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
|
|
|
|
if (versionValue && atof(versionValue) > 1.2)
|
|
|
|
{
|
|
|
|
this->SetError("The SOURCE_FILES_REMOVE command has been deprecated in CMake version 1.4. You should use the REMOVE command instead.\n");
|
|
|
|
return false;
|
|
|
|
}
|
2002-06-27 23:57:09 +04:00
|
|
|
|
|
|
|
if(args.size() < 2 )
|
2001-06-22 17:58:13 +04:00
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2002-03-29 22:20:32 +03:00
|
|
|
|
2002-06-27 23:57:09 +04:00
|
|
|
const char* variable = args[0].c_str(); // VAR is always first
|
|
|
|
// get the old value
|
|
|
|
const char* cacheValue
|
|
|
|
= m_Makefile->GetDefinition(variable);
|
|
|
|
|
|
|
|
// expand the variable
|
|
|
|
std::vector<std::string> varArgsExpanded;
|
2002-12-12 02:13:33 +03:00
|
|
|
cmSystemTools::ExpandListArgument(cacheValue, varArgsExpanded);
|
2002-06-27 23:57:09 +04:00
|
|
|
|
|
|
|
// expand the args
|
|
|
|
// check for REMOVE(VAR v1 v2 ... vn)
|
|
|
|
std::vector<std::string> argsExpanded;
|
2002-12-12 02:13:33 +03:00
|
|
|
std::vector<std::string> temp;
|
2002-06-27 23:57:09 +04:00
|
|
|
for(unsigned int j = 1; j < args.size(); ++j)
|
2001-06-22 17:58:13 +04:00
|
|
|
{
|
2002-12-12 02:13:33 +03:00
|
|
|
temp.push_back(args[j]);
|
2002-06-27 23:57:09 +04:00
|
|
|
}
|
2002-12-12 02:13:33 +03:00
|
|
|
cmSystemTools::ExpandList(temp, argsExpanded);
|
2002-06-27 23:57:09 +04:00
|
|
|
|
|
|
|
// now create the new value
|
|
|
|
std::string value;
|
|
|
|
for(unsigned int j = 0; j < varArgsExpanded.size(); ++j)
|
|
|
|
{
|
|
|
|
int found = 0;
|
|
|
|
for(unsigned int k = 0; k < argsExpanded.size(); ++k)
|
2002-01-18 23:39:24 +03:00
|
|
|
{
|
2002-06-27 23:57:09 +04:00
|
|
|
if (varArgsExpanded[j] == argsExpanded[k])
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
2002-01-18 23:39:24 +03:00
|
|
|
}
|
2002-06-27 23:57:09 +04:00
|
|
|
if (!found)
|
2002-01-18 23:39:24 +03:00
|
|
|
{
|
2002-06-27 23:57:09 +04:00
|
|
|
if (value.size())
|
|
|
|
{
|
|
|
|
value += ";";
|
|
|
|
}
|
|
|
|
value += varArgsExpanded[j];
|
2002-01-18 23:39:24 +03:00
|
|
|
}
|
2001-06-22 17:58:13 +04:00
|
|
|
}
|
2002-06-27 23:57:09 +04:00
|
|
|
|
|
|
|
// add the definition
|
|
|
|
m_Makefile->AddDefinition(variable, value.c_str());
|
|
|
|
|
2001-06-22 17:58:13 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|