diff --git a/CMakeLists.txt b/CMakeLists.txt index eb30a1e26..4b744c01f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,8 @@ if (ENABLE_VCARD) if(NOT BELCARD_FOUND) message(WARNING "Could not find the belcard library!") set(ENABLE_VCARD OFF CACHE BOOL "Enable vcard support." FORCE) + else() + add_definitions("-DVCARD_ENABLED") endif() endif() diff --git a/coreapi/friend.c b/coreapi/friend.c index 852d14a25..b937c7ddb 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -858,6 +858,9 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char * MSList *vcards = linphone_vcard_list_from_vcard4_file(vcard_file); int count = 0; +#ifndef VCARD_ENABLED + ms_error("vCard support wasn't enabled at compilation time"); +#else while (vcards != NULL && vcards->data != NULL) { LinphoneVCard *vcard = (LinphoneVCard *)vcards->data; LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard); @@ -876,7 +879,7 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char * #ifndef FRIENDS_SQL_STORAGE_ENABLED linphone_core_write_friends_config(lc); #endif - +#endif return count; } @@ -890,6 +893,9 @@ void linphone_core_export_friends_as_vcard4_file(LinphoneCore *lc, const char *v return; } +#ifndef VCARD_ENABLED + ms_error("vCard support wasn't enabled at compilation time"); +#else while (friends != NULL && friends->data != NULL) { LinphoneFriend *lf = (LinphoneFriend *)friends->data; LinphoneVCard *vcard = linphone_friend_get_vcard(lf); @@ -901,6 +907,7 @@ void linphone_core_export_friends_as_vcard4_file(LinphoneCore *lc, const char *v } friends = ms_list_next(friends); } +#endif fclose(file); }