[CMake] CMake add_subdirectory and recompiling

Michael Wild themiwi at gmail.com
Wed Dec 21 12:03:41 EST 2011


On 12/21/2011 05:59 PM, David Cole wrote:
>  On Wed, Dec 21, 2011 at 11:56 AM, Michael Wild <themiwi at gmail.com> wrote:
>> On 12/21/2011 05:25 PM, André Caron wrote:
>>> I've recently been surprised by the behavior of CMake when modifying
>>> "CMakeLists.txt" files pointed to by "add_subdirectory()" directives.
>>> I've asked the question on StackOverflow[1] and have gotten no clean
>>> answer.  If anyone is interested, there is a small bounty (50 points)
>>> on the question expiring in a few hours.
>>>
>>> The question is tad bit lengthy, so I won't duplicate here.  Any reply
>>> on either the mailing list or to the linked StackOverflow question is
>>> appreciated.
>>>
>>> Thanks!
>>> André
>>>
>>> [1]: http://stackoverflow.com/questions/8479929/cmake-add-subdirectory-and-recompiling
>>
>> Get rid of the file(GLOB ...). Never, ever use it unless you know
>> exactly what you're doing. Using it usually breaks something.
>>
>> Also, you didn't say *what* changes you made that caused a full rebuild.
>> If you change anything that will show up on the command line (e.g.
>> change add_definitions(), include_directories(), etc.), this will of
>> course cause a rebuild.
>>
>> Michael
>>
>> --
>>
>> 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
> 
> 
> I agree with the advice to get rid of file(GLOB, but I also think it's
> irrelevant to the problem here. Using it should have no bearing on
> what rebuilds when CMake re-runs, assuming that the set of globbed
> files is the same from run to run.

That's why I was asking for the specifics of the modifications causing a
rebuild.

Michael


More information about the CMake mailing list