diff --git a/CMakeLists.txt b/CMakeLists.txt
index e69d809dc0038700394b8e19afe99c8227aa4880..3917b2f37ffc15eea4c446b200b82d399bd0fb34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 ############################################################################
 # CMakeLists.txt
-# Copyright (C) 2014  Belledonne Communications, Grenoble France
+# Copyright (C) 2010-2019  Belledonne Communications, Grenoble France
 #
 ############################################################################
 #
@@ -20,7 +20,7 @@
 #
 ############################################################################
 
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.11) # we need CMake 3.11 for defining 'package_source' target as custom target
 project(linphone VERSION 4.3.0 LANGUAGES C CXX)
 
 
diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt
index 1fd7492c0008ee94227823742de5450c7f3fe08c..50519a0c1cfa2fe656fff653c7497dd3ec5d21fd 100644
--- a/build/CMakeLists.txt
+++ b/build/CMakeLists.txt
@@ -1,6 +1,6 @@
 ############################################################################
 # CMakeLists.txt
-# Copyright (C) 2017-2018  Belledonne Communications, Grenoble France
+# Copyright (C) 2010-2019  Belledonne Communications, Grenoble France
 #
 ############################################################################
 #
@@ -22,33 +22,13 @@
 
 if(NOT CPACK_PACKAGE_NAME)
 	set(CPACK_PACKAGE_NAME "liblinphone")
-ENDIF()
-
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt")
-
-set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
-set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
-set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
-
-set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION})
+endif()
 
-set(CPACK_SOURCE_GENERATOR "TGZ")
 set(CPACK_SOURCE_IGNORE_FILES
 	"${CMAKE_BINARY_DIR}"
 	"^${PROJECT_SOURCE_DIR}/.git*"
 )
 
-bc_project_build_version(${PROJECT_VERSION} PROJECT_VERSION_BUILD)
-if(PROJECT_VERSION_BUILD)
-	set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
-endif()
-
-message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}" )
-
-set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
-
-bc_generate_rpm_specfile("rpm/liblinphone.spec.cmake" "${PROJECT_SOURCE_DIR}/liblinphone.spec")
-
-include(CPack)
-
+set(BC_SPECFILE_NAME "liblinphone.spec")
 
+bc_make_package_source_target()
diff --git a/build/rpm/liblinphone.spec.cmake b/build/rpm/liblinphone.spec.cmake
index 96bb648f1cd5838850f42b3e569da3b3e6e670ba..03fcc579ea757779a6a8dbf11cd7035e00ad6174 100755
--- a/build/rpm/liblinphone.spec.cmake
+++ b/build/rpm/liblinphone.spec.cmake
@@ -2,6 +2,7 @@
 
 %define _prefix    @CMAKE_INSTALL_PREFIX@
 %define pkg_prefix @BC_PACKAGE_NAME_PREFIX@
+%define package_name @CPACK_PACKAGE_NAME@-${FULL_VERSION}
 
 # re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir
 # taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros
@@ -9,21 +10,16 @@
 %define _datadir           %{_datarootdir}
 %define _docdir            %{_datadir}/doc
 
-%define build_number @PROJECT_VERSION_BUILD@
-%if %{build_number}
-%define build_number_ext -%{build_number}
-%endif
-
 
 Name:           @CPACK_PACKAGE_NAME@
-Version:        @PROJECT_VERSION@
-Release:        %{build_number}%{?dist}
+Version:        ${RPM_VERSION}
+Release:        ${RPM_RELEASE}%{?dist}
 Summary:        Phone anywhere in the whole world by using the Internet
 
 Group:          Applications/Communications
 License:        GPL
 URL:            http://www.linphone.org
-Source0:        %{name}-%{version}%{?build_number_ext}.tar.gz
+Source0:        %{package_name}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 
 Requires:	%{pkg_prefix}bctoolbox
@@ -61,7 +57,7 @@ develop programs using the liblinphone library.
 %custom_debug_package
 
 %prep
-%setup -n %{name}-%{version}%{?build_number_ext}
+%setup -n %{package_name}
 
 %build
 %{expand:%%%cmake_name} . -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ -DCMAKE_PREFIX_PATH:PATH=%{_prefix} @RPM_ALL_CMAKE_OPTIONS@
@@ -93,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root)
-%doc ChangeLog.md COPYING README.md
+%doc ChangeLog.md LICENSE.txt README.md
 %if @ENABLE_DAEMON@ || @ENABLE_CONSOLE_UI@ || @ENABLE_TOOLS@
 %{_bindir}/*
 %endif