diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f2c71495..97c041a92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,6 +238,11 @@ if(MSVC) endif() add_definitions("-DLINPHONE_EXPORTS") +set(LINPHONE_CPPFLAGS ${MEDIASTREAMER2_CPPFLAGS}) +if(ENABLE_STATIC) + list(APPEND LINPHONE_CPPFLAGS "-DLINPHONE_STATIC") + add_definitions(${LINPHONE_CPPFLAGS}) +endif() if(ENABLE_DEBUG_LOGS) add_definitions("-DDEBUG") endif() diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in index 2bbdf4118..dcab2bb85 100644 --- a/cmake/LinphoneConfig.cmake.in +++ b/cmake/LinphoneConfig.cmake.in @@ -59,7 +59,7 @@ else() endif() list(APPEND LINPHONE_INCLUDE_DIRS ${MEDIASTREAMER2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS}) list(APPEND LINPHONE_LIBRARIES ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES}) -set(LINPHONE_CPPFLAGS "${MEDIASTREAMER2_CPPFLAGS}") +set(LINPHONE_CPPFLAGS @LINPHONE_CPPFLAGS@) set(LINPHONE_LDFLAGS "${MEDIASTREAMER2_LDFLAGS} ${BELLESIP_LDFLAGS}") if(TUNNEL_FOUND) list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS}) diff --git a/include/linphone/defs.h b/include/linphone/defs.h index 3e985b3de..fc26222cb 100644 --- a/include/linphone/defs.h +++ b/include/linphone/defs.h @@ -29,11 +29,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef LINPHONE_PUBLIC #if defined(_MSC_VER) +#ifdef LINPHONE_STATIC +#define LINPHONE_PUBLIC +#else #ifdef LINPHONE_EXPORTS #define LINPHONE_PUBLIC __declspec(dllexport) #else #define LINPHONE_PUBLIC __declspec(dllimport) #endif +#endif #else #define LINPHONE_PUBLIC #endif