2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2004-2009 Kitware, Inc.
|
|
|
|
Copyright 2004 Alexander Neundorf (neundorf@kde.org)
|
|
|
|
|
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
|
|
|
|
|
|
|
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.
|
|
|
|
============================================================================*/
|
2007-07-13 08:58:43 +04:00
|
|
|
#include "cmExtraCodeBlocksGenerator.h"
|
|
|
|
#include "cmGlobalUnixMakefileGenerator3.h"
|
|
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmake.h"
|
|
|
|
#include "cmSourceFile.h"
|
|
|
|
#include "cmGeneratedFileStream.h"
|
|
|
|
#include "cmTarget.h"
|
2007-08-29 18:12:09 +04:00
|
|
|
#include "cmSystemTools.h"
|
2011-10-05 20:02:32 +04:00
|
|
|
#include "cmXMLSafe.h"
|
2007-07-13 08:58:43 +04:00
|
|
|
|
|
|
|
#include <cmsys/SystemTools.hxx>
|
|
|
|
|
2007-08-28 23:13:01 +04:00
|
|
|
/* Some useful URLs:
|
2010-11-12 00:02:07 +03:00
|
|
|
Homepage:
|
2007-08-28 23:13:01 +04:00
|
|
|
http://www.codeblocks.org
|
|
|
|
|
|
|
|
File format docs:
|
|
|
|
http://wiki.codeblocks.org/index.php?title=File_formats_description
|
|
|
|
http://wiki.codeblocks.org/index.php?title=Workspace_file
|
|
|
|
http://wiki.codeblocks.org/index.php?title=Project_file
|
|
|
|
|
|
|
|
Discussion:
|
|
|
|
http://forums.codeblocks.org/index.php/topic,6789.0.html
|
|
|
|
*/
|
|
|
|
|
2007-07-13 08:58:43 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmExtraCodeBlocksGenerator
|
2014-02-25 02:36:27 +04:00
|
|
|
::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
|
2007-07-13 08:58:43 +04:00
|
|
|
{
|
2007-10-22 20:49:09 +04:00
|
|
|
entry.Name = this->GetName();
|
|
|
|
entry.Brief = "Generates CodeBlocks project files.";
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
|
|
|
|
:cmExternalMakefileProjectGenerator()
|
|
|
|
{
|
2007-07-18 18:19:33 +04:00
|
|
|
#if defined(_WIN32)
|
|
|
|
this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
|
2009-06-28 12:30:11 +04:00
|
|
|
this->SupportedGlobalGenerators.push_back("NMake Makefiles");
|
2007-08-27 21:23:37 +04:00
|
|
|
// disable until somebody actually tests it:
|
2007-08-01 22:58:55 +04:00
|
|
|
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
|
2012-04-07 23:40:17 +04:00
|
|
|
#endif
|
|
|
|
this->SupportedGlobalGenerators.push_back("Ninja");
|
2007-07-13 08:58:43 +04:00
|
|
|
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cmExtraCodeBlocksGenerator::Generate()
|
|
|
|
{
|
2007-08-06 21:24:42 +04:00
|
|
|
// for each sub project in the project create a codeblocks project
|
2014-02-10 09:21:34 +04:00
|
|
|
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
2007-07-13 08:58:43 +04:00
|
|
|
it = this->GlobalGenerator->GetProjectMap().begin();
|
|
|
|
it!= this->GlobalGenerator->GetProjectMap().end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
// create a project file
|
|
|
|
this->CreateProjectFile(it->second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-17 00:48:42 +04:00
|
|
|
/* create the project file */
|
2007-07-20 16:36:16 +04:00
|
|
|
void cmExtraCodeBlocksGenerator::CreateProjectFile(
|
|
|
|
const std::vector<cmLocalGenerator*>& lgs)
|
2007-07-13 08:58:43 +04:00
|
|
|
{
|
|
|
|
const cmMakefile* mf=lgs[0]->GetMakefile();
|
|
|
|
std::string outputDir=mf->GetStartOutputDirectory();
|
|
|
|
std::string projectName=mf->GetProjectName();
|
|
|
|
|
|
|
|
std::string filename=outputDir+"/";
|
|
|
|
filename+=projectName+".cbp";
|
|
|
|
std::string sessionFilename=outputDir+"/";
|
|
|
|
sessionFilename+=projectName+".layout";
|
|
|
|
|
2008-08-17 00:48:42 +04:00
|
|
|
this->CreateNewProjectFile(lgs, filename);
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-28 12:58:27 +04:00
|
|
|
/* Tree is used to create a "Virtual Folder" in CodeBlocks, in which all
|
|
|
|
CMake files this project depends on will be put. This means additionally
|
|
|
|
to the "Sources" and "Headers" virtual folders of CodeBlocks, there will
|
2010-11-12 00:02:07 +03:00
|
|
|
now also be a "CMake Files" virtual folder.
|
2009-06-28 12:58:27 +04:00
|
|
|
Patch by Daniel Teske <daniel.teske AT nokia.com> (which use C::B project
|
|
|
|
files in QtCreator).*/
|
|
|
|
struct Tree
|
|
|
|
{
|
|
|
|
std::string path; //only one component of the path
|
|
|
|
std::vector<Tree> folders;
|
|
|
|
std::vector<std::string> files;
|
2010-11-12 00:02:07 +03:00
|
|
|
void InsertPath(const std::vector<std::string>& splitted,
|
|
|
|
std::vector<std::string>::size_type start,
|
2009-06-28 12:58:27 +04:00
|
|
|
const std::string& fileName);
|
|
|
|
void BuildVirtualFolder(std::string& virtualFolders) const;
|
2010-11-12 00:02:07 +03:00
|
|
|
void BuildVirtualFolderImpl(std::string& virtualFolders,
|
2009-06-28 12:58:27 +04:00
|
|
|
const std::string& prefix) const;
|
|
|
|
void BuildUnit(std::string& unitString, const std::string& fsPath) const;
|
2010-11-12 00:02:07 +03:00
|
|
|
void BuildUnitImpl(std::string& unitString,
|
|
|
|
const std::string& virtualFolderPath,
|
2009-06-28 12:58:27 +04:00
|
|
|
const std::string& fsPath) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
void Tree::InsertPath(const std::vector<std::string>& splitted,
|
|
|
|
std::vector<std::string>::size_type start,
|
2009-06-28 12:58:27 +04:00
|
|
|
const std::string& fileName)
|
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
if (start == splitted.size())
|
2009-06-28 12:58:27 +04:00
|
|
|
{
|
|
|
|
files.push_back(fileName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (std::vector<Tree>::iterator
|
|
|
|
it = folders.begin();
|
|
|
|
it != folders.end();
|
|
|
|
++it)
|
|
|
|
{
|
2009-06-29 22:27:45 +04:00
|
|
|
if ((*it).path == splitted[start])
|
2009-06-28 12:58:27 +04:00
|
|
|
{
|
|
|
|
if (start + 1 < splitted.size())
|
|
|
|
{
|
|
|
|
it->InsertPath(splitted, start + 1, fileName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// last part of splitted
|
|
|
|
it->files.push_back(fileName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Not found in folders, thus insert
|
|
|
|
Tree newFolder;
|
2009-06-29 22:27:45 +04:00
|
|
|
newFolder.path = splitted[start];
|
2009-06-28 12:58:27 +04:00
|
|
|
if (start + 1 < splitted.size())
|
|
|
|
{
|
|
|
|
newFolder.InsertPath(splitted, start + 1, fileName);
|
|
|
|
folders.push_back(newFolder);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// last part of splitted
|
|
|
|
newFolder.files.push_back(fileName);
|
|
|
|
folders.push_back(newFolder);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tree::BuildVirtualFolder(std::string& virtualFolders) const
|
|
|
|
{
|
|
|
|
virtualFolders += "<Option virtualFolders=\"CMake Files\\;";
|
|
|
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
|
|
|
it != folders.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
it->BuildVirtualFolderImpl(virtualFolders, "");
|
|
|
|
}
|
|
|
|
virtualFolders += "\" />";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
|
|
|
|
const std::string& prefix) const
|
|
|
|
{
|
|
|
|
virtualFolders += "CMake Files\\" + prefix + path + "\\;";
|
|
|
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
2009-10-12 21:44:42 +04:00
|
|
|
it != folders.end();
|
2009-06-28 12:58:27 +04:00
|
|
|
++it)
|
|
|
|
{
|
|
|
|
it->BuildVirtualFolderImpl(virtualFolders, prefix + path + "\\");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tree::BuildUnit(std::string& unitString, const std::string& fsPath) const
|
|
|
|
{
|
|
|
|
for (std::vector<std::string>::const_iterator it = files.begin();
|
|
|
|
it != files.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
unitString += " <Unit filename=\"" + fsPath + *it + "\">\n";
|
|
|
|
unitString += " <Option virtualFolder=\"CMake Files\\\" />\n";
|
|
|
|
unitString += " </Unit>\n";
|
|
|
|
}
|
|
|
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
|
|
|
it != folders.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
it->BuildUnitImpl(unitString, "", fsPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tree::BuildUnitImpl(std::string& unitString,
|
|
|
|
const std::string& virtualFolderPath,
|
|
|
|
const std::string& fsPath) const
|
|
|
|
{
|
|
|
|
for (std::vector<std::string>::const_iterator it = files.begin();
|
|
|
|
it != files.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
unitString += " <Unit filename=\"" +fsPath+path+ "/" + *it + "\">\n";
|
|
|
|
unitString += " <Option virtualFolder=\"CMake Files\\"
|
|
|
|
+ virtualFolderPath + path + "\\\" />\n";
|
|
|
|
unitString += " </Unit>\n";
|
|
|
|
}
|
|
|
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
|
|
|
it != folders.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
it->BuildUnitImpl(unitString,
|
|
|
|
virtualFolderPath + path + "\\", fsPath + path + "/");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-13 08:58:43 +04:00
|
|
|
void cmExtraCodeBlocksGenerator
|
|
|
|
::CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
|
|
|
|
const std::string& filename)
|
|
|
|
{
|
|
|
|
const cmMakefile* mf=lgs[0]->GetMakefile();
|
|
|
|
cmGeneratedFileStream fout(filename.c_str());
|
|
|
|
if(!fout)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-28 12:58:27 +04:00
|
|
|
Tree tree;
|
|
|
|
|
|
|
|
// build tree of virtual folders
|
2014-02-10 09:21:34 +04:00
|
|
|
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
2009-06-28 12:58:27 +04:00
|
|
|
it = this->GlobalGenerator->GetProjectMap().begin();
|
|
|
|
it != this->GlobalGenerator->GetProjectMap().end();
|
|
|
|
++it)
|
|
|
|
{
|
2009-10-12 21:37:09 +04:00
|
|
|
// Collect all files
|
|
|
|
std::vector<std::string> listFiles;
|
|
|
|
for (std::vector<cmLocalGenerator *>::const_iterator
|
|
|
|
jt = it->second.begin();
|
|
|
|
jt != it->second.end();
|
|
|
|
++jt)
|
|
|
|
{
|
2009-10-13 21:35:24 +04:00
|
|
|
const std::vector<std::string> & files =
|
|
|
|
(*jt)->GetMakefile()->GetListFiles();
|
2009-10-12 21:37:09 +04:00
|
|
|
listFiles.insert(listFiles.end(), files.begin(), files.end());
|
|
|
|
}
|
2009-06-28 12:58:27 +04:00
|
|
|
|
2009-10-12 21:37:09 +04:00
|
|
|
// Convert
|
2011-07-30 01:24:21 +04:00
|
|
|
const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
|
2009-10-12 21:37:09 +04:00
|
|
|
for (std::vector<std::string>::const_iterator jt = listFiles.begin();
|
2009-10-12 21:44:42 +04:00
|
|
|
jt != listFiles.end();
|
|
|
|
++jt)
|
|
|
|
{
|
2011-07-30 01:24:21 +04:00
|
|
|
// don't put cmake's own files into the project (#12110):
|
|
|
|
if (jt->find(cmakeRoot) == 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-12 21:44:42 +04:00
|
|
|
const std::string &relative = cmSystemTools::RelativePath(
|
2009-06-28 12:58:27 +04:00
|
|
|
it->second[0]->GetMakefile()->GetHomeDirectory(),
|
|
|
|
jt->c_str());
|
2009-10-12 21:44:42 +04:00
|
|
|
std::vector<std::string> splitted;
|
|
|
|
cmSystemTools::SplitPath(relative.c_str(), splitted, false);
|
|
|
|
// Split filename from path
|
|
|
|
std::string fileName = *(splitted.end()-1);
|
|
|
|
splitted.erase(splitted.end() - 1, splitted.end());
|
|
|
|
|
|
|
|
// We don't want paths with CMakeFiles in them
|
|
|
|
// or do we?
|
|
|
|
// In speedcrunch those where purely internal
|
|
|
|
if (splitted.size() >= 1
|
|
|
|
&& relative.find("CMakeFiles") == std::string::npos)
|
|
|
|
{
|
|
|
|
tree.InsertPath(splitted, 1, fileName);
|
|
|
|
}
|
|
|
|
}
|
2009-06-28 12:58:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Now build a virtual tree string
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string virtualFolders;
|
2009-06-28 12:58:27 +04:00
|
|
|
tree.BuildVirtualFolder(virtualFolders);
|
|
|
|
// And one for <Unit>
|
|
|
|
std::string unitFiles;
|
|
|
|
tree.BuildUnit(unitFiles, std::string(mf->GetHomeDirectory()) + "/");
|
|
|
|
|
2007-08-29 18:12:09 +04:00
|
|
|
// figure out the compiler
|
|
|
|
std::string compiler = this->GetCBCompilerId(mf);
|
2007-07-13 08:58:43 +04:00
|
|
|
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
|
|
|
|
|
|
|
fout<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"
|
|
|
|
"<CodeBlocks_project_file>\n"
|
|
|
|
" <FileVersion major=\"1\" minor=\"6\" />\n"
|
2007-08-29 18:12:09 +04:00
|
|
|
" <Project>\n"
|
|
|
|
" <Option title=\"" << mf->GetProjectName()<<"\" />\n"
|
2007-07-13 08:58:43 +04:00
|
|
|
" <Option makefile_is_custom=\"1\" />\n"
|
2007-08-29 18:12:09 +04:00
|
|
|
" <Option compiler=\"" << compiler << "\" />\n"
|
2009-06-28 12:58:27 +04:00
|
|
|
" "<<virtualFolders<<"\n"
|
2007-07-13 08:58:43 +04:00
|
|
|
" <Build>\n";
|
|
|
|
|
2007-11-25 15:45:18 +03:00
|
|
|
this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str());
|
|
|
|
|
2010-11-12 00:02:07 +03:00
|
|
|
// add all executable and library targets and some of the GLOBAL
|
2007-11-25 15:45:18 +03:00
|
|
|
// and UTILITY targets
|
2007-07-13 08:58:43 +04:00
|
|
|
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
|
|
|
|
lg!=lgs.end(); lg++)
|
|
|
|
{
|
|
|
|
cmMakefile* makefile=(*lg)->GetMakefile();
|
|
|
|
cmTargets& targets=makefile->GetTargets();
|
|
|
|
for (cmTargets::iterator ti = targets.begin();
|
|
|
|
ti != targets.end(); ti++)
|
|
|
|
{
|
2009-10-12 21:44:42 +04:00
|
|
|
switch(ti->second.GetType())
|
2007-07-13 08:58:43 +04:00
|
|
|
{
|
2009-10-12 21:44:42 +04:00
|
|
|
case cmTarget::GLOBAL_TARGET:
|
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
// Only add the global targets from CMAKE_BINARY_DIR,
|
2009-10-12 21:44:42 +04:00
|
|
|
// not from the subdirs
|
2010-11-12 00:02:07 +03:00
|
|
|
if (strcmp(makefile->GetStartOutputDirectory(),
|
2009-10-12 21:44:42 +04:00
|
|
|
makefile->GetHomeOutputDirectory())==0)
|
2009-09-10 21:44:02 +04:00
|
|
|
{
|
2014-03-11 03:04:11 +04:00
|
|
|
this->AppendTarget(fout, ti->first, 0,
|
2009-09-10 21:44:02 +04:00
|
|
|
make.c_str(), makefile, compiler.c_str());
|
|
|
|
}
|
2009-10-12 21:44:42 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case cmTarget::UTILITY:
|
|
|
|
// Add all utility targets, except the Nightly/Continuous/
|
|
|
|
// Experimental-"sub"targets as e.g. NightlyStart
|
|
|
|
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly"))
|
2009-09-06 13:43:51 +04:00
|
|
|
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
|
2010-11-12 00:02:07 +03:00
|
|
|
|| ((ti->first.find("Experimental")==0)
|
2009-09-06 13:43:51 +04:00
|
|
|
&& (ti->first!="Experimental")))
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
2007-07-13 08:58:43 +04:00
|
|
|
break;
|
2009-10-12 21:44:42 +04:00
|
|
|
}
|
|
|
|
|
2014-03-11 03:04:11 +04:00
|
|
|
this->AppendTarget(fout, ti->first, 0,
|
2009-10-12 21:44:42 +04:00
|
|
|
make.c_str(), makefile, compiler.c_str());
|
|
|
|
break;
|
|
|
|
case cmTarget::EXECUTABLE:
|
|
|
|
case cmTarget::STATIC_LIBRARY:
|
|
|
|
case cmTarget::SHARED_LIBRARY:
|
|
|
|
case cmTarget::MODULE_LIBRARY:
|
2012-03-31 18:01:37 +04:00
|
|
|
case cmTarget::OBJECT_LIBRARY:
|
2009-10-12 21:44:42 +04:00
|
|
|
{
|
2014-03-11 03:04:11 +04:00
|
|
|
this->AppendTarget(fout, ti->first, &ti->second,
|
2009-10-12 21:44:42 +04:00
|
|
|
make.c_str(), makefile, compiler.c_str());
|
|
|
|
std::string fastTarget = ti->first;
|
|
|
|
fastTarget += "/fast";
|
2014-03-11 03:04:11 +04:00
|
|
|
this->AppendTarget(fout, fastTarget, &ti->second,
|
2009-10-12 21:44:42 +04:00
|
|
|
make.c_str(), makefile, compiler.c_str());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fout<<" </Build>\n";
|
|
|
|
|
2007-08-29 18:12:09 +04:00
|
|
|
|
2007-11-25 13:26:58 +03:00
|
|
|
// Collect all used source files in the project
|
2009-03-11 00:34:18 +03:00
|
|
|
// Sort them into two containers, one for C/C++ implementation files
|
|
|
|
// which may have an acompanying header, one for all other files
|
|
|
|
std::map<std::string, cmSourceFile*> cFiles;
|
|
|
|
std::set<std::string> otherFiles;
|
2007-07-13 08:58:43 +04:00
|
|
|
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
|
|
|
|
lg!=lgs.end(); lg++)
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
2007-07-13 08:58:43 +04:00
|
|
|
cmMakefile* makefile=(*lg)->GetMakefile();
|
|
|
|
cmTargets& targets=makefile->GetTargets();
|
|
|
|
for (cmTargets::iterator ti = targets.begin();
|
|
|
|
ti != targets.end(); ti++)
|
|
|
|
{
|
2007-08-29 18:12:09 +04:00
|
|
|
switch(ti->second.GetType())
|
|
|
|
{
|
2007-07-13 08:58:43 +04:00
|
|
|
case cmTarget::EXECUTABLE:
|
|
|
|
case cmTarget::STATIC_LIBRARY:
|
|
|
|
case cmTarget::SHARED_LIBRARY:
|
|
|
|
case cmTarget::MODULE_LIBRARY:
|
2012-03-31 18:01:37 +04:00
|
|
|
case cmTarget::OBJECT_LIBRARY:
|
2011-02-14 00:53:43 +03:00
|
|
|
case cmTarget::UTILITY: // can have sources since 2.6.3
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
2013-07-14 20:22:57 +04:00
|
|
|
std::vector<cmSourceFile*> sources;
|
2014-02-13 20:25:00 +04:00
|
|
|
ti->second.GetSourceFiles(sources,
|
|
|
|
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
2007-07-13 08:58:43 +04:00
|
|
|
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
|
|
|
|
si!=sources.end(); si++)
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
2011-02-14 00:53:43 +03:00
|
|
|
// don't add source files which have the GENERATED property set:
|
|
|
|
if ((*si)->GetPropertyAsBool("GENERATED"))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-03-11 00:34:18 +03:00
|
|
|
// check whether it is a C/C++ implementation file
|
|
|
|
bool isCFile = false;
|
2014-02-04 06:20:56 +04:00
|
|
|
std::string lang = (*si)->GetLanguage();
|
|
|
|
if (lang == "C" || lang == "CXX")
|
2009-03-11 00:34:18 +03:00
|
|
|
{
|
2014-02-25 05:47:20 +04:00
|
|
|
std::string srcext = (*si)->GetExtension();
|
2009-03-11 00:34:18 +03:00
|
|
|
for(std::vector<std::string>::const_iterator
|
|
|
|
ext = mf->GetSourceExtensions().begin();
|
2010-11-12 00:02:07 +03:00
|
|
|
ext != mf->GetSourceExtensions().end();
|
2009-03-11 00:34:18 +03:00
|
|
|
++ext)
|
|
|
|
{
|
2014-02-25 05:47:20 +04:00
|
|
|
if (srcext == *ext)
|
2009-03-11 00:34:18 +03:00
|
|
|
{
|
|
|
|
isCFile = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// then put it accordingly into one of the two containers
|
|
|
|
if (isCFile)
|
|
|
|
{
|
|
|
|
cFiles[(*si)->GetFullPath()] = *si ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
otherFiles.insert((*si)->GetFullPath());
|
|
|
|
}
|
2007-08-29 18:12:09 +04:00
|
|
|
}
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
2007-08-29 18:12:09 +04:00
|
|
|
default: // intended fallthrough
|
2007-07-13 08:58:43 +04:00
|
|
|
break;
|
2007-08-29 18:12:09 +04:00
|
|
|
}
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
|
|
|
}
|
2007-08-29 18:12:09 +04:00
|
|
|
|
2009-03-08 22:33:58 +03:00
|
|
|
// The following loop tries to add header files matching to implementation
|
|
|
|
// files to the project. It does that by iterating over all source files,
|
2010-11-12 00:02:07 +03:00
|
|
|
// replacing the file name extension with ".h" and checks whether such a
|
2009-03-08 22:33:58 +03:00
|
|
|
// file exists. If it does, it is inserted into the map of files.
|
|
|
|
// A very similar version of that code exists also in the kdevelop
|
|
|
|
// project generator.
|
2010-11-12 00:02:07 +03:00
|
|
|
for (std::map<std::string, cmSourceFile*>::const_iterator
|
2009-03-11 00:34:18 +03:00
|
|
|
sit=cFiles.begin();
|
|
|
|
sit!=cFiles.end();
|
2009-03-08 22:33:58 +03:00
|
|
|
++sit)
|
|
|
|
{
|
|
|
|
std::string headerBasename=cmSystemTools::GetFilenamePath(sit->first);
|
|
|
|
headerBasename+="/";
|
|
|
|
headerBasename+=cmSystemTools::GetFilenameWithoutExtension(sit->first);
|
|
|
|
|
|
|
|
// check if there's a matching header around
|
|
|
|
for(std::vector<std::string>::const_iterator
|
|
|
|
ext = mf->GetHeaderExtensions().begin();
|
2010-11-12 00:02:07 +03:00
|
|
|
ext != mf->GetHeaderExtensions().end();
|
2009-03-08 22:33:58 +03:00
|
|
|
++ext)
|
|
|
|
{
|
|
|
|
std::string hname=headerBasename;
|
|
|
|
hname += ".";
|
|
|
|
hname += *ext;
|
2009-03-11 00:34:18 +03:00
|
|
|
// if it's already in the set, don't check if it exists on disk
|
|
|
|
std::set<std::string>::const_iterator headerIt=otherFiles.find(hname);
|
|
|
|
if (headerIt != otherFiles.end())
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-03-08 22:33:58 +03:00
|
|
|
if(cmSystemTools::FileExists(hname.c_str()))
|
|
|
|
{
|
2009-03-11 00:34:18 +03:00
|
|
|
otherFiles.insert(hname);
|
2009-03-08 22:33:58 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-11 00:34:18 +03:00
|
|
|
// insert all source files in the CodeBlocks project
|
|
|
|
// first the C/C++ implementation files, then all others
|
2010-11-12 00:02:07 +03:00
|
|
|
for (std::map<std::string, cmSourceFile*>::const_iterator
|
2009-03-11 00:34:18 +03:00
|
|
|
sit=cFiles.begin();
|
|
|
|
sit!=cFiles.end();
|
|
|
|
++sit)
|
|
|
|
{
|
|
|
|
fout<<" <Unit filename=\""<< sit->first <<"\">\n"
|
|
|
|
" </Unit>\n";
|
|
|
|
}
|
2010-11-12 00:02:07 +03:00
|
|
|
for (std::set<std::string>::const_iterator
|
2009-03-11 00:34:18 +03:00
|
|
|
sit=otherFiles.begin();
|
|
|
|
sit!=otherFiles.end();
|
2007-07-13 08:58:43 +04:00
|
|
|
++sit)
|
2009-03-08 22:33:58 +03:00
|
|
|
{
|
2014-03-11 16:35:32 +04:00
|
|
|
fout<<" <Unit filename=\""<< *sit <<"\">\n"
|
2009-03-08 22:33:58 +03:00
|
|
|
" </Unit>\n";
|
|
|
|
}
|
2007-08-29 18:12:09 +04:00
|
|
|
|
2009-06-28 12:58:27 +04:00
|
|
|
// Add CMakeLists.txt
|
|
|
|
fout<<unitFiles;
|
|
|
|
|
2007-07-13 08:58:43 +04:00
|
|
|
fout<<" </Project>\n"
|
|
|
|
"</CodeBlocks_project_file>\n";
|
2007-08-29 18:12:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-09 16:53:47 +04:00
|
|
|
// Write a dummy file for OBJECT libraries, so C::B can reference some file
|
|
|
|
std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
|
|
|
|
cmMakefile* mf, cmTarget* target) const
|
|
|
|
{
|
|
|
|
// this file doesn't seem to be used by C::B in custom makefile mode,
|
|
|
|
// but we generate a unique file for each OBJECT library so in case
|
|
|
|
// C::B uses it in some way, the targets don't interfere with each other.
|
|
|
|
std::string filename = mf->GetCurrentOutputDirectory();
|
|
|
|
filename += "/";
|
|
|
|
filename += mf->GetLocalGenerator()->GetTargetDirectory(*target);
|
|
|
|
filename += "/";
|
|
|
|
filename += target->GetName();
|
|
|
|
filename += ".objlib";
|
|
|
|
cmGeneratedFileStream fout(filename.c_str());
|
|
|
|
if(fout)
|
|
|
|
{
|
|
|
|
fout << "# This is a dummy file for the OBJECT library "
|
|
|
|
<< target->GetName()
|
|
|
|
<< " for the CMake CodeBlocks project generator.\n"
|
|
|
|
<< "# Don't edit, this file will be overwritten.\n";
|
|
|
|
}
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-25 15:45:18 +03:00
|
|
|
// Generate the xml code for one target.
|
|
|
|
void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& targetName,
|
2007-11-25 15:45:18 +03:00
|
|
|
cmTarget* target,
|
|
|
|
const char* make,
|
|
|
|
const cmMakefile* makefile,
|
|
|
|
const char* compiler)
|
|
|
|
{
|
|
|
|
std::string makefileName = makefile->GetStartOutputDirectory();
|
|
|
|
makefileName += "/Makefile";
|
|
|
|
|
|
|
|
fout<<" <Target title=\"" << targetName << "\">\n";
|
|
|
|
if (target!=0)
|
|
|
|
{
|
|
|
|
int cbTargetType = this->GetCBTargetType(target);
|
2009-09-26 12:26:28 +04:00
|
|
|
std::string workingDir = makefile->GetStartOutputDirectory();
|
|
|
|
if ( target->GetType()==cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
// Determine the directory where the executable target is created, and
|
|
|
|
// set the working directory to this dir.
|
|
|
|
const char* runtimeOutputDir = makefile->GetDefinition(
|
|
|
|
"CMAKE_RUNTIME_OUTPUT_DIRECTORY");
|
|
|
|
if (runtimeOutputDir != 0)
|
|
|
|
{
|
|
|
|
workingDir = runtimeOutputDir;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char* executableOutputDir = makefile->GetDefinition(
|
|
|
|
"EXECUTABLE_OUTPUT_PATH");
|
|
|
|
if (executableOutputDir != 0)
|
|
|
|
{
|
|
|
|
workingDir = executableOutputDir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-07 22:02:22 +04:00
|
|
|
const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
2012-04-09 16:53:47 +04:00
|
|
|
std::string location;
|
2012-03-31 18:01:37 +04:00
|
|
|
if ( target->GetType()==cmTarget::OBJECT_LIBRARY)
|
|
|
|
{
|
2012-04-09 16:53:47 +04:00
|
|
|
location = this->CreateDummyTargetFile(const_cast<cmMakefile*>(makefile),
|
|
|
|
target);
|
2012-03-31 18:01:37 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
location = target->GetLocation(buildType);
|
|
|
|
}
|
|
|
|
|
|
|
|
fout<<" <Option output=\"" << location
|
2007-11-25 15:45:18 +03:00
|
|
|
<< "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
|
2009-09-26 12:26:28 +04:00
|
|
|
" <Option working_dir=\"" << workingDir << "\" />\n"
|
2007-11-25 15:45:18 +03:00
|
|
|
" <Option object_output=\"./\" />\n"
|
|
|
|
" <Option type=\"" << cbTargetType << "\" />\n"
|
|
|
|
" <Option compiler=\"" << compiler << "\" />\n"
|
|
|
|
" <Compiler>\n";
|
2011-07-30 01:51:31 +04:00
|
|
|
|
2012-09-21 10:51:42 +04:00
|
|
|
cmGeneratorTarget *gtgt = this->GlobalGenerator
|
|
|
|
->GetGeneratorTarget(target);
|
|
|
|
|
2011-07-30 01:51:31 +04:00
|
|
|
// the compilerdefines for this target
|
2013-06-06 20:13:35 +04:00
|
|
|
std::vector<std::string> cdefs;
|
|
|
|
target->GetCompileDefinitions(cdefs, buildType);
|
2012-09-21 10:51:42 +04:00
|
|
|
|
2013-06-06 20:13:35 +04:00
|
|
|
// Expand the list.
|
|
|
|
for(std::vector<std::string>::const_iterator di = cdefs.begin();
|
|
|
|
di != cdefs.end(); ++di)
|
2011-07-30 01:51:31 +04:00
|
|
|
{
|
2013-06-06 20:13:35 +04:00
|
|
|
cmXMLSafe safedef(di->c_str());
|
|
|
|
fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
|
2011-07-30 01:51:31 +04:00
|
|
|
}
|
|
|
|
|
2012-09-21 10:50:50 +04:00
|
|
|
// the include directories for this target
|
|
|
|
std::set<std::string> uniqIncludeDirs;
|
|
|
|
|
|
|
|
std::vector<std::string> includes;
|
|
|
|
target->GetMakefile()->GetLocalGenerator()->
|
2013-03-25 00:18:39 +04:00
|
|
|
GetIncludeDirectories(includes, gtgt, "C", buildType);
|
2012-09-21 10:50:50 +04:00
|
|
|
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
|
|
|
|
dirIt != includes.end();
|
|
|
|
++dirIt)
|
|
|
|
{
|
|
|
|
uniqIncludeDirs.insert(*dirIt);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string systemIncludeDirs = makefile->GetSafeDefinition(
|
|
|
|
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
|
|
|
|
if (!systemIncludeDirs.empty())
|
|
|
|
{
|
|
|
|
std::vector<std::string> dirs;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
|
2012-09-21 10:50:50 +04:00
|
|
|
for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
|
|
|
|
dirIt != dirs.end();
|
2007-11-25 15:45:18 +03:00
|
|
|
++dirIt)
|
|
|
|
{
|
2011-08-02 03:46:39 +04:00
|
|
|
uniqIncludeDirs.insert(*dirIt);
|
|
|
|
}
|
2012-09-21 10:50:50 +04:00
|
|
|
}
|
2011-08-02 03:46:39 +04:00
|
|
|
|
2012-09-21 10:50:50 +04:00
|
|
|
systemIncludeDirs = makefile->GetSafeDefinition(
|
|
|
|
"CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
|
|
|
|
if (!systemIncludeDirs.empty())
|
|
|
|
{
|
|
|
|
std::vector<std::string> dirs;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
|
2012-09-21 10:50:50 +04:00
|
|
|
for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
|
|
|
|
dirIt != dirs.end();
|
2011-08-02 03:46:39 +04:00
|
|
|
++dirIt)
|
|
|
|
{
|
2012-09-21 10:50:50 +04:00
|
|
|
uniqIncludeDirs.insert(*dirIt);
|
2007-11-25 15:45:18 +03:00
|
|
|
}
|
2012-09-21 10:50:50 +04:00
|
|
|
}
|
2011-08-02 03:46:39 +04:00
|
|
|
|
2012-09-21 10:50:50 +04:00
|
|
|
for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();
|
|
|
|
dirIt != uniqIncludeDirs.end();
|
|
|
|
++dirIt)
|
|
|
|
{
|
2014-03-11 16:35:32 +04:00
|
|
|
fout <<" <Add directory=\"" << *dirIt << "\" />\n";
|
2007-11-25 15:45:18 +03:00
|
|
|
}
|
2012-09-21 10:50:50 +04:00
|
|
|
|
|
|
|
fout<<" </Compiler>\n";
|
|
|
|
}
|
|
|
|
else // e.g. all and the GLOBAL and UTILITY targets
|
2007-11-25 15:45:18 +03:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
fout<<" <Option working_dir=\""
|
2007-11-25 15:45:18 +03:00
|
|
|
<< makefile->GetStartOutputDirectory() << "\" />\n"
|
|
|
|
<<" <Option type=\"" << 4 << "\" />\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
fout<<" <MakeCommands>\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
" <Build command=\""
|
2007-11-25 15:45:18 +03:00
|
|
|
<< this->BuildMakeCommand(make, makefileName.c_str(), targetName)
|
|
|
|
<< "\" />\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
" <CompileFile command=\""
|
2007-11-25 15:45:18 +03:00
|
|
|
<< this->BuildMakeCommand(make, makefileName.c_str(),""$file"")
|
|
|
|
<< "\" />\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
" <Clean command=\""
|
|
|
|
<< this->BuildMakeCommand(make, makefileName.c_str(), "clean")
|
2007-11-25 15:45:18 +03:00
|
|
|
<< "\" />\n"
|
2010-11-12 00:02:07 +03:00
|
|
|
" <DistClean command=\""
|
|
|
|
<< this->BuildMakeCommand(make, makefileName.c_str(), "clean")
|
2007-11-25 15:45:18 +03:00
|
|
|
<< "\" />\n"
|
|
|
|
" </MakeCommands>\n"
|
|
|
|
" </Target>\n";
|
2010-11-12 00:02:07 +03:00
|
|
|
|
2007-11-25 15:45:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-25 13:26:58 +03:00
|
|
|
// Translate the cmake compiler id into the CodeBlocks compiler id
|
2007-08-29 18:12:09 +04:00
|
|
|
std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
|
|
|
|
{
|
|
|
|
// figure out which language to use
|
|
|
|
// for now care only for C and C++
|
|
|
|
std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID";
|
2007-08-31 21:42:21 +04:00
|
|
|
if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false)
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
|
|
|
compilerIdVar = "CMAKE_C_COMPILER_ID";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string hostSystemName = mf->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
|
|
|
|
std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
|
2014-03-11 03:04:11 +04:00
|
|
|
std::string compilerId = mf->GetSafeDefinition(compilerIdVar);
|
2010-03-15 21:53:12 +03:00
|
|
|
std::string compiler = "gcc"; // default to gcc
|
2007-08-29 18:12:09 +04:00
|
|
|
if (compilerId == "MSVC")
|
|
|
|
{
|
2009-06-28 12:30:11 +04:00
|
|
|
compiler = "msvc8";
|
2007-08-29 18:12:09 +04:00
|
|
|
}
|
|
|
|
else if (compilerId == "Borland")
|
|
|
|
{
|
|
|
|
compiler = "bcc";
|
|
|
|
}
|
|
|
|
else if (compilerId == "SDCC")
|
|
|
|
{
|
|
|
|
compiler = "sdcc";
|
|
|
|
}
|
|
|
|
else if (compilerId == "Intel")
|
|
|
|
{
|
|
|
|
compiler = "icc";
|
|
|
|
}
|
2014-03-17 22:41:02 +04:00
|
|
|
else if (compilerId == "Watcom" || compilerId == "OpenWatcom")
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
|
|
|
compiler = "ow";
|
|
|
|
}
|
|
|
|
else if (compilerId == "GNU")
|
|
|
|
{
|
2007-08-29 23:19:15 +04:00
|
|
|
compiler = "gcc";
|
2007-08-29 18:12:09 +04:00
|
|
|
}
|
|
|
|
return compiler;
|
|
|
|
}
|
|
|
|
|
2007-07-13 08:58:43 +04:00
|
|
|
|
2007-11-25 13:26:58 +03:00
|
|
|
// Translate the cmake target type into the CodeBlocks target type id
|
2007-08-29 18:12:09 +04:00
|
|
|
int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
|
|
|
|
{
|
|
|
|
if ( target->GetType()==cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
if ((target->GetPropertyAsBool("WIN32_EXECUTABLE"))
|
|
|
|
|| (target->GetPropertyAsBool("MACOSX_BUNDLE")))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-31 18:01:37 +04:00
|
|
|
else if (( target->GetType()==cmTarget::STATIC_LIBRARY)
|
|
|
|
|| (target->GetType()==cmTarget::OBJECT_LIBRARY))
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
2010-11-12 00:02:07 +03:00
|
|
|
else if ((target->GetType()==cmTarget::SHARED_LIBRARY)
|
2009-10-12 21:44:42 +04:00
|
|
|
|| (target->GetType()==cmTarget::MODULE_LIBRARY))
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return 4;
|
2007-07-13 08:58:43 +04:00
|
|
|
}
|
|
|
|
|
2007-11-25 13:26:58 +03:00
|
|
|
// Create the command line for building the given target using the selected
|
|
|
|
// make
|
2007-08-29 18:12:09 +04:00
|
|
|
std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& make, const char* makefile,
|
|
|
|
const std::string& target)
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
|
|
|
std::string command = make;
|
2014-02-25 02:36:27 +04:00
|
|
|
std::string generator = this->GlobalGenerator->GetName();
|
|
|
|
if (generator == "NMake Makefiles")
|
2007-08-29 18:12:09 +04:00
|
|
|
{
|
2014-01-14 02:15:26 +04:00
|
|
|
// For Windows ConvertToOutputPath already adds quotes when required.
|
|
|
|
// These need to be escaped, see
|
|
|
|
// http://public.kitware.com/Bug/view.php?id=13952
|
2010-01-24 23:11:58 +03:00
|
|
|
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
2014-01-14 02:15:26 +04:00
|
|
|
command += " /NOLOGO /f ";
|
|
|
|
command += cmXMLSafe(makefileName).str();
|
2010-11-12 00:06:09 +03:00
|
|
|
command += " VERBOSE=1 ";
|
2007-08-29 18:12:09 +04:00
|
|
|
command += target;
|
|
|
|
}
|
2014-02-25 02:36:27 +04:00
|
|
|
else if (generator == "MinGW Makefiles")
|
2009-01-10 02:04:20 +03:00
|
|
|
{
|
2010-11-12 00:02:07 +03:00
|
|
|
// no escaping of spaces in this case, see
|
2010-01-24 23:11:58 +03:00
|
|
|
// http://public.kitware.com/Bug/view.php?id=10014
|
2010-11-12 00:02:07 +03:00
|
|
|
std::string makefileName = makefile;
|
2010-01-24 23:11:58 +03:00
|
|
|
command += " -f "";
|
|
|
|
command += makefileName;
|
|
|
|
command += "" ";
|
2010-11-12 00:06:09 +03:00
|
|
|
command += " VERBOSE=1 ";
|
2009-01-10 02:04:20 +03:00
|
|
|
command += target;
|
|
|
|
}
|
2014-02-25 02:36:27 +04:00
|
|
|
else if (generator == "Ninja")
|
2013-01-05 11:29:58 +04:00
|
|
|
{
|
|
|
|
command += " -v ";
|
|
|
|
command += target;
|
|
|
|
}
|
2007-08-29 18:12:09 +04:00
|
|
|
else
|
|
|
|
{
|
2010-01-24 23:11:58 +03:00
|
|
|
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
2007-08-29 23:19:15 +04:00
|
|
|
command += " -f "";
|
2010-01-24 23:11:58 +03:00
|
|
|
command += makefileName;
|
2007-08-29 23:19:15 +04:00
|
|
|
command += "" ";
|
2010-11-12 00:06:09 +03:00
|
|
|
command += " VERBOSE=1 ";
|
2007-08-29 18:12:09 +04:00
|
|
|
command += target;
|
|
|
|
}
|
|
|
|
return command;
|
|
|
|
}
|