2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2005-05-05 20:45:53 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2005-05-05 20:45:53 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2005-05-05 20:45:53 +04:00
|
|
|
#include "cmGlobalUnixMakefileGenerator3.h"
|
|
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
2009-06-25 17:58:51 +04:00
|
|
|
#include "cmMakefileTargetGenerator.h"
|
2005-05-05 20:45:53 +04:00
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmake.h"
|
|
|
|
#include "cmGeneratedFileStream.h"
|
2006-05-23 17:11:46 +04:00
|
|
|
#include "cmSourceFile.h"
|
|
|
|
#include "cmTarget.h"
|
2012-03-07 23:01:46 +04:00
|
|
|
#include "cmGeneratorTarget.h"
|
2005-05-05 20:45:53 +04:00
|
|
|
|
|
|
|
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
|
|
|
|
{
|
|
|
|
// This type of makefile always requires unix style paths
|
2006-03-15 19:02:08 +03:00
|
|
|
this->ForceUnixPaths = true;
|
|
|
|
this->FindMakeProgramFile = "CMakeUnixFindMake.cmake";
|
2006-04-27 05:31:39 +04:00
|
|
|
this->ToolSupportsColor = true;
|
2007-06-06 00:35:24 +04:00
|
|
|
|
2009-06-10 21:04:04 +04:00
|
|
|
#if defined(_WIN32) || defined(__VMS)
|
2006-06-19 04:05:56 +04:00
|
|
|
this->UseLinkScript = false;
|
|
|
|
#else
|
2006-06-16 00:17:11 +04:00
|
|
|
this->UseLinkScript = true;
|
2006-06-19 04:05:56 +04:00
|
|
|
#endif
|
2011-01-13 07:39:13 +03:00
|
|
|
this->CommandDatabase = NULL;
|
2005-05-05 20:45:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGlobalUnixMakefileGenerator3
|
2010-11-12 00:02:07 +03:00
|
|
|
::EnableLanguage(std::vector<std::string>const& languages,
|
|
|
|
cmMakefile *mf,
|
2007-06-28 17:09:26 +04:00
|
|
|
bool optional)
|
2005-05-05 20:45:53 +04:00
|
|
|
{
|
2007-06-28 17:09:26 +04:00
|
|
|
this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
|
2005-05-05 20:45:53 +04:00
|
|
|
for(std::vector<std::string>::const_iterator l = languages.begin();
|
|
|
|
l != languages.end(); ++l)
|
|
|
|
{
|
2005-09-02 01:14:56 +04:00
|
|
|
if(*l == "NONE")
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-10 06:52:53 +04:00
|
|
|
this->ResolveLanguageCompiler(*l, mf, optional);
|
2005-05-05 20:45:53 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///! Create a local generator appropriate to this Global Generator
|
|
|
|
cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
|
|
|
|
{
|
|
|
|
cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3;
|
|
|
|
lg->SetGlobalGenerator(this);
|
|
|
|
return lg;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2006-05-11 18:40:28 +04:00
|
|
|
void cmGlobalUnixMakefileGenerator3
|
|
|
|
::GetDocumentation(cmDocumentationEntry& entry) const
|
2005-05-05 20:45:53 +04:00
|
|
|
{
|
2007-10-22 20:49:09 +04:00
|
|
|
entry.Name = this->GetName();
|
|
|
|
entry.Brief = "Generates standard UNIX makefiles.";
|
|
|
|
entry.Full =
|
2005-05-05 20:45:53 +04:00
|
|
|
"A hierarchy of UNIX makefiles is generated into the build tree. Any "
|
|
|
|
"standard UNIX-style make program can build the project through the "
|
|
|
|
"default make target. A \"make install\" target is also provided.";
|
|
|
|
}
|
|
|
|
|
2012-03-07 23:01:46 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
|
|
|
::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
|
|
|
{
|
|
|
|
cmTarget* target = gt->Target;
|
|
|
|
cmLocalUnixMakefileGenerator3* lg =
|
|
|
|
static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator);
|
|
|
|
|
|
|
|
// Compute full path to object file directory for this target.
|
|
|
|
std::string dir_max;
|
|
|
|
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
|
|
|
dir_max += "/";
|
|
|
|
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
|
|
|
dir_max += "/";
|
2012-03-09 01:32:03 +04:00
|
|
|
gt->ObjectDirectory = dir_max;
|
2012-03-07 23:01:46 +04:00
|
|
|
|
|
|
|
// Compute the name of each object file.
|
|
|
|
for(std::vector<cmSourceFile*>::iterator
|
|
|
|
si = gt->ObjectSources.begin();
|
|
|
|
si != gt->ObjectSources.end(); ++si)
|
|
|
|
{
|
|
|
|
cmSourceFile* sf = *si;
|
|
|
|
bool hasSourceExtension = true;
|
|
|
|
std::string objectName = gt->LocalGenerator
|
|
|
|
->GetObjectFileNameWithoutTarget(*sf, dir_max,
|
|
|
|
&hasSourceExtension);
|
|
|
|
gt->Objects[sf] = objectName;
|
|
|
|
lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-06 22:49:38 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2011-01-13 07:39:13 +03:00
|
|
|
std::string EscapeJSON(const std::string& s) {
|
|
|
|
std::string result;
|
2011-05-16 19:55:56 +04:00
|
|
|
for (std::string::size_type i = 0; i < s.size(); ++i) {
|
2011-01-13 07:39:13 +03:00
|
|
|
if (s[i] == '"' || s[i] == '\\') {
|
|
|
|
result += '\\';
|
|
|
|
}
|
|
|
|
result += s[i];
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
void cmGlobalUnixMakefileGenerator3::Generate()
|
2005-05-06 22:49:38 +04:00
|
|
|
{
|
2006-07-11 17:55:27 +04:00
|
|
|
// first do superclass method
|
|
|
|
this->cmGlobalGenerator::Generate();
|
|
|
|
|
2011-05-16 19:18:39 +04:00
|
|
|
// initialize progress
|
|
|
|
unsigned long total = 0;
|
|
|
|
for(ProgressMapType::const_iterator pmi = this->ProgressMap.begin();
|
|
|
|
pmi != this->ProgressMap.end(); ++pmi)
|
2006-05-23 17:11:46 +04:00
|
|
|
{
|
2011-05-16 19:18:39 +04:00
|
|
|
total += pmi->second.NumberOfActions;
|
2006-05-23 17:11:46 +04:00
|
|
|
}
|
2005-05-06 22:49:38 +04:00
|
|
|
|
2011-05-16 19:18:39 +04:00
|
|
|
// write each target's progress.make this loop is done twice. Bascially the
|
|
|
|
// Generate pass counts all the actions, the first loop below determines
|
|
|
|
// how many actions have progress updates for each target and writes to
|
|
|
|
// corrrect variable values for everything except the all targets. The
|
|
|
|
// second loop actually writes out correct values for the all targets as
|
|
|
|
// well. This is because the all targets require more information that is
|
|
|
|
// computed in the first loop.
|
|
|
|
unsigned long current = 0;
|
|
|
|
for(ProgressMapType::iterator pmi = this->ProgressMap.begin();
|
|
|
|
pmi != this->ProgressMap.end(); ++pmi)
|
2006-07-11 17:55:27 +04:00
|
|
|
{
|
2011-05-16 19:18:39 +04:00
|
|
|
pmi->second.WriteProgressVariables(total, current);
|
|
|
|
}
|
|
|
|
for(unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
|
|
|
{
|
|
|
|
cmLocalUnixMakefileGenerator3 *lg =
|
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
|
|
|
std::string markFileName = lg->GetMakefile()->GetStartOutputDirectory();
|
|
|
|
markFileName += "/";
|
|
|
|
markFileName += cmake::GetCMakeFilesDirectory();
|
|
|
|
markFileName += "/progress.marks";
|
|
|
|
cmGeneratedFileStream markFile(markFileName.c_str());
|
|
|
|
markFile << this->CountProgressMarksInAll(lg) << "\n";
|
2006-07-11 17:55:27 +04:00
|
|
|
}
|
2010-10-28 19:13:00 +04:00
|
|
|
|
2005-05-06 22:49:38 +04:00
|
|
|
// write the main makefile
|
2005-05-31 19:46:49 +04:00
|
|
|
this->WriteMainMakefile2();
|
2005-05-06 22:49:38 +04:00
|
|
|
this->WriteMainCMakefile();
|
2011-01-13 07:39:13 +03:00
|
|
|
|
|
|
|
if (this->CommandDatabase != NULL) {
|
|
|
|
*this->CommandDatabase << std::endl << "]";
|
|
|
|
delete this->CommandDatabase;
|
|
|
|
this->CommandDatabase = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
|
|
|
|
const std::string &sourceFile, const std::string &workingDirectory,
|
|
|
|
const std::string &compileCommand) {
|
|
|
|
if (this->CommandDatabase == NULL)
|
|
|
|
{
|
|
|
|
std::string commandDatabaseName =
|
|
|
|
std::string(this->GetCMakeInstance()->GetHomeOutputDirectory())
|
2011-01-15 02:16:11 +03:00
|
|
|
+ "/compile_commands.json";
|
2011-01-13 07:39:13 +03:00
|
|
|
this->CommandDatabase =
|
|
|
|
new cmGeneratedFileStream(commandDatabaseName.c_str());
|
|
|
|
*this->CommandDatabase << "[" << std::endl;
|
|
|
|
} else {
|
|
|
|
*this->CommandDatabase << "," << std::endl;
|
|
|
|
}
|
|
|
|
*this->CommandDatabase << "{" << std::endl
|
|
|
|
<< " \"directory\": \"" << EscapeJSON(workingDirectory) << "\","
|
|
|
|
<< std::endl
|
|
|
|
<< " \"command\": \"" << EscapeJSON(compileCommand) << "\","
|
|
|
|
<< std::endl
|
|
|
|
<< " \"file\": \"" << EscapeJSON(sourceFile) << "\""
|
|
|
|
<< std::endl << "}";
|
2005-05-06 22:49:38 +04:00
|
|
|
}
|
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
|
|
|
|
{
|
|
|
|
// Open the output file. This should not be copy-if-different
|
|
|
|
// because the check-build-system step compares the makefile time to
|
|
|
|
// see if the build system must be regenerated.
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string makefileName =
|
2005-05-31 19:46:49 +04:00
|
|
|
this->GetCMakeInstance()->GetHomeOutputDirectory();
|
2006-06-14 20:28:32 +04:00
|
|
|
makefileName += cmake::GetCMakeFilesDirectory();
|
|
|
|
makefileName += "/Makefile2";
|
2005-05-31 19:46:49 +04:00
|
|
|
cmGeneratedFileStream makefileStream(makefileName.c_str());
|
|
|
|
if(!makefileStream)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
// get a local generator for some useful methods
|
2010-11-12 00:02:07 +03:00
|
|
|
cmLocalUnixMakefileGenerator3 *lg =
|
2006-03-15 19:02:08 +03:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
// Write the do not edit header.
|
|
|
|
lg->WriteDisclaimer(makefileStream);
|
2006-02-15 18:34:11 +03:00
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
// Write the main entry point target. This must be the VERY first
|
|
|
|
// target so that make with no arguments will run it.
|
|
|
|
// Just depend on the all target to drive the build.
|
|
|
|
std::vector<std::string> depends;
|
|
|
|
std::vector<std::string> no_commands;
|
|
|
|
depends.push_back("all");
|
|
|
|
|
|
|
|
// Write the rule.
|
|
|
|
lg->WriteMakeRule(makefileStream,
|
|
|
|
"Default target executed when no arguments are "
|
|
|
|
"given to make.",
|
|
|
|
"default_target",
|
|
|
|
depends,
|
2006-02-16 00:35:16 +03:00
|
|
|
no_commands, true);
|
2005-05-31 19:46:49 +04:00
|
|
|
|
2006-01-17 18:21:45 +03:00
|
|
|
depends.clear();
|
2006-02-16 00:35:16 +03:00
|
|
|
|
2006-02-17 02:50:16 +03:00
|
|
|
// The all and preinstall rules might never have any dependencies
|
|
|
|
// added to them.
|
2006-03-15 19:02:08 +03:00
|
|
|
if(this->EmptyRuleHackDepends != "")
|
2006-02-17 02:50:16 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
depends.push_back(this->EmptyRuleHackDepends);
|
2006-02-17 02:50:16 +03:00
|
|
|
}
|
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
// Write and empty all:
|
2010-11-12 00:02:07 +03:00
|
|
|
lg->WriteMakeRule(makefileStream,
|
|
|
|
"The main recursive all target", "all",
|
2006-02-16 00:35:16 +03:00
|
|
|
depends, no_commands, true);
|
2005-05-31 19:46:49 +04:00
|
|
|
|
2006-02-16 23:19:00 +03:00
|
|
|
// Write an empty preinstall:
|
|
|
|
lg->WriteMakeRule(makefileStream,
|
|
|
|
"The main recursive preinstall target", "preinstall",
|
|
|
|
depends, no_commands, true);
|
|
|
|
|
2006-02-16 00:35:16 +03:00
|
|
|
// Write out the "special" stuff
|
|
|
|
lg->WriteSpecialTargetsTop(makefileStream);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-31 19:46:49 +04:00
|
|
|
// write the target convenience rules
|
|
|
|
unsigned int i;
|
2006-03-15 19:02:08 +03:00
|
|
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
lg =
|
2006-05-11 18:40:28 +04:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
2007-08-03 23:44:25 +04:00
|
|
|
this->WriteConvenienceRules2(makefileStream,lg);
|
2005-05-31 19:46:49 +04:00
|
|
|
}
|
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
|
2005-05-31 19:46:49 +04:00
|
|
|
lg->WriteSpecialTargetsBottom(makefileStream);
|
|
|
|
}
|
|
|
|
|
2005-05-06 22:49:38 +04:00
|
|
|
|
2005-05-05 20:45:53 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
|
|
|
|
{
|
|
|
|
// Open the output file. This should not be copy-if-different
|
|
|
|
// because the check-build-system step compares the makefile time to
|
|
|
|
// see if the build system must be regenerated.
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string cmakefileName =
|
2005-05-06 22:49:38 +04:00
|
|
|
this->GetCMakeInstance()->GetHomeOutputDirectory();
|
2006-06-14 20:28:32 +04:00
|
|
|
cmakefileName += cmake::GetCMakeFilesDirectory();
|
|
|
|
cmakefileName += "/Makefile.cmake";
|
2005-05-05 20:45:53 +04:00
|
|
|
cmGeneratedFileStream cmakefileStream(cmakefileName.c_str());
|
|
|
|
if(!cmakefileStream)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2005-05-06 22:49:38 +04:00
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string makefileName =
|
2005-05-06 22:49:38 +04:00
|
|
|
this->GetCMakeInstance()->GetHomeOutputDirectory();
|
|
|
|
makefileName += "/Makefile";
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-05 20:45:53 +04:00
|
|
|
// get a local generator for some useful methods
|
2010-11-12 00:02:07 +03:00
|
|
|
cmLocalUnixMakefileGenerator3 *lg =
|
2006-03-15 19:02:08 +03:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-05 20:45:53 +04:00
|
|
|
// Write the do not edit header.
|
|
|
|
lg->WriteDisclaimer(cmakefileStream);
|
|
|
|
|
2005-05-12 18:49:56 +04:00
|
|
|
// Save the generator name
|
|
|
|
cmakefileStream
|
|
|
|
<< "# The generator used is:\n"
|
|
|
|
<< "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
|
|
|
|
|
2005-05-05 20:45:53 +04:00
|
|
|
// for each cmMakefile get its list of dependencies
|
|
|
|
std::vector<std::string> lfiles;
|
2006-03-15 19:02:08 +03:00
|
|
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
2005-05-05 20:45:53 +04:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
lg =
|
2006-05-11 18:40:28 +04:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-05 20:45:53 +04:00
|
|
|
// Get the list of files contributing to this generation step.
|
|
|
|
lfiles.insert(lfiles.end(),lg->GetMakefile()->GetListFiles().begin(),
|
|
|
|
lg->GetMakefile()->GetListFiles().end());
|
|
|
|
}
|
|
|
|
// Sort the list and remove duplicates.
|
|
|
|
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
|
2009-06-10 21:02:18 +04:00
|
|
|
#if !defined(__VMS) // The Compaq STL on VMS crashes, so accept duplicates.
|
2010-11-12 00:02:07 +03:00
|
|
|
std::vector<std::string>::iterator new_end =
|
2005-05-05 20:45:53 +04:00
|
|
|
std::unique(lfiles.begin(),lfiles.end());
|
|
|
|
lfiles.erase(new_end, lfiles.end());
|
2009-06-10 21:02:18 +04:00
|
|
|
#endif
|
2005-05-05 20:45:53 +04:00
|
|
|
|
|
|
|
// reset lg to the first makefile
|
2006-03-15 19:02:08 +03:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
|
2005-05-05 20:45:53 +04:00
|
|
|
|
|
|
|
// Build the path to the cache file.
|
|
|
|
std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
|
|
|
|
cache += "/CMakeCache.txt";
|
|
|
|
|
|
|
|
// Save the list to the cmake file.
|
|
|
|
cmakefileStream
|
|
|
|
<< "# The top level Makefile was generated from the following files:\n"
|
|
|
|
<< "SET(CMAKE_MAKEFILE_DEPENDS\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
<< " \""
|
2006-05-11 18:40:28 +04:00
|
|
|
<< lg->Convert(cache.c_str(),
|
|
|
|
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
|
2005-05-05 20:45:53 +04:00
|
|
|
for(std::vector<std::string>::const_iterator i = lfiles.begin();
|
|
|
|
i != lfiles.end(); ++i)
|
|
|
|
{
|
|
|
|
cmakefileStream
|
2010-11-12 00:02:07 +03:00
|
|
|
<< " \""
|
2006-05-11 18:40:28 +04:00
|
|
|
<< lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str()
|
2005-05-05 20:45:53 +04:00
|
|
|
<< "\"\n";
|
|
|
|
}
|
|
|
|
cmakefileStream
|
|
|
|
<< " )\n\n";
|
|
|
|
|
|
|
|
// Build the path to the cache check file.
|
|
|
|
std::string check = this->GetCMakeInstance()->GetHomeOutputDirectory();
|
2006-06-14 20:28:32 +04:00
|
|
|
check += cmake::GetCMakeFilesDirectory();
|
|
|
|
check += "/cmake.check_cache";
|
2005-05-05 20:45:53 +04:00
|
|
|
|
|
|
|
// Set the corresponding makefile in the cmake file.
|
|
|
|
cmakefileStream
|
|
|
|
<< "# The corresponding makefile is:\n"
|
|
|
|
<< "SET(CMAKE_MAKEFILE_OUTPUTS\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
<< " \""
|
2006-05-11 18:40:28 +04:00
|
|
|
<< lg->Convert(makefileName.c_str(),
|
|
|
|
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
<< " \""
|
2006-05-11 18:40:28 +04:00
|
|
|
<< lg->Convert(check.c_str(),
|
|
|
|
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
|
2005-05-05 20:45:53 +04:00
|
|
|
cmakefileStream << " )\n\n";
|
2005-05-06 22:49:38 +04:00
|
|
|
|
2009-02-06 19:18:56 +03:00
|
|
|
// CMake must rerun if a byproduct is missing.
|
|
|
|
{
|
|
|
|
cmakefileStream
|
|
|
|
<< "# Byproducts of CMake generate step:\n"
|
|
|
|
<< "SET(CMAKE_MAKEFILE_PRODUCTS\n";
|
|
|
|
const std::vector<std::string>& outfiles =
|
|
|
|
lg->GetMakefile()->GetOutputFiles();
|
|
|
|
for(std::vector<std::string>::const_iterator k = outfiles.begin();
|
|
|
|
k != outfiles.end(); ++k)
|
|
|
|
{
|
|
|
|
cmakefileStream << " \"" <<
|
|
|
|
lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
|
|
|
<< "\"\n";
|
|
|
|
}
|
2009-09-22 22:40:23 +04:00
|
|
|
|
|
|
|
// add in all the directory information files
|
|
|
|
std::string tmpStr;
|
|
|
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
lg =
|
2009-09-22 22:40:23 +04:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
|
|
|
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
|
|
|
|
tmpStr += cmake::GetCMakeFilesDirectory();
|
|
|
|
tmpStr += "/CMakeDirectoryInformation.cmake";
|
2010-11-12 00:02:07 +03:00
|
|
|
cmakefileStream << " \"" <<
|
|
|
|
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
2009-09-22 22:40:23 +04:00
|
|
|
<< "\"\n";
|
|
|
|
}
|
2009-02-06 19:18:56 +03:00
|
|
|
cmakefileStream << " )\n\n";
|
|
|
|
}
|
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
this->WriteMainCMakefileLanguageRules(cmakefileStream,
|
2006-05-11 18:40:28 +04:00
|
|
|
this->LocalGenerators);
|
2006-04-11 19:06:19 +04:00
|
|
|
}
|
|
|
|
|
2005-05-06 22:49:38 +04:00
|
|
|
void cmGlobalUnixMakefileGenerator3
|
2005-07-27 17:49:37 +04:00
|
|
|
::WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
|
2006-05-11 18:40:28 +04:00
|
|
|
std::vector<cmLocalGenerator *> &lGenerators
|
|
|
|
)
|
2005-05-06 22:49:38 +04:00
|
|
|
{
|
|
|
|
cmLocalUnixMakefileGenerator3 *lg;
|
|
|
|
|
2005-07-27 17:49:37 +04:00
|
|
|
// now list all the target info files
|
2005-05-05 20:45:53 +04:00
|
|
|
cmakefileStream
|
2007-12-21 21:10:33 +03:00
|
|
|
<< "# Dependency information for all targets:\n";
|
2005-05-05 20:45:53 +04:00
|
|
|
cmakefileStream
|
2005-07-27 17:49:37 +04:00
|
|
|
<< "SET(CMAKE_DEPEND_INFO_FILES\n";
|
|
|
|
for (unsigned int i = 0; i < lGenerators.size(); ++i)
|
2005-05-05 20:45:53 +04:00
|
|
|
{
|
2005-07-27 17:49:37 +04:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
|
|
|
|
// for all of out targets
|
|
|
|
for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
|
|
|
|
l != lg->GetMakefile()->GetTargets().end(); l++)
|
2005-05-05 20:45:53 +04:00
|
|
|
{
|
2005-08-02 19:06:16 +04:00
|
|
|
if((l->second.GetType() == cmTarget::EXECUTABLE) ||
|
|
|
|
(l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
|
|
|
(l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
2007-12-21 21:10:33 +03:00
|
|
|
(l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
2012-03-12 18:54:37 +04:00
|
|
|
(l->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
|
2007-12-21 21:10:33 +03:00
|
|
|
(l->second.GetType() == cmTarget::UTILITY))
|
2005-08-02 19:06:16 +04:00
|
|
|
{
|
|
|
|
std::string tname = lg->GetRelativeTargetDirectory(l->second);
|
|
|
|
tname += "/DependInfo.cmake";
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(tname);
|
|
|
|
cmakefileStream << " \"" << tname.c_str() << "\"\n";
|
|
|
|
}
|
2005-05-05 20:45:53 +04:00
|
|
|
}
|
|
|
|
}
|
2005-07-27 17:49:37 +04:00
|
|
|
cmakefileStream << " )\n";
|
2005-05-05 20:45:53 +04:00
|
|
|
}
|
|
|
|
|
2005-05-06 22:49:38 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
2006-03-02 02:54:17 +03:00
|
|
|
::WriteDirectoryRule2(std::ostream& ruleFileStream,
|
|
|
|
cmLocalUnixMakefileGenerator3* lg,
|
|
|
|
const char* pass, bool check_all,
|
|
|
|
bool check_relink)
|
2005-05-06 22:49:38 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
// Get the relative path to the subdirectory from the top.
|
|
|
|
std::string makeTarget = lg->GetMakefile()->GetStartOutputDirectory();
|
|
|
|
makeTarget += "/";
|
|
|
|
makeTarget += pass;
|
|
|
|
|
|
|
|
// The directory-level rule should depend on the target-level rules
|
|
|
|
// for all targets in the directory.
|
|
|
|
std::vector<std::string> depends;
|
|
|
|
for(cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
|
|
|
|
l != lg->GetMakefile()->GetTargets().end(); ++l)
|
2005-05-13 22:13:00 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
if((l->second.GetType() == cmTarget::EXECUTABLE) ||
|
|
|
|
(l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
|
|
|
(l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
|
|
|
(l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
2012-03-12 18:54:37 +04:00
|
|
|
(l->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
|
2006-03-02 02:54:17 +03:00
|
|
|
(l->second.GetType() == cmTarget::UTILITY))
|
2005-05-19 23:00:35 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
// Add this to the list of depends rules in this directory.
|
2007-03-12 17:26:59 +03:00
|
|
|
if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
|
2009-07-08 21:03:47 +04:00
|
|
|
(!check_relink ||
|
|
|
|
l->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
|
2005-05-19 23:00:35 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
std::string tname = lg->GetRelativeTargetDirectory(l->second);
|
|
|
|
tname += "/";
|
|
|
|
tname += pass;
|
|
|
|
depends.push_back(tname);
|
2005-05-19 23:00:35 +04:00
|
|
|
}
|
|
|
|
}
|
2005-05-31 19:46:49 +04:00
|
|
|
}
|
|
|
|
|
2006-03-02 02:54:17 +03:00
|
|
|
// The directory-level rule should depend on the directory-level
|
|
|
|
// rules of the subdirectories.
|
2010-11-12 00:02:07 +03:00
|
|
|
for(std::vector<cmLocalGenerator*>::iterator sdi =
|
2006-05-11 18:40:28 +04:00
|
|
|
lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
cmLocalUnixMakefileGenerator3* slg =
|
|
|
|
static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
|
|
|
|
std::string subdir = slg->GetMakefile()->GetStartOutputDirectory();
|
|
|
|
subdir += "/";
|
|
|
|
subdir += pass;
|
|
|
|
depends.push_back(subdir);
|
2005-05-31 19:46:49 +04:00
|
|
|
}
|
2006-03-02 02:54:17 +03:00
|
|
|
|
|
|
|
// Work-around for makes that drop rules that have no dependencies
|
|
|
|
// or commands.
|
2006-03-15 19:02:08 +03:00
|
|
|
if(depends.empty() && this->EmptyRuleHackDepends != "")
|
2006-03-02 02:54:17 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
depends.push_back(this->EmptyRuleHackDepends);
|
2006-03-02 02:54:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Write the rule.
|
|
|
|
std::string doc = "Convenience name for \"";
|
|
|
|
doc += pass;
|
|
|
|
doc += "\" pass in the directory.";
|
|
|
|
std::vector<std::string> no_commands;
|
|
|
|
lg->WriteMakeRule(ruleFileStream, doc.c_str(),
|
|
|
|
makeTarget.c_str(), depends, no_commands, true);
|
2005-05-31 19:46:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
2006-03-02 02:54:17 +03:00
|
|
|
::WriteDirectoryRules2(std::ostream& ruleFileStream,
|
|
|
|
cmLocalUnixMakefileGenerator3* lg)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
// Only subdirectories need these rules.
|
|
|
|
if(!lg->GetParent())
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2006-03-02 02:54:17 +03:00
|
|
|
return;
|
2005-05-13 22:13:00 +04:00
|
|
|
}
|
2005-05-25 23:09:06 +04:00
|
|
|
|
2006-03-02 02:54:17 +03:00
|
|
|
// Begin the directory-level rules section.
|
|
|
|
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
|
|
|
|
dir = lg->Convert(dir.c_str(), cmLocalGenerator::HOME_OUTPUT,
|
|
|
|
cmLocalGenerator::MAKEFILE);
|
|
|
|
lg->WriteDivider(ruleFileStream);
|
|
|
|
ruleFileStream
|
|
|
|
<< "# Directory level rules for directory "
|
|
|
|
<< dir << "\n\n";
|
|
|
|
|
|
|
|
// Write directory-level rules for "all".
|
|
|
|
this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false);
|
|
|
|
|
|
|
|
// Write directory-level rules for "clean".
|
|
|
|
this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false);
|
|
|
|
|
|
|
|
// Write directory-level rules for "preinstall".
|
2007-08-04 00:31:08 +04:00
|
|
|
this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true);
|
2005-05-31 18:16:28 +04:00
|
|
|
}
|
|
|
|
|
2006-05-02 17:56:42 +04:00
|
|
|
|
2006-05-11 18:40:28 +04:00
|
|
|
std::string cmGlobalUnixMakefileGenerator3
|
2010-11-12 00:02:07 +03:00
|
|
|
::GenerateBuildCommand(const char* makeProgram, const char *projectName,
|
2006-05-11 18:40:28 +04:00
|
|
|
const char* additionalOptions, const char *targetName,
|
2006-06-01 23:51:24 +04:00
|
|
|
const char* config, bool ignoreErrors, bool fast)
|
2006-05-02 17:56:42 +04:00
|
|
|
{
|
|
|
|
// Project name and config are not used yet.
|
|
|
|
(void)projectName;
|
|
|
|
(void)config;
|
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string makeCommand =
|
2006-05-11 18:40:28 +04:00
|
|
|
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2006-05-02 17:56:42 +04:00
|
|
|
// Since we have full control over the invocation of nmake, let us
|
|
|
|
// make it quiet.
|
|
|
|
if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
|
|
|
|
{
|
|
|
|
makeCommand += " /NOLOGO ";
|
|
|
|
}
|
|
|
|
if ( ignoreErrors )
|
|
|
|
{
|
|
|
|
makeCommand += " -i";
|
|
|
|
}
|
|
|
|
if ( additionalOptions )
|
|
|
|
{
|
|
|
|
makeCommand += " ";
|
|
|
|
makeCommand += additionalOptions;
|
|
|
|
}
|
|
|
|
if ( targetName && strlen(targetName))
|
|
|
|
{
|
|
|
|
cmLocalUnixMakefileGenerator3 *lg;
|
|
|
|
if (this->LocalGenerators.size())
|
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
|
|
|
|
(this->LocalGenerators[0]);
|
2006-05-02 17:56:42 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
|
|
|
|
(this->CreateLocalGenerator());
|
2006-05-02 17:56:42 +04:00
|
|
|
// set the Start directories
|
|
|
|
lg->GetMakefile()->SetStartDirectory
|
|
|
|
(this->CMakeInstance->GetStartDirectory());
|
|
|
|
lg->GetMakefile()->SetStartOutputDirectory
|
|
|
|
(this->CMakeInstance->GetStartOutputDirectory());
|
|
|
|
lg->GetMakefile()->MakeStartDirectoriesCurrent();
|
|
|
|
}
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2006-05-02 18:48:14 +04:00
|
|
|
makeCommand += " \"";
|
2006-05-02 17:56:42 +04:00
|
|
|
std::string tname = targetName;
|
2006-06-01 23:51:24 +04:00
|
|
|
if(fast)
|
|
|
|
{
|
|
|
|
tname += "/fast";
|
|
|
|
}
|
2006-05-02 17:56:42 +04:00
|
|
|
tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT,
|
2006-05-03 23:17:55 +04:00
|
|
|
cmLocalGenerator::MAKEFILE);
|
2006-05-02 17:56:42 +04:00
|
|
|
makeCommand += tname.c_str();
|
|
|
|
makeCommand += "\"";
|
|
|
|
if (!this->LocalGenerators.size())
|
|
|
|
{
|
|
|
|
delete lg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return makeCommand;
|
|
|
|
}
|
|
|
|
|
2005-05-31 18:16:28 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
2010-11-12 00:02:07 +03:00
|
|
|
::WriteConvenienceRules(std::ostream& ruleFileStream,
|
2005-06-01 17:25:10 +04:00
|
|
|
std::set<cmStdString> &emitted)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
std::vector<std::string> depends;
|
2005-05-31 19:46:49 +04:00
|
|
|
std::vector<std::string> commands;
|
|
|
|
|
|
|
|
depends.push_back("cmake_check_build_system");
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-10-20 21:40:28 +04:00
|
|
|
// write the target convenience rules
|
|
|
|
unsigned int i;
|
|
|
|
cmLocalUnixMakefileGenerator3 *lg;
|
2006-03-15 19:02:08 +03:00
|
|
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
|
|
|
|
(this->LocalGenerators[i]);
|
2005-10-20 21:40:28 +04:00
|
|
|
// for each target Generate the rule files for each target.
|
|
|
|
cmTargets& targets = lg->GetMakefile()->GetTargets();
|
|
|
|
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2006-06-01 22:09:21 +04:00
|
|
|
// Don't emit the same rule twice (e.g. two targets with the same
|
|
|
|
// simple name)
|
|
|
|
if(t->second.GetName() &&
|
|
|
|
strlen(t->second.GetName()) &&
|
2007-05-22 18:24:59 +04:00
|
|
|
emitted.insert(t->second.GetName()).second &&
|
|
|
|
// Handle user targets here. Global targets are handled in
|
|
|
|
// the local generator on a per-directory basis.
|
|
|
|
((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
|
|
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
|
|
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
|
|
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
2012-03-12 18:54:37 +04:00
|
|
|
(t->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
|
2007-05-22 18:24:59 +04:00
|
|
|
(t->second.GetType() == cmTarget::UTILITY)))
|
2005-05-31 19:46:49 +04:00
|
|
|
{
|
2007-05-22 18:24:59 +04:00
|
|
|
// Add a rule to build the target by name.
|
|
|
|
lg->WriteDivider(ruleFileStream);
|
|
|
|
ruleFileStream
|
|
|
|
<< "# Target rules for targets named "
|
|
|
|
<< t->second.GetName() << "\n\n";
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// Write the rule.
|
|
|
|
commands.clear();
|
|
|
|
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
|
|
|
|
tmp += "Makefile2";
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(tmp.c_str(),t->second.GetName()));
|
|
|
|
depends.clear();
|
|
|
|
depends.push_back("cmake_check_build_system");
|
2010-11-12 00:02:07 +03:00
|
|
|
lg->WriteMakeRule(ruleFileStream,
|
2007-05-22 18:24:59 +04:00
|
|
|
"Build rule for target.",
|
|
|
|
t->second.GetName(), depends, commands,
|
|
|
|
true);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// Add a fast rule to build the target
|
|
|
|
std::string localName = lg->GetRelativeTargetDirectory(t->second);
|
|
|
|
std::string makefileName;
|
|
|
|
makefileName = localName;
|
2010-11-12 00:02:07 +03:00
|
|
|
makefileName += "/build.make";
|
2007-05-22 18:24:59 +04:00
|
|
|
depends.clear();
|
|
|
|
commands.clear();
|
|
|
|
std::string makeTargetName = localName;
|
|
|
|
makeTargetName += "/build";
|
|
|
|
localName = t->second.GetName();
|
|
|
|
localName += "/fast";
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(makefileName.c_str(), makeTargetName.c_str()));
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
|
|
|
|
localName.c_str(), depends, commands, true);
|
2007-08-04 00:31:08 +04:00
|
|
|
|
|
|
|
// Add a local name for the rule to relink the target before
|
|
|
|
// installation.
|
2009-07-08 21:03:47 +04:00
|
|
|
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
|
2007-08-04 00:31:08 +04:00
|
|
|
{
|
|
|
|
makeTargetName = lg->GetRelativeTargetDirectory(t->second);
|
|
|
|
makeTargetName += "/preinstall";
|
|
|
|
localName = t->second.GetName();
|
|
|
|
localName += "/preinstall";
|
|
|
|
depends.clear();
|
|
|
|
commands.clear();
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(makefileName.c_str(), makeTargetName.c_str()));
|
|
|
|
lg->WriteMakeRule(ruleFileStream,
|
|
|
|
"Manual pre-install relink rule for target.",
|
|
|
|
localName.c_str(), depends, commands, true);
|
|
|
|
}
|
2006-05-02 17:56:42 +04:00
|
|
|
}
|
2005-05-31 19:46:49 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
2010-11-12 00:02:07 +03:00
|
|
|
::WriteConvenienceRules2(std::ostream& ruleFileStream,
|
2007-08-03 23:44:25 +04:00
|
|
|
cmLocalUnixMakefileGenerator3 *lg)
|
2005-05-31 18:16:28 +04:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
std::vector<std::string> depends;
|
2005-05-31 18:16:28 +04:00
|
|
|
std::vector<std::string> commands;
|
|
|
|
std::string localName;
|
|
|
|
std::string makeTargetName;
|
|
|
|
|
2006-05-15 21:02:28 +04:00
|
|
|
|
2005-05-31 18:16:28 +04:00
|
|
|
// write the directory level rules for this local gen
|
2005-05-31 19:46:49 +04:00
|
|
|
this->WriteDirectoryRules2(ruleFileStream,lg);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-05-31 18:16:28 +04:00
|
|
|
depends.push_back("cmake_check_build_system");
|
2005-05-25 23:09:06 +04:00
|
|
|
|
2005-05-11 20:44:01 +04:00
|
|
|
// for each target Generate the rule files for each target.
|
2005-06-22 17:06:46 +04:00
|
|
|
cmTargets& targets = lg->GetMakefile()->GetTargets();
|
|
|
|
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
|
2005-05-06 22:49:38 +04:00
|
|
|
{
|
2007-05-22 18:24:59 +04:00
|
|
|
if (t->second.GetName()
|
|
|
|
&& strlen(t->second.GetName())
|
|
|
|
&& ((t->second.GetType() == cmTarget::EXECUTABLE)
|
|
|
|
|| (t->second.GetType() == cmTarget::STATIC_LIBRARY)
|
|
|
|
|| (t->second.GetType() == cmTarget::SHARED_LIBRARY)
|
|
|
|
|| (t->second.GetType() == cmTarget::MODULE_LIBRARY)
|
2012-03-12 18:54:37 +04:00
|
|
|
|| (t->second.GetType() == cmTarget::OBJECT_LIBRARY)
|
2007-05-22 18:24:59 +04:00
|
|
|
|| (t->second.GetType() == cmTarget::UTILITY)))
|
2005-05-06 22:49:38 +04:00
|
|
|
{
|
2006-05-02 17:56:42 +04:00
|
|
|
std::string makefileName;
|
2005-05-06 22:49:38 +04:00
|
|
|
// Add a rule to build the target by name.
|
|
|
|
localName = lg->GetRelativeTargetDirectory(t->second);
|
2006-05-02 17:56:42 +04:00
|
|
|
makefileName = localName;
|
2005-05-19 18:52:59 +04:00
|
|
|
makefileName += "/build.make";
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-08-03 17:39:32 +04:00
|
|
|
bool needRequiresStep = this->NeedRequiresStep(t->second);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
lg->WriteDivider(ruleFileStream);
|
|
|
|
ruleFileStream
|
|
|
|
<< "# Target rules for target "
|
|
|
|
<< localName << "\n\n";
|
2010-11-12 00:02:07 +03:00
|
|
|
|
|
|
|
commands.clear();
|
2007-12-21 20:22:12 +03:00
|
|
|
makeTargetName = localName;
|
|
|
|
makeTargetName += "/depend";
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(makefileName.c_str(),makeTargetName.c_str()));
|
|
|
|
|
|
|
|
// add requires if we need it for this generator
|
|
|
|
if (needRequiresStep)
|
2005-05-18 21:46:00 +04:00
|
|
|
{
|
2007-05-22 18:24:59 +04:00
|
|
|
makeTargetName = localName;
|
2007-12-21 20:22:12 +03:00
|
|
|
makeTargetName += "/requires";
|
2007-05-22 18:24:59 +04:00
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
2007-12-21 20:22:12 +03:00
|
|
|
(makefileName.c_str(),makeTargetName.c_str()));
|
2007-05-22 18:24:59 +04:00
|
|
|
}
|
|
|
|
makeTargetName = localName;
|
|
|
|
makeTargetName += "/build";
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(makefileName.c_str(),makeTargetName.c_str()));
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// Write the rule.
|
|
|
|
localName += "/all";
|
|
|
|
depends.clear();
|
2006-05-15 21:02:28 +04:00
|
|
|
|
2011-05-16 19:18:39 +04:00
|
|
|
std::string progressDir =
|
|
|
|
lg->GetMakefile()->GetHomeOutputDirectory();
|
|
|
|
progressDir += cmake::GetCMakeFilesDirectory();
|
2006-06-16 23:29:25 +04:00
|
|
|
{
|
2011-05-16 19:18:39 +04:00
|
|
|
cmOStringStream progCmd;
|
|
|
|
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
|
|
|
|
// all target counts
|
|
|
|
progCmd << lg->Convert(progressDir.c_str(),
|
|
|
|
cmLocalGenerator::FULL,
|
|
|
|
cmLocalGenerator::SHELL);
|
|
|
|
progCmd << " ";
|
|
|
|
std::vector<unsigned long>& progFiles =
|
|
|
|
this->ProgressMap[&t->second].Marks;
|
|
|
|
for (std::vector<unsigned long>::iterator i = progFiles.begin();
|
|
|
|
i != progFiles.end(); ++i)
|
2007-05-22 18:24:59 +04:00
|
|
|
{
|
2011-05-16 19:18:39 +04:00
|
|
|
progCmd << " " << *i;
|
2007-05-22 18:24:59 +04:00
|
|
|
}
|
2011-05-16 19:18:39 +04:00
|
|
|
commands.push_back(progCmd.str());
|
2006-06-16 23:29:25 +04:00
|
|
|
}
|
2011-05-16 19:18:39 +04:00
|
|
|
progressDir = "Built target ";
|
|
|
|
progressDir += t->first;
|
|
|
|
lg->AppendEcho(commands,progressDir.c_str());
|
2010-10-28 19:13:00 +04:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
this->AppendGlobalTargetDepends(depends,t->second);
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
|
|
|
|
localName.c_str(), depends, commands, true);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// add the all/all dependency
|
2007-08-03 23:44:25 +04:00
|
|
|
if(!this->IsExcluded(this->LocalGenerators[0], t->second))
|
2006-06-16 23:29:25 +04:00
|
|
|
{
|
2006-02-16 23:19:00 +03:00
|
|
|
depends.clear();
|
|
|
|
depends.push_back(localName);
|
2007-05-22 18:24:59 +04:00
|
|
|
commands.clear();
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "Include target in all.",
|
|
|
|
"all", depends, commands, true);
|
|
|
|
}
|
2010-10-28 19:13:00 +04:00
|
|
|
|
2011-05-16 19:18:39 +04:00
|
|
|
// Write the rule.
|
|
|
|
commands.clear();
|
|
|
|
progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
|
|
|
|
progressDir += cmake::GetCMakeFilesDirectory();
|
2010-10-28 19:13:00 +04:00
|
|
|
|
2011-05-16 19:18:39 +04:00
|
|
|
{
|
|
|
|
// TODO: Convert the total progress count to a make variable.
|
|
|
|
cmOStringStream progCmd;
|
|
|
|
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
|
|
|
|
// # in target
|
|
|
|
progCmd << lg->Convert(progressDir.c_str(),
|
|
|
|
cmLocalGenerator::FULL,
|
|
|
|
cmLocalGenerator::SHELL);
|
|
|
|
//
|
|
|
|
std::set<cmTarget *> emitted;
|
|
|
|
progCmd << " "
|
|
|
|
<< this->CountProgressMarksInTarget(&t->second, emitted);
|
|
|
|
commands.push_back(progCmd.str());
|
|
|
|
}
|
2007-05-22 18:24:59 +04:00
|
|
|
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
|
|
|
|
tmp += "Makefile2";
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(tmp.c_str(),localName.c_str()));
|
2011-05-16 19:18:39 +04:00
|
|
|
{
|
|
|
|
cmOStringStream progCmd;
|
|
|
|
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
|
|
|
progCmd << lg->Convert(progressDir.c_str(),
|
|
|
|
cmLocalGenerator::FULL,
|
|
|
|
cmLocalGenerator::SHELL);
|
|
|
|
progCmd << " 0";
|
|
|
|
commands.push_back(progCmd.str());
|
|
|
|
}
|
2007-05-22 18:24:59 +04:00
|
|
|
depends.clear();
|
|
|
|
depends.push_back("cmake_check_build_system");
|
|
|
|
localName = lg->GetRelativeTargetDirectory(t->second);
|
|
|
|
localName += "/rule";
|
2010-11-12 00:02:07 +03:00
|
|
|
lg->WriteMakeRule(ruleFileStream,
|
2007-05-22 18:24:59 +04:00
|
|
|
"Build rule for subdir invocation for target.",
|
|
|
|
localName.c_str(), depends, commands, true);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// Add a target with the canonical name (no prefix, suffix or path).
|
|
|
|
commands.clear();
|
|
|
|
depends.clear();
|
|
|
|
depends.push_back(localName);
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
|
|
|
|
t->second.GetName(), depends, commands, true);
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// Add rules to prepare the target for installation.
|
2009-07-08 21:03:47 +04:00
|
|
|
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
|
2007-05-22 18:24:59 +04:00
|
|
|
{
|
2006-05-02 17:56:42 +04:00
|
|
|
localName = lg->GetRelativeTargetDirectory(t->second);
|
2007-05-22 18:24:59 +04:00
|
|
|
localName += "/preinstall";
|
2006-05-02 17:56:42 +04:00
|
|
|
depends.clear();
|
|
|
|
commands.clear();
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
2007-05-22 18:24:59 +04:00
|
|
|
(makefileName.c_str(), localName.c_str()));
|
2010-11-12 00:02:07 +03:00
|
|
|
lg->WriteMakeRule(ruleFileStream,
|
2007-05-22 18:24:59 +04:00
|
|
|
"Pre-install relink rule for target.",
|
|
|
|
localName.c_str(), depends, commands, true);
|
2007-08-03 23:44:25 +04:00
|
|
|
|
|
|
|
if(!this->IsExcluded(this->LocalGenerators[0], t->second))
|
|
|
|
{
|
|
|
|
depends.clear();
|
|
|
|
depends.push_back(localName);
|
|
|
|
commands.clear();
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "Prepare target for install.",
|
|
|
|
"preinstall", depends, commands, true);
|
|
|
|
}
|
2006-02-16 23:19:00 +03:00
|
|
|
}
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
// add the clean rule
|
|
|
|
localName = lg->GetRelativeTargetDirectory(t->second);
|
|
|
|
makeTargetName = localName;
|
|
|
|
makeTargetName += "/clean";
|
|
|
|
depends.clear();
|
|
|
|
commands.clear();
|
|
|
|
commands.push_back(lg->GetRecursiveMakeCall
|
|
|
|
(makefileName.c_str(), makeTargetName.c_str()));
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
|
|
|
|
makeTargetName.c_str(), depends, commands, true);
|
|
|
|
commands.clear();
|
|
|
|
depends.push_back(makeTargetName);
|
|
|
|
lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
|
|
|
|
"clean", depends, commands, true);
|
2005-05-18 21:46:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-23 17:11:46 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2009-06-25 17:58:51 +04:00
|
|
|
size_t
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
|
|
|
::CountProgressMarksInTarget(cmTarget* target,
|
|
|
|
std::set<cmTarget*>& emitted)
|
2006-05-23 17:11:46 +04:00
|
|
|
{
|
2009-06-25 17:58:51 +04:00
|
|
|
size_t count = 0;
|
|
|
|
if(emitted.insert(target).second)
|
2006-05-23 17:11:46 +04:00
|
|
|
{
|
2009-09-29 01:34:23 +04:00
|
|
|
count = this->ProgressMap[target].Marks.size();
|
2009-06-25 17:58:51 +04:00
|
|
|
TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
|
|
|
|
for(TargetDependSet::const_iterator di = depends.begin();
|
|
|
|
di != depends.end(); ++di)
|
2006-08-29 20:55:11 +04:00
|
|
|
{
|
2009-06-25 17:58:51 +04:00
|
|
|
count += this->CountProgressMarksInTarget(*di, emitted);
|
2006-08-29 20:55:11 +04:00
|
|
|
}
|
2006-05-23 17:11:46 +04:00
|
|
|
}
|
2009-06-25 17:58:51 +04:00
|
|
|
return count;
|
2006-05-23 17:11:46 +04:00
|
|
|
}
|
|
|
|
|
2009-06-25 17:58:51 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
size_t
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
|
|
|
::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg)
|
2006-07-11 17:55:27 +04:00
|
|
|
{
|
2009-06-25 17:58:51 +04:00
|
|
|
size_t count = 0;
|
|
|
|
std::set<cmTarget*> emitted;
|
|
|
|
std::set<cmTarget*> const& targets = this->LocalGeneratorToTargetMap[lg];
|
|
|
|
for(std::set<cmTarget*>::const_iterator t = targets.begin();
|
2007-08-03 23:44:25 +04:00
|
|
|
t != targets.end(); ++t)
|
2006-07-11 17:55:27 +04:00
|
|
|
{
|
2009-06-25 17:58:51 +04:00
|
|
|
count += this->CountProgressMarksInTarget(*t, emitted);
|
2006-07-11 17:55:27 +04:00
|
|
|
}
|
2009-06-25 17:58:51 +04:00
|
|
|
return count;
|
2006-07-11 17:55:27 +04:00
|
|
|
}
|
|
|
|
|
2009-06-25 17:58:51 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3::RecordTargetProgress(
|
|
|
|
cmMakefileTargetGenerator* tg)
|
|
|
|
{
|
2009-09-29 01:34:23 +04:00
|
|
|
TargetProgress& tp = this->ProgressMap[tg->GetTarget()];
|
2009-06-25 17:58:51 +04:00
|
|
|
tp.NumberOfActions = tg->GetNumberOfProgressActions();
|
|
|
|
tp.VariableFile = tg->GetProgressFileNameFull();
|
|
|
|
}
|
|
|
|
|
2009-09-29 01:34:23 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool
|
|
|
|
cmGlobalUnixMakefileGenerator3::ProgressMapCompare
|
2009-09-29 16:34:39 +04:00
|
|
|
::operator()(cmTarget* l, cmTarget* r) const
|
2009-09-29 01:34:23 +04:00
|
|
|
{
|
|
|
|
// Order by target name.
|
|
|
|
if(int c = strcmp(l->GetName(), r->GetName()))
|
|
|
|
{
|
|
|
|
return c < 0;
|
|
|
|
}
|
|
|
|
// Order duplicate targets by binary directory.
|
|
|
|
return strcmp(l->GetMakefile()->GetCurrentOutputDirectory(),
|
|
|
|
r->GetMakefile()->GetCurrentOutputDirectory()) < 0;
|
|
|
|
}
|
|
|
|
|
2009-06-25 17:58:51 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3::TargetProgress
|
|
|
|
::WriteProgressVariables(unsigned long total, unsigned long ¤t)
|
|
|
|
{
|
|
|
|
cmGeneratedFileStream fout(this->VariableFile.c_str());
|
|
|
|
for(unsigned long i = 1; i <= this->NumberOfActions; ++i)
|
|
|
|
{
|
|
|
|
fout << "CMAKE_PROGRESS_" << i << " = ";
|
|
|
|
if (total <= 100)
|
|
|
|
{
|
|
|
|
unsigned long num = i + current;
|
|
|
|
fout << num;
|
|
|
|
this->Marks.push_back(num);
|
|
|
|
}
|
|
|
|
else if (((i+current)*100)/total > ((i-1+current)*100)/total)
|
|
|
|
{
|
|
|
|
unsigned long num = ((i+current)*100)/total;
|
|
|
|
fout << num;
|
|
|
|
this->Marks.push_back(num);
|
|
|
|
}
|
|
|
|
fout << "\n";
|
|
|
|
}
|
|
|
|
fout << "\n";
|
|
|
|
current += this->NumberOfActions;
|
|
|
|
}
|
2006-05-23 17:11:46 +04:00
|
|
|
|
2005-05-18 21:46:00 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalUnixMakefileGenerator3
|
|
|
|
::AppendGlobalTargetDepends(std::vector<std::string>& depends,
|
2005-06-22 17:06:46 +04:00
|
|
|
cmTarget& target)
|
2005-05-18 21:46:00 +04:00
|
|
|
{
|
2008-01-30 20:04:38 +03:00
|
|
|
TargetDependSet const& depends_set = this->GetTargetDirectDepends(target);
|
2007-12-23 23:03:42 +03:00
|
|
|
for(TargetDependSet::const_iterator i = depends_set.begin();
|
|
|
|
i != depends_set.end(); ++i)
|
2005-10-10 19:49:17 +04:00
|
|
|
{
|
2007-12-22 21:08:26 +03:00
|
|
|
// Create the target-level dependency.
|
2007-12-23 23:03:42 +03:00
|
|
|
cmTarget const* dep = *i;
|
|
|
|
cmLocalUnixMakefileGenerator3* lg3 =
|
|
|
|
static_cast<cmLocalUnixMakefileGenerator3*>
|
|
|
|
(dep->GetMakefile()->GetLocalGenerator());
|
|
|
|
std::string tgtName = lg3->GetRelativeTargetDirectory(*dep);
|
2005-10-10 19:49:17 +04:00
|
|
|
tgtName += "/all";
|
|
|
|
depends.push_back(tgtName);
|
2005-05-18 21:46:00 +04:00
|
|
|
}
|
|
|
|
}
|
2005-05-20 19:01:21 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2005-10-20 21:40:28 +04:00
|
|
|
void cmGlobalUnixMakefileGenerator3::WriteHelpRule
|
|
|
|
(std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3 *lg)
|
2005-05-20 19:01:21 +04:00
|
|
|
{
|
|
|
|
// add the help target
|
|
|
|
std::string path;
|
|
|
|
std::vector<std::string> no_depends;
|
|
|
|
std::vector<std::string> commands;
|
2006-05-11 18:40:28 +04:00
|
|
|
lg->AppendEcho(commands,"The following are some of the valid targets "
|
|
|
|
"for this Makefile:");
|
2005-05-20 19:01:21 +04:00
|
|
|
lg->AppendEcho(commands,"... all (the default if no target is provided)");
|
|
|
|
lg->AppendEcho(commands,"... clean");
|
|
|
|
lg->AppendEcho(commands,"... depend");
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2005-06-01 17:25:10 +04:00
|
|
|
// Keep track of targets already listed.
|
|
|
|
std::set<cmStdString> emittedTargets;
|
|
|
|
|
2005-05-20 19:01:21 +04:00
|
|
|
// for each local generator
|
|
|
|
unsigned int i;
|
2005-10-20 21:40:28 +04:00
|
|
|
cmLocalUnixMakefileGenerator3 *lg2;
|
2006-03-15 19:02:08 +03:00
|
|
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
2005-05-20 19:01:21 +04:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
lg2 =
|
2006-05-11 18:40:28 +04:00
|
|
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
2005-10-20 21:40:28 +04:00
|
|
|
// for the passed in makefile or if this is the top Makefile wripte out
|
|
|
|
// the targets
|
|
|
|
if (lg2 == lg || !lg->GetParent())
|
2005-05-20 19:01:21 +04:00
|
|
|
{
|
2005-10-20 21:40:28 +04:00
|
|
|
// for each target Generate the rule files for each target.
|
2006-04-26 00:31:21 +04:00
|
|
|
cmTargets& targets = lg2->GetMakefile()->GetTargets();
|
2005-10-20 21:40:28 +04:00
|
|
|
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
|
2005-05-20 19:01:21 +04:00
|
|
|
{
|
2005-10-20 21:40:28 +04:00
|
|
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
|
|
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
|
|
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
|
|
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
2012-03-12 18:54:37 +04:00
|
|
|
(t->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
|
2006-04-20 18:51:16 +04:00
|
|
|
(t->second.GetType() == cmTarget::GLOBAL_TARGET) ||
|
2005-10-20 21:40:28 +04:00
|
|
|
(t->second.GetType() == cmTarget::UTILITY))
|
2005-06-01 17:25:10 +04:00
|
|
|
{
|
2005-10-20 21:40:28 +04:00
|
|
|
if(emittedTargets.insert(t->second.GetName()).second)
|
|
|
|
{
|
|
|
|
path = "... ";
|
|
|
|
path += t->second.GetName();
|
|
|
|
lg->AppendEcho(commands,path.c_str());
|
|
|
|
}
|
2005-06-01 17:25:10 +04:00
|
|
|
}
|
2005-05-20 19:01:21 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-06 18:22:51 +04:00
|
|
|
std::vector<cmStdString> const& localHelp = lg->GetLocalHelp();
|
|
|
|
for(std::vector<cmStdString>::const_iterator o = localHelp.begin();
|
|
|
|
o != localHelp.end(); ++o)
|
|
|
|
{
|
|
|
|
path = "... ";
|
|
|
|
path += *o;
|
|
|
|
lg->AppendEcho(commands, path.c_str());
|
|
|
|
}
|
2005-05-20 19:01:21 +04:00
|
|
|
lg->WriteMakeRule(ruleFileStream, "Help Target",
|
2008-03-24 17:26:38 +03:00
|
|
|
"help",
|
2006-02-16 00:35:16 +03:00
|
|
|
no_depends, commands, true);
|
2005-05-20 19:01:21 +04:00
|
|
|
ruleFileStream << "\n\n";
|
|
|
|
}
|
|
|
|
|
2005-05-24 19:17:30 +04:00
|
|
|
|
|
|
|
bool cmGlobalUnixMakefileGenerator3
|
2007-08-03 17:39:32 +04:00
|
|
|
::NeedRequiresStep(cmTarget const& target)
|
2005-05-24 19:17:30 +04:00
|
|
|
{
|
2007-08-03 17:39:32 +04:00
|
|
|
std::set<cmStdString> languages;
|
|
|
|
target.GetLanguages(languages);
|
|
|
|
for(std::set<cmStdString>::const_iterator l = languages.begin();
|
|
|
|
l != languages.end(); ++l)
|
2005-05-24 19:17:30 +04:00
|
|
|
{
|
2007-08-03 17:39:32 +04:00
|
|
|
std::string var = "CMAKE_NEEDS_REQUIRES_STEP_";
|
|
|
|
var += *l;
|
|
|
|
var += "_FLAG";
|
|
|
|
if(target.GetMakefile()->GetDefinition(var.c_str()))
|
2005-05-24 19:17:30 +04:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|