MantisBT - CMake
View Issue Details
0013699CMakeCMakepublic2012-11-17 18:422013-04-28 09:58
vitaut 
Alex Neundorf 
normalmajoralways
closedfixed 
x86_64Ubuntu GNU/Linux12.10
CMake 2.8.9 
 
0013699: Errors are not cleared when rebuilding a CMake-generated Eclipse CDT project
Some errors from previous builds are not cleared when rebuilding a CMake-generated Eclipse CDT project. Most of the errors are cleared but the following three persist in the Problems view:

make[1]: *** [CMakeFiles/test.dir/all] Error 2 C/C++ Problem
make: *** [all] Error 2 C/C++ Problem
make[2]: *** [CMakeFiles/test.dir/test.cc.o] Error 1 C/C++ Problem

These errors persist even if the project builds successfully which can be checked by looking at the Console output.

I am using Eclipse CDT version 8.1.0.
1. Create a simple C/C++ CMake project with a syntax error in the source code, for example,

CMakeFiles.txt:
  cmake_minimum_required(VERSION 2.6)
  project(TEST)
  add_executable(test test.cc)

test.cc:
  int main() {
    return 0 // missing semicolon
  }

2. Generate Eclipse CDT project:
cmake -G "Eclipse CDT4 - Unix Makefiles"

3. Open the project in Eclipse and build it. The Problems view will contain the following errors:
make[1]: *** [CMakeFiles/test.dir/all] Error 2 C/C++ Problem
make: *** [all] Error 2 C/C++ Problem
make[2]: *** [CMakeFiles/test.dir/test.cc.o] Error 1 C/C++ Problem
expected ‘;’ before ‘}’ token test.cc /TEST@test line 3 C/C++ Problem

4. Fix the error (add a semicolon after 0 in the example above), save the file and build the project again. The Problems view will contain the following errors:
make[1]: *** [CMakeFiles/test.dir/all] Error 2 C/C++ Problem
make: *** [all] Error 2 C/C++ Problem
make[2]: *** [CMakeFiles/test.dir/test.cc.o] Error 1 C/C++ Problem
Changing the error parser from "CDT GNU Make Error Parser 6.0 (Deprecated)" to "CDT GNU Make Error Parser 7.0" solves the problem but only until the project file is generated again. The blog post http://www.jazzbee.com/blog/?p=76 [^] suggests changing "org.eclipse.cdt.core.MakeErrorParser" to "org.eclipse.cdt.core.GmakeErrorParser" in cmExtraEclipseCDT4Generator.cxx.
No tags attached.
Issue History
2012-11-17 18:42vitautNew Issue
2013-03-25 10:00Brad KingNote Added: 0032691
2013-03-25 10:00Brad KingAssigned To => Alex Neundorf
2013-03-25 10:00Brad KingStatusnew => assigned
2013-04-28 09:58Alex NeundorfNote Added: 0032949
2013-04-28 09:58Alex NeundorfStatusassigned => closed
2013-04-28 09:58Alex NeundorfResolutionopen => fixed

Notes
(0032691)
Brad King   
2013-03-25 10:00   
Proposed solution here:

 https://github.com/Kitware/CMake/pull/38 [^]
(0032949)
Alex Neundorf   
2013-04-28 09:58   
Thanks for the patch on github, I committed it and merged it into the cmake next branch.
Unfortunately probably this won't make it for 2.8.11, but 2.8.12.