MantisBT - CMake
View Issue Details
0012617CMakeCMakepublic2011-12-10 05:522016-06-10 14:31
Benjamin Schindler 
Alex Neundorf 
normalmajoralways
closedmoved 
amd64linuxgentoo
CMake 2.8.6 
 
0012617: codeblocks project file not updated when cmakelists.txt change
I use qt-creator for working on my projects. The way qt-creator integration works is by generating a codeblocks project file and using that to build its project tree.

The problem happens as soon I add files to my project. I create them, add them to cmakelists and press build, but in qt-creator the files won't appear. I then figured that the cbp files is not updated. If I do so manually by running cmake -G "CodeBlocks - Unix Makefiles", the files appear in qtcreator.

Therefore, when if make forces cmake to rerun, it should rebuild the project file.
create a dummy project
run cmake -G "CodeBlocks..."
run make
add a file to cmake
run make
check that the timestamp of project.cbp remained unchanged
I set this bug to major as in my experience, the qt-creator/cmake combination is quite popular and I was not the only person complaining about this
No tags attached.
related to 0011959closed Alex Neundorf CMake does not write in defines into code::blocks projects files 
Issue History
2011-12-10 05:52Benjamin SchindlerNew Issue
2011-12-11 06:11Alex NeundorfAssigned To => Alex Neundorf
2011-12-11 06:11Alex NeundorfStatusnew => assigned
2011-12-11 11:08Alex NeundorfNote Added: 0027945
2011-12-21 06:19Benjamin SchindlerNote Added: 0028025
2011-12-28 04:43Benjamin SchindlerNote Added: 0028076
2012-01-04 16:06Alex NeundorfRelationship addedrelated to 0011959
2012-08-13 12:45Alex NeundorfStatusassigned => backlog
2016-06-10 14:28Kitware RobotNote Added: 0041942
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0027945)
Alex Neundorf   
2011-12-11 11:08   
I can't reproduce this:

Create a simple project:

~/src/CMake/tests/hello/build-cb$ /opt/cmake-HEAD/bin/cmake-gui ..

.cbp file created, timestamp is 17:00 :

~/src/CMake/tests/hello/build-cb$ ls -al
total 52
drwxr-xr-x 3 alex users 4096 Dec 11 17:00 ./
drwxrwxr-x 18 alex users 4096 Dec 11 16:58 ../
-rw-r--r-- 1 alex users 15362 Dec 11 17:00 CMakeCache.txt
drwxr-xr-x 5 alex users 4096 Dec 11 17:00 CMakeFiles/
-rw-r--r-- 1 alex users 8319 Dec 11 17:00 Foo.cbp
-rw-r--r-- 1 alex users 6419 Dec 11 17:00 Makefile
-rw-r--r-- 1 alex users 2487 Dec 11 17:00 cmake_install.cmake


Create an empty foo.c and add it to CMakeLists.txt:

~/src/CMake/tests/hello/build-cb$ touch ../foo.c
~/src/CMake/tests/hello/build-cb$ joe ../CMakeLists.txt
Processing '/etc/joe/joerc'...Processing '/etc/joe/ftyperc'...done
done


Wait until it is 17:01, and check whether foo.c is mentioned in the cbp file:

~/src/CMake/tests/hello/build-cb$ date
Sun Dec 11 17:00:54 CET 2011
~/src/CMake/tests/hello/build-cb$ date
Sun Dec 11 17:01:01 CET 2011
~/src/CMake/tests/hello/build-cb$ grep foo Foo.cbp


Now it's a17:01, and running make automatically reruns cmake (since CMakeLists.txt has changed):

~/src/CMake/tests/hello/build-cb$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/src/CMake/tests/hello/build-cb
Scanning dependencies of target hello
[ 50%] Building C object CMakeFiles/hello.dir/main.c.o
[100%] Building C object CMakeFiles/hello.dir/foo.c.o
Linking C executable hello
[100%] Built target hello

Now let's check whether foo.c is now mentioned in the cbp file, and also let's have a look at the time stamp of the cbp file:

~/src/CMake/tests/hello/build-cb$ grep foo Foo.cbp
      <Unit filename="/home/alex/src/CMake/tests/hello/foo.c">
~/src/CMake/tests/hello/build-cb$ ls -al
total 60
drwxr-xr-x 3 alex users 4096 Dec 11 17:01 ./
drwxrwxr-x 18 alex users 4096 Dec 11 17:00 ../
-rw-r--r-- 1 alex users 15362 Dec 11 17:00 CMakeCache.txt
drwxr-xr-x 5 alex users 4096 Dec 11 17:01 CMakeFiles/
-rw-r--r-- 1 alex users 8396 Dec 11 17:01 Foo.cbp
-rw-r--r-- 1 alex users 6980 Dec 11 17:01 Makefile
-rw-r--r-- 1 alex users 2487 Dec 11 17:00 cmake_install.cmake
-rwxr-xr-x 1 alex users 5846 Dec 11 17:01 hello*
~/src/CMake/tests/hello/build-cb$

Timestamp is 17:01, and foo.c is mentioned in the cbp file.

How does QtCreator exactly do a build ?
Does it simply run "make" or "make all" or something else ?

Alex
(0028025)
Benjamin Schindler   
2011-12-21 06:19   
I just tried.
When running cmake manually, the following command is called (I froze qtcreator and checked /proc/pid/cmdline)

/usr/bin/cmake.-GCodeBlocks - Unix Makefiles

When building:

/usr/bin/make-j6

Timestamp check:

benjamin@metis ~/projects/visdom/release-build $ ls -l Visdom.cbp
-rw-r--r-- 1 benjamin users 302090 Dez 21 12:08 Visdom.cbp

/** Adding a file to the cmakelists.txt and building in qtcreator */

benjamin@metis ~/projects/visdom/release-build $ ls -l Visdom.cbp
-rw-r--r-- 1 benjamin users 302090 Dez 21 12:08 Visdom.cbp
(0028076)
Benjamin Schindler   
2011-12-28 04:43   
I think I figured why this happens - when I initially created the build, I did not specify codeblocks project files. The reason is that multiple externals need to be set which I cannot do inside qtcreator. Then I import the project into qt-creator and there the codeblocks project is created.

I think this is why cmake doesn't realize that it needs to update the codeblocks project file.

So, for me the following would fix this:

cmake srcDir
cmake -G"CodeBlocks - Unix Makefiles" .
-> from now on, the codeblocks project is continuously updated
(0041942)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.