[CMake] CMake rebuilds every time

Arindam Mukherjee arindam.mukerjee at gmail.com
Thu Oct 25 08:32:38 EDT 2012


On Mon, Oct 22, 2012 at 5:55 PM, David Cole <david.cole at kitware.com> wrote:
> On Mon, Oct 22, 2012 at 6:38 AM, Arindam Mukherjee
> <arindam.mukerjee at gmail.com> wrote:
>> On Mon, Oct 22, 2012 at 4:06 PM, Arindam Mukherjee
>> <arindam.mukerjee at gmail.com> wrote:
>>> I am sorry I missed your response. Here are the details:
>>>
>>> 1. I have a shell / batch script which does two things:
>>>     a. cd build_dir && cmake $SRC_PATH
>>>     b. make   # On Unix
>>>
>>>     On Windows, for step b., we run
>>>     devenv proj.sln /Build "Release|x86" /out <logfile_path>
>>>
>>> Here is the top level CMakeLists.txt:
>>> http://pastebin.com/QWG4wSuf
>>>
>>> Here is a CMakeLists.txt in one of the subdirs:
>>> http://pastebin.com/QYGCpH7k
>>>
>>> These are fairly representative of how the CMakeLists.txt are.
>>
>> I should have added - we have source files with extension ".C" (i.e.
>> .C in caps) and these are meant to be C++ sources.
>>
>>>
>>> Regards,
>>> Arindam
>>>
>>> On Tue, Oct 16, 2012 at 9:04 PM, David Cole <david.cole at kitware.com> wrote:
>>>> What does your CMakeLists look like?
>>>>
>>>> Only the necessary rebuild steps should be taken on an incremental build.
>>>>
>>>> How do you invoke a rebuild? (Just typing 'make' or some other mechanism?)
>>>>
>>>>
>>>> On Mon, Oct 15, 2012 at 6:22 AM, Arindam Mukherjee
>>>> <arindam.mukerjee at gmail.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I have a cross-platform build setup using cmake 2.8.9 which builds on
>>>>> 5 different OSs. However it rebuilds every time even when neither the
>>>>> Makefile timestamps nor the source file timastamps had changed.
>>>>> Examining the generated Makefiles I can see that all .o, .i and .s
>>>>> targets have been marked .PHONY. Don't know if this is the reason for
>>>>> it. How to fix this to not rebuild every time but do incremental
>>>>> builds?
>>>>>
>>>>> Thanks,
>>>>> Arindam
>>>>> --
>>>>>
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.cmake.org/mailman/listinfo/cmake
>
>
> The *.C files will only be seen as "C" files on Windows because the
> file system is case insensitive, so there is no difference between "c"
> and "C"... Use ".cpp" or ".cxx" to name C++ source files.

I have attached a .tgz archive with which the issue can be reproduced.
Here are the instructions to run the
build on a Linux system with gcc and gmake (I have tested it on RHEL
5.0 and Lubuntu 12.04):

$ mkdir -p cmake_dbg && cmake_dbg
$ tar xfz <path_to_archive>/cmake_dbg.tgz
$ . ./bldenv `pwd`
$ cd my_proj
$ ./src/mk/build

The sources get rebuilt every time I run ./src/mk/build. Tested with
cmake 2.8.9 and 2.8.7.

I added the following line to the top-level CMakeLists.txt file:

set (CMAKE_SKIP_RULE_DEPENDENCY TRUE)

and I can now get incremental builds
(source:http://www.vtk.org/Wiki/CMake_Useful_Variables#Various_Options).
However I was hoping I didn't have to do that because I am not really
changing any options.

Thanks,
Arindam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_dbg.tgz
Type: application/x-gzip
Size: 3813 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121025/8fc5d34b/attachment-0001.bin>


More information about the CMake mailing list