[CMake] Avoiding error when using add_subdirectory twice on same path (CMake 2.6.4)

Bill Hoffman bill.hoffman at kitware.com
Tue Jun 16 18:04:17 EDT 2009


Tyler Roscoe wrote:
> On Tue, Jun 16, 2009 at 07:41:20PM +0200, Floca Ralf Omar wrote:
>> using CMake 2.6.4 to build one of our projects an error occurred due to
>> the repeated usage of add_subdirectory on the same path.
>>
>> In former versions of CMake the repeated usage was accepted and worked
>> fine.
> 
> I'm in the same boat.
> 
> CMake devs, what problem is this change designed to address? I don't see
> anything in the release notes at
> http://www.cmake.org/files/v2.6/CMakeChangeLog-2.6.4.
> 

This was never expected to work, and CMake creates "bad" makefiles in 
versions of CMake prior to this.   Basically, CMake was over-writing the 
makefiles as many times as the directory was there.  This causes very 
odd things to happen, and there were many reports of CMake is broken 
because of this.   It caused incorrect percent done reporting and 
sometimes failed to build some targets altogether.   If it was working 
for you, you were getting lucky (or unlucky...).


-Bill


More information about the CMake mailing list