MantisBT - CMake
View Issue Details
0011723CMakeCMakepublic2011-01-19 11:582011-11-11 14:43
Galeazzi 
Alex Neundorf 
normalminoralways
closedno change required 
PCWindowsXP
CMake 2.8.3 
 
0011723: Eclipse: "Build project" and "Clean project" do not work
suppose I have a project with:
add_subdirectory("path/lib1" "${CMAKE_CURRENT_BINARY_DIR}/ib1")
when I change a source of lib1 and click on build over the eclipse project, eclipse doesn't build anything.
If I change a source of the main project it launches the build correctly.
I also tried to test the same thing with a simple MinGW Makefile (instead of Eclipse CDT 4 - MinGW Makefile) and it works properly in both two cases.
Just create a project with the same structure above
No tags attached.
related to 0012223closed Alex Neundorf Support of linked resources in Eclipse/CDT (single files, not folders) 
jpg eclipse-build.jpg (170,526) 2011-01-27 16:05
https://public.kitware.com/Bug/file/3664/eclipse-build.jpg
jpg

rar CMakeEclipseBug.rar (1,373) 2011-01-28 03:55
https://public.kitware.com/Bug/file/3665/CMakeEclipseBug.rar
Issue History
2011-01-19 11:58GaleazziNew Issue
2011-01-19 12:04Alex NeundorfAssigned To => Alex Neundorf
2011-01-19 12:04Alex NeundorfStatusnew => assigned
2011-01-27 16:05Alex NeundorfFile Added: eclipse-build.jpg
2011-01-27 16:06Alex NeundorfNote Added: 0025114
2011-01-28 03:55GaleazziFile Added: CMakeEclipseBug.rar
2011-01-28 04:04GaleazziNote Added: 0025118
2011-01-29 12:49Alex NeundorfNote Added: 0025161
2011-01-31 04:51GaleazziNote Added: 0025175
2011-01-31 05:02GaleazziNote Edited: 0025175bug_revision_view_page.php?bugnote_id=25175#r178
2011-01-31 16:58Alex NeundorfNote Added: 0025188
2011-02-01 03:57GaleazziNote Added: 0025197
2011-02-01 16:18Alex NeundorfNote Added: 0025218
2011-02-01 16:19Alex NeundorfSummaryeclipse build => Eclipse: "Build project" and "Clean project" do not work
2011-02-01 16:35Alex NeundorfNote Added: 0025219
2011-02-04 04:25GaleazziNote Added: 0025275
2011-03-21 07:30GaleazziNote Added: 0025837
2011-03-21 16:21Alex NeundorfNote Added: 0025851
2011-03-22 04:52GaleazziNote Added: 0025861
2011-09-30 15:20Alex NeundorfRelationship addedrelated to 0012223
2011-11-11 14:43Alex NeundorfNote Added: 0027784
2011-11-11 14:43Alex NeundorfStatusassigned => closed
2011-11-11 14:43Alex NeundorfResolutionopen => no change required

Notes
(0025114)
Alex Neundorf   
2011-01-27 16:06   
I can't reproduce a problem here with current cmake (2.8.4) under Linux.
As you can see in the screenshot I have a subdir foo/lib/, which I add in lib/ to the project.
Clicking e.g. the "[pre] foo.c.i" target on the right works, also all other targets work.

Did I misunderstand something ?
Or is this different on Windows ?

