vector-of-bool / cmrc

A Resource Compiler in a Single CMake Script
MIT License
674 stars 74 forks source link

[Wishlist] Allow nested namespaces #18

Open mbr0wn opened 4 years ago

mbr0wn commented 4 years ago

On most compilers (gcc, clang) you can actually have a nested namespace. This bit me, because MSVC doesn't let you do that by default. Maybe there's a way that a nested namespace can be detected and expanded in the generated code.

To reproduce, simply try following the instructions with

cmrc_add_resource_library(foo-resources ALIAS foo::rc NAMESPACE foo::bar  ...)

And then keep going. In the generated lib.cpp file you'll see

namespace foo::bar {

....which I think is legal C++17. I'm surprised that my gcc didn't choke (it was set to C++14), but MSVC for sure didn't like it. If this can be autoexpanded to

namespace foo { namespace bar {

(and then again on the closing braces), this will work just fine.