[Qgis-developer] DLL import/export defines quoting

Larry Shaffer larrys at dakotacarto.com
Fri Sep 30 13:48:21 PDT 2016


Hi,

I have some questions I found while trying to figure out why the C++ code
model for QGIS classes in Qt Creator were not being recognized (since a
recent Creator update, not sure when) [0].

I tracked it down to the following code (sample):

REMOVE_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DGUI_EXPORT=${DLLEXPORT}\"")

This extra quoting causes the definition (and any other *_EXPORT define) to
be parsed as undefined in Qt Creator when building the code model. Why is
the quoting like it is? i.e., why isn't it?:

ADD_DEFINITIONS("-DGUI_EXPORT=${DLLEXPORT}")

I could not find any CMake documentation on what the extra quoting
accomplishes. There are instances of this type of quoting in the GRASS
provider CMake setup as well.


Also, why are there spaces here in this string value? (in root
CMakeLists.txt):

SET(DLLEXPORT "__attribute__ ((visibility (\\\"default\\\")))")

Shouldn't that be?:

SET(DLLEXPORT "__attribute__((visibility(\\\"default\\\")))")

The latter seems to make a difference with Clang on OS X [1].

[0] http://drive.dakotacarto.com/qgis/qgis-dllexport-quoting_qt-creator.png
[1]
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160930/0a08b3f9/attachment.html>


More information about the Qgis-developer mailing list