[CMake] Multiple calls to PROJECT() not diagnosed [was:2.6.4 add_subdirectory with same argument broken?]

Carsten Neumann carsten_neumann at gmx.net
Thu May 7 19:12:15 EDT 2009


	Hello Brad,

Brad King wrote:
> Carsten Neumann wrote:
>> It does so by performing multiple passes over the source tree 
> [snip]
>> This all works fine with cmake 2.6.x (x < 4), but the latest version 
>> complains in the OSGSETUP pass on the first call to ADD_SUBDIRECTORY 
>> in that pass (see attachment for more details):
> [snip]
>> Is this intended behavior, should I file a bug report, any ideas how 
>> to make this or something similar work again?
> 
> Adding the same build directory multiple times even from the same
> source tree is not allowed, but was not enforced until now.  When you
> did this before CMake would generate the build files over and over
> again.  It just happened that the last time wrote the files you want.

ok, thanks for the clarification.

> I suggest moving the meta-information into a separate file in each
> subdirectory which you can load with a normal include() command.  Then
> you only need to add each subdirectory once.

yes, I did something along those lines to fix the build. While doing so 
I noticed that when INCLUDEing the per-library files into the top level 
CMakeLists.txt essentially PROJECT() was called more than once for the 
same directory, which generated a broken solution file for VS 2005/8.
I opened feature request 8984 asking for PROJECT() to detect and error 
out in this case.

	Thanks and kind regards,
		Carsten


More information about the CMake mailing list