Alex
(0025118)
Galeazzi   
2011-01-28 04:04   
The difference is that my lib isn't a subdirectory of the main project:
cmake_minimum_required(VERSION 2.8)
project(Hello)
    set(Lib_OutPut_Dir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
    message(STATUS ${Lib_OutPut_Dir})
    add_subdirectory(../myLib "${Lib_OutPut_Dir}/BuildFiles")
    #link_directories(${CMAKE_CURRENT_BINARY_DIR})
    set(SOURCES ./main.c
                )
    set_source_files_properties(./main.c PROPERTIES LANGUAGE CXX)
    add_executable(Hello ${SOURCES})
    target_link_libraries(Hello HelloLib)
    
When you have built the project for the first time, just try to modify a file in lib and then build the Hello project again.
In windows it doesn't build anything.
In the next few days I'm gonna test it on Linux too.

Andrea
(0025161)
Alex Neundorf   
2011-01-29 12:49   
Works here too.
This is with Eclipse Helios.
Which version of Eclipse are you using ?

Alex
(0025175)
Galeazzi   
2011-01-31 04:51   
(edited on: 2011-01-31 05:02)
I'm using Helios too.
I just tested it also under Fedora and I've got the same problem.
Let me point out the procedure again (about the attachment):
1 - Generate an Eclipse Project from HelloExec
2 - Import it into your workspace (Eclipse will automatically build the project)
3 - Modify sayHello.cpp with any editor (sayHello.cpp is not available in the Eclipse project) (i.e. printf("Hello Word2"); -> printf("Hello Word");) and save the file.
4 - Right-click on HelloExec and click on Build Project
In both Windows and Linux Eclipse doesn't rebuild the project despite of the fact that sayHello.cpp has been modified. In order to "force" Eclipse to build it again I've to modify a file, like main.c, explicitly listed in the main CMakeLists.txt.
Let me know if you also can reproduce it.

(0025188)
Alex Neundorf   
2011-01-31 16:58   
Ok, I can reproduce this.
So, building via the generated targets in the "Make target" panel works without problems.

Building via the right-click menu on the project does not work as it should.
When I select "Build project", basically nothing happens.
When I select "Clean project", it does a "gmake all".

Do you have the same behaviour ?

Alex
(0025197)
Galeazzi   
2011-02-01 03:57   
Yes I do
(0025218)
Alex Neundorf   
2011-02-01 16:18   
I tested a bit more.
This is completely independent from whether some files are in some other directory or not. I.e. I tried it with a basic "hello world" project, and had the same effect.
Eclipse seems to use the value from the "org.eclipse.cdt.make.core.build.target.inc" specified in the .project file when it does a "Clean project". I.e. when I put there
<dictionary>
 <key>org.eclipse.cdt.make.core.build.target.inc</key>
 <value>clean</value>
</dictionary>

"Clean project" does make clean. Probably this is also used in some cases, so this doesn't look like a fix.


Now it gets weird.
I now ignored cmake, and used Eclipse to create a new "Hello world" C++ project. Same here !
"Clean project" does "make all", "Build project" also does "make all".
Does "Clean project" maybe try to remove all files it knows about (instead of calling "make clean") and then starts an incremental build ?
Maybe this "Build project" and "Clean project" is not supposed to be used for imported projects ?

Alex
(0025219)
Alex Neundorf   
2011-02-01 16:35   
Ok. "Clean project" does actually work. It cleans the project, probably by calling a hardcoded "make clean", followed by an incremental build.
IOW, if I do "Clean project", the built executables are not there anymore afterwards, although I don't see any output in Eclipse.
Strange thing is, if I change

<dictionary>
 <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
 <value>clean</value>
</dictionary>

to some other (nonexistant) target than "clean", e.g. "foo", and execute "Clean project" then, the built executables still are removed.

OTOH, setting

<dictionary>
 <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
 <value>false</value>
</dictionary>

to false as shown here, doesn't disable the incremental build after the clean.

Also, messing around with

<dictionary>
 <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
 <value>all</value>
</dictionary>

doesn't change the behaviour on "Build project", the stuff is not built whatever I enter there.

Alex
(0025275)
Galeazzi   
2011-02-04 04:25   
Probably I don't deeply understand all your considerations, anyway if you try to modify the main.c file of the attachment, save it, right click on the project and select build project, Eclipse builds the file (and the whole project) correctly.
Andrea
(0025837)
Galeazzi   
2011-03-21 07:30   
Any news about this bug?
Andrea
(0025851)
Alex Neundorf   
2011-03-21 16:21   
No, I was confused and still am.

Alex
(0025861)
Galeazzi   
2011-03-22 04:52   
Are you confused about the bug or how to fix it? Could I help you in any ways?
Andrea
(0027784)
Alex Neundorf   
2011-11-11 14:43   
I'm closing this one now.

It looks like this is a bug in Eclipse Helios.
I imported a fresh-created project in Helios.
"Build Project" worked.
"Clean Project" did also execute "make all".

Then I did the same in Eclipse Indigo.
"Build Project" still works (but doing it twice in a row doesn't do anything, it seems you have to save a file or something to make it start the build).
And, tada, "Clean Project" now does "make clean".