2001-01-11 22:55:47 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-01-11 22:55:47 +03: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-01-11 22:55:47 +03: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-01-11 22:55:47 +03:00
|
|
|
|
|
|
|
=========================================================================*/
|
2001-01-18 19:20:24 +03:00
|
|
|
#include "cmFindProgramCommand.h"
|
2001-02-19 23:13:48 +03:00
|
|
|
#include "cmCacheManager.h"
|
2001-01-05 19:41:20 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2006-03-02 21:30:22 +03:00
|
|
|
cmFindProgramCommand::cmFindProgramCommand()
|
|
|
|
{
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"FIND_XXX", "FIND_PROGRAM");
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"CMAKE_XXX_PATH", "CMAKE_PROGRAM_PATH");
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"XXX_SYSTEM", "");
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"CMAKE_SYSTEM_XXX_PATH", "CMAKE_SYSTEM_PROGRAM_PATH");
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"SEARCH_XXX_DESC", "program");
|
|
|
|
cmSystemTools::ReplaceString(this->GenericDocumentation,
|
|
|
|
"SEARCH_XXX", "program");
|
|
|
|
}
|
2001-01-05 19:41:20 +03:00
|
|
|
|
2001-01-18 19:20:24 +03:00
|
|
|
// cmFindProgramCommand
|
2001-09-20 23:08:30 +04:00
|
|
|
bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
2006-03-02 21:30:22 +03:00
|
|
|
this->VariableDocumentation = "Path to a program.";
|
|
|
|
this->CMakePathName = "PROGRAM";
|
|
|
|
// call cmFindBase::ParseArguments
|
|
|
|
if(!this->ParseArguments(argsIn))
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-03-02 21:30:22 +03:00
|
|
|
if(this->AlreadyInCache)
|
2001-02-19 23:13:48 +03:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2006-03-02 21:30:22 +03:00
|
|
|
std::string result = cmSystemTools::FindProgram(this->Names,
|
2006-03-09 02:16:01 +03:00
|
|
|
this->SearchPaths, true);
|
2006-03-02 21:30:22 +03:00
|
|
|
if(result != "")
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
2006-03-02 21:30:22 +03:00
|
|
|
// Save the value in the cache
|
|
|
|
m_Makefile->AddCacheDefinition(this->VariableName.c_str(),
|
|
|
|
result.c_str(),
|
|
|
|
this->VariableDocumentation.c_str(),
|
|
|
|
cmCacheManager::FILEPATH);
|
|
|
|
|
|
|
|
return true;
|
2001-01-05 19:41:20 +03:00
|
|
|
}
|
2006-03-02 21:30:22 +03:00
|
|
|
m_Makefile->AddCacheDefinition(this->VariableName.c_str(),
|
|
|
|
(this->VariableName + "-NOTFOUND").c_str(),
|
|
|
|
this->VariableDocumentation.c_str(),
|
2001-08-08 19:54:46 +04:00
|
|
|
cmCacheManager::FILEPATH);
|
2001-05-04 19:30:46 +04:00
|
|
|
return true;
|
2001-01-05 19:41:20 +03:00
|
|
|
}
|
|
|
|
|