[cmake-developers] Namespaces
Stephen Kelly
steveire at gmail.com
Thu Jan 28 15:13:37 EST 2016
Pau Garcia i Quiles wrote:
> On Thu, Jan 28, 2016 at 8:21 PM, Stephen Kelly
> <steveire at 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.
More information about the cmake-developers
mailing list