diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-10-23 16:17:36 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-10-23 16:27:30 +0200 |
| commit | 6e9b324ab7bf5909df7e68409e060282db14fa54 (patch) | |
| tree | 99383710e05b1e0bb046ce086ad522f54d55d5bc /src/proj.h | |
| parent | 9817fe7db31d5a0716876e1f8f7f1a9ba4b91be0 (diff) | |
| download | PROJ-6e9b324ab7bf5909df7e68409e060282db14fa54.tar.gz PROJ-6e9b324ab7bf5909df7e68409e060282db14fa54.zip | |
CMake: revise how we deal with symbol export and static builds
- Remove the explicit PROJ_MSVC_DLL_IMPORT symbol used for importing
symbols from a MSVC .dll: by default on MSVC, we use
now __declspec(dllimport), unless PROJ_MSVC_DLL_EXPORT is defined
by PROJ at build time. This makes it easier for users: they
don't have to define anything special. This simplifies in particular
the build of our binaries
- For static builds, export -DPROJ_DLL= as public, so that users
that import PROJ through CMake mechanism don't have to do it
manually.
Diffstat (limited to 'src/proj.h')
| -rw-r--r-- | src/proj.h | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -140,15 +140,17 @@ extern "C" { /*! @cond Doxygen_Suppress */ #ifndef PROJ_DLL -#ifdef PROJ_MSVC_DLL_EXPORT -#define PROJ_DLL __declspec(dllexport) -#elif defined(PROJ_MSVC_DLL_IMPORT) -#define PROJ_DLL __declspec(dllimport) -#elif defined(__GNUC__) -#define PROJ_DLL __attribute__ ((visibility("default"))) -#else -#define PROJ_DLL -#endif +# if defined(_MSC_VER) +# ifdef PROJ_MSVC_DLL_EXPORT +# define PROJ_DLL __declspec(dllexport) +# else +# define PROJ_DLL __declspec(dllimport) +# endif +# elif defined(__GNUC__) +# define PROJ_DLL __attribute__ ((visibility("default"))) +# else +# define PROJ_DLL +# endif #endif #ifdef PROJ_SUPPRESS_DEPRECATION_MESSAGE |
