summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2009-11-22 10:01:04 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2009-11-22 10:01:04 (GMT)
commit2d9c72c7e50e64baa8ce3905c079f067ee64f806 (patch)
tree2ced74f86bd96d0f3ec8eaa2c3fb8059f41e1b29 /Source/cmExtraEclipseCDT4Generator.cxx
parent892accffba13f17534755535da411a876ca2cce2 (diff)
downloadCMake-2d9c72c7e50e64baa8ce3905c079f067ee64f806.zip
CMake-2d9c72c7e50e64baa8ce3905c079f067ee64f806.tar.gz
CMake-2d9c72c7e50e64baa8ce3905c079f067ee64f806.tar.bz2
improve system/compiler specific settings of Eclipse
-use CMAKE_EXECUTABLE_FORMAT and CMAKE_SYSTEM_NAME to decide which binary parsers to load (ELF/Mach O/PE) -use CMAKE_(C|CXX)_COMPILER_ID to load the respective compiler error parser -remove EclipseToolchainType, which was a mixture between compiler and operating system Alex
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx110
1 files changed, 41 insertions, 69 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 0a5101f..8703853 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -285,10 +285,19 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"\t\t\t\t\t<key>org.eclipse.cdt.core.errorOutputParser</key>\n"
"\t\t\t\t\t<value>"
;
- if (this->GetToolChainType(*mf) == EclipseToolchainOther)
+ std::string compilerId = mf->GetSafeDefinition("CMAKE_C_COMPILER_ID");
+ if (compilerId.empty()) // no C compiler, try the C++ compiler:
+ {
+ compilerId = mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
+ }
+ if (compilerId == "MSVC")
{
fout << "org.eclipse.cdt.core.VCErrorParser;";
}
+ else if (compilerId == "Intel")
+ {
+ fout << "org.eclipse.cdt.core.ICCErrorParser;";
+ }
fout <<
"org.eclipse.cdt.core.MakeErrorParser;"
"org.eclipse.cdt.core.GCCErrorParser;"
@@ -418,20 +427,25 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
"<extensions>\n"
;
// TODO: refactor this out...
- switch (this->GetToolChainType(*mf))
- {
- case EclipseToolchainLinux :
- fout << "<extension id=\"org.eclipse.cdt.core.ELF\""
- " point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
- ;
- fout << "<extension id=\"org.eclipse.cdt.core.GNU_ELF\""
- " point=\"org.eclipse.cdt.core.BinaryParser\">\n"
- "<attribute key=\"addr2line\" value=\"addr2line\"/>\n"
- "<attribute key=\"c++filt\" value=\"c++filt\"/>\n"
- "</extension>\n"
- ;
- break;
- case EclipseToolchainCygwin :
+ std::string executableFormat = mf->GetSafeDefinition(
+ "CMAKE_EXECUTABLE_FORMAT");
+ if (executableFormat == "ELF")
+ {
+ fout << "<extension id=\"org.eclipse.cdt.core.ELF\""
+ " point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
+ ;
+ fout << "<extension id=\"org.eclipse.cdt.core.GNU_ELF\""
+ " point=\"org.eclipse.cdt.core.BinaryParser\">\n"
+ "<attribute key=\"addr2line\" value=\"addr2line\"/>\n"
+ "<attribute key=\"c++filt\" value=\"c++filt\"/>\n"
+ "</extension>\n"
+ ;
+ }
+ else
+ {
+ std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
+ if (systemName == "CYGWIN")
+ {
fout << "<extension id=\"org.eclipse.cdt.core.Cygwin_PE\""
" point=\"org.eclipse.cdt.core.BinaryParser\">\n"
"<attribute key=\"addr2line\" value=\"addr2line\"/>\n"
@@ -440,36 +454,28 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
"<attribute key=\"nm\" value=\"nm\"/>\n"
"</extension>\n"
;
- break;
- case EclipseToolchainMinGW :
+ }
+ else if (systemName == "Windows")
+ {
fout << "<extension id=\"org.eclipse.cdt.core.PE\""
" point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
;
- break;
- case EclipseToolchainSolaris :
- fout << "<extension id=\"org.eclipse.cdt.core.ELF\""
- " point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
- ;
- break;
- case EclipseToolchainMacOSX :
+ }
+ else if (systemName == "Darwin")
+ {
fout << "<extension id=\"org.eclipse.cdt.core.MachO\""
" point=\"org.eclipse.cdt.core.BinaryParser\">\n"
"<attribute key=\"c++filt\" value=\"c++filt\"/>\n"
"</extension>\n"
;
- break;
- case EclipseToolchainOther :
- fout << "<extension id=\"org.eclipse.cdt.core.PE\""
- " point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
- ;
- fout << "<extension id=\"org.eclipse.cdt.core.ELF\""
- " point=\"org.eclipse.cdt.core.BinaryParser\"/>\n"
- ;
- break;
- default :
+ }
+ else
+ {
// *** Should never get here ***
fout << "<error_toolchain_type/>\n";
- }
+ }
+ }
+
fout << "</extensions>\n"
"</storageModule>\n"
;
@@ -828,40 +834,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
//----------------------------------------------------------------------------
-cmExtraEclipseCDT4Generator::EclipseToolchainType
-cmExtraEclipseCDT4Generator::GetToolChainType(const cmMakefile& makefile)
-{
- if (makefile.IsSet("UNIX"))
- {
- if (makefile.IsSet("CYGWIN"))
- {
- return EclipseToolchainCygwin;
- }
- if (makefile.IsSet("APPLE" ))
- {
- return EclipseToolchainMacOSX;
- }
- // *** how do I determine if it is Solaris ???
- return EclipseToolchainLinux;
- }
- else if (makefile.IsSet("WIN32"))
- {
- if (makefile.IsSet("MINGW"))
- {
- return EclipseToolchainMinGW;
- }
- if (makefile.IsSet("MSYS" ))
- {
- return EclipseToolchainMinGW;
- }
- return EclipseToolchainOther;
- }
- else
- {
- return EclipseToolchainOther;
- }
-}
-
std::string
cmExtraEclipseCDT4Generator::GetEclipsePath(const std::string& path)
{