CMake/Source/cmExtraEclipseCDT4Generator.h
Alexander Neundorf c1beb3b141 fix the way the PATH and other related env.vars are stored in the eclipse project file when using MSVC
Before this commit, the value of PATH at cmake time was put into the eclipse
project file. The problem with this is that this will be lost the first time
cmake is rerun from an build inside eclipse which was started without the
environment externally already set.
This patch now:
-adds the env.var to the cache if it is not already in the cache
-reuses the variable from the cache if it is in the cache, but not in the env.
-uses the variable from the cache if it contains the whole content of the
current env.var (e.g. if it is the full PATH plus the MSVC dirs)

Also store INTEL_LICENSE_FILE in the project file if an Intel compiler is used.

Alex
2009-12-23 13:56:01 -05:00

116 lines
4.4 KiB
C++

/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2004-2009 Kitware, Inc.
Copyright 2004 Alexander Neundorf (neundorf@kde.org)
Copyright 2007 Miguel A. Figueroa-Villanueva
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.
============================================================================*/
#ifndef cmExtraEclipseCDT4Generator_h
#define cmExtraEclipseCDT4Generator_h
#include "cmExternalMakefileProjectGenerator.h"
class cmMakefile;
class cmGeneratedFileStream;
/** \class cmExtraEclipseCDT4Generator
* \brief Write Eclipse project files for Makefile based projects
*
* This generator is in early alpha stage.
*/
class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
{
public:
cmExtraEclipseCDT4Generator();
static cmExternalMakefileProjectGenerator* New() {
return new cmExtraEclipseCDT4Generator;
}
virtual const char* GetName() const {
return cmExtraEclipseCDT4Generator::GetActualName();
}
static const char* GetActualName() { return "Eclipse CDT4"; }
virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const;
virtual void SetGlobalGenerator(cmGlobalGenerator* generator);
virtual void Generate();
private:
// create .project file in the source tree
void CreateSourceProjectFile() const;
// create .project file
void CreateProjectFile();
// create .cproject file
void CreateCProjectFile() const;
// If built with cygwin cmake, convert posix to windows path.
static std::string GetEclipsePath(const std::string& path);
// Extract basename.
static std::string GetPathBasename(const std::string& path);
// Generate the project name as: <name>-<type>@<path>
static std::string GenerateProjectName(const std::string& name,
const std::string& type,
const std::string& path);
static std::string EscapeForXML(const std::string& value);
// Helper functions
static void AppendStorageScanners(cmGeneratedFileStream& fout,
const cmMakefile& makefile);
static void AppendTarget (cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
const std::string& path,
const char* prefix = "");
static void AppendScannerProfile (cmGeneratedFileStream& fout,
const std::string& profileID,
bool openActionEnabled,
const std::string& openActionFilePath,
bool pParserEnabled,
const std::string& scannerInfoProviderID,
const std::string& runActionArguments,
const std::string& runActionCommand,
bool runActionUseDefault,
bool sipParserEnabled);
static void AppendLinkedResource (cmGeneratedFileStream& fout,
const std::string& name,
const std::string& path);
bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
const std::string& defname,
const std::string& altdefname);
static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
const std::vector<std::string>& includeDirs,
std::set<std::string>& emittedDirs);
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
std::vector<std::string> SrcLinkedResources;
std::vector<std::string> OutLinkedResources;
std::string HomeDirectory;
std::string HomeOutputDirectory;
bool IsOutOfSourceBuild;
bool GenerateSourceProject;
};
#endif