Per my understanding the macros XXX_BUILDING_DLL are processed (replacing XXX_PUBLIC
by XXX_EXPORT
instead of XXX_IMPORT
) only if WIN32 is defined. The macros controlling this behavior can be found in the visibility control file of each package, here ament_index_cpp
for example).
So If I understand correctly adding an if(WIN32)
would be redundant.