I have two sources with name collisions (autogenerated1.cpp and autogenerated2.cpp).
I don't want to modify them as they're generated by a 3rd party tool, so I made wrappers to hide the implementations.
I'd like to do something like this on CMAKE:
g++ -fvisibility=hidden -c autogenerated1.cpp
g++ -fvisibility=hidden -c autogenerated2.cpp
g++ -c wrapper1.cpp
g++ -c wrapper2.cpp
ld -Ur autogenerated1.o wrapper1.o -o partial1.o
ld -Ur autogenerated2.o wrapper2.o -o partial2.o
objcopy --localize-hidden partial1.o
objcopy --localize-hidden partial2.o
How could I achieve something similar with CMAKE?
The TARGET_OBJECT generator doesn't work on custom commands or custom targets.
And I wasn't able to produce a working static library by applying "objcopy --localize-hidden" to the a target's output shared library without a relocatable intermediate object.
I'm open to other solutions to fix the symbol collision.