Pau Garcia i Quiles wrote:

> On Thu, Jan 28, 2016 at 8:21 PM, Stephen Kelly
> <steve...@gmail.com> wrote:
> 
> 
> Pau Garcia i Quiles wrote:
>>
>> > CMake should wrap every variable defined under the directory added with
>> > add_subdirectory(QtZeroConf NAMESPACE QTZEROCONF)
>>
>> So, CMake needs to first determine what variables are used in the
>> QtZeroConf
>> directory (presumably without executing the cmake code there) and then
>> wrap the variables, then execute the cmake code?
>>
> I must be missing something. I don't think that's possible.
>>
>>
> I think it's just a matter of adding an "internal note" saying "OK, I'm
> going to namespace variables from now on" in cmAddSubdirectoryCommand when
> add_subdirectory contains NAMESPACE, and then modifying the literal of the
> variable in cmSetCommand.cxx (first argument to AddDefinition here in line
> 165):
> 
> this->Makefile->AddDefinition(variable, value.c_str());
> 
> https://github.com/Kitware/CMake/blob/master/Source/cmSetCommand.cxx#L165

I'm happy to provide guidance if you start writing a patch and find that it 
is a realistic approach, but I still don't think this is possible.

What do you do when third party code contains

 set(SOMETHING foo bar)
 foreach(thing ${SOMETHING})
 ...
 endforeach()

?

Are you going to change every read of a variable to prefix it with a 
namespace?

Thanks,

Steve.


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to